From 90c81291285d9c0cb6f10223d65fd72f95a1d7bf Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 5 Aug 2021 19:31:44 +0200 Subject: [PATCH] fdfd --- files/routes/posts.py | 18 ++- files/templates/authforms.html | 4 +- files/templates/comment_failed.html | 9 -- files/templates/embeds/comment.html | 130 ++++++++++++++++++ files/templates/embeds/embed_default.html | 104 ++++++++++++++ .../{site_embeds => embeds}/instagram.html | 0 files/templates/embeds/post.html | 21 +++ .../{site_embeds => embeds}/twitter.html | 0 .../{site_embeds => embeds}/twitterlight.html | 0 .../{site_embeds => embeds}/youtube.html | 0 files/templates/sign_up_failed_ref.html | 2 +- files/templates/submission.html | 8 +- 12 files changed, 279 insertions(+), 17 deletions(-) create mode 100644 files/templates/embeds/comment.html create mode 100644 files/templates/embeds/embed_default.html rename files/templates/{site_embeds => embeds}/instagram.html (100%) create mode 100644 files/templates/embeds/post.html rename files/templates/{site_embeds => embeds}/twitter.html (100%) rename files/templates/{site_embeds => embeds}/twitterlight.html (100%) rename files/templates/{site_embeds => embeds}/youtube.html (100%) diff --git a/files/routes/posts.py b/files/routes/posts.py index 4080c0a28..bce0f5bb5 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -507,6 +507,22 @@ def archiveorg(url): except Exception as e: print(e) +@app.route("/embed/post/", methods=["GET"]) +def embed_post_pid(pid): + + post = get_post(pid) + + return render_template("embeds/post.html", p=post) + + +@app.route("/embed/comment/", methods=["GET"]) +def embed_comment_cid(cid, pid=None): + + comment = get_comment(cid) + + return render_template("embeds/comment.html", c=comment) + + @app.post("/submit") @limiter.limit("6/minute") @is_not_banned @@ -789,7 +805,7 @@ def submit_post(v): url = url.replace("https://mobile.twitter.com", "https://twitter.com") - if url.startswith("https://old.reddit.com/") and '/comments/' in url and '?sort=' not in url: url += "?sort=controversial" + # if url.startswith("https://old.reddit.com/") and '/comments/' in url and '?' not in url: url += "?sort=controversial" title_html = sanitize(title, linkgen=True, flair=True) diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 0bc0c834c..3a19f3da5 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -5,10 +5,10 @@ - + - {% block pagetitle %}{{"SITE_NAME" | app_config}} - the open, free-speech social platform{% endblock %} + {% block pagetitle %}{{"SITE_NAME" | app_config}}{% endblock %} diff --git a/files/templates/comment_failed.html b/files/templates/comment_failed.html index ebeb3beb6..f702d692f 100644 --- a/files/templates/comment_failed.html +++ b/files/templates/comment_failed.html @@ -9,15 +9,6 @@ {% block content %}
-

Whoops!

-

Although {{"SITE_NAME" | app_config}} puts your freedom of speech first, there are a few things that we don't allow here:

-
    -
  • Digitally malicious content
  • -
  • URL shorteners
  • -
  • Copyright infringement
  • -
  • Spam
  • -
-

Please remove the following link(s) from your comment, and then you will be able to post it:

    diff --git a/files/templates/embeds/comment.html b/files/templates/embeds/comment.html new file mode 100644 index 000000000..3f3ee2897 --- /dev/null +++ b/files/templates/embeds/comment.html @@ -0,0 +1,130 @@ +{% extends "embeds/embed_default.html" %} + +{% set score=c.score_fuzzed %} + +{% block title %} +@{{ c.author.username }} comments in +{{ c.board.name }} on "{{ c.post.title }}" + +{% endblock %} + + +{% block content %} + + +
    + + + + + +
    + +
    + + + +
    + {{ c.body_html | safe }} +
    + + +
    +
      + + + +
    • +
    • + + +
    • + {{ score }}
    • + +{% if not c.board.downvotes_disabled %} + + + +
    • +
    • + +{% endif %} +
    • Copy link +
    • +
    • + +
    • +
    • + +
    • + +
    • +
    • +
    • +{{ score }} +
    • + +
    • +
    • +
    + +
    +
    + + + + + +
    +{% endblock %} \ No newline at end of file diff --git a/files/templates/embeds/embed_default.html b/files/templates/embeds/embed_default.html new file mode 100644 index 000000000..c1dfb278a --- /dev/null +++ b/files/templates/embeds/embed_default.html @@ -0,0 +1,104 @@ + + + + + + + + + + {% block title %} + {% endblock %} + + + + + + {% block stylesheets %} + + {% endblock %} + + + + + + + + + + + +
    +
    + +
    + + + {% block content %} + {% endblock %} + + +
    + + + + + + + + +{% include "bootstrap.html" %} + + + + + + + + + + + +{% block enlargeThumbJS %} +{% endblock %} + +{% block toggleView %} +{% endblock %} + +{% block embedJS %} +{% endblock %} + +{% block formatJS %} +{% endblock %} + + + + + + + \ No newline at end of file diff --git a/files/templates/site_embeds/instagram.html b/files/templates/embeds/instagram.html similarity index 100% rename from files/templates/site_embeds/instagram.html rename to files/templates/embeds/instagram.html diff --git a/files/templates/embeds/post.html b/files/templates/embeds/post.html new file mode 100644 index 000000000..6373e6db3 --- /dev/null +++ b/files/templates/embeds/post.html @@ -0,0 +1,21 @@ +{% extends "embeds/embed_default.html" %} + +{% block title %} +{{ p.title | safe}} + +{% endblock %} + +{% block pagetype %}thread{% endblock %} + + +{% block content %} +
    +
    +
    + {% with listing = [p] %} + {% include "submission_listing.html" %} + {% endwith %} +
    +
    +
    +{% endblock %} \ No newline at end of file diff --git a/files/templates/site_embeds/twitter.html b/files/templates/embeds/twitter.html similarity index 100% rename from files/templates/site_embeds/twitter.html rename to files/templates/embeds/twitter.html diff --git a/files/templates/site_embeds/twitterlight.html b/files/templates/embeds/twitterlight.html similarity index 100% rename from files/templates/site_embeds/twitterlight.html rename to files/templates/embeds/twitterlight.html diff --git a/files/templates/site_embeds/youtube.html b/files/templates/embeds/youtube.html similarity index 100% rename from files/templates/site_embeds/youtube.html rename to files/templates/embeds/youtube.html diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index d6dc03ffa..30ed96098 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -25,7 +25,7 @@ - {% if ref_user %}{{ref_user.username}} invites you to {{"SITE_NAME" | app_config}}{% else %}{{"SITE_NAME" | app_config}}: the open, free-speech social platform{% endif %} + {% if ref_user %}{{ref_user.username}} invites you to {{"SITE_NAME" | app_config}}{% else %}{{"SITE_NAME" | app_config}}{% endif %} diff --git a/files/templates/submission.html b/files/templates/submission.html index d5960343c..a53406c59 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -267,13 +267,13 @@ {{p.realbody(v) | safe}} {% if p.domain == "twitter.com" and (v and v.theme.split("_")[0] in ["light", "coffee", "4chan"]) %} - {% include "site_embeds/twitterlight.html" %} + {% include "embeds/twitterlight.html" %} {% elif "twitter.com" in p.domain %} - {% include "site_embeds/twitter.html" %} + {% include "embeds/twitter.html" %} {% elif "youtu" in p.domain %} - {% include "site_embeds/youtube.html" %} + {% include "embeds/youtube.html" %} {% elif "instagram.com" in p.domain %} - {% include "site_embeds/instagram.html" %} + {% include "embeds/instagram.html" %} {% endif %}