diff --git a/resources/js/index.js b/resources/js/index.js
index f407bb9..808fced 100644
--- a/resources/js/index.js
+++ b/resources/js/index.js
@@ -86,6 +86,9 @@ async function getCfg() {
const cfgStr = await Neutralino.storage.getData('config').catch(e => {
// The data isn't set, so this is our first time opening
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
@@ -328,6 +331,17 @@ async function toggleKillSwitch() {
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
*/
diff --git a/scripts/install.cmd b/scripts/install.cmd
index 93a41c2..e697cf7 100644
--- a/scripts/install.cmd
+++ b/scripts/install.cmd
@@ -1,25 +1,31 @@
@echo off
+set ORIGIN=%1
+set ORIGIN=%ORIGIN:"=%
+
:: Ensure admin
>nul 2>&1 reg query "HKU\S-1-5-19" || (
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...
-if not exist "./ext" mkdir "ext"
-if not exist "./temp" mkdir "temp"
+:: Make sure we are in the right directory
+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
-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...
:: 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...
@@ -32,6 +38,8 @@ ping 127.0.0.1 -n 6 > nul
:: Kill the process
taskkill /f /im mitmdump.exe
+echo Adding ceritifcate...
+
:: 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,
@@ -40,3 +48,5 @@ taskkill /f /im mitmdump.exe
echo Done! You can now open GrassClipper.exe!
pause
+
+exit /b
\ No newline at end of file