Skip to content

Commit 65886f8

Browse files
authored
Update install-commands.tsx (#25)
修正了实际windows复制安装脚本不可用的问题
1 parent 58efdde commit 65886f8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/install-commands.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ const generateCommand = (type: number, { agent_secret_key, install_host, tls }:
6868
throw new Error(i18next.t("Results.InstallHostRequired"));
6969

7070
const env = `NZ_SERVER=${install_host} NZ_TLS=${tls || false} NZ_CLIENT_SECRET=${agent_secret_key}`;
71+
const env_win = `$env:NZ_SERVER=\"${install_host}\";$env:NZ_TLS=\"${tls || false}\";$env:NZ_CLIENT_SECRET=\"${agent_secret_key}\;"`;
7172

7273
switch (type) {
7374
case OSTypes.Linux:
7475
case OSTypes.macOS: {
7576
return `curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/agent/install.sh -o agent.sh && chmod +x agent.sh && env ${env} ./agent.sh`
7677
}
7778
case OSTypes.Windows: {
78-
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`
79+
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`
7980
}
8081
default: {
8182
throw new Error(`Unknown OS: ${type}`);

0 commit comments

Comments
 (0)