Restrict image/gif media host instead of hashing
This commit is contained in:
@@ -41,7 +41,7 @@ proc renderMain*(body: VNode; prefs: Prefs; title="Nitter"; titleText=""; desc="
|
||||
meta(property="og:site_name", content="Twitter")
|
||||
|
||||
for url in images:
|
||||
meta(property="og:image", content=getSigUrl(url, "pic"))
|
||||
meta(property="og:image", content=getPicUrl(url))
|
||||
|
||||
if video.len > 0:
|
||||
meta(property="og:video:url", content=video)
|
||||
|
||||
@@ -14,7 +14,7 @@ proc renderStat(num, class: string; text=""): VNode =
|
||||
proc renderProfileCard*(profile: Profile; prefs: Prefs): VNode =
|
||||
buildHtml(tdiv(class="profile-card")):
|
||||
tdiv(class="profile-card-info"):
|
||||
let url = profile.getUserPic().getSigUrl("pic")
|
||||
let url = getPicUrl(profile.getUserPic())
|
||||
a(class="profile-card-avatar", href=url, target="_blank"):
|
||||
genImg(profile.getUserpic("_200x200"))
|
||||
|
||||
@@ -72,7 +72,7 @@ proc renderBanner(profile: Profile): VNode =
|
||||
if "#" in profile.banner:
|
||||
tdiv(class="profile-banner-color", style={backgroundColor: profile.banner})
|
||||
else:
|
||||
a(href=getSigUrl(profile.banner, "pic"), target="_blank"):
|
||||
a(href=getPicUrl(profile.banner), target="_blank"):
|
||||
genImg(profile.banner)
|
||||
|
||||
proc renderProfile*(profile: Profile; timeline: Timeline;
|
||||
|
||||
@@ -32,7 +32,7 @@ proc linkUser*(profile: Profile, class=""): VNode =
|
||||
|
||||
proc genImg*(url: string; class=""): VNode =
|
||||
buildHtml():
|
||||
img(src=url.getSigUrl("pic"), class=class, alt="Image")
|
||||
img(src=getPicUrl(url), class=class, alt="Image")
|
||||
|
||||
proc linkText*(text: string; class=""): VNode =
|
||||
let url = if "http" notin text: "http://" & text else: text
|
||||
|
||||
@@ -41,7 +41,7 @@ proc renderAlbum(tweet: Tweet): VNode =
|
||||
tdiv(class="gallery-row", style={marginTop: margin}):
|
||||
for photo in photos:
|
||||
tdiv(class="attachment image"):
|
||||
a(href=getSigUrl(photo & "?name=orig", "pic"), class="still-image",
|
||||
a(href=getPicUrl(photo & "?name=orig"), class="still-image",
|
||||
target="_blank", style={display: flex}):
|
||||
genImg(photo)
|
||||
|
||||
@@ -52,7 +52,7 @@ proc isPlaybackEnabled(prefs: Prefs; video: Video): bool =
|
||||
|
||||
proc renderVideoDisabled(video: Video; path: string): VNode =
|
||||
buildHtml(tdiv):
|
||||
img(src=video.thumb.getSigUrl("pic"))
|
||||
img(src=getPicUrl(video.thumb))
|
||||
tdiv(class="video-overlay"):
|
||||
case video.playbackType
|
||||
of mp4:
|
||||
@@ -62,7 +62,7 @@ proc renderVideoDisabled(video: Video; path: string): VNode =
|
||||
|
||||
proc renderVideoUnavailable(video: Video): VNode =
|
||||
buildHtml(tdiv):
|
||||
img(src=video.thumb.getSigUrl("pic"))
|
||||
img(src=getPicUrl(video.thumb))
|
||||
tdiv(class="video-overlay"):
|
||||
case video.reason
|
||||
of "dmcaed":
|
||||
@@ -74,13 +74,13 @@ proc renderVideo(video: Video; prefs: Prefs; path: string): VNode =
|
||||
buildHtml(tdiv(class="attachments")):
|
||||
tdiv(class="gallery-video"):
|
||||
tdiv(class="attachment video-container"):
|
||||
let thumb = video.thumb.getSigUrl("pic")
|
||||
let thumb = getPicUrl(video.thumb)
|
||||
if not video.available:
|
||||
renderVideoUnavailable(video)
|
||||
elif not prefs.isPlaybackEnabled(video):
|
||||
renderVideoDisabled(video, path)
|
||||
else:
|
||||
let source = video.url.getSigUrl("video")
|
||||
let source = getVidUrl(video.url)
|
||||
case video.playbackType
|
||||
of mp4:
|
||||
if prefs.muteVideos:
|
||||
@@ -99,8 +99,8 @@ proc renderGif(gif: Gif; prefs: Prefs): VNode =
|
||||
buildHtml(tdiv(class="attachments media-gif")):
|
||||
tdiv(class="gallery-gif", style=style(maxHeight, "unset")):
|
||||
tdiv(class="attachment"):
|
||||
let thumb = gif.thumb.getSigUrl("pic")
|
||||
let url = gif.url.getSigUrl("video")
|
||||
let thumb = getPicUrl(gif.thumb)
|
||||
let url = getGifUrl(gif.url)
|
||||
if prefs.autoplayGifs:
|
||||
video(class="gif", poster=thumb, autoplay="", muted="", loop=""):
|
||||
source(src=url, `type`="video/mp4")
|
||||
@@ -123,7 +123,7 @@ proc renderPoll(poll: Poll): VNode =
|
||||
proc renderCardImage(card: Card): VNode =
|
||||
buildHtml(tdiv(class="card-image-container")):
|
||||
tdiv(class="card-image"):
|
||||
img(src=getSigUrl(get(card.image), "pic"))
|
||||
img(src=getPicUrl(get(card.image)))
|
||||
if card.kind == player:
|
||||
tdiv(class="card-overlay"):
|
||||
tdiv(class="overlay-circle"):
|
||||
|
||||
Reference in New Issue
Block a user