diff --git a/resources/index.html b/resources/index.html
index 321ecc5..97b48c2 100644
--- a/resources/index.html
+++ b/resources/index.html
@@ -98,7 +98,7 @@
-
+
@@ -109,7 +109,7 @@
-
+
diff --git a/resources/js/index.js b/resources/js/index.js
index 10fe83e..dd07f0c 100644
--- a/resources/js/index.js
+++ b/resources/js/index.js
@@ -25,6 +25,10 @@ document.addEventListener('DOMContentLoaded', async () => {
handleServerNotSet()
}
+ if (config.serverLaunchPanel) {
+ displayServerLaunchSection()
+ }
+
// Set last connect
document.querySelector('#ip').value = config.lastConnect
@@ -396,8 +400,12 @@ async function openSettings() {
// Fill setting options with what is currently set in config
const killSwitch = document.querySelector('#killswitchOption')
+ const serverLaunch = document.querySelector('#serverLaunchOption')
killSwitch.checked = config.enableKillswitch
+ serverLaunch.checked = config.serverLaunchPanel
+
+ console.log(config)
// Check for updates
//checkForUpdatesAndShow()
@@ -458,15 +466,20 @@ async function checkForUpdatesAndShow() {
}
}
-async function toggleServerLaunchSection() {
+async function displayServerLaunchSection() {
const serverPanel = document.querySelector('#thirdPanel')
- const config = await getCfg()
if (serverPanel.style.display === 'none') {
serverPanel.style.removeProperty('display')
} else {
serverPanel.style.display = 'none'
}
+}
+
+async function toggleServerLaunchSection() {
+ const config = await getCfg()
+
+ displayServerLaunchSection()
// Save setting
config.serverLaunchPanel = !config.serverLaunchPanel
@@ -502,7 +515,11 @@ async function setGenshinImpactFolder() {
}
async function setGrassCutterFolder() {
- const folder = await Neutralino.os.showFolderDialog('Select GrassCutter folder')
+ const folder = await Neutralino.os.showOpenDialog('Select GrassCutter server jar', {
+ filters: [
+ { name: 'Jar files', extensions: ['jar'] }
+ ]
+ })
// Set the folder in our configuration
const config = await getCfg()
@@ -557,6 +574,12 @@ async function launchPrivate() {
Neutralino.os.execCommand(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} "${config.genshinImpactFolder}/${await getGenshinExecName()}" "${NL_CWD}" ${config.enableKillswitch}`).catch(e => console.log(e))
}
+async function launchLocalServer() {
+ const config = await getCfg()
+
+ Neutralino.os.execCommand(`${NL_CWD}/scripts/local_server_launch.cmd "${config.serverFolder}"`).catch(e => console.log(e))
+}
+
/**
* Minimize the window
*/
diff --git a/scripts/local_server_launch.cmd b/scripts/local_server_launch.cmd
new file mode 100644
index 0000000..d411daa
--- /dev/null
+++ b/scripts/local_server_launch.cmd
@@ -0,0 +1,14 @@
+@echo off
+
+set GRASSCUTTER_JAR=%1
+set GRASSCUTTER_JAR=%GRASSCUTTER_JAR:"=%
+
+:: 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 "%1"", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
+)
+
+echo Starting local Grasscutter server...
+
+start /b java -jar %GRASSCUTTER_JAR%
\ No newline at end of file