Compare commits

...

4 Commits

Author SHA1 Message Date
0e707271a4 chore: added missing near param and removed unused import 2025-11-24 22:00:36 -03:00
f68e234ea6 Merge remote-tracking branch 'upstream/master' 2025-11-24 22:00:01 -03:00
Zed
404b06b5f3 Include "Video" and link for video tweets in RSS (#1315)
Fixes #836
2025-11-25 01:03:45 +01:00
Zed
2b922c049a Embed quote tweet in RSS (#1316)
Fixes #132
Closes #820
2025-11-25 01:02:45 +01:00
4 changed files with 37 additions and 13 deletions

View File

@@ -30,6 +30,7 @@ proc initQuery*(pms: Table[string, string]; name=""): Query =
excludes: validFilters.filterIt("e-" & it in pms), excludes: validFilters.filterIt("e-" & it in pms),
since: @"since", since: @"since",
until: @"until", until: @"until",
near: @"near",
minLikes: validateNumber(@"min_faves") minLikes: validateNumber(@"min_faves")
) )
@@ -85,6 +86,8 @@ proc genQueryParam*(query: Query): string =
result &= " since:" & query.since result &= " since:" & query.since
if query.until.len > 0: if query.until.len > 0:
result &= " until:" & query.until result &= " until:" & query.until
if query.near.len > 0:
result &= " near:\"" & query.near & "\""
if query.minLikes.len > 0: if query.minLikes.len > 0:
result &= " min_faves:" & query.minLikes result &= " min_faves:" & query.minLikes
if query.text.len > 0: if query.text.len > 0:
@@ -110,6 +113,8 @@ proc genQueryUrl*(query: Query): string =
params.add "since=" & query.since params.add "since=" & query.since
if query.until.len > 0: if query.until.len > 0:
params.add "until=" & query.until params.add "until=" & query.until
if query.near.len > 0:
params.add "near=" & query.near
if query.minLikes.len > 0: if query.minLikes.len > 0:
params.add "min_faves=" & query.minLikes params.add "min_faves=" & query.minLikes

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
import asyncdispatch, strutils, sequtils, uri, options, sugar, logging import asyncdispatch, strutils, sequtils, uri, options, sugar
import jester, karax/vdom import jester, karax/vdom

View File

@@ -141,6 +141,7 @@ type
fromUser*: seq[string] fromUser*: seq[string]
since*: string since*: string
until*: string until*: string
near*: string
minLikes*: string minLikes*: string
sep*: string sep*: string

View File

@@ -9,9 +9,9 @@
#elif tweet.reply.len > 0: result = &"R to @{tweet.reply[0]}: " #elif tweet.reply.len > 0: result = &"R to @{tweet.reply[0]}: "
#end if #end if
#var text = stripHtml(tweet.text) #var text = stripHtml(tweet.text)
##if unicode.runeLen(text) > 32: #if unicode.runeLen(text) > 100:
## text = unicode.runeSubStr(text, 0, 32) & "..." # text = unicode.runeSubStr(text, 0, 64) & "..."
##end if #end if
#result &= xmltree.escape(text) #result &= xmltree.escape(text)
#if result.len > 0: return #if result.len > 0: return
#end if #end if
@@ -25,7 +25,7 @@
#end proc #end proc
# #
#proc getDescription(desc: string; cfg: Config): string = #proc getDescription(desc: string; cfg: Config): string =
Twitter feed for: ${desc}. Generated by ${cfg.hostname} Twitter feed for: ${desc}. Generated by ${getUrlPrefix(cfg)}
#end proc #end proc
# #
#proc getTweetsWithPinned(profile: Profile): seq[Tweets] = #proc getTweetsWithPinned(profile: Profile): seq[Tweets] =
@@ -56,7 +56,10 @@ Twitter feed for: ${desc}. Generated by ${cfg.hostname}
<img src="${urlPrefix}${getPicUrl(photo)}" style="max-width:250px;" /> <img src="${urlPrefix}${getPicUrl(photo)}" style="max-width:250px;" />
# end for # end for
#elif tweet.video.isSome: #elif tweet.video.isSome:
<a href="${urlPrefix}${tweet.getLink}">
<br>Video<br>
<img src="${urlPrefix}${getPicUrl(get(tweet.video).thumb)}" style="max-width:250px;" /> <img src="${urlPrefix}${getPicUrl(get(tweet.video).thumb)}" style="max-width:250px;" />
</a>
#elif tweet.gif.isSome: #elif tweet.gif.isSome:
# let thumb = &"{urlPrefix}{getPicUrl(get(tweet.gif).thumb)}" # let thumb = &"{urlPrefix}{getPicUrl(get(tweet.gif).thumb)}"
# let url = &"{urlPrefix}{getPicUrl(get(tweet.gif).url)}" # let url = &"{urlPrefix}{getPicUrl(get(tweet.gif).url)}"
@@ -69,13 +72,16 @@ Twitter feed for: ${desc}. Generated by ${cfg.hostname}
# end if # end if
#end if #end if
#if tweet.quote.isSome and get(tweet.quote).available: #if tweet.quote.isSome and get(tweet.quote).available:
# let quoteLink = getLink(get(tweet.quote)) # let quoteTweet = get(tweet.quote)
# let quoteLink = urlPrefix & getLink(quoteTweet)
<hr/>
<blockquote> <blockquote>
<b>${quoteTweet.user.fullname} (@${quoteTweet.user.username})</b>
<p> <p>
${renderRssTweet(get(tweet.quote), cfg)} ${renderRssTweet(quoteTweet, cfg)}
</p> </p>
<footer> <footer>
— <cite><a href="${urlPrefix}${quoteLink}">${cfg.hostname}${quoteLink}</a></cite> — <cite><a href="${quoteLink}">${quoteLink}</a>
</footer> </footer>
</blockquote> </blockquote>
#end if #end if
@@ -101,6 +107,18 @@ Twitter feed for: ${desc}. Generated by ${cfg.hostname}
<title>${getTitle(tweet, retweet)}</title> <title>${getTitle(tweet, retweet)}</title>
<dc:creator>@${tweet.user.username}</dc:creator> <dc:creator>@${tweet.user.username}</dc:creator>
<description><![CDATA[${renderRssTweet(tweet, cfg).strip(chars={'\n'})}]]></description> <description><![CDATA[${renderRssTweet(tweet, cfg).strip(chars={'\n'})}]]></description>
# let desc = renderRssTweet(tweet, cfg).strip(chars={'\n'})
# if retweet.len > 0:
<description><![CDATA[
<blockquote>
<b>${tweet.user.fullname} (@${tweet.user.username})</b>
<p>${desc}</p>
<footer>— <cite><a href="${urlPrefix & link}">${urlPrefix & link}</a></footer>
</blockquote>
]]></description>
# else:
<description><![CDATA[${desc}]]></description>
# end if
<pubDate>${getRfc822Time(tweet)}</pubDate> <pubDate>${getRfc822Time(tweet)}</pubDate>
<guid>${urlPrefix & link}</guid> <guid>${urlPrefix & link}</guid>
<link>${urlPrefix & link}</link> <link>${urlPrefix & link}</link>