mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-08-14 13:11:48 +08:00
install proxy server now integrated with installation
This commit is contained in:
parent
fed7490129
commit
88b08b9b1b
@ -8,7 +8,7 @@
|
|||||||
<script src="js/index.js"></script>
|
<script src="js/index.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="firstTimeNotice">
|
<div id="firstTimeNotice" style="display: none">
|
||||||
<span>
|
<span>
|
||||||
<span class="boldTitle">Looks like this is your first time opening GrassClipper!<br/></span>
|
<span class="boldTitle">Looks like this is your first time opening GrassClipper!<br/></span>
|
||||||
First of all, welcome, happy to see you here! :)<br/><br/>
|
First of all, welcome, happy to see you here! :)<br/><br/>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<div id="firstTimeBtns">
|
<div id="firstTimeBtns">
|
||||||
<button class="playBtn" id="firstTimeBtn" onclick="runInstallScript()">Install</button>
|
<button class="playBtn" id="firstTimeBtn" onclick="runInstallScript()">Install</button>
|
||||||
<button class="altBtn" id="firstTimeBtn">No thanks</button>
|
<button class="altBtn" id="firstTimeBtn" onclick="closeFirstTimePopup()">No thanks</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="settingsPanel" style="display: none;">
|
<div id="settingsPanel" style="display: none;">
|
||||||
@ -41,7 +41,7 @@
|
|||||||
<div id="controlBar">
|
<div id="controlBar">
|
||||||
<span id="titleSection">
|
<span id="titleSection">
|
||||||
GrassClipper
|
GrassClipper
|
||||||
<span id="version">0.4.0</span>
|
<span id="version">0.4.1</span>
|
||||||
</span>
|
</span>
|
||||||
<div id="settingsBtn" onclick="openSettings()">
|
<div id="settingsBtn" onclick="openSettings()">
|
||||||
<img src="icons/cog.svg" />
|
<img src="icons/cog.svg" />
|
||||||
|
@ -86,6 +86,9 @@ async function getCfg() {
|
|||||||
const cfgStr = await Neutralino.storage.getData('config').catch(e => {
|
const cfgStr = await Neutralino.storage.getData('config').catch(e => {
|
||||||
// The data isn't set, so this is our first time opening
|
// The data isn't set, so this is our first time opening
|
||||||
Neutralino.storage.setData('config', JSON.stringify(defaultConf))
|
Neutralino.storage.setData('config', JSON.stringify(defaultConf))
|
||||||
|
|
||||||
|
// Show the first time notice if there is no config
|
||||||
|
document.querySelector('#firstTimeNotice').style.display = 'block'
|
||||||
})
|
})
|
||||||
|
|
||||||
const config = cfgStr ? JSON.parse(cfgStr) : defaultConf
|
const config = cfgStr ? JSON.parse(cfgStr) : defaultConf
|
||||||
@ -328,6 +331,17 @@ async function toggleKillSwitch() {
|
|||||||
Neutralino.storage.setData('config', JSON.stringify(config))
|
Neutralino.storage.setData('config', JSON.stringify(config))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function closeFirstTimePopup() {
|
||||||
|
const firstTimePopup = document.querySelector('#firstTimeNotice')
|
||||||
|
firstTimePopup.style.display = 'none'
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runInstallScript() {
|
||||||
|
Neutralino.os.execCommand(`${NL_CWD}/scripts/install.cmd "${NL_CWD}"`)
|
||||||
|
|
||||||
|
closeFirstTimePopup()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the game folder by opening a folder picker
|
* Set the game folder by opening a folder picker
|
||||||
*/
|
*/
|
||||||
|
@ -1,25 +1,31 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
set ORIGIN=%1
|
||||||
|
set ORIGIN=%ORIGIN:"=%
|
||||||
|
|
||||||
:: Ensure admin
|
:: Ensure admin
|
||||||
>nul 2>&1 reg query "HKU\S-1-5-19" || (
|
>nul 2>&1 reg query "HKU\S-1-5-19" || (
|
||||||
set params = %*:"="""%
|
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", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && 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" ", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Downloading proxy server...
|
echo Downloading proxy server...
|
||||||
|
|
||||||
if not exist "./ext" mkdir "ext"
|
:: Make sure we are in the right directory
|
||||||
if not exist "./temp" mkdir "temp"
|
cd "%ORIGIN%"
|
||||||
|
|
||||||
|
if not exist "%ORIGIN%/ext" mkdir "%ORIGIN%/ext"
|
||||||
|
if not exist "%ORIGIN%/temp" mkdir "%ORIGIN%/temp"
|
||||||
|
|
||||||
:: Begin by retrieving mitmproxy 8.0.0
|
:: 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 "%ORIGIN%/temp/mitmproxy-8.0.0-windows.zip"
|
||||||
|
|
||||||
echo Extracting...
|
echo Extracting...
|
||||||
|
|
||||||
:: Extract from temp/ to ext/ with powershell
|
:: 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 "%ORIGIN%/temp/mitmproxy-8.0.0-windows.zip" -DestinationPath "%ORIGIN%/ext/" -Force
|
||||||
|
|
||||||
del /s /q "./temp"
|
del /s /q "%ORIGIN%/temp"
|
||||||
|
|
||||||
echo Running proxy server in order to generate certificates...
|
echo Running proxy server in order to generate certificates...
|
||||||
|
|
||||||
@ -32,6 +38,8 @@ ping 127.0.0.1 -n 6 > nul
|
|||||||
:: Kill the process
|
:: Kill the process
|
||||||
taskkill /f /im mitmdump.exe
|
taskkill /f /im mitmdump.exe
|
||||||
|
|
||||||
|
echo Adding ceritifcate...
|
||||||
|
|
||||||
:: Ensure we are elevated for certs
|
:: 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 Certificate install failed, ensure the script is running as Administrator and that the path "%USERPROFILE%\.mitmproxy" exists,
|
echo Certificate install failed, ensure the script is running as Administrator and that the path "%USERPROFILE%\.mitmproxy" exists,
|
||||||
@ -40,3 +48,5 @@ taskkill /f /im mitmdump.exe
|
|||||||
echo Done! You can now open GrassClipper.exe!
|
echo Done! You can now open GrassClipper.exe!
|
||||||
|
|
||||||
pause
|
pause
|
||||||
|
|
||||||
|
exit /b
|
Loading…
x
Reference in New Issue
Block a user