From be6fa59e131fd4725cb34b0dbdc223108d06ef04 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Mon, 17 Oct 2022 18:35:51 -0500 Subject: [PATCH] fix host bug, do a absolute redirect instead of a relative one, and make wpdco page essentially static --- files/__main__.py | 3 +- files/routes/front.py | 2 +- files/templates/wpdco.html | 79 +++++++++++++++++++++++++++++++------- 3 files changed, 67 insertions(+), 17 deletions(-) diff --git a/files/__main__.py b/files/__main__.py index 43c70fd259..51e735254a 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -74,7 +74,6 @@ if not path.isfile(f'/site_settings.json'): @app.before_request def before_request(): - g.agent = request.headers.get("User-Agent") if not g.agent and request.path != '/kofi': return 'Please use a "User-Agent" header!', 403 @@ -91,7 +90,7 @@ def before_request(): if not request.path: request.path = '/' if request.path != '/': return redirect('/') - if request.host != app.config["SERVER_NAME"]: return {"error": "Unauthorized host provided."}, 403 + elif request.host != app.config["SERVER_NAME"]: return {"error": "Unauthorized host provided."}, 403 if request.headers.get("CF-Worker"): return {"error": "Cloudflare workers are not allowed to access this website."}, 403 if not app.config['SETTINGS']['Bots'] and request.headers.get("Authorization"): abort(403) diff --git a/files/routes/front.py b/files/routes/front.py index 8f42a567c1..a53b829cb3 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -24,7 +24,7 @@ def front_all(v, sub=None, subdomain=None): if request.host == 'watchpeopledie.co': if v and not v.admin_level: # security: don't auto login admins hash = generate_hash(f'{v.id}+{now.year}+{now.month}+{now.day}+{now.hour}+WPDusermigration') - return redirect(f'/?user={v.id}&code={hash}', 301) + return redirect(f'https://watchpeopledie.tv/?user={v.id}&code={hash}', 301) else: return render_template('wpdco.html') elif request.host == 'watchpeopledie.tv' and not v: # security: don't try to login people into accounts more than once diff --git a/files/templates/wpdco.html b/files/templates/wpdco.html index 5ccdfaa6d1..2bbc122a27 100644 --- a/files/templates/wpdco.html +++ b/files/templates/wpdco.html @@ -1,17 +1,68 @@ -{% extends "default.html" %} + + + + + + + -{% block title %} -cute cat pictures or something idk -{% endblock %} + + -{% block pagetype %}sadface{% endblock %} + -{% block content %} -
-
-
- -
-
-
-{% endblock %} \ No newline at end of file + + + rip + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ + \ No newline at end of file