From 574b2f4f09a3e903160e2fdc1bd2d45ade23c4ed Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Mon, 2 May 2022 19:50:49 -0700 Subject: [PATCH 01/25] change auth endpoints --- manifest.json | 2 +- neutralino.config.json | 2 +- package.json | 2 +- resources/js/index.js | 5 ++--- resources/js/login.js | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/manifest.json b/manifest.json index 3df9a34..95e72a6 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { "applicationId": "js.grassclipper.app", - "version": "0.8.5", + "version": "0.8.6", "resourcesURL": "https://github.com/Grasscutters/GrassClipper/releases/latest/download/resources.neu" } \ No newline at end of file diff --git a/neutralino.config.json b/neutralino.config.json index 7abf636..f3a3b87 100644 --- a/neutralino.config.json +++ b/neutralino.config.json @@ -1,6 +1,6 @@ { "applicationId": "js.grassclipper.app", - "version": "0.8.5", + "version": "0.8.6", "defaultMode": "window", "port": 0, "documentRoot": "/resources/", diff --git a/package.json b/package.json index 196bce7..8a336fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grassclipper", - "version": "0.8.5", + "version": "0.8.6", "repository": "https://github.com/Grasscutters/GrassClipper.git", "author": "SpikeHD ", "license": "Apache-2.0", diff --git a/resources/js/index.js b/resources/js/index.js index 0a4e2ce..98b22d8 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -298,9 +298,9 @@ async function openLogin() { // Check if we even need to authenticate try { - const { data } = await axios.get(url + '/grasscutter/auth_status') + const { data } = await axios.get(url + '/authentication/type') - if (data?.message !== 'AUTH_ENABLED') { + if (!data.includes('GCAuthAuthenticationHandler')) { launchPrivate() return } @@ -309,7 +309,6 @@ async function openLogin() { return } - loginIpDisplay.innerText = ip registerIpDisplay.innerText = ip diff --git a/resources/js/login.js b/resources/js/login.js index 5fd7f8e..60188d7 100644 --- a/resources/js/login.js +++ b/resources/js/login.js @@ -62,7 +62,7 @@ async function login() { password, } - const { data } = await axios.post(url + '/grasscutter/login', reqBody) + const { data } = await axios.post(url + '/authentication/login', reqBody) switch(data.message) { case 'INVALID_ACCOUNT': @@ -117,7 +117,7 @@ async function register() { password_confirmation } - const { data } = await axios.post(url + '/grasscutter/register', reqBody) + const { data } = await axios.post(url + '/authentication/register', reqBody) switch(data.message) { case 'USERNAME_TAKEN': From 1f3632753f89fca22b1f0ac2cca6004204f6cfc5 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Mon, 2 May 2022 21:34:53 -0700 Subject: [PATCH 02/25] fix traditional chinese translation file --- languages/zh-tw.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/languages/zh-tw.json b/languages/zh-tw.json index d551fb9..0d23c08 100644 --- a/languages/zh-tw.json +++ b/languages/zh-tw.json @@ -38,7 +38,7 @@ "proxyInstallDeny": "不用了,謝謝。", "gameFolderDialog": "選擇Genshin Impact game資料夾", - "grasscutterFileDialog": "選擇Grasscutter.jar檔案" + "grasscutterFileDialog": "選擇Grasscutter.jar檔案", "loggingInTo": "登錄至:", "registeringFor": "註冊至:", @@ -60,7 +60,7 @@ "alertUserTaken": "用戶名已被占用", "alertPassMismatch": "兩組密碼不一致", "alertAuthNoRegister": "未啟用認證,無需註冊!", - "alertRegisterSuccess": "註冊成功!" + "alertRegisterSuccess": "註冊成功!", "updateNotifText": "有新的GrassClipper更新可用! 最新版本: " } From 08cd04b134300cd5c763802cdc3f0deb2d1c8a2b Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Mon, 2 May 2022 21:35:38 -0700 Subject: [PATCH 03/25] version bump --- manifest.json | 2 +- neutralino.config.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 95e72a6..2fc35a4 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { "applicationId": "js.grassclipper.app", - "version": "0.8.6", + "version": "0.8.7", "resourcesURL": "https://github.com/Grasscutters/GrassClipper/releases/latest/download/resources.neu" } \ No newline at end of file diff --git a/neutralino.config.json b/neutralino.config.json index f3a3b87..be4549a 100644 --- a/neutralino.config.json +++ b/neutralino.config.json @@ -1,6 +1,6 @@ { "applicationId": "js.grassclipper.app", - "version": "0.8.6", + "version": "0.8.7", "defaultMode": "window", "port": 0, "documentRoot": "/resources/", diff --git a/package.json b/package.json index 8a336fe..e5efc86 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grassclipper", - "version": "0.8.6", + "version": "0.8.7", "repository": "https://github.com/Grasscutters/GrassClipper.git", "author": "SpikeHD ", "license": "Apache-2.0", From e152cc3e3c806e460570905839034c88b1936c43 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Mon, 2 May 2022 21:40:05 -0700 Subject: [PATCH 04/25] Quotes in user profile usage in scripts --- scripts/install.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install.cmd b/scripts/install.cmd index 99e27c3..f8e14f1 100644 --- a/scripts/install.cmd +++ b/scripts/install.cmd @@ -35,12 +35,12 @@ taskkill /f /im mitmdump.exe echo Adding ceritifcate... :: Ensure we are elevated for certs ->nul 2>&1 certutil -addstore root %USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.cer || ( +>nul 2>&1 certutil -addstore root "%USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.cer" || ( echo ============================================================================================================ echo !! Certificate install failed !! echo. echo Please manually run this command as Administrator: - echo certutil -addstore root %USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.cer + echo certutil -addstore root "%USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.cer" echo ============================================================================================================ ) From 7c2f36109d7aed1bb37905b056af53c1a5b03f82 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 19:09:10 -0700 Subject: [PATCH 05/25] download script for gc --- .gitignore | 1 + resources/index.html | 1 + resources/js/gcdownloader.js | 24 ++++++++++++++++++++++++ resources/js/helpers.js | 1 + scripts/gcdownload.cmd | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 100644 resources/js/gcdownloader.js create mode 100644 scripts/gcdownload.cmd diff --git a/.gitignore b/.gitignore index 2ccb550..66207a5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ bin/ dist/ ext/ temp/ +gc*/ resources/js/neutralino.js resources/bg/official diff --git a/resources/index.html b/resources/index.html index f59f5ea..81a7e7a 100644 --- a/resources/index.html +++ b/resources/index.html @@ -8,6 +8,7 @@ + diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js new file mode 100644 index 0000000..c1b5e1b --- /dev/null +++ b/resources/js/gcdownloader.js @@ -0,0 +1,24 @@ +async function clearGCInstallation() { + Neutralino.os.execCommand(`del /s /q "./gc"`) +} + +async function downloadGC(branch) { + const config = await getCfg() + + // If we are pulling from a new branch, delete the old installation + if (config.grasscutterBranch !== branch) await clearGCInstallation() + + // Keystore for branch (since they can differ) + const keystoreUrl = `https://github.com/Grasscutters/Grasscutter/raw/${branch}/keystore.p12` + + // External service that allows un-authed artifact downloading + const artiUrl = `https://nightly.link/Grasscutters/Grasscutter/workflows/build/${branch}/Grasscutter.zip` + + // Run installer + createCmdWindow(`.\\scripts\\gcdownload.cmd ${artiUrl} ${keystoreUrl} ${branch}`) + + // Set current installation in config + config.grasscutterBranch = branch + + Neutralino.storage.setData('config', JSON.stringify(config)) +} \ No newline at end of file diff --git a/resources/js/helpers.js b/resources/js/helpers.js index c0b31c0..ad313fa 100644 --- a/resources/js/helpers.js +++ b/resources/js/helpers.js @@ -12,6 +12,7 @@ serverLaunchPanel: false, language: 'en', useHttps: true, + grasscutterBranch: '', } const cfgStr = await Neutralino.storage.getData('config').catch(e => { // The data isn't set, so this is our first time opening diff --git a/scripts/gcdownload.cmd b/scripts/gcdownload.cmd new file mode 100644 index 0000000..9105de2 --- /dev/null +++ b/scripts/gcdownload.cmd @@ -0,0 +1,34 @@ +@echo off + +set KEYSTORE_URL=%1 +set ARTIFACT_URL=%2 +set BRANCH=%3 +set FOLDER_NAME=".\gc-%BRANCH%" + +if not exist %FOLDER_NAME% mkdir %FOLDER_NAME% +if not exist ".\temp" mkdir ".\temp" + +echo Downloading Grasscutter prebuilt jar... + +:: Download the jar +powershell Invoke-WebRequest -Uri %KEYSTORE_URL% -OutFile "./temp/gcjar.zip" + +echo Extracting... + +powershell Expand-Archive -Path "./temp/gcjar.zip" -DestinationPath %FOLDER_NAME% -Force + +:: Download the keystore.p12 file + +echo Downloading keystore.p12... + +powershell Invoke-WebRequest -Uri %ARTIFACT_URL% -OutFile "./%FOLDER_NAME%/keystore.p12" + +:: Remove temp stuff +del /s /q "./temp" + +echo Done, latest Grasscutter %BRANCH% now downloaded in %FOLDER_NAME% + +pause + +exit /b + From 158e10352b1094322b54d11c8c26d3445fe52b42 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 19:34:10 -0700 Subject: [PATCH 06/25] fix gc downloader script --- resources/js/gcdownloader.js | 3 +++ scripts/gcdownload.cmd | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index c1b5e1b..0786abe 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -20,5 +20,8 @@ async function downloadGC(branch) { // Set current installation in config config.grasscutterBranch = branch + // Set gc path for people with launcher enabled + config.serverFolder = `${NL_CWD}\\gc-${branch}\\` + Neutralino.storage.setData('config', JSON.stringify(config)) } \ No newline at end of file diff --git a/scripts/gcdownload.cmd b/scripts/gcdownload.cmd index 9105de2..3c6c05d 100644 --- a/scripts/gcdownload.cmd +++ b/scripts/gcdownload.cmd @@ -4,8 +4,9 @@ set KEYSTORE_URL=%1 set ARTIFACT_URL=%2 set BRANCH=%3 set FOLDER_NAME=".\gc-%BRANCH%" +set FOLDER_NAME=%FOLDER_NAME:"=% -if not exist %FOLDER_NAME% mkdir %FOLDER_NAME% +if not exist "%FOLDER_NAME%" mkdir "%FOLDER_NAME%" if not exist ".\temp" mkdir ".\temp" echo Downloading Grasscutter prebuilt jar... @@ -15,12 +16,20 @@ powershell Invoke-WebRequest -Uri %KEYSTORE_URL% -OutFile "./temp/gcjar.zip" echo Extracting... -powershell Expand-Archive -Path "./temp/gcjar.zip" -DestinationPath %FOLDER_NAME% -Force +:: Delete old file if there is one there +if exist "%FOLDER_NAME%\grasscutter.jar" del "%FOLDER_NAME%\grasscutter.jar" -:: Download the keystore.p12 file +powershell Expand-Archive -Path "./temp/gcjar.zip" -DestinationPath "%FOLDER_NAME%" -Force + +:: Find the jar file name and rename it, just in case +for %%i in (%FOLDER_NAME%/*) do ( + :: If the extension is jar, rename the file + if %%~xi equ .jar rename "%FOLDER_NAME%\%%i" grasscutter.jar +) echo Downloading keystore.p12... +:: Download the keystore.p12 file powershell Invoke-WebRequest -Uri %ARTIFACT_URL% -OutFile "./%FOLDER_NAME%/keystore.p12" :: Remove temp stuff From bdea511d543ce310f665c152997cd80118751b78 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 19:39:47 -0700 Subject: [PATCH 07/25] extra fixes --- resources/js/gcdownloader.js | 5 ++++- scripts/gcdownload.cmd | 4 +++- scripts/install.cmd | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index 0786abe..454c7b6 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -21,7 +21,10 @@ async function downloadGC(branch) { config.grasscutterBranch = branch // Set gc path for people with launcher enabled - config.serverFolder = `${NL_CWD}\\gc-${branch}\\` + config.serverFolder = `${NL_CWD}/gc-${branch}/grasscutter.jar` Neutralino.storage.setData('config', JSON.stringify(config)) + + // Display folder after saving config + displayServerFolder() } \ No newline at end of file diff --git a/scripts/gcdownload.cmd b/scripts/gcdownload.cmd index 3c6c05d..576d117 100644 --- a/scripts/gcdownload.cmd +++ b/scripts/gcdownload.cmd @@ -6,6 +6,8 @@ set BRANCH=%3 set FOLDER_NAME=".\gc-%BRANCH%" set FOLDER_NAME=%FOLDER_NAME:"=% +title GC Download Script + if not exist "%FOLDER_NAME%" mkdir "%FOLDER_NAME%" if not exist ".\temp" mkdir ".\temp" @@ -39,5 +41,5 @@ echo Done, latest Grasscutter %BRANCH% now downloaded in %FOLDER_NAME% pause -exit /b +taskkill /f /fi "WINDOWTITLE eq GC Download Script" diff --git a/scripts/install.cmd b/scripts/install.cmd index f8e14f1..63fbd41 100644 --- a/scripts/install.cmd +++ b/scripts/install.cmd @@ -3,6 +3,8 @@ set ORIGIN=%1 set ORIGIN=%ORIGIN:"=% +title Grassclipper Installer + echo Downloading proxy server... :: Make sure we are in the right directory @@ -48,4 +50,4 @@ echo Done! You can now open GrassClipper.exe! pause -exit /b \ No newline at end of file +taskkill /f /fi "WINDOWTITLE eq Grassclipper Installer" \ No newline at end of file From 6c0a079a41ba7399a6eabfa44b60b684b27dc4f8 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 19:43:57 -0700 Subject: [PATCH 08/25] fix server launcher script --- scripts/local_server_launch.cmd | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/local_server_launch.cmd b/scripts/local_server_launch.cmd index e052d1a..75dde1f 100644 --- a/scripts/local_server_launch.cmd +++ b/scripts/local_server_launch.cmd @@ -3,15 +3,23 @@ set GRASSCUTTER_JAR=%1 set GRASSCUTTER_JAR=%GRASSCUTTER_JAR:"=% +title Grasscutter + :: Get folder the jar is in set "X=%GRASSCUTTER_JAR%" :l -if "%X:~-1%"=="\" goto al -set "X=%X:~0,-1%" -goto l + set IS_SLASH=false + + if "%X:~-1%"=="\" set IS_SLASH=true + if "%X:~-1%"=="/" set IS_SLASH=true + + if %IS_SLASH% equ true goto al + + set "X=%X:~0,-1%" + goto l :al -set "X=%X:~0,-1%" -set "GRASSCUTTER_ROOT=%X%" + set "X=%X:~0,-1%" + set "GRASSCUTTER_ROOT=%X%" echo Starting local Grasscutter server... From ba91d9058f9909d60435a75f37132a583b7d8366 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 21:05:24 -0700 Subject: [PATCH 09/25] resource downloader --- resources/js/gcdownloader.js | 2 +- scripts/gcdownload.cmd | 45 ------------------------------------ 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 scripts/gcdownload.cmd diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index 454c7b6..d20399e 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -15,7 +15,7 @@ async function downloadGC(branch) { const artiUrl = `https://nightly.link/Grasscutters/Grasscutter/workflows/build/${branch}/Grasscutter.zip` // Run installer - createCmdWindow(`.\\scripts\\gcdownload.cmd ${artiUrl} ${keystoreUrl} ${branch}`) + createCmdWindow(`.\\scripts\\gc_download.cmd ${artiUrl} ${keystoreUrl} ${branch}`) // Set current installation in config config.grasscutterBranch = branch diff --git a/scripts/gcdownload.cmd b/scripts/gcdownload.cmd deleted file mode 100644 index 576d117..0000000 --- a/scripts/gcdownload.cmd +++ /dev/null @@ -1,45 +0,0 @@ -@echo off - -set KEYSTORE_URL=%1 -set ARTIFACT_URL=%2 -set BRANCH=%3 -set FOLDER_NAME=".\gc-%BRANCH%" -set FOLDER_NAME=%FOLDER_NAME:"=% - -title GC Download Script - -if not exist "%FOLDER_NAME%" mkdir "%FOLDER_NAME%" -if not exist ".\temp" mkdir ".\temp" - -echo Downloading Grasscutter prebuilt jar... - -:: Download the jar -powershell Invoke-WebRequest -Uri %KEYSTORE_URL% -OutFile "./temp/gcjar.zip" - -echo Extracting... - -:: Delete old file if there is one there -if exist "%FOLDER_NAME%\grasscutter.jar" del "%FOLDER_NAME%\grasscutter.jar" - -powershell Expand-Archive -Path "./temp/gcjar.zip" -DestinationPath "%FOLDER_NAME%" -Force - -:: Find the jar file name and rename it, just in case -for %%i in (%FOLDER_NAME%/*) do ( - :: If the extension is jar, rename the file - if %%~xi equ .jar rename "%FOLDER_NAME%\%%i" grasscutter.jar -) - -echo Downloading keystore.p12... - -:: Download the keystore.p12 file -powershell Invoke-WebRequest -Uri %ARTIFACT_URL% -OutFile "./%FOLDER_NAME%/keystore.p12" - -:: Remove temp stuff -del /s /q "./temp" - -echo Done, latest Grasscutter %BRANCH% now downloaded in %FOLDER_NAME% - -pause - -taskkill /f /fi "WINDOWTITLE eq GC Download Script" - From 8f86d5c2834432eba7e18e3cb60d59f1409252f4 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 21:07:09 -0700 Subject: [PATCH 10/25] resource downloader (fr this time) --- scripts/gc_download.cmd | 55 ++++++++++++++++++++++++++++++++++ scripts/resources_download.cmd | 29 ++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 scripts/gc_download.cmd create mode 100644 scripts/resources_download.cmd diff --git a/scripts/gc_download.cmd b/scripts/gc_download.cmd new file mode 100644 index 0000000..1b24f2b --- /dev/null +++ b/scripts/gc_download.cmd @@ -0,0 +1,55 @@ +@echo off + +set KEYSTORE_URL=%1 +set ARTIFACT_URL=%2 +set BRANCH=%3 +set FOLDER_NAME=".\gc-%BRANCH%" +set FOLDER_NAME=%FOLDER_NAME:"=% + +title GC Download Script + +if not exist "%FOLDER_NAME%" mkdir "%FOLDER_NAME%" +if not exist ".\temp" mkdir ".\temp" + +echo Downloading Grasscutter prebuilt jar... + +:: Download the jar +powershell Invoke-WebRequest -Uri %KEYSTORE_URL% -OutFile "./temp/gcjar.zip" + +echo Extracting... + +:: Delete old file if there is one there +if exist "%FOLDER_NAME%\grasscutter.jar" del "%FOLDER_NAME%\grasscutter.jar" + +powershell Expand-Archive -Path "./temp/gcjar.zip" -DestinationPath "%FOLDER_NAME%" -Force + +:: Find the jar file name and rename it, just in case +for %%i in (%FOLDER_NAME%/*) do ( + :: If the extension is jar, rename the file + if %%~xi equ .jar rename "%FOLDER_NAME%\%%i" grasscutter.jar +) + +echo Downloading keystore.p12... + +:: Download the keystore.p12 file +powershell Invoke-WebRequest -Uri %ARTIFACT_URL% -OutFile "./%FOLDER_NAME%/keystore.p12" + +:: Allow resource downloading to be optional, since it takes a while +set REPLY=y +set /p "REPLY=Download server resources? (This can take a while) [y|n]:" +if /i not "%reply%" == "y" goto :finish + +call .\scripts\resources_download.cmd %FOLDER_NAME% + +goto :finish + +:finish + :: Remove temp stuff + del /s /q "./temp" + + echo Done, latest Grasscutter %BRANCH% now downloaded in %FOLDER_NAME% + + pause + + taskkill /f /fi "WINDOWTITLE eq GC Download Script" + diff --git a/scripts/resources_download.cmd b/scripts/resources_download.cmd new file mode 100644 index 0000000..f1e1574 --- /dev/null +++ b/scripts/resources_download.cmd @@ -0,0 +1,29 @@ +@echo off + +set FOLDER_NAME=%1 +set FOLDER_NAME=%FOLDER_NAME:"=% + +if not exist ".\temp" mkdir ".\temp" +if not exist ".\resources" mkdir ".\resources" + +echo Downloading resources, this can take a while... + +:: Grab the giant ass resource zip +powershell Invoke-WebRequest -Uri https://github.com/Koko-boya/Grasscutter_Resources/archive/refs/heads/main.zip -OutFile "./temp/resources.zip" + +echo Extracting... + +:: Extract resources to the folder +powershell Expand-Archive -Path "./temp/resources.zip" -DestinationPath "%FOLDER_NAME%" -Force + +:: Delete old resources folder if there is one there +del /s /q "%FOLDER_NAME%\resources">nul + +echo Moving resources to folder... + +robocopy "%FOLDER_NAME%\Grasscutter_Resources-main\Resources" "%FOLDER_NAME%\resources" /E /MOVE>nul + +:: Delete straggling files +del /s /q "%FOLDER_NAME%\Grasscutter_Resources-main" + +echo Done, resources should be properly extracted \ No newline at end of file From f2f4179813c60dcdc74c2f75fd9eb0d47c960156 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 22:19:32 -0700 Subject: [PATCH 11/25] download data and key files --- resources/js/gcdownloader.js | 47 +++++++++++++++++++++++++++++------- resources/js/helpers.js | 2 +- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index d20399e..29eb8a2 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -8,15 +8,6 @@ async function downloadGC(branch) { // If we are pulling from a new branch, delete the old installation if (config.grasscutterBranch !== branch) await clearGCInstallation() - // Keystore for branch (since they can differ) - const keystoreUrl = `https://github.com/Grasscutters/Grasscutter/raw/${branch}/keystore.p12` - - // External service that allows un-authed artifact downloading - const artiUrl = `https://nightly.link/Grasscutters/Grasscutter/workflows/build/${branch}/Grasscutter.zip` - - // Run installer - createCmdWindow(`.\\scripts\\gc_download.cmd ${artiUrl} ${keystoreUrl} ${branch}`) - // Set current installation in config config.grasscutterBranch = branch @@ -24,6 +15,44 @@ async function downloadGC(branch) { config.serverFolder = `${NL_CWD}/gc-${branch}/grasscutter.jar` Neutralino.storage.setData('config', JSON.stringify(config)) + + // Keystore for branch (since they can differ) + const keystoreUrl = `https://github.com/Grasscutters/Grasscutter/raw/${branch}/keystore.p12` + + // External service that allows un-authed artifact downloading + const artiUrl = `https://nightly.link/Grasscutters/Grasscutter/workflows/build/${branch}/Grasscutter.zip` + + // For data files + const dataFiles = await axios.get(`https://api.github.com/repos/Grasscutters/Grasscutter/contents/data?ref=${branch}`) + const dataList = dataFiles.data + .map(file => ({ path: file.path, filename: file.name })) + .map(o => ({ url: `https://raw.githubusercontent.com/Grasscutters/Grasscutter/${branch}/${o.path}`, filename: o.filename })) + + // For key files + const keyFiles = await axios.get(`https://api.github.com/repos/Grasscutters/Grasscutter/contents/keys?ref=${branch}`) + const keyList = keyFiles.data + .map(file => ({ path: file.path, filename: file.name })) + .map(o => ({ url: `https://raw.githubusercontent.com/Grasscutters/Grasscutter/${branch}/${o.path}`, filename: o.filename })) + + const serverFolderFixed = config.serverFolder.match(/.*\\|.*\//g, '')[0].replace(/\//g, '\\') + + // Download data files + for (const o of dataList) { + const folder = 'data' + Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) + } + + // Download each file + for (const o of keyList) { + const folder = 'keys' + Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) + } + + return; + + // Run installer + createCmdWindow(`.\\scripts\\gc_download.cmd ${artiUrl} ${keystoreUrl} ${branch}`) + // Display folder after saving config displayServerFolder() diff --git a/resources/js/helpers.js b/resources/js/helpers.js index ad313fa..4e3a38b 100644 --- a/resources/js/helpers.js +++ b/resources/js/helpers.js @@ -98,7 +98,7 @@ async function openGameFolder() { async function openGrasscutterFolder() { const config = await getCfg() - const folder = config.serverFolder.match(/.*\\/g, '')[0] + const folder = config.serverFolder.match(/.*\\|.*\//g, '')[0] openInExplorer(folder) } From daef0d1724f5839a181f760f829a04dac1261c4c Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 22:23:33 -0700 Subject: [PATCH 12/25] ensure folders exist --- resources/js/gcdownloader.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index 29eb8a2..960a757 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -36,16 +36,21 @@ async function downloadGC(branch) { const serverFolderFixed = config.serverFolder.match(/.*\\|.*\//g, '')[0].replace(/\//g, '\\') + // Ensure data and key folders exist + + await Neutralino.os.execCommand(`mkdir ${serverFolderFixed}\\data`) + await Neutralino.os.execCommand(`mkdir ${serverFolderFixed}\\keys`) + // Download data files for (const o of dataList) { const folder = 'data' - Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) + await Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) } - // Download each file + // Download key files for (const o of keyList) { const folder = 'keys' - Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) + await Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) } return; From a47389e38b5129adb4d1b17a63aaf0a21250f815 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 22:24:45 -0700 Subject: [PATCH 13/25] re-enable full installer --- resources/js/gcdownloader.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index 960a757..257a5f5 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -52,8 +52,6 @@ async function downloadGC(branch) { const folder = 'keys' await Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) } - - return; // Run installer createCmdWindow(`.\\scripts\\gc_download.cmd ${artiUrl} ${keystoreUrl} ${branch}`) From 8b76778996ffc78b4505b19a21633efb915c71fd Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 22:56:15 -0700 Subject: [PATCH 14/25] begin downloads panel --- resources/index.html | 27 +++++++++++++++++++++++++++ resources/js/gcdownloader.js | 1 - resources/js/index.js | 14 ++++++++++++++ resources/style/index.css | 13 +++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/resources/index.html b/resources/index.html index 81a7e7a..ed5353e 100644 --- a/resources/index.html +++ b/resources/index.html @@ -115,6 +115,28 @@ + + + +
diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index 257a5f5..f101690 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -56,7 +56,6 @@ async function downloadGC(branch) { // Run installer createCmdWindow(`.\\scripts\\gc_download.cmd ${artiUrl} ${keystoreUrl} ${branch}`) - // Display folder after saving config displayServerFolder() } \ No newline at end of file diff --git a/resources/js/index.js b/resources/js/index.js index 98b22d8..2656464 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -246,6 +246,20 @@ async function handleFavoriteList() { } } +async function openDownloads() { + const downloads = document.querySelector('#downloadPanel') + + if (downloads.style.display === 'none') { + downloads.style.removeProperty('display') + } +} + +async function closeDownloads() { + const downloads = document.querySelector('#downloadPanel') + + downloads.style.display = 'none' +} + async function openSettings() { const settings = document.querySelector('#settingsPanel') const config = await getCfg() diff --git a/resources/style/index.css b/resources/style/index.css index ff31870..0b16237 100644 --- a/resources/style/index.css +++ b/resources/style/index.css @@ -157,6 +157,7 @@ a { #firstTimeNotice, #loginPanel, +#downloadPanel, #settingsPanel { display: block; position: absolute; @@ -172,6 +173,7 @@ a { font-family: system-ui; } +#downloadPanel, #settingsPanel { width: 35%; height: 80%; @@ -184,6 +186,7 @@ a { margin-bottom: 10px; } +#downloadPanelInner, #settingsPanelInner { display: flex; flex-direction: column; @@ -192,16 +195,19 @@ a { padding: 10px 10%; } +.downloadRow, .settingsRow { width: 100%; } +.downloadTitle, .settingTitle { font-size: 1.2em; font-weight: bold; margin-bottom: 10px; } +.downloadLabel, .settingLabel { display:inline-block; font-size: 1em; @@ -209,12 +215,14 @@ a { margin: 10px 0px; } +.downloadSubtitle, .settingSubtitle { color: rgb(165, 165, 165); font-size: 0.8em; font-weight: normal; } +.downloadSection, .settingSection { display: flex; flex-direction: row; @@ -222,10 +230,12 @@ a { justify-content: space-between; } +.downloadSection .smolBtn, .settingSection .smolBtn { height: 30px; } +#downloadTitleBar #settingsTitleBar { display: flex; flex-direction: row; @@ -233,15 +243,18 @@ a { justify-content: space-between; } +#downloadClose, #settingsClose { display: inline-block; transition: filter 0.1s ease-in-out; } +#downloadClose img, #settingsClose img { height: 20px; } +#downloadClose:hover, #settingsClose:hover { filter: invert(85%) sepia(31%) saturate(560%) hue-rotate(329deg) brightness(100%) contrast(92%); cursor: pointer; From f8185e5b633175e021079b53b65911173ec0456d Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 22:59:11 -0700 Subject: [PATCH 15/25] small styling fixes --- resources/index.html | 10 ++++------ resources/style/index.css | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/resources/index.html b/resources/index.html index ed5353e..2d63c3a 100644 --- a/resources/index.html +++ b/resources/index.html @@ -117,12 +117,10 @@ From ec27fd0530ced6b61a5df2378d2d94c255b021e0 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 23:09:20 -0700 Subject: [PATCH 17/25] download page open/close --- resources/icons/download.svg | 11 +++++++++++ resources/index.html | 13 +++++++++++-- resources/js/index.js | 10 ++++++++++ resources/style/index.css | 4 ++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 resources/icons/download.svg diff --git a/resources/icons/download.svg b/resources/icons/download.svg new file mode 100644 index 0000000..8baf9ed --- /dev/null +++ b/resources/icons/download.svg @@ -0,0 +1,11 @@ + +Created with Fabric.js 1.7.22 + + + + + + + + + \ No newline at end of file diff --git a/resources/index.html b/resources/index.html index 41b951e..6b86265 100644 --- a/resources/index.html +++ b/resources/index.html @@ -134,7 +134,7 @@
- Download Stable Build + Download Grasscutter Stable Build
@@ -143,13 +143,22 @@
- Download Development Build + Download Grasscutter Development Build
Install Grasscutter development branch. This build sometimes has bugs, and is frequently updated. Use at your own risk.
+
+
+ Download Grasscutter Resources + +
+ + Downloads Grasscutter resources into the currently set Grasscutter folder. This should be done unless you plan on getting resources externally. + +
diff --git a/resources/js/index.js b/resources/js/index.js index 2656464..db2b550 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -248,10 +248,20 @@ async function handleFavoriteList() { async function openDownloads() { const downloads = document.querySelector('#downloadPanel') + const config = await getCfg() if (downloads.style.display === 'none') { downloads.style.removeProperty('display') } + + // Disable the resource download button if a serverFolder path is not set + if (!config.serverFolder) { + document.querySelector('#resourceInstall').disabled = true + document.querySelector('#resourceInstall').classList.add('disabled') + } else { + document.querySelector('#resourceInstall').disabled = false + document.querySelector('#resourceInstall').classList.remove('disabled') + } } async function closeDownloads() { diff --git a/resources/style/index.css b/resources/style/index.css index d466177..d1e2ea6 100644 --- a/resources/style/index.css +++ b/resources/style/index.css @@ -216,6 +216,10 @@ a { margin: 10px 0px; } +.downloadLabel { + margin: 14px 0px; +} + .downloadSubtitle, .settingSubtitle { color: rgb(165, 165, 165); From bc363759900bafebcb51557c8cbc3b84f410d8d6 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 23:15:04 -0700 Subject: [PATCH 18/25] organization --- resources/index.html | 6 ++++++ resources/js/onLoad.js | 22 ++++++++++++++++------ resources/style/index.css | 8 ++++---- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/resources/index.html b/resources/index.html index 6b86265..f3edc5d 100644 --- a/resources/index.html +++ b/resources/index.html @@ -123,6 +123,9 @@
+
+ GrassClipper +
Installer @@ -132,6 +135,9 @@ Installs proxy and other tools. Required for Grasscutter servers.
+
+ Grasscutter +
Download Grasscutter Stable Build diff --git a/resources/js/onLoad.js b/resources/js/onLoad.js index a1e8773..bc96832 100644 --- a/resources/js/onLoad.js +++ b/resources/js/onLoad.js @@ -38,6 +38,7 @@ window.addEventListener("click", function(e) { const favList = document.querySelector('#ipList') const settingsPanel = document.querySelector('#settingsPanel') + const downloadPanel = document.querySelector('#downloadPanel') // This will close the favorites list no matter what is clicked if (favList.style.display !== 'none') { @@ -46,23 +47,32 @@ } // This will close the settings panel no matter what is clicked - let settingCheckElm = e.target + let checkElm = e.target - while(settingCheckElm.tagName !== 'BODY') { - if (settingCheckElm.id === 'settingsPanel' - || settingCheckElm.id === 'settingsBtn') { + while(checkElm.tagName !== 'BODY') { + if (checkElm.id === 'settingsPanel' + || checkElm.id === 'settingsBtn') { return } - settingCheckElm = settingCheckElm.parentElement + if (checkElm.id === 'downloadPanel' || + checkElm.id === 'downloadBtn') { + return + } + + checkElm = checkElm.parentElement } // We travelled through the parents, so if we are at the body, we clicked outside of the settings panel - if (settingCheckElm.tagName === 'BODY') { + if (checkElm.tagName === 'BODY') { // This will close the settings panel only when something outside of it is clicked if (settingsPanel.style.display !== 'none') { settingsPanel.style.display = 'none' } + + if (downloadPanel.style.display !== 'none') { + downloadPanel.style.display = 'none' + } } }); diff --git a/resources/style/index.css b/resources/style/index.css index d1e2ea6..6bb5548 100644 --- a/resources/style/index.css +++ b/resources/style/index.css @@ -208,6 +208,10 @@ a { margin-bottom: 10px; } +.downloadTitle { + margin: 6px; +} + .downloadLabel, .settingLabel { display:inline-block; @@ -216,10 +220,6 @@ a { margin: 10px 0px; } -.downloadLabel { - margin: 14px 0px; -} - .downloadSubtitle, .settingSubtitle { color: rgb(165, 165, 165); From 092424e3108bb74a216d76808d346fc82866feb4 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 23:17:23 -0700 Subject: [PATCH 19/25] disallow unset paths --- resources/js/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/js/index.js b/resources/js/index.js index db2b550..6e14f7d 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -411,6 +411,8 @@ async function setGameExe() { ] }) + if (!gameexe[0]) return; + // Set the folder in our configuration const config = await getCfg() @@ -432,6 +434,8 @@ async function setGrasscutterFolder() { ] }) + if (!folder[0]) return; + // Set the folder in our configuration const config = await getCfg() From 42290412bae95c08f33f9e8dfce3cfb83baacfe3 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 23:32:51 -0700 Subject: [PATCH 20/25] show when script is beginning to run --- resources/js/gcdownloader.js | 40 ++++++++++++++++++++++++++++++++++++ resources/style/index.css | 4 ++++ 2 files changed, 44 insertions(+) diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index f101690..a8523f0 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -2,6 +2,37 @@ async function clearGCInstallation() { Neutralino.os.execCommand(`del /s /q "./gc"`) } +async function setDownloadButtonsToLoading() { + const stableBtn = document.querySelector('#stableInstall') + const devBtn = document.querySelector('#devInstall') + + stableBtn.innerText = localeObj.gcScriptRunning || 'Running...' + + devBtn.innerText = localeObj.gcScriptRunning || 'Running...' + + // Set btns to disabled + stableBtn.disabled = true + stableBtn.classList.add('disabled') + + devBtn.disabled = true + devBtn.classList.add('disabled') +} + +async function resetDownloadButtons() { + const stableBtn = document.querySelector('#stableInstall') + const devBtn = document.querySelector('#devInstall') + + stableBtn.innerText = localeObj.stableInstall || 'Download' + devBtn.innerText = localeObj.devInstall || 'Download' + + // Set btns to enabled + stableBtn.disabled = false + stableBtn.classList.remove('disabled') + + devBtn.disabled = false + devBtn.classList.remove('disabled') +} + async function downloadGC(branch) { const config = await getCfg() @@ -14,8 +45,13 @@ async function downloadGC(branch) { // Set gc path for people with launcher enabled config.serverFolder = `${NL_CWD}/gc-${branch}/grasscutter.jar` + // Enable server launcher + config.serverLaunchPanel = true + Neutralino.storage.setData('config', JSON.stringify(config)) + setDownloadButtonsToLoading() + // Keystore for branch (since they can differ) const keystoreUrl = `https://github.com/Grasscutters/Grasscutter/raw/${branch}/keystore.p12` @@ -56,6 +92,10 @@ async function downloadGC(branch) { // Run installer createCmdWindow(`.\\scripts\\gc_download.cmd ${artiUrl} ${keystoreUrl} ${branch}`) + // Fix buttons + resetDownloadButtons() + // Display folder after saving config displayServerFolder() + displayServerLaunchSection() } \ No newline at end of file diff --git a/resources/style/index.css b/resources/style/index.css index 6bb5548..f738e24 100644 --- a/resources/style/index.css +++ b/resources/style/index.css @@ -11,6 +11,10 @@ a { color: #fff; } +img { + height: 20px; +} + .darken { filter: brightness(0.6); } From fdc3abb6008002cc58a3febda7adb9a583d28b8c Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 23:40:11 -0700 Subject: [PATCH 21/25] translation setup for downloads --- languages/en.json | 16 ++++++++++++++++ resources/index.html | 2 +- resources/js/translation.js | 15 +++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/languages/en.json b/languages/en.json index a7ecafe..1fecb4d 100644 --- a/languages/en.json +++ b/languages/en.json @@ -63,5 +63,21 @@ "alertAuthNoRegister": "Authentication is disabled, no need to register!", "alertRegisterSuccess": "Registration successful!", + "downloadTitle": "Downloads", + "grassclipperTitle": "GrassClipper", + "grasscutterTitle": "Grasscutter", + "installerTitle": "Installer", + "installerSubtitle": "Installs proxy and other tools. Required for Grasscutter servers.", + "downloadStable": "Download Grasscutter Stable Build", + "stableSubtitle": "Install Grasscutter stable branch. This build usually has less bugs, but also less features.", + "downloadDev": "Download Grasscutter Development Build", + "downloadSubtitle": "Install Grasscutter development branch. This build sometimes has bugs, and is frequently updated. Use at your own risk.", + "downloadResources": "Download Grasscutter Resources", + "devSubtitle": "Downloads Grasscutter resources into the currently set Grasscutter folder. This should be done unless you plan on getting resources externally.", + + "gcScriptRunning": "Running...", + "stableInstall": "Download", + "devInstall": "Download", + "updateNotifText": "A new update is available! Newest version: " } diff --git a/resources/index.html b/resources/index.html index f3edc5d..bb71778 100644 --- a/resources/index.html +++ b/resources/index.html @@ -135,7 +135,7 @@ Installs proxy and other tools. Required for Grasscutter servers.
-
+
Grasscutter
diff --git a/resources/js/translation.js b/resources/js/translation.js index 986b03c..2f1d17d 100644 --- a/resources/js/translation.js +++ b/resources/js/translation.js @@ -90,6 +90,21 @@ async function doTranslation() { set('loginPopupContentBodyBtnRegister', 'authRegisterBtn') set('noLoginBtn', 'launchWithoutAuth') + // Downloads section + set('downloadTitle', 'downloadTitle') + set('grassclipperTitle', 'grassclipperTitle') + set('grasscutterTitle', 'grasscutterTitle') + set('installerTitle', 'installerTitle') + set('installerSubtitle', 'installerSubtitle') + set('downloadStable', 'downloadStable') + set('stableSubtitle', 'stableSubtitle') + set('downloadDev', 'downloadDev') + set('downloadSubtitle', 'downloadSubtitle') + set('downloadResources', 'downloadResources') + set('devSubtitle', 'devSubtitle') + set('stableInstall', 'stableInstall') + set('devInstall', 'devInstall') + // update notification set('updateNotifText', 'updateNotifText') } \ No newline at end of file From ff9c0f203952ecf55f0ffe98353350054cf3d570 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 23:54:40 -0700 Subject: [PATCH 22/25] bugfix --- resources/js/index.js | 2 +- resources/js/translation.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/js/index.js b/resources/js/index.js index 6e14f7d..a9a0bee 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -411,7 +411,7 @@ async function setGameExe() { ] }) - if (!gameexe[0]) return; + if (!gameExe[0]) return; // Set the folder in our configuration const config = await getCfg() diff --git a/resources/js/translation.js b/resources/js/translation.js index 2f1d17d..dd80b83 100644 --- a/resources/js/translation.js +++ b/resources/js/translation.js @@ -99,7 +99,7 @@ async function doTranslation() { set('downloadStable', 'downloadStable') set('stableSubtitle', 'stableSubtitle') set('downloadDev', 'downloadDev') - set('downloadSubtitle', 'downloadSubtitle') + set('devSubtitle', 'downloadSubtitle') set('downloadResources', 'downloadResources') set('devSubtitle', 'devSubtitle') set('stableInstall', 'stableInstall') From dc486fd83003904525076a5b2cee5ca527660718 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 23:59:20 -0700 Subject: [PATCH 23/25] enable server button --- resources/js/gcdownloader.js | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index a8523f0..e45a0f4 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -97,5 +97,6 @@ async function downloadGC(branch) { // Display folder after saving config displayServerFolder() + enableServerButton() displayServerLaunchSection() } \ No newline at end of file From 2e68da72be3192c293aef38cce05cbfd9b38c04e Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Mon, 2 May 2022 02:47:55 -0700 Subject: [PATCH 24/25] fix killswitch --- scripts/private_server_launch.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/private_server_launch.cmd b/scripts/private_server_launch.cmd index 0cc7b12..5fcbf1e 100644 --- a/scripts/private_server_launch.cmd +++ b/scripts/private_server_launch.cmd @@ -27,7 +27,7 @@ if "%ENABLE_KILLSWITCH%" EQU "true" ( :: Restart in elevated if need be >nul 2>&1 reg query "HKU\S-1-5-19" || ( set params = %*:"="""% - cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %1 %2 %3 "%4" ""%cd%/../"" %6", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && taskkill /f /fi "WINDOWTITLE eq PS Launcher Script" && exit /b ) + cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %1 %2 %3 "%4" ""%cd%"" %6", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && taskkill /f /fi "WINDOWTITLE eq PS Launcher Script" && exit /b ) ) ) @@ -41,7 +41,7 @@ reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v Pr reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "127.0.0.1:8080" /f >nul 2>nul :: Start proxy server -start "Proxy Server" "%ORIGIN%/ext/mitmdump.exe" -s "%ORIGIN%/proxy/proxy.py" -k --allow-hosts ".*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com" --ssl-insecure --set ip=%IP% --set port=%PORT% --set use_https=%USE_HTTPS% +start "Proxy Server" "%ORIGIN%\ext\mitmdump.exe" -s "%ORIGIN%/proxy/proxy.py" -k --allow-hosts ".*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com" --ssl-insecure --set ip=%IP% --set port=%PORT% --set use_https=%USE_HTTPS% echo Opening %GAME_PATH% From 3379e688a68b6e33c0763d8a953feec77b9e688b Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Mon, 2 May 2022 22:00:55 -0700 Subject: [PATCH 25/25] java version script --- scripts/javaver.cmd | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 scripts/javaver.cmd diff --git a/scripts/javaver.cmd b/scripts/javaver.cmd new file mode 100644 index 0000000..dad849f --- /dev/null +++ b/scripts/javaver.cmd @@ -0,0 +1,38 @@ +@echo off + +set BRANCH=%1 + +echo Checking java version... + +:: https://stackoverflow.com/questions/5675459/how-to-get-java-version-from-batch-script +for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do ( + @echo Output: %%g + set JAVAVER=%%g +) +set JAVAVER=%JAVAVER:"=% + +for /f "delims=. tokens=1-3" %%v in ("%JAVAVER%") do ( + set MAJOR=%%v + set MINOR=%%w + set BUILD=%%x +) + +if %BRANCH% EQU stable ( + :: Ensure java 8 + if %MAJOR% EQU 1 ( + if %MINOR% LSS 8 ( + echo Java version is less than 8, please download Java 8 + exit /b + ) + ) +) + +if %BRANCH% EQU development ( + :: Ensure java 17 + if %MAJOR% LSS 17 ( + echo Java version is less than 17, please download Java 17 + exit /b + ) +) + +echo Java version is compatible \ No newline at end of file