mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-08-14 13:11:48 +08:00
specify port when connecitng
This commit is contained in:
parent
e4cc000117
commit
9adb023f7c
@ -11,6 +11,7 @@
|
|||||||
"folderNotSet": "Not set",
|
"folderNotSet": "Not set",
|
||||||
|
|
||||||
"ipPlaceholder": "IP Address",
|
"ipPlaceholder": "IP Address",
|
||||||
|
"portPlaceholder": "Port (optional)",
|
||||||
"noFavorites": "No favorites set",
|
"noFavorites": "No favorites set",
|
||||||
|
|
||||||
"settingsTitle": "Settings",
|
"settingsTitle": "Settings",
|
||||||
|
@ -34,9 +34,17 @@ class MlgmXyysd_Anime_Game_Proxy:
|
|||||||
help = "IP address to replace",
|
help = "IP address to replace",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
loader.add_option(
|
||||||
|
name = "port",
|
||||||
|
typespec = int,
|
||||||
|
default = 80,
|
||||||
|
help = "Port to replace",
|
||||||
|
)
|
||||||
|
|
||||||
def request(self, flow: http.HTTPFlow) -> None:
|
def request(self, flow: http.HTTPFlow) -> None:
|
||||||
# This can also be replaced with another IP address.
|
# This can also be replaced with another IP address.
|
||||||
REMOTE_HOST = ctx.options.ip
|
REMOTE_HOST = ctx.options.ip
|
||||||
|
REMOTE_PORT = ctx.options.port
|
||||||
|
|
||||||
LIST_DOMAINS = [
|
LIST_DOMAINS = [
|
||||||
"api-os-takumi.mihoyo.com",
|
"api-os-takumi.mihoyo.com",
|
||||||
@ -75,6 +83,7 @@ class MlgmXyysd_Anime_Game_Proxy:
|
|||||||
|
|
||||||
if flow.request.host in LIST_DOMAINS:
|
if flow.request.host in LIST_DOMAINS:
|
||||||
flow.request.host = REMOTE_HOST
|
flow.request.host = REMOTE_HOST
|
||||||
|
flow.request.port = REMOTE_PORT
|
||||||
|
|
||||||
addons = [
|
addons = [
|
||||||
MlgmXyysd_Anime_Game_Proxy()
|
MlgmXyysd_Anime_Game_Proxy()
|
||||||
|
@ -103,6 +103,7 @@
|
|||||||
<div id="secondControlContainer">
|
<div id="secondControlContainer">
|
||||||
<div id="serverInput">
|
<div id="serverInput">
|
||||||
<input type="text" id="ip" placeholder="IP Address" oninput="handleFavoriteInput()"/>
|
<input type="text" id="ip" placeholder="IP Address" oninput="handleFavoriteInput()"/>
|
||||||
|
<input type="text" id="port" placeholder="Port" oninput="handleFavoriteInput()"/>
|
||||||
<img src="icons/star_empty.svg" id="star" onclick="setFavorite()" />
|
<img src="icons/star_empty.svg" id="star" onclick="setFavorite()" />
|
||||||
<img src="icons/list.svg" id="star" onclick="handleFavoriteList()" />
|
<img src="icons/list.svg" id="star" onclick="handleFavoriteList()" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -370,17 +370,18 @@ async function launchOfficial() {
|
|||||||
*/
|
*/
|
||||||
async function launchPrivate() {
|
async function launchPrivate() {
|
||||||
const ip = document.getElementById('ip').value || 'localhost'
|
const ip = document.getElementById('ip').value || 'localhost'
|
||||||
|
const port = document.getElementById('port').value || '443'
|
||||||
|
|
||||||
const config = await getCfg()
|
const config = await getCfg()
|
||||||
|
|
||||||
console.log('connecting to ' + ip)
|
console.log('connecting to ' + ip + ':' + port)
|
||||||
|
|
||||||
// Set the last connect
|
// Set the last connect
|
||||||
config.lastConnect = ip
|
config.lastConnect = ip
|
||||||
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
|
||||||
Neutralino.os.execCommand(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} "${config.gamefolder}/${await getGameExecName()}" "${NL_CWD}" ${config.enableKillswitch}`).catch(e => console.log(e))
|
Neutralino.os.execCommand(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} ${port} "${config.gamefolder}/${await getGameExecName()}" "${NL_CWD}" ${config.enableKillswitch}`).catch(e => console.log(e))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function launchLocalServer() {
|
async function launchLocalServer() {
|
||||||
|
@ -13,6 +13,7 @@ async function doTranslation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const localization = await filesystem.readFile(`${NL_CWD}/languages/${config.language}.json`)
|
const localization = await filesystem.readFile(`${NL_CWD}/languages/${config.language}.json`)
|
||||||
|
const engLocale = await filesystem.readFile(`${NL_CWD}/languages/en.json`)
|
||||||
localeObj = JSON.parse(localization)
|
localeObj = JSON.parse(localization)
|
||||||
|
|
||||||
const set = (id, localeString) => document.getElementById(id).innerHTML = localeString || 'UNKNOWN'
|
const set = (id, localeString) => document.getElementById(id).innerHTML = localeString || 'UNKNOWN'
|
||||||
@ -37,6 +38,7 @@ async function doTranslation() {
|
|||||||
|
|
||||||
// Private options
|
// Private options
|
||||||
document.querySelector('#ip').placeholder = localeObj.ipPlaceholder
|
document.querySelector('#ip').placeholder = localeObj.ipPlaceholder
|
||||||
|
document.querySelector('#port').placeholder = localeObj.portPlaceholder
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
set('fullSettingsTitle', localeObj.settingsTitle)
|
set('fullSettingsTitle', localeObj.settingsTitle)
|
||||||
|
@ -351,6 +351,10 @@ body {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#port {
|
||||||
|
width: 12%;
|
||||||
|
}
|
||||||
|
|
||||||
#secondPanel input {
|
#secondPanel input {
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
@ -87,6 +87,6 @@ if "%PROXY_IP%" EQU "localhost" (
|
|||||||
:: Reconnect to the WiFi
|
:: Reconnect to the WiFi
|
||||||
netsh wlan connect name="%WIFI%"
|
netsh wlan connect name="%WIFI%"
|
||||||
|
|
||||||
:: taskkill /f /fi "WINDOWTITLE eq Administrator: PS Killswitch"
|
taskkill /f /fi "WINDOWTITLE eq Administrator: PS Killswitch"
|
||||||
|
|
||||||
exit
|
exit
|
@ -3,7 +3,7 @@
|
|||||||
:: 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 %1 "%2" ""%cd%"" %4", "", "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 %2 "%3" ""%cd%"" %5", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Use to force task kill
|
:: Use to force task kill
|
||||||
@ -12,11 +12,12 @@ title PS Launcher Script
|
|||||||
echo Starting Proxy Server
|
echo Starting Proxy Server
|
||||||
|
|
||||||
set IP=%1
|
set IP=%1
|
||||||
set GAME_PATH=%2
|
set PORT=%2
|
||||||
|
set GAME_PATH=%3
|
||||||
set GAME_PATH=%GAME_PATH:"=%
|
set GAME_PATH=%GAME_PATH:"=%
|
||||||
set ORIGIN=%3
|
set ORIGIN=%4
|
||||||
set ORIGIN=%ORIGIN:"=%
|
set ORIGIN=%ORIGIN:"=%
|
||||||
set ENABLE_KILLSWITCH=%4
|
set ENABLE_KILLSWITCH=%5
|
||||||
|
|
||||||
set PROXY=true
|
set PROXY=true
|
||||||
@rem Store original proxy settings
|
@rem Store original proxy settings
|
||||||
@ -28,7 +29,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%
|
start "Proxy Server" %ORIGIN%/ext/mitmdump.exe -s "%ORIGIN%/proxy/proxy.py" --ssl-insecure --set ip=%IP% --set port=%PORT%
|
||||||
|
|
||||||
echo Opening %GAME_PATH%
|
echo Opening %GAME_PATH%
|
||||||
|
|
||||||
@ -72,6 +73,6 @@ echo Done! See you next time!
|
|||||||
|
|
||||||
timeout /t 2 /nobreak >nul
|
timeout /t 2 /nobreak >nul
|
||||||
|
|
||||||
:: taskkill /f /fi "WINDOWTITLE eq Administrator: PS Launcher Script"
|
taskkill /f /fi "WINDOWTITLE eq Administrator: PS Launcher Script"
|
||||||
|
|
||||||
exit /b
|
exit /b
|
Loading…
x
Reference in New Issue
Block a user