mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-08-14 13:11:48 +08:00
https options
This commit is contained in:
parent
30aeba0794
commit
f4bfb34f47
@ -41,6 +41,13 @@ class MlgmXyysd_Anime_Game_Proxy:
|
|||||||
help = "Port to replace",
|
help = "Port to replace",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
loader.add_option(
|
||||||
|
name = "use_https",
|
||||||
|
typespec = bool,
|
||||||
|
default = True,
|
||||||
|
help = "Use HTTPS",
|
||||||
|
)
|
||||||
|
|
||||||
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
|
||||||
@ -82,6 +89,10 @@ class MlgmXyysd_Anime_Game_Proxy:
|
|||||||
]
|
]
|
||||||
|
|
||||||
if flow.request.host in LIST_DOMAINS:
|
if flow.request.host in LIST_DOMAINS:
|
||||||
|
if ctx.options.use_https:
|
||||||
|
flow.request.scheme = "https"
|
||||||
|
else:
|
||||||
|
flow.request.scheme = "http"
|
||||||
flow.request.host = REMOTE_HOST
|
flow.request.host = REMOTE_HOST
|
||||||
flow.request.port = REMOTE_PORT
|
flow.request.port = REMOTE_PORT
|
||||||
|
|
||||||
|
@ -77,6 +77,16 @@
|
|||||||
Select your language!
|
Select your language!
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="settingsRow">
|
||||||
|
<div class="settingSection">
|
||||||
|
<span class="settingLabel", id="httpsTitle">Use HTTPS</span>
|
||||||
|
<input type="checkbox" id="httpsOption" onchange="toggleHttps()" />
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<span class="settingSubtitle" id="httpsSubtitle">
|
||||||
|
Choose between using HTTPS or HTTP.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="controlBar">
|
<div id="controlBar">
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
lastConnect: '',
|
lastConnect: '',
|
||||||
enableKillswitch: false,
|
enableKillswitch: false,
|
||||||
serverLaunchPanel: false,
|
serverLaunchPanel: false,
|
||||||
language: 'en'
|
language: 'en',
|
||||||
|
useHttps: true,
|
||||||
}
|
}
|
||||||
const cfgStr = await Neutralino.storage.getData('config').catch(e => {
|
const cfgStr = await Neutralino.storage.getData('config').catch(e => {
|
||||||
// The data isn't set, so this is our first time opening
|
// The data isn't set, so this is our first time opening
|
||||||
|
@ -249,9 +249,11 @@ async function openSettings() {
|
|||||||
// Fill setting options with what is currently set in config
|
// Fill setting options with what is currently set in config
|
||||||
const killSwitch = document.querySelector('#killswitchOption')
|
const killSwitch = document.querySelector('#killswitchOption')
|
||||||
const serverLaunch = document.querySelector('#serverLaunchOption')
|
const serverLaunch = document.querySelector('#serverLaunchOption')
|
||||||
|
const httpsCheckbox = document.querySelector('#httpsOption')
|
||||||
|
|
||||||
killSwitch.checked = config.enableKillswitch
|
killSwitch.checked = config.enableKillswitch
|
||||||
serverLaunch.checked = config.serverLaunchPanel
|
serverLaunch.checked = config.serverLaunchPanel
|
||||||
|
httpsCheckbox.checked = config.useHttps
|
||||||
|
|
||||||
// Load languages
|
// Load languages
|
||||||
getLanguages()
|
getLanguages()
|
||||||
|
@ -69,6 +69,17 @@ async function handleLanguageChange(elm) {
|
|||||||
window.location.reload()
|
window.location.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the use of HTTPS
|
||||||
|
*/
|
||||||
|
async function toggleKillSwitch() {
|
||||||
|
const httpsCheckbox = document.querySelector('#httpsOption')
|
||||||
|
const config = await getCfg()
|
||||||
|
|
||||||
|
config.useHttps = httpsCheckbox.checked
|
||||||
|
|
||||||
|
Neutralino.storage.setData('config', JSON.stringify(config))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the current value of the IP input to the favorites list
|
* Add the current value of the IP input to the favorites list
|
||||||
|
@ -51,7 +51,7 @@ body {
|
|||||||
|
|
||||||
#settingsPanel {
|
#settingsPanel {
|
||||||
width: 35%;
|
width: 35%;
|
||||||
height: 70%;
|
height: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#fullSettingsTitle {
|
#fullSettingsTitle {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user