diff --git a/files/__main__.py b/files/__main__.py index 8a6f0261a..903c09c35 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -85,6 +85,10 @@ def before_request(): with open('/site_settings.json', 'r', encoding='utf_8') as f: app.config['SETTINGS'] = json.load(f) + if request.host == 'watchpeopledie.co' and app.config["SERVER_NAME"] == "watchpeopledie.tv": + #### WPD TEMP #### temporary WPD migration logic: redirect to / + if request.host != '/': + return redirect('/') if 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 diff --git a/files/routes/front.py b/files/routes/front.py index e33c140d9..768723dbc 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -17,7 +17,29 @@ from files.helpers.awards import award_timers @limiter.limit("3/second;30/minute;5000/hour;10000/day") @auth_desired_with_logingate def front_all(v, sub=None, subdomain=None): - + #### WPD TEMP #### special front logic + from helpers.security import generate_hash, validate_hash + from datetime import datetime + today = datetime.today() + if request.host == 'watchpeopledie.co': + if v and not v.admin_level: # security: don't auto login admins + hash = generate_hash(f'{v.id}+{today.year}+{today.month}+{today.day}+{today.hour}+WPDusermigration') + return redirect(f'/?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 + req_user = request.values.get('user') + req_code = request.values.get('code') + if req_user and req_code: + from routes.login import on_login + user = get_account(req_user) + if user: + if user.admin_level: + abort(401) + else: + if validate_hash(req_code, f'{v.id}+{today.year}+{today.month}+{today.day}+{today.hour}+WPDusermigration'): + on_login(user) + #### WPD TEMP #### end special front logic if sub: sub = sub.strip().lower() if sub == 'chudrama' and not (v and v.can_see_chudrama): abort(403) diff --git a/files/templates/wpdco.html b/files/templates/wpdco.html new file mode 100644 index 000000000..dff9a9de3 --- /dev/null +++ b/files/templates/wpdco.html @@ -0,0 +1,17 @@ +{% extends "default.html" %} + +{% block title %} +cute cat pictures or something idk +{% endblock %} + +{% block pagetype %}sadface{% endblock %} + +{% block content %} +
+
+
+ hi fish i need some txt thx +
+
+
+{% endblock %} \ No newline at end of file