diff --git a/app/index.php b/app/index.php index 46ba587..39fa705 100644 --- a/app/index.php +++ b/app/index.php @@ -55,8 +55,7 @@ if ($hash == substr(md5($c['key']), 0, 8)) { header("Location: $fs"); exit; case '2': - $link = htmlspecialchars($bot->singboxSubscription($_GET['s'], a: 1), ENT_XML1, 'UTF-8'); - file_put_contents('/singbox/winsw.xml', preg_replace('#~url~#', $link, file_get_contents('/singbox/winsw.xml'))); + file_put_contents('/singbox/update.cmd', preg_replace('#~url~#', $bot->singboxSubscription($_GET['s'], a: 1), file_get_contents('/singbox/update.cmd'))); $zip = new ZipArchive(); $n = "singbox_$v.zip"; $zip->open($n, ZipArchive::CREATE | ZipArchive::OVERWRITE); diff --git a/singbox_windows/install.cmd b/singbox_windows/install.cmd index 6f4a0d5..e5d9374 100644 --- a/singbox_windows/install.cmd +++ b/singbox_windows/install.cmd @@ -1,2 +1,2 @@ -winsw.exe install +winsw3.exe install pause \ No newline at end of file diff --git a/singbox_windows/start.cmd b/singbox_windows/start.cmd index f6035a8..ffa73a0 100644 --- a/singbox_windows/start.cmd +++ b/singbox_windows/start.cmd @@ -1 +1 @@ -winsw.exe start \ No newline at end of file +winsw3.exe start \ No newline at end of file diff --git a/singbox_windows/status.cmd b/singbox_windows/status.cmd index 0d4850e..0359701 100644 --- a/singbox_windows/status.cmd +++ b/singbox_windows/status.cmd @@ -1,2 +1,2 @@ -winsw.exe status +winsw3.exe status pause \ No newline at end of file diff --git a/singbox_windows/stop.cmd b/singbox_windows/stop.cmd index 5ca32da..c248f3c 100644 --- a/singbox_windows/stop.cmd +++ b/singbox_windows/stop.cmd @@ -1 +1 @@ -winsw.exe stop \ No newline at end of file +winsw3.exe stop \ No newline at end of file diff --git a/singbox_windows/uninstall.cmd b/singbox_windows/uninstall.cmd index df8b561..f8025eb 100644 --- a/singbox_windows/uninstall.cmd +++ b/singbox_windows/uninstall.cmd @@ -1,2 +1,2 @@ -winsw.exe uninstall +winsw3.exe uninstall pause \ No newline at end of file diff --git a/singbox_windows/update.cmd b/singbox_windows/update.cmd new file mode 100644 index 0000000..df8ddda --- /dev/null +++ b/singbox_windows/update.cmd @@ -0,0 +1,35 @@ +@echo off +setlocal + +set "exe_path=sing-box.exe" +set "URL=~url~" +set "FileName=config.json" +set "PreviousHash=" + +taskkill /IM "%exe_path%" /F +powershell -command "(New-Object System.Net.WebClient).DownloadFile('%URL%', '%FileName%')" +for /F "skip=1 delims=" %%H in ('2^>nul CertUtil -hashfile "%FileName%" SHA256') do ( + if not defined PreviousHash set "PreviousHash=%%H" +) +start "" /B "%CD%\%exe_path%" run -c "%FileName%" +echo "%PreviousHash%" +:loop +powershell -command "(New-Object System.Net.WebClient).DownloadFile('%URL%', '%FileName%')" +for /F "skip=1 delims=" %%H in ('2^>nul CertUtil -hashfile "%FileName%" SHA256') do ( + if not defined HASH set "HASH=%%H" +) +set "CurrentHash=%HASH%" +set "HASH=" +echo "%CurrentHash%" +if "%CurrentHash%" NEQ "%PreviousHash%" ( + echo "change" + set "PreviousHash=%CurrentHash%" + taskkill /IM "%exe_path%" /F + start "" /B "%CD%\%exe_path%" run -c "%FileName%" +) else ( + echo "not change" +) + +timeout /t 15 /nobreak + +goto :loop diff --git a/singbox_windows/winsw.exe b/singbox_windows/winsw3.exe similarity index 67% rename from singbox_windows/winsw.exe rename to singbox_windows/winsw3.exe index 9eb3759..6806bb4 100644 Binary files a/singbox_windows/winsw.exe and b/singbox_windows/winsw3.exe differ diff --git a/singbox_windows/winsw.xml b/singbox_windows/winsw3.xml similarity index 66% rename from singbox_windows/winsw.xml rename to singbox_windows/winsw3.xml index d347978..54beacc 100644 --- a/singbox_windows/winsw.xml +++ b/singbox_windows/winsw3.xml @@ -2,8 +2,7 @@ singbox singbox singbox - %BASE%\sing-box.exe - run -c %BASE%\config.json + %BASE%\update.cmd rotate @@ -13,7 +12,4 @@ - - - \ No newline at end of file diff --git a/version b/version index 69200a5..2209753 100644 --- a/version +++ b/version @@ -1,3 +1,5 @@ +14.04.2024 v1.27.1 +- singbox windows: замена winsw на winsw3, + скрипт обновления подписки 13.04.2024 v1.27 - архив сингбокса для windows, работает как служба 12.04.2024 v1.26