mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 22:59:31 +00:00
parent
44b2f096f6
commit
bfcf75af7f
3 changed files with 5 additions and 0 deletions
|
|
@ -40,12 +40,14 @@ proc getVidUrl*(link: string): string =
|
||||||
&"/video/{sig}/{encodeUrl(link)}"
|
&"/video/{sig}/{encodeUrl(link)}"
|
||||||
|
|
||||||
proc getPicUrl*(link: string): string =
|
proc getPicUrl*(link: string): string =
|
||||||
|
if link.len == 0: return
|
||||||
if base64Media:
|
if base64Media:
|
||||||
&"/pic/enc/{encode(link, safe=true)}"
|
&"/pic/enc/{encode(link, safe=true)}"
|
||||||
else:
|
else:
|
||||||
&"/pic/{encodeUrl(link)}"
|
&"/pic/{encodeUrl(link)}"
|
||||||
|
|
||||||
proc getOrigPicUrl*(link: string): string =
|
proc getOrigPicUrl*(link: string): string =
|
||||||
|
if link.len == 0: return
|
||||||
if base64Media:
|
if base64Media:
|
||||||
&"/pic/orig/enc/{encode(link, safe=true)}"
|
&"/pic/orig/enc/{encode(link, safe=true)}"
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
|
||||||
link(rel="preload", type="image/png", href=bannerUrl, `as`="image")
|
link(rel="preload", type="image/png", href=bannerUrl, `as`="image")
|
||||||
|
|
||||||
for url in images:
|
for url in images:
|
||||||
|
if url.len == 0: continue
|
||||||
let preloadUrl = if "400x400" in url: getPicUrl(url)
|
let preloadUrl = if "400x400" in url: getPicUrl(url)
|
||||||
else: getSmallPic(url)
|
else: getSmallPic(url)
|
||||||
link(rel="preload", type="image/png", href=preloadUrl, `as`="image")
|
link(rel="preload", type="image/png", href=preloadUrl, `as`="image")
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,14 @@ const smallWebp* = "?name=small&format=webp"
|
||||||
const mediumWebp* = "?name=medium&format=webp"
|
const mediumWebp* = "?name=medium&format=webp"
|
||||||
|
|
||||||
proc getSmallPic*(url: string): string =
|
proc getSmallPic*(url: string): string =
|
||||||
|
if url.len == 0: return
|
||||||
result = url
|
result = url
|
||||||
if "?" notin url and not url.endsWith("placeholder.png"):
|
if "?" notin url and not url.endsWith("placeholder.png"):
|
||||||
result &= smallWebp
|
result &= smallWebp
|
||||||
result = getPicUrl(result)
|
result = getPicUrl(result)
|
||||||
|
|
||||||
proc getMediumPic*(url: string): string =
|
proc getMediumPic*(url: string): string =
|
||||||
|
if url.len == 0: return
|
||||||
result = url
|
result = url
|
||||||
if "?" notin url and not url.endsWith("placeholder.png"):
|
if "?" notin url and not url.endsWith("placeholder.png"):
|
||||||
result &= mediumWebp
|
result &= mediumWebp
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue