https options

This commit is contained in:
SpikeHD 2022-04-24 16:17:23 -07:00
parent 30aeba0794
commit f4bfb34f47
6 changed files with 37 additions and 2 deletions

View File

@ -41,6 +41,13 @@ class MlgmXyysd_Anime_Game_Proxy:
help = "Port to replace",
)
loader.add_option(
name = "use_https",
typespec = bool,
default = True,
help = "Use HTTPS",
)
def request(self, flow: http.HTTPFlow) -> None:
# This can also be replaced with another IP address.
REMOTE_HOST = ctx.options.ip
@ -82,6 +89,10 @@ class MlgmXyysd_Anime_Game_Proxy:
]
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.port = REMOTE_PORT

View File

@ -77,6 +77,16 @@
Select your language!
</span>
</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 id="controlBar">

View File

@ -10,7 +10,8 @@
lastConnect: '',
enableKillswitch: false,
serverLaunchPanel: false,
language: 'en'
language: 'en',
useHttps: true,
}
const cfgStr = await Neutralino.storage.getData('config').catch(e => {
// The data isn't set, so this is our first time opening

View File

@ -249,9 +249,11 @@ async function openSettings() {
// Fill setting options with what is currently set in config
const killSwitch = document.querySelector('#killswitchOption')
const serverLaunch = document.querySelector('#serverLaunchOption')
const httpsCheckbox = document.querySelector('#httpsOption')
killSwitch.checked = config.enableKillswitch
serverLaunch.checked = config.serverLaunchPanel
httpsCheckbox.checked = config.useHttps
// Load languages
getLanguages()

View File

@ -69,6 +69,17 @@ async function handleLanguageChange(elm) {
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

View File

@ -51,7 +51,7 @@ body {
#settingsPanel {
width: 35%;
height: 70%;
height: 80%;
}
#fullSettingsTitle {