remotes/1693045480750635534/spooky-22
Aevann1 2021-08-13 20:53:11 +02:00
parent 3d7dd7b0c3
commit bbb7046a76
7 changed files with 18 additions and 12 deletions

View File

@ -13,9 +13,10 @@ def app_config(x):
return app.config.get(x)
@app.template_filter("post_embed")
def crosspost_embed(id):
def post_embed(id):
id = int(id)
try: id = int(id)
except: return None
p = get_post(id, graceful=True)

View File

@ -35,8 +35,8 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
if not v and "logged_out" not in request.path: return redirect(f"/logged_out/comment/{cid}")
if v and "logged_out" in request.full_path: return redirect(f"/comment/{cid}")
if v and "logged_out" in request.full_path: v = None
try: cid = int(cid)
except:
try: cid = int(cid, 36)

View File

@ -191,7 +191,7 @@ def front_all(v):
if not v and request.path == "/": return redirect("/logged_out")
if v and "logged_out" in request.full_path: return redirect("/")
if v and "logged_out" in request.full_path: v = None
try: page = int(request.args.get("page") or 1)
except: abort(400)

View File

@ -54,7 +54,7 @@ def post_id(pid, anything=None, v=None):
if not v and "logged_out" not in request.path: return redirect(f"/logged_out/post/{pid}")
if v and "logged_out" in request.full_path: return redirect(f"/post/{pid}")
if v and "logged_out" in request.full_path: v = None
try: pid = int(pid)
except Exception as e: pass

View File

@ -281,7 +281,7 @@ def u_username(username, v=None):
if not v and "logged_out" not in request.path: return redirect(f"/logged_out/@{username}")
if v and "logged_out" in request.full_path: return redirect(f"/@{username}")
if v and "logged_out" in request.full_path: v = None
# username is unique so at most this returns one result. Otherwise 404
@ -402,7 +402,7 @@ def u_username_comments(username, v=None):
if not v and "logged_out" not in request.path: return redirect(f"/logged_out/@{username}/comments")
if v and "logged_out" in request.full_path: return redirect(f"/@{username}/comments")
if v and "logged_out" in request.full_path: v = None
# username is unique so at most this returns one result. Otherwise 404

View File

@ -9,7 +9,12 @@
{% endif %}
</script>
{% if v %}
{% set title=p.realtitle(v) %}
{% else %}
{% set title=p.title %}
{% endif %}
{% set ups=p.upvotes_fuzzed %}
{% set downs=p.downvotes_fuzzed %}
{% set score=ups-downs %}
@ -58,7 +63,7 @@
<meta property="og:article:author" content="{{'@'+p.author.username}}" />
<meta property="article:published_time" content="{{p.created_iso}}" />
{% if p.edited_utc %}<meta property="article:modified_time" content="{{p.edited_string}}" />{% endif %}
<meta property="og:description" name="description" content="{{p.body}}" />
<meta property="og:description" name="description" content="{{p.realbody(V)}}" />
<meta property="og:author" name="author" content="{{'@'+p.author.username}}" />
<meta property="og:title" content="{{title}} - {{"SITE_NAME" | app_config}}" />
<meta property="og:image" content="{% if p.is_image %}{{p.realurl(v)}}{% elif p.has_thumb%}{{p.thumb_url}}{% else %}{{'/assets/images/preview.png' | full_link}}{% endif %}" />
@ -69,7 +74,7 @@
<meta name="twitter:site" content="{{request.host_url}}">
<meta name="twitter:title" content="{{title}} - {{"SITE_NAME" | app_config}}" />
<meta name="twitter:creator" content="{{'@'+p.author.username}}">
<meta name="twitter:description" content="{{p.body}}" />
<meta name="twitter:description" content="{{p.realbody(v)}}" />
<meta name="twitter:image" content="{% if p.is_image %}{{p.realurl(v)}}{% elif p.has_thumb %}{{p.thumb_url}}{% else %}{{'/assets/images/preview.png' | full_link}}{% endif %}" />
<meta name="twitter:url" content="{{p.permalink | full_link}}" />

View File

@ -10,7 +10,7 @@
{% endif %}
{% block title %}
<title>{{p.title}}</title>
<title>{{p.realtitle(v)}}</title>
{% if p.is_banned %}
<meta name="description" content="[removed by admins]">
{% else %}
@ -55,7 +55,7 @@
<div id="post-{{p.id}}" class="card d-flex flex-row-reverse flex-nowrap justify-content-end border-0 p-0 {% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}">
<div class="card-block my-md-auto{% if p.is_banned %} banned{% endif %}">
<div class="post-meta text-left d-block d-md-none mb-1">{% if p.over_18 %}<span class="badge badge-danger">+18</span> {% endif %}{% if p.is_banned %}[Removed by admins]{% else %}[Deleted by user]{% endif %}</div>
<h5 class="card-title post-title text-left mb-0 mb-md-1">{{p.title}}</h5>
<h5 class="card-title post-title text-left mb-0 mb-md-1">{{p.realtitle(v)}}</h5>
<div class="post-meta text-left d-none d-md-block">{% if p.over_18 %}<span class="badge badge-danger">+18</span> {% endif %}{% if p.is_banned %}[Removed by admins]{% else %}[Deleted by user]{% endif %}</div>
</div>