From 1d57f1f4323ecd4fc9c4a99040b56a4f7725b9d4 Mon Sep 17 00:00:00 2001 From: Zed Date: Fri, 5 Jun 2026 22:26:38 +0200 Subject: [PATCH] Add video attribution link support --- src/types.nim | 1 + src/views/tweet.nim | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/types.nim b/src/types.nim index 848f8ae..c755589 100644 --- a/src/types.nim +++ b/src/types.nim @@ -264,6 +264,7 @@ type stats*: TweetStats retweet*: Option[Tweet] attribution*: Option[User] + attributionLink*: string mediaTags*: seq[User] quote*: Option[Tweet] card*: Option[Card] diff --git a/src/views/tweet.nim b/src/views/tweet.nim index e15cf1d..5546eb4 100644 --- a/src/views/tweet.nim +++ b/src/views/tweet.nim @@ -239,8 +239,9 @@ proc renderReply(tweet: Tweet): VNode = if i > 0: text " " a(href=("/" & u)): text "@" & u -proc renderAttribution(user: User; prefs: Prefs): VNode = - buildHtml(a(class="attribution", href=("/" & user.username))): +proc renderAttribution(user: User; prefs: Prefs; link = ""): VNode = + let href = if link.len > 0: link else: "/" & user.username + buildHtml(a(class="attribution", href=href)): renderMiniAvatar(user, prefs) strong: text user.fullname verifiedIcon(user) @@ -386,7 +387,7 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; index=0; verbatim replaceUrls(tweet.text, prefs) & renderLocation(tweet) if tweet.attribution.isSome: - renderAttribution(tweet.attribution.get(), prefs) + renderAttribution(tweet.attribution.get(), prefs, tweet.attributionLink) if tweet.card.isSome and tweet.card.get().kind != hidden: renderCard(tweet.card.get(), prefs, path)