Merge branch 'main' into main

This commit is contained in:
labalityowo 2022-04-26 17:06:13 +07:00 committed by GitHub
commit e78d715066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 71 additions and 17 deletions

View File

@ -3,6 +3,8 @@ Grasscutter launcher for easily switching between Official and Private servers
[Download Here!](https://github.com/Grasscutters/GrassClipper/releases/) [Download Here!](https://github.com/Grasscutters/GrassClipper/releases/)
*\*Note: some translations are outdated, so if random English text appears or an option seems misleading, this is why. If you notice an issue like this, feel free to make a pull request!*
# Table of Contents # Table of Contents
* [Setup (for users)](#setup-for-users) * [Setup (for users)](#setup-for-users)

View File

@ -6,8 +6,8 @@
"playPrivate": "啟動私人伺服器", "playPrivate": "啟動私人伺服器",
"launchLocalServer": "啟動本地伺服器", "launchLocalServer": "啟動本地伺服器",
"gameExeSet": "設定 \"Genshin Impact game\" 資料夾", "gameExeSet": "設定\"GenshinImpact\".exe執行檔",
"grasscutterFileSet": "設定 \"Grasscutter\" .jar 檔案", "grasscutterFileSet": "設定 \"Grasscutter\".jar 檔案",
"folderNotSet": "尚未設定Genshin Impact game資料夾", "folderNotSet": "尚未設定Genshin Impact game資料夾",
"ipPlaceholder": "IP地址", "ipPlaceholder": "IP地址",

View File

@ -1,5 +1,5 @@
{ {
"applicationId": "js.grassclipper.app", "applicationId": "js.grassclipper.app",
"version": "0.7.3", "version": "0.7.4",
"resourcesURL": "https://github.com/Grasscutters/GrassClipper/releases/latest/download/resources.neu" "resourcesURL": "https://github.com/Grasscutters/GrassClipper/releases/latest/download/resources.neu"
} }

View File

@ -1,6 +1,6 @@
{ {
"applicationId": "js.grassclipper.app", "applicationId": "js.grassclipper.app",
"version": "0.7.3", "version": "0.7.4",
"defaultMode": "window", "defaultMode": "window",
"port": 0, "port": 0,
"documentRoot": "/resources/", "documentRoot": "/resources/",

View File

@ -1,6 +1,6 @@
{ {
"name": "grassclipper", "name": "grassclipper",
"version": "0.7.3", "version": "0.7.4",
"repository": "https://github.com/Grasscutters/GrassClipper.git", "repository": "https://github.com/Grasscutters/GrassClipper.git",
"author": "SpikeHD <spikegdofficial@gmail.com>", "author": "SpikeHD <spikegdofficial@gmail.com>",
"license": "Apache-2.0", "license": "Apache-2.0",

View File

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="256" height="256" viewBox="0 0 256 256" xml:space="preserve">
<desc>Created with Fabric.js 1.7.22</desc>
<defs>
</defs>
<g transform="translate(128 128) scale(0.72 0.72)" style="">
<g style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: nonzero; opacity: 1;" transform="translate(-175.05 -175.05) scale(3.89 3.89)" >
<path d="M 89.475 31.953 c -0.56 -0.816 -1.485 -1.304 -2.475 -1.304 H 73.97 v -9.181 c 0 -1.657 -1.343 -3 -3 -3 H 30.857 l -2.408 -4.916 c -0.504 -1.028 -1.549 -1.68 -2.694 -1.68 H 3 c -1.657 0 -3 1.343 -3 3 v 60.254 c 0 0.071 0.016 0.137 0.021 0.207 c 0.006 0.083 0.012 0.164 0.025 0.246 c 0.024 0.158 0.063 0.309 0.11 0.458 c 0.02 0.061 0.033 0.123 0.057 0.183 c 0.083 0.211 0.184 0.412 0.31 0.596 c 0.001 0.002 0.002 0.005 0.003 0.007 c 0.009 0.013 0.022 0.023 0.031 0.036 c 0.118 0.166 0.254 0.318 0.402 0.456 c 0.052 0.049 0.109 0.091 0.164 0.135 c 0.119 0.096 0.243 0.183 0.376 0.26 c 0.065 0.038 0.129 0.074 0.196 0.107 c 0.143 0.069 0.292 0.124 0.446 0.17 c 0.062 0.019 0.12 0.042 0.184 0.057 c 0.218 0.05 0.442 0.083 0.675 0.083 h 67.97 c 1.239 0 2.352 -0.763 2.798 -1.919 l 16.03 -41.477 C 90.155 33.808 90.034 32.769 89.475 31.953 z M 23.884 17.873 l 2.408 4.916 c 0.504 1.028 1.549 1.68 2.694 1.68 H 67.97 v 6.181 H 19.03 c -1.24 0 -2.352 0.762 -2.798 1.918 L 6 59.042 v -41.17 H 23.884 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -128,11 +128,17 @@
<div id="bottomBar"> <div id="bottomBar">
<div class="bottomSection"> <div class="bottomSection">
<div> <div>
<button class="smolBtn" onclick="setGameExe()" id="gameExeSet">Set game folder</button> <div>
<button class="smolBtn" onclick="setGameExe()" id="gameExeSet">Set game folder</button>
<img src="icons/folder.svg" class="openFolderIcon" onclick="openGameFolder()"/>
</div>
<span id="gamePath" style="margin-top: 4px;"></span> <span id="gamePath" style="margin-top: 4px;"></span>
</div> </div>
<div style="display: none;"> <div style="display: none;">
<button class="smolBtn" onclick="setGrasscutterFolder()" id="grasscutterFileSet">Set "Grasscutter" .jar file</button> <div>
<button class="smolBtn" onclick="setGrasscutterFolder()" id="grasscutterFileSet">Set "Grasscutter" .jar file</button>
<img src="icons/folder.svg" class="openFolderIcon" onclick="openGrasscutterFolder()"/>
</div>
<span id="serverPath" style="margin-top: 4px;"></span> <span id="serverPath" style="margin-top: 4px;"></span>
</div> </div>
</div> </div>

View File

@ -57,6 +57,20 @@ async function proxyIsInstalled() {
return false return false
} }
async function openGameFolder() {
const config = await getCfg()
const folder = config.gameexe.match(/.*\\/g, '')[0]
openInExplorer(folder)
}
async function openGrasscutterFolder() {
const config = await getCfg()
const folder = config.serverFolder.match(/.*\\/g, '')[0]
openInExplorer(folder)
}
/** /**
* Minimize the window * Minimize the window
*/ */

View File

@ -3,7 +3,11 @@ Neutralino.init();
let localeObj; let localeObj;
const filesystem = Neutralino.filesystem const filesystem = Neutralino.filesystem
const createCmdWindow = async (command) => { const createCmdWindow = async (command) => {
Neutralino.os.execCommand(`cmd.exe /c start ${command}`, { background: true }) Neutralino.os.execCommand(`cmd.exe /c start "" ${command}`, { background: true })
}
const openInExplorer = async (path) => {
createCmdWindow(`explorer.exe "${path}"`)
} }
/** /**
@ -286,7 +290,7 @@ async function closeFirstTimePopup() {
} }
async function runInstallScript() { async function runInstallScript() {
createCmdWindow(`${NL_CWD}/scripts/install.cmd "${NL_CWD}" true`) createCmdWindow(`.\\scripts\\install.cmd "${NL_CWD}" true`)
// Create an interval that will check for the proxy server installation finish // Create an interval that will check for the proxy server installation finish
const interval = setInterval(async () => { const interval = setInterval(async () => {
@ -366,7 +370,7 @@ async function setGrasscutterFolder() {
// Set the folder in our configuration // Set the folder in our configuration
const config = await getCfg() const config = await getCfg()
config.serverFolder = folder config.serverFolder = folder[0]
Neutralino.storage.setData('config', JSON.stringify(config)) Neutralino.storage.setData('config', JSON.stringify(config))
displayServerFolder() displayServerFolder()
@ -398,11 +402,11 @@ async function launchPrivate() {
Neutralino.storage.setData('config', JSON.stringify(config)) Neutralino.storage.setData('config', JSON.stringify(config))
// Pass IP and game folder to the private server launcher // Pass IP and game folder to the private server launcher
createCmdWindow(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} ${port} ${config.useHttps} "${config.gameexe}" "${NL_CWD}" ${config.enableKillswitch} true`).catch(e => console.log(e)) createCmdWindow(`.\\scripts\\private_server_launch.cmd ${ip} ${port} ${config.useHttps} "${config.gameexe}" "${NL_CWD}" ${config.enableKillswitch} true`).catch(e => console.log(e))
} }
async function launchLocalServer() { async function launchLocalServer() {
const config = await getCfg() const config = await getCfg()
createCmdWindow(`${NL_CWD}/scripts/local_server_launch.cmd "${config.serverFolder}"`).catch(e => console.log(e)) createCmdWindow(`.\\scripts\\local_server_launch.cmd "${config.serverFolder}"`).catch(e => console.log(e))
} }

View File

@ -277,6 +277,18 @@ body {
background: linear-gradient(#ffc61e, #ffd326); background: linear-gradient(#ffc61e, #ffd326);
} }
.openFolderIcon {
display: inline;
height: 20px;
filter: invert(97%) sepia(85%) saturate(12%) hue-rotate(184deg) brightness(103%) contrast(103%);
padding: 10px;
}
.openFolderIcon:hover {
cursor: pointer;
filter: invert(99%) sepia(0%) saturate(1092%) hue-rotate(172deg) brightness(80%) contrast(103%);
}
#bottomBar { #bottomBar {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -305,6 +317,12 @@ body {
height: 10%; height: 10%;
} }
.bottomSection div div {
display: flex;
flex-direction: row;
height: 100%;
}
#gamePath, #serverPath { #gamePath, #serverPath {
color: white; color: white;
font-size: 14px; font-size: 14px;

View File

@ -9,22 +9,22 @@ echo Downloading proxy server...
cd "%ORIGIN%" cd "%ORIGIN%"
if not exist "%ORIGIN%/ext" mkdir "%ORIGIN%/ext" if not exist "%ORIGIN%/ext" mkdir "%ORIGIN%/ext"
if not exist "%ORIGIN%/temp" mkdir "%ORIGIN%/temp" if not exist "%ORIGIN%/temp" mkdir "%ORIGIN%/temp
:: Begin by retrieving mitmproxy 7.0.4 :: Begin by retrieving mitmproxy 7.0.4
powershell Invoke-WebRequest -Uri https://snapshots.mitmproxy.org/7.0.4/mitmproxy-7.0.4-windows.zip -OutFile "%ORIGIN%/temp/mitmproxy-7.0.4-windows.zip" powershell Invoke-WebRequest -Uri https://snapshots.mitmproxy.org/7.0.4/mitmproxy-7.0.4-windows.zip -OutFile "'%ORIGIN%/temp/mitmproxy-7.0.4-windows.zip'"
echo Extracting... echo Extracting...
:: Extract from temp/ to ext/ with powershell :: Extract from temp/ to ext/ with powershell
powershell Expand-Archive -Path "%ORIGIN%/temp/mitmproxy-7.0.4-windows.zip" -DestinationPath "%ORIGIN%/ext/" -Force powershell Expand-Archive -Path "'%ORIGIN%/temp/mitmproxy-7.0.4-windows.zip'" -DestinationPath "'%ORIGIN%/ext/'" -Force
del /s /q "%ORIGIN%/temp" del /s /q "%ORIGIN%/temp"
echo Running proxy server in order to generate certificates... echo Running proxy server in order to generate certificates...
:: Start proxy server :: Start proxy server
start "Proxy Server" %ORIGIN%/ext/mitmdump.exe --ssl-insecure --set ip=%ip% start "Proxy Server" "%ORIGIN%/ext/mitmdump.exe" --ssl-insecure --set ip=%ip%
:: Allow the proxy server to create the certificates :: Allow the proxy server to create the certificates
ping 127.0.0.1 -n 6 > nul ping 127.0.0.1 -n 6 > nul

View File

@ -38,7 +38,7 @@ reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v Pr
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "127.0.0.1:8080" /f >nul 2>nul reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "127.0.0.1:8080" /f >nul 2>nul
:: Start proxy server :: Start proxy server
start "Proxy Server" %ORIGIN%/ext/mitmdump.exe -s "%ORIGIN%/proxy/proxy.py" --ssl-insecure --set ip=%IP% --set port=%PORT% --set use_https=%USE_HTTPS% start "Proxy Server" "%ORIGIN%/ext/mitmdump.exe" -s "%ORIGIN%/proxy/proxy.py" --ssl-insecure --set ip=%IP% --set port=%PORT% --set use_https=%USE_HTTPS%
echo Opening %GAME_PATH% echo Opening %GAME_PATH%