fix: Kill auto language (#21)

* fix: Kill auto language

Kill the background automatic recognition of language to prevent backend
Language file correction

* refactor(Aggregate): Ports and install hosts

Optimize multi-language

* fix(I18n): Kill spurious shortcuts

Fix wrong import
This commit is contained in:
GuGuGu
2024-12-02 13:57:03 +01:00
committed by GitHub
parent 51c0af6146
commit 22c53cf723
10 changed files with 68 additions and 63 deletions

View File

@@ -10,9 +10,10 @@ import useSettings from "@/hooks/useSetting"
import { ModelConfig } from "@/types"
import { Check, Clipboard } from "lucide-react"
import { toast } from "sonner"
import { copyToClipboard } from "@/lib/utils"
import { useTranslation } from "react-i18next"
import { copyToClipboard } from "@/lib/utils"
import i18next from "i18next"
enum OSTypes {
Linux = 1,
@@ -61,22 +62,23 @@ export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((p
);
})
const generateCommand = (type: number, { agent_secret_key, install_host, listen_port, tls }: ModelConfig) => {
const generateCommand = (type: number, { agent_secret_key, install_host, tls }: ModelConfig) => {
if (!install_host)
throw new Error("You have not specify the installed host.")
throw new Error(i18next.t("Results.InstallHostRequired"));
const env = `NZ_SERVER=${install_host}:${listen_port} NZ_TLS=${tls || false} NZ_CLIENT_SECRET=${agent_secret_key}`;
const env = `NZ_SERVER=${install_host} NZ_TLS=${tls || false} NZ_CLIENT_SECRET=${agent_secret_key}`;
switch (type) {
case OSTypes.Linux:
case OSTypes.macOS: {
return `curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/agent/install.sh -o nezha.sh && chmod +x nezha.sh && env ${env} ./nezha.sh`
}
case OSTypes.Windows: {
return `${env} [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3 -bor [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12;set-ExecutionPolicy RemoteSigned;Invoke-WebRequest https://raw.githubusercontent.com/nezhahq/scripts/main/agent/install.ps1 -OutFile C:\install.ps1;powershell.exe C:\install.ps1`
}
default: {
throw new Error(`Unknown OS: ${type}`);
}
case OSTypes.Linux:
case OSTypes.macOS: {
return `curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/agent/install.sh -o nezha.sh && chmod +x nezha.sh && env ${env} ./nezha.sh`
}
case OSTypes.Windows: {
return `${env} [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3 -bor [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12;set-ExecutionPolicy RemoteSigned;Invoke-WebRequest https://raw.githubusercontent.com/nezhahq/scripts/main/agent/install.ps1 -OutFile C:\install.ps1;powershell.exe C:\install.ps1`
}
default: {
throw new Error(`Unknown OS: ${type}`);
}
}
}