diff --git a/files/helpers/images.py b/files/helpers/images.py index f535f5509..13cab7770 100644 --- a/files/helpers/images.py +++ b/files/helpers/images.py @@ -20,7 +20,7 @@ def process_image(file=None, filename=None, resize=0): exif[k] = None del exif[k] i.info["exif"] = exif.tobytes() - transposed = ImageOps.exif_transpose(i) + i = ImageOps.exif_transpose(i) if resize: size = resize, resize diff --git a/files/routes/awards.py b/files/routes/awards.py index 3571f1aa6..b31331146 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -382,7 +382,7 @@ def award_post(pid, v): g.db.commit() if request.referrer and len(request.referrer) > 1: - if request.referrer == f'{request.host_url}submit': return redirect(post.permalink) + if request.referrer == f'{SITE_FULL}/submit': return redirect(post.permalink) elif request.host in request.referrer: return redirect(request.referrer) return redirect("/") diff --git a/files/routes/comments.py b/files/routes/comments.py index 4d59dcc88..b27431c77 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -507,8 +507,8 @@ def api_comment(v): 'notification': { 'title': f'New reply by @{c.author_name}', 'body': notifbody, - 'deep_link': f'{request.host_url}comment/{c.id}?context=9&read=true#context', - 'icon': f'{request.host_url}assets/images/{SITE_NAME}/icon.webp', + 'deep_link': f'{SITE_FULL}/comment/{c.id}?context=9&read=true#context', + 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp', } }, 'fcm': { diff --git a/files/routes/errors.py b/files/routes/errors.py index 9c36a9a40..428cb10e0 100644 --- a/files/routes/errors.py +++ b/files/routes/errors.py @@ -61,5 +61,5 @@ def error_500(e): def allow_nsfw(): session["over_18"] = int(time.time()) + 3600 redir = request.values.get("redir") - if redir and redir.startswith(request.host_url) or redir.startswith('/'): return redirect(redir) + if redir and redir.startswith(SITE_FULL) or redir.startswith('/'): return redirect(redir) return redirect('/') \ No newline at end of file diff --git a/files/routes/feeds.py b/files/routes/feeds.py index 398bbf028..84ee231ec 100644 --- a/files/routes/feeds.py +++ b/files/routes/feeds.py @@ -53,7 +53,7 @@ def feeds_user(v=None, sort='hot', t='all'): with tag("name"): text(post.author_name) with tag("uri"): - text(f'{request.host_url}@{post.author_name}') + text(f'{SITE_FULL}/@{post.author_name}') doc.stag("link", href=full_link(post.permalink)) diff --git a/files/routes/login.py b/files/routes/login.py index cd4a76a68..b2c524ff5 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -15,7 +15,7 @@ def login_get(v): redir = request.values.get("redirect") if redir: redir = redir.replace("/logged_out", "").strip() - if not redir.startswith(request.host_url) and not redir.startswith('/'): redir = None + if not redir.startswith(SITE_FULL) and not redir.startswith('/'): redir = None if v and redir: return redirect(redir) @@ -143,7 +143,7 @@ def login_post(): redir = request.values.get("redirect") if redir: redir = redir.replace("/logged_out", "").strip() - if not redir.startswith(request.host_url) and not redir.startswith('/'): redir = '/' + if not redir.startswith(SITE_FULL) and not redir.startswith('/'): redir = '/' return redirect(redir) @@ -366,7 +366,7 @@ def post_forgot(): if user: now = int(time.time()) token = generate_hash(f"{user.id}+{now}+forgot+{user.login_nonce}") - url = f"{request.host_url}reset?id={user.id}&time={now}&token={token}" + url = f"{SITE_FULL}/reset?id={user.id}&time={now}&token={token}" send_mail(to_address=user.email, subject="Password Reset Request", @@ -489,7 +489,7 @@ def request_2fa_disable(): valid=int(time.time()) token=generate_hash(f"{user.id}+{user.username}+disable2fa+{valid}+{user.mfa_secret}+{user.login_nonce}") - action_url=f"{request.host_url}reset_2fa?id={user.id}&t={valid}&token={token}" + action_url=f"{SITE_FULL}/reset_2fa?id={user.id}&t={valid}&token={token}" send_mail(to_address=user.email, subject="2FA Removal Request", diff --git a/files/routes/posts.py b/files/routes/posts.py index d4d869808..a7d5c6730 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -78,7 +78,7 @@ def publish(pid, v): cache.delete_memoized(User.userpagelisting) if v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()): - send_discord_message(f"{request.host_url}{post.permalink[1:]}") + send_discord_message(f"{SITE_FULL}{post.permalink}") cache.delete_memoized(changeloglist) g.db.commit() @@ -557,7 +557,7 @@ def thumbnail_thread(pid): fetch_url = post.url - if fetch_url.startswith('/'): fetch_url = f"{request.host_url}{fetch_url[1:]}" + if fetch_url.startswith('/'): fetch_url = f"{SITE_FULL}{fetch_url}" headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"} @@ -1023,7 +1023,7 @@ def submit_post(v): rev = f"* [unddit.com](https://unddit.com/{rev})\n" else: rev = '' newposturl = new_post.url - if newposturl.startswith('/'): newposturl = f"{request.host_url}{newposturl[1:]}" + if newposturl.startswith('/'): newposturl = f"{SITE_FULL}{newposturl}" body += f"Snapshots:\n\n{rev}* [archive.org](https://web.archive.org/{newposturl})\n* [archive.ph](https://archive.ph/?url={quote(newposturl)}&run=1) (click to archive)\n\n" gevent.spawn(archiveorg, newposturl) @@ -1076,7 +1076,7 @@ def submit_post(v): cache.delete_memoized(frontlist) cache.delete_memoized(User.userpagelisting) if v.admin_level > 0 and ("[changelog]" in new_post.title.lower() or "(changelog)" in new_post.title.lower()) and not new_post.private: - send_discord_message(f"{request.host_url}{new_post.permalink[1:]}") + send_discord_message(f"{SITE_FULL}{new_post.permalink}") cache.delete_memoized(changeloglist) if v.id in (PIZZASHILL_ID, HIL_ID): diff --git a/files/routes/settings.py b/files/routes/settings.py index 38b563a9b..58355227c 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -537,7 +537,7 @@ def settings_security_post(v): if new_email == v.email: return render_template("settings_security.html", v=v, error="That email is already yours!") - url = f"{request.host_url}activate" + url = f"{SITE_FULL}/activate" now = int(time.time()) diff --git a/files/routes/users.py b/files/routes/users.py index 9ccee4b73..8b2529d88 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -473,8 +473,8 @@ def message2(v, username): 'notification': { 'title': f'New message from @{v.username}', 'body': notifbody, - 'deep_link': f'{request.host_url}notifications?messages=true', - 'icon': f'{request.host_url}assets/images/{SITE_NAME}/icon.webp', + 'deep_link': f'{SITE_FULL}/notifications?messages=true', + 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp', } }, 'fcm': { @@ -540,8 +540,8 @@ def messagereply(v): 'notification': { 'title': f'New message from @{v.username}', 'body': notifbody, - 'deep_link': f'{request.host_url}notifications?messages=true', - 'icon': f'{request.host_url}assets/images/{SITE_NAME}/icon.webp', + 'deep_link': f'{SITE_FULL}/notifications?messages=true', + 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp', } }, 'fcm': { diff --git a/files/templates/default.html b/files/templates/default.html index 264e1e415..282354c21 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -50,13 +50,13 @@ - + - + - + diff --git a/files/templates/formatting.html b/files/templates/formatting.html index 34b84f9d5..f6be58201 100644 --- a/files/templates/formatting.html +++ b/files/templates/formatting.html @@ -48,8 +48,8 @@ You can use Markdown formatting: