From b018da2572350f27be9a817bb9d8c15b3557d987 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Tue, 19 Apr 2022 22:16:56 -0700 Subject: [PATCH] reorg and install script --- .gitignore | 1 + install.cmd | 26 +++++++++++++++++++ package.json | 6 +++-- resources/js/index.js | 2 +- .../private_server_launch.cmd | 0 5 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 install.cmd rename private_server_launch.cmd => scripts/private_server_launch.cmd (100%) diff --git a/.gitignore b/.gitignore index 155e314..5a37163 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ bin/ dist/ ext/ resources/js/neutralino.js +resources/bg .storage/ .tmp/ diff --git a/install.cmd b/install.cmd new file mode 100644 index 0000000..401d96e --- /dev/null +++ b/install.cmd @@ -0,0 +1,26 @@ +@echo off + +:: Ensure we are elevated for certs +>nul 2>&1 reg query "HKU\S-1-5-19" || ( + echo Currently running with non Administrator privileges, raising... + echo set UAC = CreateObject^("Shell.Application"^) > "%temp%\UAC.vbs" + echo UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%temp%\UAC.vbs" + "%temp%\UAC.vbs" + del /f /q "%temp%\UAC.vbs" >nul 2>nul + exit /b +) + +certutil -addstore root %USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.cer + +echo Downloading proxy server... + +if not exist "./ext" mkdir "ext" +if not exist "./temp" mkdir "temp" + +:: Begin by retrieving mitmproxy 8.0.0 +powershell Invoke-WebRequest -Uri https://snapshots.mitmproxy.org/8.0.0/mitmproxy-8.0.0-windows.zip -OutFile "./temp/mitmproxy-8.0.0-windows.zip" + +:: Extract from temp/ to ext/ with powershell +powershell Expand-Archive -Path "./temp/mitmproxy-8.0.0-windows.zip" -DestinationPath "./ext/" -Force + +echo Done! You can now open \ No newline at end of file diff --git a/package.json b/package.json index 95607b8..1a386ef 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "license": "Apache-2.0", "scripts": { "dev": "neu run", - "build": "neu build && npm run move_files", - "move_files": "cp -r ./ext ./dist/GrassClipper && cp -r ./proxy ./dist/GrassClipper" + "build": "npm run clean_dist && neu build && npm run move_files && npm run rename_exe", + "move_files": "cp -r ./ext ./dist/GrassClipper && cp -r ./proxy ./dist/GrassClipper && cp install.cmd ./dist/GrassClipper && cp -r ./scripts ./dist/GrassClipper", + "rename_exe": "mv ./dist/GrassClipper/GrassClipper-win_x64.exe ./dist/GrassClipper/GrassClipper.exe", + "clean_dist": "rm -rf ./dist" } } diff --git a/resources/js/index.js b/resources/js/index.js index e3cdef4..ab04e60 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -100,5 +100,5 @@ async function launchPrivate() { console.log('connecting to ' + ip) // Pass IP and game folder to the private server launcher - Neutralino.os.execCommand(`${NL_CWD}/private_server_launch.cmd ${ip} "${config.genshinImpactFolder}/Genshin Impact Game/${await getGenshinExecName()}"`).catch(e => console.log(e)) + Neutralino.os.execCommand(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} "${config.genshinImpactFolder}/Genshin Impact Game/${await getGenshinExecName()}"`).catch(e => console.log(e)) } \ No newline at end of file diff --git a/private_server_launch.cmd b/scripts/private_server_launch.cmd similarity index 100% rename from private_server_launch.cmd rename to scripts/private_server_launch.cmd