mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-17 08:09:47 +02:00
Replace newt and olm with pangolin-cli
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Terminal } from "lucide-react";
|
||||
import { Download, Terminal } from "lucide-react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { FaDocker, FaWindows } from "react-icons/fa";
|
||||
@@ -10,9 +10,13 @@ import {
|
||||
SettingsSectionHeader,
|
||||
SettingsSectionTitle
|
||||
} from "./Settings";
|
||||
import { Button } from "./ui/button";
|
||||
import { OptionSelect, type OptionSelectOption } from "./OptionSelect";
|
||||
|
||||
export type CommandItem = string | { title: string; command: string };
|
||||
export type CommandItem =
|
||||
| string
|
||||
| { title: string; command: string }
|
||||
| { title: string; link: string };
|
||||
|
||||
const PLATFORMS = ["unix", "docker", "windows"] as const;
|
||||
|
||||
@@ -40,14 +44,28 @@ export function OlmInstallCommands({
|
||||
|
||||
const commandList: Record<Platform, Record<string, CommandItem[]>> = {
|
||||
unix: {
|
||||
All: [
|
||||
Run: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | sudo bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `sudo pangolin up --id ${id} --secret ${secret} --endpoint ${endpoint} --attach`
|
||||
command: `sudo pangolin up client --id ${id} --secret ${secret} --endpoint ${endpoint} --attach`
|
||||
}
|
||||
],
|
||||
Service: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `sudo pangolin service install client --id ${id} --secret ${secret} --endpoint ${endpoint}`
|
||||
},
|
||||
{
|
||||
title: t("check"),
|
||||
command: `sudo pangolin service status client`
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -73,15 +91,31 @@ export function OlmInstallCommands({
|
||||
]
|
||||
},
|
||||
windows: {
|
||||
x64: [
|
||||
Run: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `# Download and run the installer to install Olm first\n
|
||||
curl -o olm.exe -L "https://github.com/fosrl/olm/releases/download/${version}/olm_windows_installer.exe"`
|
||||
link:
|
||||
version === "latest"
|
||||
? `https://github.com/fosrl/cli/releases/latest/download/pangolin-cli_windows_installer.msi`
|
||||
: `https://github.com/fosrl/cli/releases/download/${version}/pangolin-cli_windows_installer.msi`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `olm.exe --id ${id} --secret ${secret} --endpoint ${endpoint}`
|
||||
command: `pangolin up client --id ${id} --secret ${secret} --endpoint ${endpoint}`
|
||||
}
|
||||
],
|
||||
Service: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `sudo pangolin service install client --id ${id} --secret ${secret} --endpoint ${endpoint}`
|
||||
},
|
||||
{
|
||||
title: t("check"),
|
||||
command: `sudo pangolin service status client`
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -138,8 +172,17 @@ curl -o olm.exe -L "https://github.com/fosrl/olm/releases/download/${version}/ol
|
||||
<p className="font-semibold mb-3">{t("commands")}</p>
|
||||
<div className="mt-2 space-y-3">
|
||||
{commands.map((item, index) => {
|
||||
const isLink =
|
||||
typeof item !== "string" && "link" in item;
|
||||
const commandText =
|
||||
typeof item === "string" ? item : item.command;
|
||||
typeof item === "string"
|
||||
? item
|
||||
: isLink
|
||||
? undefined
|
||||
: item.command;
|
||||
const linkHref = isLink
|
||||
? (item as { link: string }).link
|
||||
: undefined;
|
||||
const title =
|
||||
typeof item === "string"
|
||||
? undefined
|
||||
@@ -152,10 +195,23 @@ curl -o olm.exe -L "https://github.com/fosrl/olm/releases/download/${version}/ol
|
||||
{title}
|
||||
</p>
|
||||
)}
|
||||
<CopyTextBox
|
||||
text={commandText}
|
||||
outline={true}
|
||||
/>
|
||||
{isLink ? (
|
||||
<Button
|
||||
asChild
|
||||
variant="outline"
|
||||
className="w-full"
|
||||
>
|
||||
<a href={linkHref}>
|
||||
<Download className="h-4 w-4 mr-2" />
|
||||
{t("downloadInstaller")}
|
||||
</a>
|
||||
</Button>
|
||||
) : (
|
||||
<CopyTextBox
|
||||
text={commandText!}
|
||||
outline={true}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user