Rename replaceUrl to replaceUrls
This commit is contained in:
parent
0e01ecb001
commit
9e413e1f8c
7 changed files with 11 additions and 11 deletions
|
@ -89,7 +89,7 @@ proc resolve*(url: string; prefs: Prefs): Future[string] {.async.} =
|
|||
let client = newAsyncHttpClient(maxRedirects=0)
|
||||
try:
|
||||
let resp = await client.request(url, HttpHead)
|
||||
result = resp.headers["location"].replaceUrl(prefs)
|
||||
result = resp.headers["location"].replaceUrls(prefs)
|
||||
except:
|
||||
discard
|
||||
finally:
|
||||
|
|
|
@ -47,8 +47,8 @@ proc shortLink*(text: string; length=28): string =
|
|||
if result.len > length:
|
||||
result = result[0 ..< length] & "…"
|
||||
|
||||
proc replaceUrl*(url: string; prefs: Prefs; absolute=""): string =
|
||||
result = url
|
||||
proc replaceUrls*(body: string; prefs: Prefs; absolute=""): string =
|
||||
result = body
|
||||
|
||||
if prefs.replaceYouTube.len > 0 and ytRegex in result:
|
||||
result = result.replace(ytRegex, prefs.replaceYouTube)
|
||||
|
|
|
@ -69,7 +69,7 @@ routes:
|
|||
get "/i/redirect":
|
||||
let url = decodeUrl(@"url")
|
||||
if url.len == 0: resp Http404
|
||||
redirect(replaceUrl(url, cookiePrefs()))
|
||||
redirect(replaceUrls(url, cookiePrefs()))
|
||||
|
||||
error Http404:
|
||||
resp Http404, showError("Page not found", cfg)
|
||||
|
|
|
@ -29,7 +29,7 @@ proc renderProfileCard*(profile: Profile; prefs: Prefs): VNode =
|
|||
if profile.bio.len > 0:
|
||||
tdiv(class="profile-bio"):
|
||||
p(dir="auto"):
|
||||
verbatim replaceUrl(profile.bio, prefs)
|
||||
verbatim replaceUrls(profile.bio, prefs)
|
||||
|
||||
if profile.location.len > 0:
|
||||
tdiv(class="profile-location"):
|
||||
|
@ -45,7 +45,7 @@ proc renderProfileCard*(profile: Profile; prefs: Prefs): VNode =
|
|||
if profile.website.len > 0:
|
||||
tdiv(class="profile-website"):
|
||||
span:
|
||||
let url = replaceUrl(profile.website, prefs)
|
||||
let url = replaceUrls(profile.website, prefs)
|
||||
icon "link"
|
||||
a(href=url): text shortLink(url)
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ Twitter feed for: ${desc}. Generated by ${cfg.hostname}
|
|||
#proc renderRssTweet(tweet: Tweet; prefs: Prefs; cfg: Config): string =
|
||||
#let tweet = tweet.retweet.get(tweet)
|
||||
#let urlPrefix = getUrlPrefix(cfg)
|
||||
#let text = replaceUrl(tweet.text, prefs, absolute=urlPrefix)
|
||||
#let text = replaceUrls(tweet.text, prefs, absolute=urlPrefix)
|
||||
#if tweet.quote.isSome and get(tweet.quote).available:
|
||||
# let quoteLink = getLink(get(tweet.quote))
|
||||
<p>${text}<br><a href="${urlPrefix}${quoteLink}">${cfg.hostname}${quoteLink}</a></p>
|
||||
|
|
|
@ -70,7 +70,7 @@ proc renderUser(user: Profile; prefs: Prefs): VNode =
|
|||
linkUser(user, class="username")
|
||||
|
||||
tdiv(class="tweet-content media-body", dir="auto"):
|
||||
verbatim replaceUrl(user.bio, prefs)
|
||||
verbatim replaceUrls(user.bio, prefs)
|
||||
|
||||
proc renderTimelineUsers*(results: Result[Profile]; prefs: Prefs; path=""): VNode =
|
||||
buildHtml(tdiv(class="timeline")):
|
||||
|
|
|
@ -166,7 +166,7 @@ proc renderCardContent(card: Card): VNode =
|
|||
proc renderCard(card: Card; prefs: Prefs; path: string): VNode =
|
||||
const smallCards = {app, player, summary, storeLink}
|
||||
let large = if card.kind notin smallCards: " large" else: ""
|
||||
let url = replaceUrl(card.url, prefs)
|
||||
let url = replaceUrls(card.url, prefs)
|
||||
|
||||
buildHtml(tdiv(class=("card" & large))):
|
||||
if card.video.isSome:
|
||||
|
@ -249,7 +249,7 @@ proc renderQuote(quote: Tweet; prefs: Prefs; path: string): VNode =
|
|||
|
||||
if quote.text.len > 0:
|
||||
tdiv(class="quote-text", dir="auto"):
|
||||
verbatim replaceUrl(quote.text, prefs)
|
||||
verbatim replaceUrls(quote.text, prefs)
|
||||
|
||||
if quote.hasThread:
|
||||
a(class="show-thread", href=getLink(quote)):
|
||||
|
@ -312,7 +312,7 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; index=0;
|
|||
tweetClass &= " tweet-bidi"
|
||||
|
||||
tdiv(class=tweetClass, dir="auto"):
|
||||
verbatim replaceUrl(tweet.text, prefs) & renderLocation(tweet)
|
||||
verbatim replaceUrls(tweet.text, prefs) & renderLocation(tweet)
|
||||
|
||||
if tweet.attribution.isSome:
|
||||
renderAttribution(tweet.attribution.get())
|
||||
|
|
Loading…
Reference in a new issue