From e844936a00cacc83a55444bd9e860fedb63da05a Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Wed, 27 Mar 2024 20:41:24 +1100 Subject: [PATCH] fix: Add https.js --- main.py | 4 ++++ templates/https.js | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 templates/https.js diff --git a/main.py b/main.py index d562e1b..2e88249 100644 --- a/main.py +++ b/main.py @@ -51,6 +51,10 @@ if not os.path.isdir('certs'): def send_report(path): return send_from_directory('templates/assets', path) +@app.route('/https.js') +def httpsJS(): + return send_from_directory('templates', 'https.js') + @app.route('/favicon.png') def faviconPNG(): return send_from_directory('templates/assets/img', 'favicon.png') diff --git a/templates/https.js b/templates/https.js new file mode 100644 index 0000000..4d0083b --- /dev/null +++ b/templates/https.js @@ -0,0 +1,6 @@ +if (location.protocol !== 'https:') { + location.replace(`https:${location.href.substring(location.protocol.length)}`); +} +else{ +console.log("Already Https"); +}