diff --git a/proxy/proxy.py b/proxy/proxy.py index c2a0b70..fc7cc25 100644 --- a/proxy/proxy.py +++ b/proxy/proxy.py @@ -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 diff --git a/resources/index.html b/resources/index.html index 123f9ac..708db52 100644 --- a/resources/index.html +++ b/resources/index.html @@ -77,6 +77,16 @@ Select your language! +
+
+ Use HTTPS + + +
+ + Choose between using HTTPS or HTTP. + +
diff --git a/resources/js/helpers.js b/resources/js/helpers.js index 6d83690..03a57a8 100644 --- a/resources/js/helpers.js +++ b/resources/js/helpers.js @@ -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 diff --git a/resources/js/index.js b/resources/js/index.js index 12e4f64..be5639e 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -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() diff --git a/resources/js/options.js b/resources/js/options.js index 43c227b..9d0ec2a 100644 --- a/resources/js/options.js +++ b/resources/js/options.js @@ -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 diff --git a/resources/style/index.css b/resources/style/index.css index 7a33d47..0888f84 100644 --- a/resources/style/index.css +++ b/resources/style/index.css @@ -51,7 +51,7 @@ body { #settingsPanel { width: 35%; - height: 70%; + height: 80%; } #fullSettingsTitle {