From e54ba1cf28b5d06fc11e5a8b50fe267595c2b9d2 Mon Sep 17 00:00:00 2001 From: dysf888 <47450409+dysf888@users.noreply.github.com> Date: Fri, 29 Apr 2022 03:22:37 +0800 Subject: [PATCH 1/5] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 7ad6b27..5f554e4 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ CN=true sudo ./nezha.sh ``` _\* 使用 WatchTower 可以自动更新面板,Windows 终端可以使用 nssm 配置自启动(见尾部教程)_ +**Win一键安装Agent 请使用 Powershell! 管理员权限**(jsdelivr飘忽不定未找到稳定渠道暂对国内不友好) +![image](https://user-images.githubusercontent.com/47450409/165829132-cb1ab16a-7b22-4c5f-9fdf-89d140cf7e40.png) +如遇此图请选择 Y ### Agent 自定义 From af642a7068b8a009aad313250c3ca3ee656048d5 Mon Sep 17 00:00:00 2001 From: dysf888 <47450409+dysf888@users.noreply.github.com> Date: Fri, 29 Apr 2022 03:23:33 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=A4=AA=E5=A2=9E=E5=8A=A0win=20install?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤪增加win installer --- script/install.ps1 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 script/install.ps1 diff --git a/script/install.ps1 b/script/install.ps1 new file mode 100644 index 0000000..a77dae1 --- /dev/null +++ b/script/install.ps1 @@ -0,0 +1,40 @@ +#Get server and key +param($server, $key) +# Download latest release from github +$repo = "naiba/nezha" +# x86 or x64 +if ([System.Environment]::Is64BitOperatingSystem) { + $file = "nezha-agent_windows_amd64.zip" +} +else { + $file = "nezha-agent_windows_386.zip" +} +$releases = "https://api.github.com/repos/$repo/releases" +Write-Host "Determining latest nezha release" -BackgroundColor DarkGreen -ForegroundColor White +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$tag = (Invoke-WebRequest -Uri $releases -UseBasicParsing | ConvertFrom-Json)[0].tag_name +$download = "https://github.com/$repo/releases/download/$tag/$file" +Invoke-WebRequest $download -OutFile "C:\nezha.zip" +#使用nssm安装服务 +Invoke-WebRequest "http://nssm.cc/release/nssm-2.24.zip" -OutFile "C:\nssm.zip" +#解压 +Expand-Archive "C:\nezha.zip" -DestinationPath "C:\temp" -Force +Expand-Archive "C:\nssm.zip" -DestinationPath "C:\temp" -Force +if (!(Test-Path "C:\nezha")) { New-Item -Path "C:\nezha" -type directory } +#整理文件 +Move-Item -Path "C:\temp\nezha-agent.exe" -Destination "C:\nezha\nezha.exe" +if ($file = "nezha-agent_windows_amd64.zip") { + Move-Item -Path "C:\temp\nssm-2.24\win64\nssm.exe" -Destination "C:\nezha\nssm.exe" +} +else { + Move-Item -Path "C:\temp\nssm-2.24\win32\nssm.exe" -Destination "C:\nezha\nssm.exe" +} +#清理垃圾 +Remove-Item "C:\nezha.zip" +Remove-Item "C:\nssm.zip" +Remove-Item "C:\temp" -Recurse +#安装部分 +C:\nezha\nssm.exe install nezha C:\nezha\nezha.exe -s $server -p $key -d +C:\nezha\nssm.exe start nezha +#enjoy +Write-Host "Enjoy It!" -BackgroundColor DarkGreen -ForegroundColor Red From e20198594bb1234f4a6dfe665e8af78ef22fa4a6 Mon Sep 17 00:00:00 2001 From: dysf888 <47450409+dysf888@users.noreply.github.com> Date: Fri, 29 Apr 2022 03:24:52 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=94=96=E6=94=AF=E6=8C=81PowerShell=20?= =?UTF-8?q?WIN=E4=B8=80=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PowerShell(管理员) --- resource/template/dashboard/server.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resource/template/dashboard/server.html b/resource/template/dashboard/server.html index 3a00318..82215cc 100644 --- a/resource/template/dashboard/server.html +++ b/resource/template/dashboard/server.html @@ -44,7 +44,10 @@ data-tooltip="点击复制安装命令"> -