![](assets/images/WPD/WPDBYE_w_text_2.png)
![](assets/images/WPD/WPDBYE_w_text_2.png)
diff --git a/files/__main__.py b/files/__main__.py index 8a6f0261af..92e1158b1b 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 @@ -94,6 +93,13 @@ def before_request(): g.webview = '; wv) ' in ua g.inferior_browser = 'iphone' in ua or 'ipad' in ua or 'ipod' in ua or 'mac os' in ua or ' firefox/' in ua + #### WPD TEMP #### temporary WPD migration logic: redirect to / + if request.host == 'watchpeopledie.co' and app.config["SERVER_NAME"] == "watchpeopledie.co": + request.path = request.path.rstrip('/') + if not request.path: request.path = '/' + if request.path != '/': + return redirect('/') + #### END WPD TEMP #### request.path = request.path.rstrip('/') if not request.path: request.path = '/' request.full_path = request.full_path.rstrip('?').rstrip('/') diff --git a/files/assets/images/WPD/WPDBYE_w_text_2.png b/files/assets/images/WPD/WPDBYE_w_text_2.png new file mode 100644 index 0000000000..37ae34fd8c Binary files /dev/null and b/files/assets/images/WPD/WPDBYE_w_text_2.png differ diff --git a/files/assets/images/badges/181.webp b/files/assets/images/badges/181.webp new file mode 100644 index 0000000000..060e06a490 Binary files /dev/null and b/files/assets/images/badges/181.webp differ diff --git a/files/assets/images/badges/182.webp b/files/assets/images/badges/182.webp new file mode 100644 index 0000000000..13bb31b52f Binary files /dev/null and b/files/assets/images/badges/182.webp differ diff --git a/files/helpers/const.py b/files/helpers/const.py index 49c17eeb0c..0ba4e10a59 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -52,7 +52,7 @@ if SITE == "localhost": SITE_FULL = 'http://' + SITE else: SITE_FULL = 'https://' + SITE -if SITE == 'pcmemes.net': CC = "SPLASH MOUNTAIN" +if SITE_NAME == 'PCM': CC = "SPLASH MOUNTAIN" else: CC = "COUNTRY CLUB" CC_TITLE = CC.title() @@ -993,8 +993,10 @@ for k, val in temp: if SITE_NAME != 'rDrama': AWARDS_DISABLED.append('progressivestack') -if SITE == 'pcmemes.net': - AWARDS_DISABLED.extend(['ban','pizzashill','marsey','bird','grass','chud','unblockable']) +if SITE_NAME == 'PCM': + # Previous set of disabled, changed temporarily by request 2022-10-17 + #AWARDS_DISABLED.extend(['ban','pizzashill','marsey','bird','grass','chud','unblockable']) + AWARDS_DISABLED.extend(['unblockable']) AWARDS_DISABLED.remove('ghost') elif SITE_NAME == 'WPD': AWARDS_DISABLED.remove('lootbox') @@ -1067,7 +1069,7 @@ if SITE == 'rdrama.net': 'carpathianflorist': CARP_ID, 'carpathian florist': CARP_ID, 'the_homocracy': HOMO_ID, - 'justcool393', JUSTCOOL_ID + 'justcool393': JUSTCOOL_ID } elif SITE_NAME == 'WPD': REDDIT_NOTIFS_SITE.update({'watchpeopledie', 'makemycoffin'}) diff --git a/files/helpers/offsitementions.py b/files/helpers/offsitementions.py index 149e671a6f..0804714b01 100644 --- a/files/helpers/offsitementions.py +++ b/files/helpers/offsitementions.py @@ -36,13 +36,12 @@ def get_mentions(queries): mentions = [] for kind, query in itertools.product(kinds, queries): try: - data = requests.get(f'https://api.pushshift.io/reddit/{kind}/search?html_decode=true&q={query}&size=1', timeout=5).json()['data'] + # Special cases: PokemonGoRaids says 'Marsey' a lot unrelated to us. + # SubSimulatorGPT2 is just bots + data = requests.get(f'https://api.pushshift.io/reddit/{kind}/search?html_decode=true&q={query}&subreddit=!PokemonGoRaids,!SubSimulatorGPT2&size=1', timeout=5).json()['data'] except: break for i in data: - # Special case: PokemonGoRaids says 'Marsey' a lot unrelated to us. - if i['subreddit'] == 'PokemonGoRaids': continue - if kind == 'comment': body = i["body"].replace('>', '> ') text = f'
' diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 0fe7ad8570..0d5cbccb86 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -106,6 +106,11 @@ def auth_desired_with_logingate(f): v = get_logged_in_user() if app.config['SETTINGS']['login_required'] and not v: abort(401) + #### WPD TEMP #### disable this /logged_out thing on .co + if request.host == 'watchpeopledie.co': + return make_response(f(*args, v=v, **kwargs)) + #### END WPD TEMP #### + if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}") diff --git a/files/routes/awards.py b/files/routes/awards.py index 84c0a9b299..99d47524f3 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -358,7 +358,7 @@ def award_thing(v, thing_type, id): if author.marsify: body = marsify(body) thing.body_html = sanitize(body, limit_pings=5) g.db.add(thing) - elif ("Femboy" in kind and kind == v.house): + elif ("Femboy" in kind and kind == v.house) or kind == 'rainbow': if author.rainbow: author.rainbow += 86400 else: author.rainbow = int(time.time()) + 86400 badge_grant(user=author, badge_id=171) diff --git a/files/routes/front.py b/files/routes/front.py index e33c140d92..f1d9842676 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -17,7 +17,31 @@ 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 files.helpers.security import generate_hash, validate_hash + from datetime import datetime + now = datetime.utcnow() + 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'https://watchpeopledie.tv/logged_out?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 files.routes.login import on_login + user = get_account(req_user, graceful=True) + if user: + if user.admin_level: + abort(401) + else: + if validate_hash(req_code, f'{user.id}+{now.year}+{now.month}+{now.day}+{now.hour}+WPDusermigration'): + on_login(user) + return redirect('/') + return redirect('/logged_out') + #### 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 0000000000..b0d47b52ec --- /dev/null +++ b/files/templates/wpdco.html @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + +{body}