From a60bc5e57834d6267488a385a787e153bd6c5452 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 19 Jan 2022 14:21:20 +0200 Subject: [PATCH] sfsf --- files/routes/posts.py | 20 ++++++++++---------- files/routes/users.py | 2 +- files/templates/authforms.html | 4 ++-- files/templates/default.html | 4 ++-- files/templates/log.html | 4 ++-- files/templates/login.html | 2 +- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 2 +- files/templates/settings2.html | 4 ++-- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 4 ++-- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 5cb5f05968..9d118fdc2f 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1055,21 +1055,21 @@ def submit_post(v): 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) - url_regex = '([^\"]+)' - for url_match in re.finditer(url_regex, new_post.body_html, flags=re.M|re.I): + url_regex = '(.+)<\/a>' + for url_match in re.finditer(url_regex, new_post.body_html): href = url_match.group(3) if not href: continue title = url_match.group(5) - if "Snapshots:\n\n" not in body: body += "Snapshots:\n\n" + if "Snapshots:\n\n" not in body: body += "Snapshots:\n\n" - if f'**[{title}]({href})**:\n\n' in body: continue - body += f'**[{title}]({href})**:\n\n' - if href.startswith('https://old.reddit.com/'): - body += f'* [unddit.com](https://unddit.com/{href.replace("https://old.reddit.com/", "")})\n' - body += f'* [archive.org](https://web.archive.org/{href})\n' - body += f'* [archive.ph](https://archive.ph/?url={quote(href)}&run=1) (click to archive)\n\n' - gevent.spawn(archiveorg, href) + if f'**[{title}]({href})**:\n\n' not in body: + body += f'**[{title}]({href})**:\n\n' + if href.startswith('https://old.reddit.com/'): + body += f'* [unddit.com](https://unddit.com/{href.replace("https://old.reddit.com/", "")})\n' + body += f'* [archive.org](https://web.archive.org/{href})\n' + body += f'* [archive.ph](https://archive.ph/?url={quote(href)}&run=1) (click to archive)\n\n' + gevent.spawn(archiveorg, href) body_html = sanitize(body) diff --git a/files/routes/users.py b/files/routes/users.py index b54e39f29c..e6100f3aa4 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -361,7 +361,7 @@ def leaderboard(v): sq = g.db.query(Badge.user_id, func.count(Badge.user_id).label("count"), func.rank().over(order_by=func.count(Badge.user_id).desc()).label("rank")).group_by(Badge.user_id).subquery() users11 = g.db.query(User, sq.c.count).join(sq, User.id==sq.c.user_id).order_by(sq.c.count.desc()).limit(25).all() - pos11 = g.db.query(User, sq.c.rank, sq.c.count).join(sq, User.id==sq.c.user_id).filter(User.id == v.id).one() + pos11 = g.db.query(User.id, sq.c.rank, sq.c.count).join(sq, User.id==sq.c.user_id).filter(User.id == v.id).one() pos11 = (pos11[1],pos11[2]) try: diff --git a/files/templates/authforms.html b/files/templates/authforms.html index b18af15593..9216802092 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,7 +15,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index 485d632761..b83a0e5dce 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -7,7 +7,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} diff --git a/files/templates/log.html b/files/templates/log.html index ad83ccaec6..84841813e0 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -6,7 +6,7 @@ {% block content %} {% if v %} - + {% if v.agendaposter %} - + {% endif %}
diff --git a/files/templates/login.html b/files/templates/login.html index 85a542ae50..7063169ddc 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -18,7 +18,7 @@ {% endblock %} - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 2566e12049..9ba4654a1a 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -14,7 +14,7 @@ 2-Step Login - {{SITE_NAME}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index a305dc4890..1a30655c4e 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -34,7 +34,7 @@ - + {% if v.agendaposter %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index e36a73d77f..b927f57529 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %} - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index f9dbacf173..04855c638f 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -32,7 +32,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %} - + diff --git a/files/templates/submit.html b/files/templates/submit.html index e31e088329..d02d803db1 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -26,7 +26,7 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %} - + {% endif %} {% endblock %}