From 65886f8348da4e3fbbee9812bd63014d6782b1ca Mon Sep 17 00:00:00 2001 From: bobyasasas <90000490+bobyasasas@users.noreply.github.com> Date: Thu, 5 Dec 2024 00:10:58 +0800 Subject: [PATCH] Update install-commands.tsx (#25) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正了实际windows复制安装脚本不可用的问题 --- src/components/install-commands.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/install-commands.tsx b/src/components/install-commands.tsx index ea5f57c..1b8b259 100644 --- a/src/components/install-commands.tsx +++ b/src/components/install-commands.tsx @@ -68,6 +68,7 @@ const generateCommand = (type: number, { agent_secret_key, install_host, tls }: throw new Error(i18next.t("Results.InstallHostRequired")); const env = `NZ_SERVER=${install_host} NZ_TLS=${tls || false} NZ_CLIENT_SECRET=${agent_secret_key}`; + const env_win = `$env:NZ_SERVER=\"${install_host}\";$env:NZ_TLS=\"${tls || false}\";$env:NZ_CLIENT_SECRET=\"${agent_secret_key}\;"`; switch (type) { case OSTypes.Linux: @@ -75,7 +76,7 @@ const generateCommand = (type: number, { agent_secret_key, install_host, tls }: return `curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/agent/install.sh -o agent.sh && chmod +x agent.sh && env ${env} ./agent.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` + return `${env_win} [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}`);