mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-22 07:08:11 +00:00
specify port when connecitng
This commit is contained in:
parent
e4cc000117
commit
9adb023f7c
@ -11,6 +11,7 @@
|
||||
"folderNotSet": "Not set",
|
||||
|
||||
"ipPlaceholder": "IP Address",
|
||||
"portPlaceholder": "Port (optional)",
|
||||
"noFavorites": "No favorites set",
|
||||
|
||||
"settingsTitle": "Settings",
|
||||
|
@ -34,9 +34,17 @@ class MlgmXyysd_Anime_Game_Proxy:
|
||||
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:
|
||||
# This can also be replaced with another IP address.
|
||||
REMOTE_HOST = ctx.options.ip
|
||||
REMOTE_PORT = ctx.options.port
|
||||
|
||||
LIST_DOMAINS = [
|
||||
"api-os-takumi.mihoyo.com",
|
||||
@ -75,6 +83,7 @@ class MlgmXyysd_Anime_Game_Proxy:
|
||||
|
||||
if flow.request.host in LIST_DOMAINS:
|
||||
flow.request.host = REMOTE_HOST
|
||||
flow.request.port = REMOTE_PORT
|
||||
|
||||
addons = [
|
||||
MlgmXyysd_Anime_Game_Proxy()
|
||||
|
@ -103,6 +103,7 @@
|
||||
<div id="secondControlContainer">
|
||||
<div id="serverInput">
|
||||
<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/list.svg" id="star" onclick="handleFavoriteList()" />
|
||||
</div>
|
||||
|
@ -370,17 +370,18 @@ async function launchOfficial() {
|
||||
*/
|
||||
async function launchPrivate() {
|
||||
const ip = document.getElementById('ip').value || 'localhost'
|
||||
const port = document.getElementById('port').value || '443'
|
||||
|
||||
const config = await getCfg()
|
||||
|
||||
console.log('connecting to ' + ip)
|
||||
console.log('connecting to ' + ip + ':' + port)
|
||||
|
||||
// Set the last connect
|
||||
config.lastConnect = ip
|
||||
Neutralino.storage.setData('config', JSON.stringify(config))
|
||||
|
||||
// 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() {
|
||||
|
@ -13,6 +13,7 @@ async function doTranslation() {
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
const set = (id, localeString) => document.getElementById(id).innerHTML = localeString || 'UNKNOWN'
|
||||
@ -37,6 +38,7 @@ async function doTranslation() {
|
||||
|
||||
// Private options
|
||||
document.querySelector('#ip').placeholder = localeObj.ipPlaceholder
|
||||
document.querySelector('#port').placeholder = localeObj.portPlaceholder
|
||||
|
||||
// Settings
|
||||
set('fullSettingsTitle', localeObj.settingsTitle)
|
||||
|
@ -351,6 +351,10 @@ body {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#port {
|
||||
width: 12%;
|
||||
}
|
||||
|
||||
#secondPanel input {
|
||||
margin-bottom: 4px;
|
||||
height: 20px;
|
||||
|
@ -87,6 +87,6 @@ if "%PROXY_IP%" EQU "localhost" (
|
||||
:: Reconnect to the WiFi
|
||||
netsh wlan connect name="%WIFI%"
|
||||
|
||||
:: taskkill /f /fi "WINDOWTITLE eq Administrator: PS Killswitch"
|
||||
taskkill /f /fi "WINDOWTITLE eq Administrator: PS Killswitch"
|
||||
|
||||
exit
|
@ -3,7 +3,7 @@
|
||||
:: 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 "%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
|
||||
@ -12,11 +12,12 @@ title PS Launcher Script
|
||||
echo Starting Proxy Server
|
||||
|
||||
set IP=%1
|
||||
set GAME_PATH=%2
|
||||
set PORT=%2
|
||||
set GAME_PATH=%3
|
||||
set GAME_PATH=%GAME_PATH:"=%
|
||||
set ORIGIN=%3
|
||||
set ORIGIN=%4
|
||||
set ORIGIN=%ORIGIN:"=%
|
||||
set ENABLE_KILLSWITCH=%4
|
||||
set ENABLE_KILLSWITCH=%5
|
||||
|
||||
set PROXY=true
|
||||
@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
|
||||
|
||||
:: 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%
|
||||
|
||||
@ -72,6 +73,6 @@ echo Done! See you next time!
|
||||
|
||||
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
|
Loading…
Reference in New Issue
Block a user