publish fix
This commit is contained in:
parent
57f3edd1cc
commit
de96579808
19 changed files with 41 additions and 40 deletions
|
@ -137,7 +137,7 @@ a {
|
|||
}
|
||||
|
||||
/*post*/
|
||||
.post-meta, .post-actions a, .nav-link .fas, label, small, .comment-actions * {
|
||||
.post-meta, .post-actions a, .post-actions button, .nav-link .fas, label, small, .comment-actions * {
|
||||
color: var(--black1) !important;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ body, .card, #main-content-row {
|
|||
}
|
||||
|
||||
/*post*/
|
||||
.post-meta, .post-actions a, .nav-link .fas, label, small, .comment-actions * {
|
||||
.post-meta, .post-actions a, .post-actions button, .nav-link .fas, label, small, .comment-actions * {
|
||||
color: var(--grey) !important;
|
||||
}
|
||||
|
||||
|
|
|
@ -3340,7 +3340,7 @@ small, .small {
|
|||
.modal .post-actions .list-group-item:focus, .modal .post-actions .list-group-item:hover {
|
||||
background-color: var(--gray-300);
|
||||
}
|
||||
.modal .post-actions a {
|
||||
.modal .post-actions a, .post-actions button {
|
||||
color: var(--black);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
@ -3368,7 +3368,7 @@ small, .small {
|
|||
.post-actions .dropdown-item:hover .fa, .post-actions .dropdown-item:hover .fas {
|
||||
color: var(--gray);
|
||||
}
|
||||
.post-actions a:hover .fa, .post-actions a:hover .fas {
|
||||
.post-actions a, .post-actions button:hover .fa, .post-actions a, .post-actions button:hover .fas {
|
||||
color: var(--black);
|
||||
}
|
||||
.post-actions:hover, .post-actions:focus {
|
||||
|
@ -3474,12 +3474,12 @@ small, .small {
|
|||
.post-actions .list-inline .list-inline-item .dropdown-item:active {
|
||||
color: var(--white);
|
||||
}
|
||||
.post-actions a {
|
||||
.post-actions a, .post-actions button {
|
||||
color: var(--gray-100);
|
||||
text-decoration: none;
|
||||
text-transform: none;
|
||||
}
|
||||
.post-actions a:hover {
|
||||
.post-actions a, .post-actions button:hover {
|
||||
color: var(--black);
|
||||
}
|
||||
.post-actions .dropdown-item:hover {
|
||||
|
@ -4128,7 +4128,7 @@ pre .com, code .com {
|
|||
.post-actions {
|
||||
font-weight: 400;
|
||||
}
|
||||
.post-actions a {
|
||||
.post-actions a, .post-actions button {
|
||||
font-size: 1rem;
|
||||
color: var(--gray-200);
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ blockquote {
|
|||
color: #5c5c5c !important;
|
||||
}
|
||||
|
||||
.post-actions a {
|
||||
.post-actions a, .post-actions button {
|
||||
color: var(--muted) !important;
|
||||
}
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ class Comment(Base):
|
|||
if v.teddit: body = body.replace("old.reddit.com", "teddit.net")
|
||||
elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
|
||||
|
||||
if v.nitter and not '/i/' in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
||||
if v.nitter and not '/i/' in body and '/retweets' not in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
||||
|
||||
if v and v.controversial:
|
||||
captured = []
|
||||
|
|
|
@ -354,7 +354,7 @@ class Submission(Base):
|
|||
if v.controversial: url += "&sort=controversial"
|
||||
return url
|
||||
elif self.url:
|
||||
if v and v.nitter and not '/i/' in self.url: return self.url.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
||||
if v and v.nitter and '/i/' not in self.url and '/retweets' not in self.url: return self.url.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
||||
if self.url.startswith('/'): return SITE_FULL + self.url
|
||||
return self.url
|
||||
else: return ""
|
||||
|
@ -370,7 +370,7 @@ class Submission(Base):
|
|||
if v.teddit: body = body.replace("old.reddit.com", "teddit.net")
|
||||
elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
|
||||
|
||||
if v.nitter and not '/i/' in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
||||
if v.nitter and '/i/' not in body and '/retweets' not in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
||||
|
||||
if v and v.shadowbanned and v.id == self.author_id and 86400 > time.time() - self.created_utc > 20:
|
||||
ti = max(int((time.time() - self.created_utc)/60), 1)
|
||||
|
@ -436,7 +436,7 @@ class Submission(Base):
|
|||
if v.teddit: body = body.replace("old.reddit.com", "teddit.net")
|
||||
elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
|
||||
|
||||
if v.nitter and not '/i/' in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
||||
if v.nitter and '/i/' not in body and '/retweets' not in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
|
||||
|
||||
return body
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
sanitized = re.sub(f'(?<!"):{i.group(1).lower()}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{old}:" title=":{old}:" class="{classes}" src="/e/{emoji}.webp">', sanitized, flags=re.I|re.A)
|
||||
if comment: marseys_used.add(emoji)
|
||||
|
||||
sanitized = sanitized.replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").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").replace("https://www.youtube", "https://youtube")
|
||||
sanitized = sanitized.replace("nitter.net", "twitter.com").replace("old.reddit.com/gallery", "reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").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").replace("https://www.youtube", "https://youtube").replace("https://www.twitter", "https://twitter")
|
||||
|
||||
if "https://youtube.com/watch?v=" in sanitized: sanitized = sanitized.replace("?t=", "&t=")
|
||||
|
||||
|
@ -302,8 +302,6 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
for rd in ["://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it"]:
|
||||
sanitized = sanitized.replace(rd, "://old.reddit.com")
|
||||
|
||||
sanitized = sanitized.replace("old.reddit.com/gallery", "reddit.com/gallery")
|
||||
|
||||
|
||||
sanitized = unlinked_regex.sub(r'\1<a href="\2" rel="nofollow noopener noreferrer" target="_blank">\2</a>', sanitized)
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ def publish(pid, v):
|
|||
|
||||
g.db.commit()
|
||||
|
||||
return redirect(p.permalink)
|
||||
return redirect(post.permalink)
|
||||
|
||||
@app.get("/submit")
|
||||
@app.get("/h/<sub>/submit")
|
||||
|
@ -839,6 +839,8 @@ def submit_post(v, sub=None):
|
|||
embed = None
|
||||
|
||||
if url:
|
||||
url = url.replace("nitter.net", "twitter.com").replace("old.reddit.com/gallery", "reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").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").replace("https://www.youtube", "https://youtube").replace("https://www.twitter", "https://twitter")
|
||||
|
||||
if "/i.imgur.com/" in url: url = url.replace(".png", ".webp").replace(".jpg", ".webp").replace(".jpeg", ".webp")
|
||||
elif "/media.giphy.com/" in url or "/c.tenor.com/" in url: url = url.replace(".gif", ".webp")
|
||||
elif "/i.ibb.com/" in url: url = url.replace(".png", ".webp").replace(".jpg", ".webp").replace(".jpeg", ".webp").replace(".gif", ".webp")
|
||||
|
@ -846,8 +848,6 @@ def submit_post(v, sub=None):
|
|||
for rd in ("://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it", "://teddit.net"):
|
||||
url = url.replace(rd, "://old.reddit.com")
|
||||
|
||||
url = url.replace("nitter.net", "twitter.com").replace("old.reddit.com/gallery", "reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").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").replace("https://www.youtube", "https://youtube")
|
||||
|
||||
if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"): url = url.replace("https://streamable.com/", "https://streamable.com/e/")
|
||||
|
||||
parsed_url = urlparse(url)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -39,7 +39,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
{% endif %}
|
||||
|
||||
</head>
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<script src="/static/assets/js/bootstrap.js?v=245"></script>
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -32,8 +32,8 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
{% endif %}
|
||||
|
||||
{% if sub and sub.css and not request.path.endswith('settings') %}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% block content %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -30,7 +30,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
{% endif %}
|
||||
|
||||
<div class="row justify-content-around">
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
{% endblock %}
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<title>2-Step Login - {{SITE_NAME}}</title>
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
|
||||
{% if not p.ghost %}<a class="list-inline-item" href="/votes?link={{p.fullname}}"><i class="fas fa-arrows-v"></i>Votes</a>{% endif %}
|
||||
|
||||
{% if v and v.id==p.author_id %}
|
||||
{% if p.private %}
|
||||
<a class="list-inline-item" href='/publish/{{p.id}}'><i class="fas fa-globe"></i>Publish</a>
|
||||
<form action="/publish/{{p.id}}" method="post">
|
||||
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
||||
<button class="list-inline-item text-small p-0 m-0 mr-3 border-0 nobackground font-weight-bold" type="submit"><i class="fas fa-globe"></i>Publish</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if not p.ghost %}<a class="list-inline-item" href="/votes?link={{p.fullname}}"><i class="fas fa-arrows-v"></i>Votes</a>{% endif %}
|
||||
|
||||
{% if v %}
|
||||
<a class="list-inline-item text-muted d-none d-md-inline-block" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" onclick="awardModal('/award_post/{{p.id}}')"><i class="fas fa-gift fa-fw"></i>Give Award</a>
|
||||
{% endif %}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% 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?v=178"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
{% 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:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
|
||||
</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:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
{% block stylesheets %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -50,8 +50,8 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=178">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=29">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=179">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue