diff --git a/frontend/src/app/scripts/_components/ScriptItems/InstallCommand.tsx b/frontend/src/app/scripts/_components/ScriptItems/InstallCommand.tsx index ff95097c1..62dd65535 100644 --- a/frontend/src/app/scripts/_components/ScriptItems/InstallCommand.tsx +++ b/frontend/src/app/scripts/_components/ScriptItems/InstallCommand.tsx @@ -1,17 +1,20 @@ import CodeCopyButton from "@/components/ui/code-copy-button"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { Alert, AlertDescription } from "@/components/ui/alert"; +import { Info } from "lucide-react"; import { basePath } from "@/config/siteConfig"; import { Script } from "@/lib/types"; import { getDisplayValueFromType } from "../ScriptInfoBlocks"; -const getInstallCommand = (scriptPath = "", isAlpine = false) => { - const url = `https://raw.githubusercontent.com/community-scripts/${basePath}/main/${scriptPath}`; - return isAlpine ? `bash -c "$(curl -fsSL ${url})"` : `bash -c "$(curl -fsSL ${url})"`; +const getInstallCommand = (scriptPath = "", isAlpine = false, useGitea = false) => { + const githubUrl = `https://raw.githubusercontent.com/community-scripts/${basePath}/main/${scriptPath}`; + const giteaUrl = `https://git.community-scripts.org/community-scripts/${basePath}/raw/branch/main/${scriptPath}`; + const url = useGitea ? giteaUrl : githubUrl; + return `bash -c "$(curl -fsSL ${url})"`; }; export default function InstallCommand({ item }: { item: Script }) { const alpineScript = item.install_methods.find((method) => method.type === "alpine"); - const defaultScript = item.install_methods.find((method) => method.type === "default"); const renderInstructions = (isAlpine = false) => ( @@ -49,9 +52,20 @@ export default function InstallCommand({ item }: { item: Script }) { ); - return ( -
- {alpineScript ? ( + const renderGiteaInfo = () => ( + + + + When to use Gitea: GitHub may have issues including slow connections, delayed updates after bug + fixes, no IPv6 support, API rate limits (60/hour). Use our Gitea mirror as a reliable alternative when + experiencing these issues. + + + ); + + const renderScriptTabs = (useGitea = false) => { + if (alpineScript) { + return ( Default @@ -59,19 +73,40 @@ export default function InstallCommand({ item }: { item: Script }) { {renderInstructions()} - {getInstallCommand(defaultScript?.script)} + {getInstallCommand(defaultScript?.script, false, useGitea)} {renderInstructions(true)} - {getInstallCommand(alpineScript.script, true)} + {getInstallCommand(alpineScript.script, true, useGitea)} - ) : defaultScript?.script ? ( + ); + } else if (defaultScript?.script) { + return ( <> {renderInstructions()} - {getInstallCommand(defaultScript.script)} + {getInstallCommand(defaultScript.script, false, useGitea)} - ) : null} + ); + } + return null; + }; + + return ( +
+ + + GitHub + Gitea + + + {renderScriptTabs(false)} + + + {renderGiteaInfo()} + {renderScriptTabs(true)} + +
); -} +} \ No newline at end of file