From c9be301462d9eb44983407338af252e397ce6b03 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 14 Dec 2021 21:34:31 +0200 Subject: [PATCH 1/2] fdssdf --- files/helpers/wrappers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 83c610b86..8de3a0eb8 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -47,7 +47,7 @@ def auth_desired(f): v = get_logged_in_user() - if request.host == 'old.rdrama.net' and not (v and v.admin_level) and '/login' not in request.path: + if request.host == 'old.rdrama.net' and not (v and v.admin_level) and '/log' not in request.path: if request.headers.get("Authorization"): return {"error": "403 Forbidden"}, 403 else: return render_template('errors/403.html', v=v), 403 check_ban_evade(v) From 481af28e35c95470550b5521064afdfba57879d7 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 14 Dec 2021 22:25:57 +0200 Subject: [PATCH 2/2] fdsfsd --- files/helpers/sanitize.py | 10 +++++----- files/routes/admin.py | 2 +- files/routes/awards.py | 4 ++-- files/routes/comments.py | 4 ++-- files/routes/posts.py | 14 +++++++------- files/routes/settings.py | 10 +++++----- files/routes/static.py | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 7f67f7c5f..59cdfed8c 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -183,7 +183,7 @@ def sanitize(sanitized, noimages=False): remoji = emoji if path.isfile(f'./files/assets/images/emojis/{remoji}.webp'): - new = re.sub(f'(?', new, flags=re.I) + new = re.sub(f'(?', new, flags=re.I) sanitized = sanitized.replace(old, new) @@ -193,10 +193,10 @@ def sanitize(sanitized, noimages=False): if emoji.startswith("!"): emoji = emoji[1:] if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'): - sanitized = re.sub(f'(?', sanitized, flags=re.I) + sanitized = re.sub(f'(?', sanitized, flags=re.I) elif path.isfile(f'./files/assets/images/emojis/{emoji}.webp'): - sanitized = re.sub(f'(?', sanitized, flags=re.I) + sanitized = re.sub(f'(?', sanitized, flags=re.I) sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("https://m.wikipedia", "https://wikipedia").replace("https://m.youtube", "https://youtube") @@ -240,10 +240,10 @@ def filter_emojis_only(title): if emoji.startswith("!"): emoji = emoji[1:] if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'): - title = re.sub(f'(?', title, flags=re.I) + title = re.sub(f'(?', title, flags=re.I) elif path.isfile(f'./files/assets/images/emojis/{emoji}.webp'): - title = re.sub(f'(?', title, flags=re.I) + title = re.sub(f'(?', title, flags=re.I) if len(title) > 1500: abort(400) else: return title \ No newline at end of file diff --git a/files/routes/admin.py b/files/routes/admin.py index bc8781b12..4c4c2050f 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -33,7 +33,7 @@ def distribute(v, cid): for vote in votes: u = vote.user u.coins += coinsperperson - send_notification(u.id, f"You won {coinsperperson} coins betting on https://{request.host}{post} !") + send_notification(u.id, f"You won {coinsperperson} coins betting on {post} !") g.db.add(u) autobetter.coins = 0 diff --git a/files/routes/awards.py b/files/routes/awards.py index 36b473f92..efec4cd3a 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -585,7 +585,7 @@ def award_post(pid, v): return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404 if author.longpost: author.longpost += 86400 else: author.longpost = time.time() + 86400 - send_notification(IDIO_ID, f"@{v.username} used {kind} award on {request.host_url}{post.shortlink}") + send_notification(IDIO_ID, f"@{v.username} used {kind} award on [{post.shortlink}]({post.shortlink})") elif kind == "bird": if author.longpost: return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404 @@ -747,7 +747,7 @@ def award_comment(cid, v): return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404 if author.longpost: author.longpost += 86400 else: author.longpost = time.time() + 86400 - send_notification(IDIO_ID, f"@{v.username} used {kind} award on {request.host_url}{c.shortlink}") + send_notification(IDIO_ID, f"@{v.username} used {kind} award on [{c.shortlink}]({c.shortlink})") elif kind == "bird": if author.longpost: return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404 diff --git a/files/routes/comments.py b/files/routes/comments.py index 522d9601a..45d03801b 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -194,7 +194,7 @@ def api_comment(v): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' file.save(name) - url = request.host_url[:-1] + process_image(name) + url = process_image(name) body += f"\n\n![]({url})" @@ -724,7 +724,7 @@ def edit_comment(cid, v): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' file.save(name) - url = request.host_url[:-1] + process_image(name) + url = process_image(name) body += f"\n\n![]({url})" body_md = CustomRenderer().render(mistletoe.Document(body)) diff --git a/files/routes/posts.py b/files/routes/posts.py index 3c1fa9773..abd2a639e 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -63,12 +63,12 @@ def publish(pid, v): user = g.db.query(User).filter_by(username=username).first() if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user.id) - for x in notify_users: send_notification(x, f"@{v.username} has mentioned you: https://{site}{post.permalink}") + for x in notify_users: send_notification(x, f"@{v.username} has mentioned you: [{post.title}]({post.permalink})") for follow in v.followers: user = get_account(follow.user_id) if post.club and not user.club_allowed: continue - send_notification(user.id, f"@{v.username} has made a new post: [{post.title}](https://{site}{post.permalink})", True) + send_notification(user.id, f"@{v.username} has made a new post: [{post.title}]({post.permalink})", True) cache.delete_memoized(frontlist) @@ -425,7 +425,7 @@ def edit_post(pid, v): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' file.save(name) - url = request.host_url[:-1] + process_image(name) + url = process_image(name) body += f"\n\n![]({url})" @@ -542,7 +542,7 @@ def edit_post(pid, v): user = g.db.query(User).filter_by(username=username).first() if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user.id) - message = f"@{v.username} has mentioned you: https://{site}{p.permalink}" + message = f"@{v.username} has mentioned you: [{p.title}]({p.permalink})" for x in notify_users: send_notification(x, message) @@ -698,7 +698,7 @@ def thumbnail_thread(pid): for chunk in image_req.iter_content(1024): file.write(chunk) - post.thumburl = f"https://{site}" + process_image(name, True) + post.thumburl = process_image(name, True) db.add(post) db.commit() db.close() @@ -919,7 +919,7 @@ def submit_post(v): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' file.save(name) - url = request.host_url[:-1] + process_image(name) + url = process_image(name) body += f"\n\n![]({url})" @@ -1019,7 +1019,7 @@ def submit_post(v): if file.content_type.startswith('image/'): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' file.save(name) - new_post.url = request.host_url[:-1] + process_image(name) + new_post.url = process_image(name) elif file.content_type.startswith('video/'): file.save("video.mp4") diff --git a/files/routes/settings.py b/files/routes/settings.py index 7b582bb20..e06e7520c 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -126,7 +126,7 @@ def settings_profile_post(v): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' file.save(name) - url = request.host_url[:-1] + process_image(name) + url = process_image(name) bio += f"\n\n![]({url})" @@ -316,7 +316,7 @@ def settings_profile_post(v): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' file.save(name) - url = request.host_url[:-1] + process_image(name) + url = process_image(name) bio += f"\n\n![]({url})" @@ -722,13 +722,13 @@ def settings_images_profile(v): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' file.save(name) - highres = request.host_url[:-1] + process_image(name) + highres = process_image(name) if not highres: abort(400) name2 = name.replace('.webp', 'r.webp') copyfile(name, name2) - imageurl = request.host_url + process_image(name2, True) + imageurl = process_image(name2, True) if not imageurl: abort(400) @@ -758,7 +758,7 @@ def settings_images_banner(v): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' file.save(name) - bannerurl = request.host_url[:-1] + process_image(name) + bannerurl = process_image(name) if bannerurl: if v.bannerurl and '/images/' in v.bannerurl : os.remove('images/' + v.bannerurl.split('/images/')[1]) diff --git a/files/routes/static.py b/files/routes/static.py index 88e2cbf15..71d9db856 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -232,7 +232,7 @@ def contact(v): @auth_required @validate_formkey def submit_contact(v): - message = f'This message has been sent automatically to all admins via https://{site}/contact, user email is "{v.email}"\n\nMessage:\n\n' + request.values.get("message", "") + message = f'This message has been sent automatically to all admins via [/contact](/contact), user email is "{v.email}"\n\nMessage:\n\n' + request.values.get("message", "") send_admin(v.id, message) g.db.commit() return render_template("contact.html", v=v, msg="Your message has been sent.")