master
Aevann1 2022-01-24 19:37:37 +02:00
parent b094e976dc
commit 25d9419388
19 changed files with 42 additions and 42 deletions

View File

@ -20,7 +20,7 @@ def process_image(file=None, filename=None, resize=0):
exif[k] = None
del exif[k]
i.info["exif"] = exif.tobytes()
transposed = ImageOps.exif_transpose(i)
i = ImageOps.exif_transpose(i)
if resize:
size = resize, resize

View File

@ -382,7 +382,7 @@ def award_post(pid, v):
g.db.commit()
if request.referrer and len(request.referrer) > 1:
if request.referrer == f'{request.host_url}submit': return redirect(post.permalink)
if request.referrer == f'{SITE_FULL}/submit': return redirect(post.permalink)
elif request.host in request.referrer: return redirect(request.referrer)
return redirect("/")

View File

@ -507,8 +507,8 @@ def api_comment(v):
'notification': {
'title': f'New reply by @{c.author_name}',
'body': notifbody,
'deep_link': f'{request.host_url}comment/{c.id}?context=9&read=true#context',
'icon': f'{request.host_url}assets/images/{SITE_NAME}/icon.webp',
'deep_link': f'{SITE_FULL}/comment/{c.id}?context=9&read=true#context',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp',
}
},
'fcm': {

View File

@ -61,5 +61,5 @@ def error_500(e):
def allow_nsfw():
session["over_18"] = int(time.time()) + 3600
redir = request.values.get("redir")
if redir and redir.startswith(request.host_url) or redir.startswith('/'): return redirect(redir)
if redir and redir.startswith(SITE_FULL) or redir.startswith('/'): return redirect(redir)
return redirect('/')

View File

@ -53,7 +53,7 @@ def feeds_user(v=None, sort='hot', t='all'):
with tag("name"):
text(post.author_name)
with tag("uri"):
text(f'{request.host_url}@{post.author_name}')
text(f'{SITE_FULL}/@{post.author_name}')
doc.stag("link", href=full_link(post.permalink))

View File

@ -15,7 +15,7 @@ def login_get(v):
redir = request.values.get("redirect")
if redir:
redir = redir.replace("/logged_out", "").strip()
if not redir.startswith(request.host_url) and not redir.startswith('/'): redir = None
if not redir.startswith(SITE_FULL) and not redir.startswith('/'): redir = None
if v and redir: return redirect(redir)
@ -143,7 +143,7 @@ def login_post():
redir = request.values.get("redirect")
if redir:
redir = redir.replace("/logged_out", "").strip()
if not redir.startswith(request.host_url) and not redir.startswith('/'): redir = '/'
if not redir.startswith(SITE_FULL) and not redir.startswith('/'): redir = '/'
return redirect(redir)
@ -366,7 +366,7 @@ def post_forgot():
if user:
now = int(time.time())
token = generate_hash(f"{user.id}+{now}+forgot+{user.login_nonce}")
url = f"{request.host_url}reset?id={user.id}&time={now}&token={token}"
url = f"{SITE_FULL}/reset?id={user.id}&time={now}&token={token}"
send_mail(to_address=user.email,
subject="Password Reset Request",
@ -489,7 +489,7 @@ def request_2fa_disable():
valid=int(time.time())
token=generate_hash(f"{user.id}+{user.username}+disable2fa+{valid}+{user.mfa_secret}+{user.login_nonce}")
action_url=f"{request.host_url}reset_2fa?id={user.id}&t={valid}&token={token}"
action_url=f"{SITE_FULL}/reset_2fa?id={user.id}&t={valid}&token={token}"
send_mail(to_address=user.email,
subject="2FA Removal Request",

View File

@ -78,7 +78,7 @@ def publish(pid, v):
cache.delete_memoized(User.userpagelisting)
if v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()):
send_discord_message(f"{request.host_url}{post.permalink[1:]}")
send_discord_message(f"{SITE_FULL}{post.permalink}")
cache.delete_memoized(changeloglist)
g.db.commit()
@ -557,7 +557,7 @@ def thumbnail_thread(pid):
fetch_url = post.url
if fetch_url.startswith('/'): fetch_url = f"{request.host_url}{fetch_url[1:]}"
if fetch_url.startswith('/'): fetch_url = f"{SITE_FULL}{fetch_url}"
headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"}
@ -1023,7 +1023,7 @@ def submit_post(v):
rev = f"* [unddit.com](https://unddit.com/{rev})\n"
else: rev = ''
newposturl = new_post.url
if newposturl.startswith('/'): newposturl = f"{request.host_url}{newposturl[1:]}"
if newposturl.startswith('/'): newposturl = f"{SITE_FULL}{newposturl}"
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)
@ -1076,7 +1076,7 @@ def submit_post(v):
cache.delete_memoized(frontlist)
cache.delete_memoized(User.userpagelisting)
if v.admin_level > 0 and ("[changelog]" in new_post.title.lower() or "(changelog)" in new_post.title.lower()) and not new_post.private:
send_discord_message(f"{request.host_url}{new_post.permalink[1:]}")
send_discord_message(f"{SITE_FULL}{new_post.permalink}")
cache.delete_memoized(changeloglist)
if v.id in (PIZZASHILL_ID, HIL_ID):

View File

@ -537,7 +537,7 @@ def settings_security_post(v):
if new_email == v.email:
return render_template("settings_security.html", v=v, error="That email is already yours!")
url = f"{request.host_url}activate"
url = f"{SITE_FULL}/activate"
now = int(time.time())

View File

@ -473,8 +473,8 @@ def message2(v, username):
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
'deep_link': f'{request.host_url}notifications?messages=true',
'icon': f'{request.host_url}assets/images/{SITE_NAME}/icon.webp',
'deep_link': f'{SITE_FULL}/notifications?messages=true',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp',
}
},
'fcm': {
@ -540,8 +540,8 @@ def messagereply(v):
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
'deep_link': f'{request.host_url}notifications?messages=true',
'icon': f'{request.host_url}assets/images/{SITE_NAME}/icon.webp',
'deep_link': f'{SITE_FULL}/notifications?messages=true',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp',
}
},
'fcm': {

View File

@ -50,13 +50,13 @@
<meta property="og:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta property="og:url" content="{{request.path | full_link}}">
<meta property="og:description" name="description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}">
<meta property="og:author" name="author" content="@{{request.host_url}}" >
<meta property="og:author" name="author" content="@{{SITE_FULL}}/" >
<meta property="og:site_name" content="{{request.host}}" >
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@{{request.host_url}}">
<meta name="twitter:site" content="@{{SITE_FULL}}/">
<meta name="twitter:title" content="{{SITE_NAME}}" >
<meta name="twitter:creator" content="@{{request.host_url}}">
<meta name="twitter:creator" content="@{{SITE_FULL}}/">
<meta name="twitter:description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}" >
<meta name="twitter:image" content="/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta name="twitter:url" content="{{request.path | full_link}}" >

View File

@ -48,8 +48,8 @@ You can use Markdown formatting:
</tr>
<tr>
<td>Links</td>
<td>[{{SITE_NAME}}]({{request.host_url}})</td>
<td><a href="{{request.host_url}}">{{SITE_NAME}}</a></td>
<td>[{{SITE_NAME}}]({{SITE_FULL}}/)</td>
<td><a href="{{SITE_FULL}}/">{{SITE_NAME}}</a></td>
</tr>
<tr>
<td>Images</td>

View File

@ -7,7 +7,7 @@
<script>
function fp(fp) {
const xhr = new XMLHttpRequest();
xhr.open("POST", '{{request.host_url}}fp/'+fp, true);
xhr.open("POST", '{{SITE_FULL}}/fp/'+fp, true);
xhr.setRequestHeader('xhr', 'xhr');
var form = new FormData()
form.append("formkey", formkey());

View File

@ -21,13 +21,13 @@
<meta property="og:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta property="og:url" content="{{request.host}}">
<meta property="og:description" name="description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}">
<meta property="og:author" name="author" content="@{{request.host_url}}" >
<meta property="og:author" name="author" content="@{{SITE_FULL}}/" >
<meta property="og:site_name" content="{{request.host}}" >
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@{{request.host_url}}">
<meta name="twitter:site" content="@{{SITE_FULL}}/">
<meta name="twitter:title" content="{{SITE_NAME}}" >
<meta name="twitter:creator" content="@{{request.host_url}}">
<meta name="twitter:creator" content="@{{SITE_FULL}}/">
<meta name="twitter:description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}" >
<meta name="twitter:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta name="twitter:url" content="{{request.host}}" >

View File

@ -21,13 +21,13 @@
<meta property="og:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta property="og:url" content="{{request.path | full_link}}">
<meta property="og:description" name="description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}">
<meta property="og:author" name="author" content="{{request.host_url}}" >
<meta property="og:author" name="author" content="{{SITE_FULL}}/" >
<meta property="og:site_name" content="{{request.host}}" >
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="{{request.host_url}}">
<meta name="twitter:site" content="{{SITE_FULL}}/">
<meta name="twitter:title" content="{{SITE_NAME}}" >
<meta name="twitter:creator" content="{{request.host_url}}">
<meta name="twitter:creator" content="{{SITE_FULL}}/">
<meta name="twitter:description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}" >
<meta name="twitter:image" content="/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta name="twitter:url" content="{{request.path | full_link}}" >

View File

@ -258,7 +258,7 @@
<div class="input-group">
<input autocomplete="off" type="text" readonly="" class="form-control copy-link" id="referral_code" value="{{request.host_url}}signup?ref={{v.username}}" data-clipboard-text="{{request.host_url}}signup?ref={{v.username}}">
<input autocomplete="off" type="text" readonly="" class="form-control copy-link" id="referral_code" value="{{SITE_FULL}}/signup?ref={{v.username}}" data-clipboard-text="{{SITE_FULL}}/signup?ref={{v.username}}">
<span class="input-group-append" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="You have referred {{v.referral_count}} user{{'s' if v.referral_count != 1 else ''}} so far. {% if v.referral_count==0 %}¯\_(ツ)_/¯{% elif v.referral_count>10%}Wow!{% endif %}">
<span class="input-group-text text-primary border-0">

View File

@ -17,13 +17,13 @@
<meta property="og:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta property="og:url" content="{{request.host}}">
<meta property="og:description" name="description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}">
<meta property="og:author" name="author" content="{{request.host_url}}" >
<meta property="og:author" name="author" content="{{SITE_FULL}}/" >
<meta property="og:site_name" content="{{request.host}}" >
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="{{request.host_url}}">
<meta name="twitter:site" content="{{SITE_FULL}}/">
<meta name="twitter:title" content="{{SITE_NAME}}" >
<meta name="twitter:creator" content="{{request.host_url}}">
<meta name="twitter:creator" content="{{SITE_FULL}}/">
<meta name="twitter:description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}" >
<meta name="twitter:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta name="twitter:url" content="{{request.host}}" >

View File

@ -18,13 +18,13 @@
<meta property="og:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta property="og:url" content="{{request.host}}">
<meta property="og:description" name="description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}">
<meta property="og:author" name="author" content="{{request.host_url}}" >
<meta property="og:author" name="author" content="{{SITE_FULL}}/" >
<meta property="og:site_name" content="{{request.host}}" >
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="{{request.host_url}}">
<meta name="twitter:site" content="{{SITE_FULL}}/">
<meta name="twitter:title" content="{{SITE_NAME}}" >
<meta name="twitter:creator" content="{{request.host_url}}">
<meta name="twitter:creator" content="{{SITE_FULL}}/">
<meta name="twitter:description" content="{{SITE_NAME}} - {{'SLOGAN' | app_config}}" >
<meta name="twitter:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta name="twitter:url" content="{{request.host}}" >
@ -65,7 +65,7 @@
<h1 class="h4 font-weight-normal text-center">Whoops! You can't refer yourself!</h1>
<p class="text-center text-muted mb-md-5">Send this link to a friend instead :)</p>
<label>Referral code</label>
<input autocomplete="off" type="text" class="form-control copy-link" readonly value="{{request.host_url}}signup?ref={{request.values.get('ref')}}" data-clipboard-text="{{request.host_url}}signup?ref={{request.values.get('ref')}}">
<input autocomplete="off" type="text" class="form-control copy-link" readonly value="{{SITE_FULL}}/signup?ref={{request.values.get('ref')}}" data-clipboard-text="{{SITE_FULL}}/signup?ref={{request.values.get('ref')}}">
<div class="text-center mt-5 mb-3">
Already have an account? <a href="/login" class="font-weight-bold text-small toggle-login">Log in.</a>

View File

@ -229,7 +229,7 @@
<meta property="og:site_name" content="{{request.host}}" >
<meta name="twitter:card" content="summary" >
<meta name="twitter:site" content="{{request.host_url}}">
<meta name="twitter:site" content="{{SITE_FULL}}/">
<meta name="twitter:title" content="{{'@'+comment_info.author_name}} comments on {{p.plaintitle(v)}} - {{SITE_NAME}}" >
<meta name="twitter:creator" content="{{'@'+comment_info.author_name}}">
<meta name="twitter:description" content="{{comment_info.plainbody(v)}}" >
@ -254,7 +254,7 @@
<meta property="og:site_name" content="{{request.host}}" >
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="{{request.host_url}}">
<meta name="twitter:site" content="{{SITE_FULL}}/">
<meta name="twitter:title" content="{{p.plaintitle(v)}} - {{SITE_NAME}}" >
{% if p.author %}<meta name="twitter:creator" content="{{'@'+p.author_name}}">{% endif %}
<meta name="twitter:description" content="{{p.plainbody(v)}}" >

View File

@ -21,7 +21,7 @@
<meta property="og:site_name" content="{{request.host}}" >
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="{{request.host_url}}">
<meta name="twitter:site" content="{{SITE_FULL}}/">
<meta name="twitter:title" content="{{u.username}}'s profile - {{SITE_NAME}}" >
<meta name="twitter:creator" content="@{{u.username}}">
<meta name="twitter:description" content="{{u.coins}} coins - Joined {{u.created_date}} - {% if u.stored_subscriber_count >=1 and not u.is_private and not u.is_nofollow %}{{u.stored_subscriber_count}} Followers -{% endif %} {% if not u.is_private %} {{0 if u.shadowbanned else u.post_count}} Posts - {{0 if u.shadowbanned else u.comment_count}} Comments - {% endif %}{{u.bio}}">