remotes/1693045480750635534/spooky-22
Aevann1 2022-01-28 23:42:09 +02:00
parent ba56444e37
commit c7bab4ec6c
8 changed files with 19 additions and 34 deletions

View File

@ -61,7 +61,7 @@ class Badge(Base):
@property
@lazy
def path(self):
return f"/static/assets/images/badges/{self.badge_id}.webp?a=1008"
return f"{SITE_FULL}/static/assets/images/badges/{self.badge_id}.webp?a=1008"
@property
@lazy
@ -69,5 +69,5 @@ class Badge(Base):
return {'text': self.text,
'name': self.name,
'url': self.url,
'icon_url':f"{SITE_FULL}{self.path}"
'icon_url':self.path
}

View File

@ -237,22 +237,12 @@ class Submission(Base):
def thumb_url(self):
if self.over_18: return f"{SITE_FULL}/static/assets/images/nsfw.webp"
elif not self.url: return f"{SITE_FULL}/static/assets/images/{SITE_NAME}/default_text.webp"
elif self.thumburl: return self.thumburl
elif self.thumburl:
if self.thumburl.startswith('/'): return SITE_FULL + self.thumburl
return self.thumburl
elif self.is_youtube or self.is_video: return f"{SITE_FULL}/static/assets/images/default_thumb_yt.webp"
else: return f"{SITE_FULL}/static/assets/images/default_thumb_link.webp"
@property
@lazy
def full_thumb(self):
if self.thumb_url.startswith('/'): return SITE_FULL + self.thumb_url
return self.thumb_url
@property
@lazy
def full_url(self):
if self.url and self.url.startswith('/'): return SITE_FULL + self.url
return self.url
@property
@lazy
def json_raw(self):
@ -268,9 +258,9 @@ class Submission(Base):
'title': self.title,
'is_nsfw': self.over_18,
'is_bot': self.is_bot,
'thumb_url': self.full_thumb,
'thumb_url': self.thumb_url,
'domain': self.domain,
'url': self.full_url,
'url': self.realurl(None),
'body': self.body,
'body_html': self.body_html,
'created_utc': self.created_utc,
@ -351,6 +341,7 @@ class Submission(Base):
return url
elif self.url:
if v and v.nitter: 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 ""

View File

@ -455,12 +455,6 @@ class User(Base):
return data
@property
@lazy
def full_profileurl(self):
if self.profile_url.startswith('/'): return SITE_FULL + self.profile_url
return self.profile_url
@property
@lazy
def json_raw(self):
@ -470,7 +464,7 @@ class User(Base):
'created_utc': self.created_utc,
'id': self.id,
'is_private': self.is_private,
'profile_url': self.full_profileurl,
'profile_url': self.profile_url,
'bannerurl': self.banner_url,
'bio': self.bio,
'bio_html': self.bio_html_eager,

View File

@ -31,11 +31,11 @@ def feeds_user(v=None, sort='hot', t='all'):
with tag("title", type="text"):
text(f"{sort} posts from {domain}")
doc.stag("link", href=request.url)
doc.stag("link", href=request.url_root)
doc.stag("link", href=SITE_FULL + request.full_path)
doc.stag("link", href=SITE_FULL)
for post in posts:
with tag("entry", ("xml:base", request.url)):
with tag("entry", ("xml:base", SITE_FULL + request.full_path)):
with tag("title", type="text"):
text(post.realtitle(None))

View File

@ -542,7 +542,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

@ -48,7 +48,7 @@
<meta property="og:title" content="{{SITE_NAME}}" >
<meta property="og:site_name" content="{{request.host}}" >
<meta property="og:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta property="og:url" content="{{request.url}}">
<meta property="og:url" content="{{SITE_FULL}}{{request.full_path}}">
<meta property="og:description" name="description" content="{{SITE_NAME}} - {{config('SLOGAN')}}">
<meta property="og:author" name="author" content="@{{SITE_FULL}}/" >
<meta property="og:site_name" content="{{request.host}}" >
@ -59,7 +59,7 @@
<meta name="twitter:creator" content="@{{SITE_FULL}}/">
<meta name="twitter:description" content="{{SITE_NAME}} - {{config('SLOGAN')}}" >
<meta name="twitter:image" content="/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta name="twitter:url" content="{{request.url}}" >
<meta name="twitter:url" content="{{SITE_FULL}}{{request.full_path}}" >
{% endblock %}
<meta name="apple-mobile-web-app-capable" content="yes">

View File

@ -19,7 +19,7 @@
<meta property="og:title" content="{{SITE_NAME}}" >
<meta property="og:site_name" content="{{request.host}}" >
<meta property="og:image" content="{{SITE_NAME}}/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta property="og:url" content="{{request.url}}">
<meta property="og:url" content="{{SITE_FULL}}{{request.full_path}}">
<meta property="og:description" name="description" content="{{SITE_NAME}} - {{config('SLOGAN')}}">
<meta property="og:author" name="author" content="{{SITE_FULL}}/" >
<meta property="og:site_name" content="{{request.host}}" >
@ -30,7 +30,7 @@
<meta name="twitter:creator" content="{{SITE_FULL}}/">
<meta name="twitter:description" content="{{SITE_NAME}} - {{config('SLOGAN')}}" >
<meta name="twitter:image" content="/static/assets/images/{{SITE_NAME}}/site_preview.webp?a=1008" >
<meta name="twitter:url" content="{{request.url}}" >
<meta name="twitter:url" content="{{SITE_FULL}}{{request.full_path}}" >

View File

@ -518,8 +518,8 @@
{% if p.is_image and not p.over_18 and ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %}
<div style="text-align: center" class="mt-3 mb-4">
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.url}}">
<img loading="lazy" data-src="{{p.url}}" src="/static/assets/images/loading.webp" class="img-fluid" style="max-height:20rem;" alt="Unable to load image">
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
<img loading="lazy" data-src="{{p.realurl(v)}}" src="/static/assets/images/loading.webp" class="img-fluid" style="max-height:20rem;" alt="Unable to load image">
</a>
</div>
{% elif p.is_video %}