disable private launcher when proxy server is not found

This commit is contained in:
SpikeHD 2022-04-21 17:23:18 -07:00
parent ebe014bd72
commit b8cf13badd
2 changed files with 17 additions and 3 deletions

View File

@ -15,8 +15,7 @@ Grasscutter launcher for easily switching between Official and Private servers
1. Download the zip file 1. Download the zip file
2. Extract the zip file somewhere 2. Extract the zip file somewhere
3. Run `install.cmd` as administrator. This will install the proxy server. 3. Run `GrassClipper.exe`, install the proxy server, and set your `Genshin Impact` folder!
4. Run `GrassClipper.exe` and set your `Genshin Impact` folder!
# Setup (for Development) # Setup (for Development)

View File

@ -22,8 +22,23 @@ document.addEventListener('DOMContentLoaded', async () => {
document.querySelector('#star').src = 'icons/star_filled.svg' 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)
// Exit favorites list when clicking outside of it if (!curDirList.find(f => f.entry === 'ext')) {
playPriv.classList.add('disabled')
playPriv.disabled = true
}
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) { window.addEventListener("click", function(e) {
const favList = document.querySelector('#ipList') const favList = document.querySelector('#ipList')
const settingsPanel = document.querySelector('#settingsPanel') const settingsPanel = document.querySelector('#settingsPanel')