diff --git a/files/classes/user.py b/files/classes/user.py index 00816c675..56398f3a3 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -436,7 +436,7 @@ class User(Base): @lazy def banner_url(self): if self.bannerurl: return self.bannerurl - else: return f"https://{site}/static/assets/images/{site_name}/preview.webp?a=200" + else: return f"https://{site}/static/assets/images/{site_name}/site_preview.webp?a=1" @property @lazy diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index aa601a438..071786f21 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -109,7 +109,7 @@ def sanitize(sanitized, noimages=False, alert=False): for i in re.finditer("
@((\w|-){1,25})", sanitized): u = get_user(i.group(1), graceful=True) if u: - sanitized = sanitized.replace(i.group(0), f'
@{u.username}')
+ sanitized = sanitized.replace(i.group(0), f'''
@{u.username}''')
else:
sanitized = re.sub('(^|\s|\n|
)\/?((r|u)\/\w{3,25})', r'\1\2', sanitized)
@@ -120,7 +120,7 @@ def sanitize(sanitized, noimages=False, alert=False):
if noimages:
sanitized = sanitized.replace(i.group(0), f'{i.group(1)}@{u.username}')
else:
- sanitized = sanitized.replace(i.group(0), f'{i.group(1)}@{u.username}')
+ sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}
@{u.username}''')
for i in re.finditer('https://i\.imgur\.com/(([^_]*?)\.(jpg|png|jpeg))', sanitized):
@@ -160,7 +160,7 @@ def sanitize(sanitized, noimages=False, alert=False):
tag["loading"] = "lazy"
tag["data-src"] = tag["src"]
tag["src"] = "/static/assets/images/loading.webp"
- tag['alt'] = f'![]({tag["src"]})'
+ tag['alt'] = f'![]({tag["data-src"]})'
link = soup.new_tag("a")
link["href"] = tag["data-src"]
@@ -203,10 +203,10 @@ def sanitize(sanitized, noimages=False, alert=False):
classes = 'class="emoji-lg" '
remoji = emoji[1:]
elif emoji.startswith("!"):
- classes = 'height=60 class="emoji-md mirrored" '
+ classes = 'class="emoji-md mirrored" '
remoji = emoji[1:]
else:
- classes = 'height=60 class="emoji-md" '
+ classes = 'class="emoji-md" '
remoji = emoji
if path.isfile(f'files/assets/images/emojis/{remoji}.webp'):
@@ -221,11 +221,11 @@ def sanitize(sanitized, noimages=False, alert=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)
marseys_used.add(emoji)
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)
marseys_used.add(emoji)
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("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube")
@@ -277,10 +277,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/front.py b/files/routes/front.py
index bad1917eb..01fe33589 100644
--- a/files/routes/front.py
+++ b/files/routes/front.py
@@ -256,7 +256,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
if sort == "hot":
ti = int(time.time()) + 3600
- posts = posts.order_by(-1000000*(Submission.realupvotes + 1 + Submission.comment_count/5)/(func.power(((ti - Submission.created_utc)/1000), 1.35)))
+ posts = posts.order_by(-1000000*(Submission.realupvotes + 1 + Submission.comment_count/5)/(func.power(((ti - Submission.created_utc)/1000), 1.23)))
elif sort == "new":
posts = posts.order_by(Submission.created_utc.desc())
elif sort == "old":
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 547c120f3..930c87a7e 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -1037,7 +1037,12 @@ def submit_post(v):
if request.headers.get("Authorization"): return {"error": "File type not allowed"}, 400
return render_template(f"{template}submit.html", v=v, error="File type not allowed.", title=title, body=request.values.get("body", "")), 400
- if not new_post.thumburl and new_post.url and request.headers.get('cf-ipcountry')!="T1": gevent.spawn( thumbnail_thread, new_post.id)
+
+ if not new_post.thumburl and new_post.url:
+ if request.host in new_post.url or new_post.url.startswith('/') or request.host == 'rdrama.net' and 'rdrama' in new_post.url:
+ new_post.thumburl = '/static/assets/images/{site_name}/site_preview.webp'
+ elif request.headers.get('cf-ipcountry')!="T1":
+ gevent.spawn( thumbnail_thread, new_post.id)
if not new_post.private:
@@ -1162,8 +1167,13 @@ def submit_post(v):
g.db.commit()
+
if request.headers.get("Authorization"): return new_post.json
- else: return redirect(new_post.permalink)
+ else:
+ if 'megathread' in new_post.title.lower(): sort = 'new'
+ else: sort = v.defaultsortingcomments
+ new_post.replies = [c]
+ return render_template('submission.html', v=v, p=new_post, sort=sort, render_replies=True, offset=0, success=True)
@app.post("/delete_post/
+
{% else %}
-
+
{% endif %}
{% endif %}
diff --git a/files/templates/log.html b/files/templates/log.html
index 74fa1987b..401e47d1e 100644
--- a/files/templates/log.html
+++ b/files/templates/log.html
@@ -6,7 +6,7 @@
{% block content %}
{% if v %}
-
+
{% if v.agendaposter %}
-
+
{% endif %}