From ac21bd5fcf016f797e00f4ae0f340384a1c03aa5 Mon Sep 17 00:00:00 2001 From: BrutuZ Date: Mon, 16 Sep 2024 21:04:10 -0300 Subject: [PATCH 1/4] Create Suwayomi Server.bat Windows script to launch the server directly, with optional auto-updater --- scripts/resources/Suwayomi Server.bat | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 scripts/resources/Suwayomi Server.bat diff --git a/scripts/resources/Suwayomi Server.bat b/scripts/resources/Suwayomi Server.bat new file mode 100644 index 0000000000..991cec5321 --- /dev/null +++ b/scripts/resources/Suwayomi Server.bat @@ -0,0 +1,22 @@ +@echo off +set auto_update=1 + +:: Move CWD to script folder +pushd "%~0\.." + +:: Auto-Updater +if %auto_update% NEQ 1 goto :launch +for /f "tokens=2" %%i in ('curl -s https://api.github.com/repos/Suwayomi/Suwayomi-Server-preview/releases/latest^|findstr "https://.*jar"') do ( + pushd bin + if NOT EXIST "%%~nxi" ( + echo Updating to %%~ni + del /q "*.jar" + curl -sL %%i -o "%%~nxi" + mklink /h "Suwayomi-Server.jar" "%%~nxi" + ) + popd +) + +:launch +start "" jre\bin\javaw %* -jar bin\Suwayomi-Server.jar +popd From 48a474170d161c37670e9abbff620b2c9db730f5 Mon Sep 17 00:00:00 2001 From: BrutuZ Date: Mon, 16 Sep 2024 21:15:33 -0300 Subject: [PATCH 2/4] Add to bundler --- scripts/bundler.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bundler.sh b/scripts/bundler.sh index d30ba92c47..dad10dd304 100755 --- a/scripts/bundler.sh +++ b/scripts/bundler.sh @@ -256,7 +256,7 @@ make_windows_bundle() { # --set-icon "$icon" cp "$JAR" "$RELEASE_NAME/bin/Suwayomi-Server.jar" - cp "scripts/resources/Suwayomi Launcher.bat" "$RELEASE_NAME" + cp "scripts/resources/*.bat" "$RELEASE_NAME" zip -9 -r "$RELEASE" "$RELEASE_NAME" } From c91c9c58081690f202c3cf8852e379578b3b31dd Mon Sep 17 00:00:00 2001 From: BrutuZ Date: Mon, 16 Sep 2024 21:42:00 -0300 Subject: [PATCH 3/4] Use silent launcher Co-authored-by: Mitchell Syer --- scripts/resources/Suwayomi Server.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/resources/Suwayomi Server.bat b/scripts/resources/Suwayomi Server.bat index 991cec5321..7416d07db2 100644 --- a/scripts/resources/Suwayomi Server.bat +++ b/scripts/resources/Suwayomi Server.bat @@ -18,5 +18,5 @@ for /f "tokens=2" %%i in ('curl -s https://api.github.com/repos/Suwayomi/Suwayom ) :launch -start "" jre\bin\javaw %* -jar bin\Suwayomi-Server.jar +start "" jre\bin\javaw %* -jar Suwayomi-Launcher.jar --launch popd From 272e77dfdf84413fc8fe0d4270356c979d222390 Mon Sep 17 00:00:00 2001 From: BrutuZ Date: Mon, 16 Sep 2024 21:56:37 -0300 Subject: [PATCH 4/4] Update channel setting --- scripts/resources/Suwayomi Server.bat | 51 +++++++++++++++------------ 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/scripts/resources/Suwayomi Server.bat b/scripts/resources/Suwayomi Server.bat index 7416d07db2..3f9fe741d1 100644 --- a/scripts/resources/Suwayomi Server.bat +++ b/scripts/resources/Suwayomi Server.bat @@ -1,22 +1,29 @@ -@echo off -set auto_update=1 - -:: Move CWD to script folder -pushd "%~0\.." - -:: Auto-Updater -if %auto_update% NEQ 1 goto :launch -for /f "tokens=2" %%i in ('curl -s https://api.github.com/repos/Suwayomi/Suwayomi-Server-preview/releases/latest^|findstr "https://.*jar"') do ( - pushd bin - if NOT EXIST "%%~nxi" ( - echo Updating to %%~ni - del /q "*.jar" - curl -sL %%i -o "%%~nxi" - mklink /h "Suwayomi-Server.jar" "%%~nxi" - ) - popd -) - -:launch -start "" jre\bin\javaw %* -jar Suwayomi-Launcher.jar --launch -popd +@echo off +SETLOCAL +:: Auto Updater: 0: Disabled; 1 = Enabled +set auto_update=1 +:: Update channel: 0 = Preview; 1 = Stable +set preview=0 + +:: Move CWD to script folder +pushd "%~0\.." + +:: Auto-Updater +if (%auto_update% NEQ 1) goto :launch +set channel= +if (%preview% EQU 1) (set channel=-preview) +for /f "tokens=2" %%i in ('curl -s https://api.github.com/repos/Suwayomi/Suwayomi-Server%channel%/releases/latest^|findstr "https://.*jar"') do ( + pushd bin + if NOT EXIST "%%~nxi" ( + echo Updating to %%~ni + del /q "*.jar" + curl -sL %%i -o "%%~nxi" + mklink /h "Suwayomi-Server.jar" "%%~nxi" + ) + popd +) + +:launch +start "" jre\bin\javaw %* -jar Suwayomi-Launcher.jar --launch +popd +ENDLOCAL