diff --git a/README.md b/README.md index ea918d9..9bc94e7 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,7 @@ Grasscutter launcher for easily switching between Official and Private servers 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! +3. Run `GrassClipper.exe`, install the proxy server, and set your `Genshin Impact` folder! # Setup (for Development) diff --git a/resources/js/index.js b/resources/js/index.js index 808fced..54a355e 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -22,8 +22,23 @@ document.addEventListener('DOMContentLoaded', async () => { document.querySelector('#star').src = 'icons/star_filled.svg' } + // Disable private game launch if proxy IP or proxy server is not found + const playPriv = document.querySelector('#playPrivate') + const curDirList = await Neutralino.filesystem.readDirectory(NL_CWD) + + if (!curDirList.find(f => f.entry === 'ext')) { + playPriv.classList.add('disabled') + playPriv.disabled = true + } - // Exit favorites list when clicking outside of it + const extFiles = await Neutralino.filesystem.readDirectory(NL_CWD + '/ext') + + if (!extFiles.find(f => f.entry === 'mitmdump.exe')) { + playPriv.classList.add('disabled') + playPriv.disabled = true + } + + // Exit favorites list and settings panel when clicking outside of it window.addEventListener("click", function(e) { const favList = document.querySelector('#ipList') const settingsPanel = document.querySelector('#settingsPanel')