From 73a47526a2d4dc234a0d6af3d01208f1b3ebc044 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Wed, 20 Apr 2022 16:27:40 -0700 Subject: [PATCH] install script fix, bg organization --- README.md | 33 ++++++++++++++++++++++++++++----- install.cmd | 29 ++++++++++++++++++++--------- resources/js/index.js | 7 ++++--- 3 files changed, 52 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 4b786a2..7f3ce30 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,14 @@ Grasscutter launcher for easily switching between Official and Private servers [Download Here!](https://github.com/Grasscutters/GrassClipper/releases/) -# Setup +# Setup (for Users) + +1. Download the zip file +2. Extract the zip file somewhere +3. Run `install.cmd` as administrator. This will install the proxy server. +4. Run `GrassClipper.exe` and set your `Genshin Impact` folder! + +# Setup (for Development) 0. Clone the repository 1. Ensure you have [NodeJS](https://nodejs.org/en/download/) installed. @@ -17,9 +24,25 @@ Grasscutter launcher for easily switching between Official and Private servers * Interface * UI - * Official and Private options - * Server IP input + * ~~Official and Private options~~ + * ~~Server IP input~~ * Fun fancy CSS styling n stuff (CoD: MW 2019-style vertical menu for choosing between official and private servers? [See this](https://charlieintel.com/wp-content/uploads/2020/11/MW-new-menu.png)) * Proxy service - * Local proxy server - * Intercept and modify GI requests like with Fiddler, allow anything else to pass through \ No newline at end of file + * ~~Local proxy server~~~~ + * ~~Intercept and modify GI requests like with Fiddler, allow anything else to pass through~~ + +# Having problems? + +Below are some scenarios you may encounter and their solutions. + +### My Discord is not letting my send messages or load images! + +Discord does not seem to be a fan of the proxy server. You may need to disable it by either closing mitmdump or by disabling your proxy in the Windows proxy settings. + +### I have no internet after closing everything/restarting my PC! + +The launcher most likely did not close correctly, and was unable to clean your proxy settings back to what they were. Disable your proxy in the Windows proxy settings. + +### The game will not launch/background launcher images don't load! + +Ensure you have selected to correct path to Genshin Impact. This is ***not*** your `Genshin Impact Game` folder, but instead the main `Genshin Impact` folder (where the `bg` folder and `launcher.exe` can be found). \ No newline at end of file diff --git a/install.cmd b/install.cmd index 148066e..5335ec3 100644 --- a/install.cmd +++ b/install.cmd @@ -1,25 +1,36 @@ @echo off -:: Ensure we are elevated for certs ->nul 2>&1 certutil -addstore root %USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.cer || ( - echo Currently running with non Administrator privileges, run as Administrator to install the certificate. -) - 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" +:: 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" echo Extracting... :: Extract from temp/ to ext/ with powershell -powershell Expand-Archive -Path "./temp/mitmproxy-8.0.0-windows.zip" -DestinationPath "./ext/" -Force +:: powershell Expand-Archive -Path "./temp/mitmproxy-8.0.0-windows.zip" -DestinationPath "./ext/" -Force del /s /q "./temp" -pause +echo Running proxy server in order to generate certificates... -echo Done! You can now open GrassClipper.exe! \ No newline at end of file +:: Start proxy server +start "Proxy Server" ./ext/mitmdump.exe --ssl-insecure --set ip=%ip% + +:: Allow the proxy server to create the certificates +ping 127.0.0.1 -n 6 > nul + +:: Kill the process +taskkill /f /im mitmdump.exe + +:: Ensure we are elevated for certs +>nul 2>&1 certutil -addstore root %USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.cer || ( + echo Certificate install failed, ensure the script is running as Administrator and that the path "%USERPROFILE%\.mitmproxy" exists, +) + +echo Done! You can now open GrassClipper.exe! + +pause diff --git a/resources/js/index.js b/resources/js/index.js index b60ad81..72c4fbb 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -49,17 +49,18 @@ async function setBackgroundImage() { const bgDir = await Neutralino.filesystem.readDirectory(NL_CWD + '/resources') if (!bgDir.find(dir => dir.entry === 'bg')) { await Neutralino.filesystem.createDirectory(NL_CWD + '/resources/bg') + await Neutralino.filesystem.createDirectory(NL_CWD + '/resources/bg/official') } // Copy to backgrounds folder - const bgs = (await Neutralino.filesystem.readDirectory(NL_CWD + '/resources/bg/')).filter(file => file.type === 'FILE') + const bgs = (await Neutralino.filesystem.readDirectory(NL_CWD + '/resources/bg/official/')).filter(file => file.type === 'FILE') if (!bgs.find(file => file.entry === image)) { - await Neutralino.filesystem.copyFile(path, NL_CWD + '/resources/bg/' + image) + await Neutralino.filesystem.copyFile(path, NL_CWD + '/resources/bg/official/' + image) } // Set the background image - document.querySelector('#firstHalf').style.backgroundImage = `url("../bg/${image}")` + document.querySelector('#firstHalf').style.backgroundImage = `url("../bg/official/${image}")` } async function setGenshinImpactFolder() {