sfsf
This commit is contained in:
parent
c356caa3a8
commit
b5f1e08ec6
13 changed files with 27 additions and 60 deletions
File diff suppressed because one or more lines are too long
|
@ -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 = '<a (target=\"_blank\" )?(rel=\"nofollow noopener noreferrer\" )?href=\"(https?://[a-z]{1,20}\.[^\"]+)\"( rel=\"nofollow noopener noreferrer\" target=\"_blank\")?>([^\"]+)</a>'
|
||||
for url_match in re.finditer(url_regex, new_post.body_html, flags=re.M|re.I):
|
||||
url_regex = '<a href=\"(https?:\/\/[a-z]{1,20}\.[^\"]+)\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">(.+)<\/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)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -39,7 +39,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
{% endif %}
|
||||
|
||||
</head>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<script src="/static/assets/js/bootstrap.js?a=202"></script>
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
|
@ -32,7 +32,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
{% endif %}
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% block content %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -30,7 +30,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
{% endif %}
|
||||
|
||||
<div class="row justify-content-around">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{% endblock %}
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
|
||||
</head>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<title>2-Step Login - {{SITE_NAME}}</title>
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
{% endif %}
|
||||
</head>
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title>
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
{% block stylesheets %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=13">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -50,7 +50,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=91">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=92">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=13">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue