fix same origin urls in mastoapi
This commit is contained in:
parent
a943767f42
commit
3445b183cd
@ -3,7 +3,7 @@ import strutils, strformat, options, json, sequtils, times, math
|
||||
import ".."/[types, formatters, utils]
|
||||
|
||||
proc formatTweetForMastoAPI*(tweet: Tweet, cfg: Config, prefs: Prefs): string =
|
||||
var content = replaceUrls(tweet.text, prefs, absolute=getUrlPrefix(cfg))
|
||||
var content = replaceUrls(tweet.text, prefs, absolute=getUrlPrefix(cfg)).replace("href=\"//", "href=\"http://")
|
||||
|
||||
if tweet.poll.isSome():
|
||||
let poll = get(tweet.poll)
|
||||
@ -24,7 +24,7 @@ proc formatTweetForMastoAPI*(tweet: Tweet, cfg: Config, prefs: Prefs): string =
|
||||
if tweet.quote.isSome():
|
||||
let
|
||||
quote = get(tweet.quote)
|
||||
quoteContent = replaceUrls(quote.text, prefs).replace("href=\"/", &"href=\"{getUrlPrefix(cfg)}/")
|
||||
quoteContent = replaceUrls(quote.text, prefs, absolute=getUrlPrefix(cfg)).replace("href=\"//", "href=\"http://")
|
||||
quoteUrl = &"{getUrlPrefix(cfg)}/i/status/{quote.id}"
|
||||
content &= &"\n\n<blockquote><b>↘ <a href=\"{quoteUrl}\">{quote.user.fullName} (@{quote.user.username})</a></b>\n{quoteContent}"
|
||||
|
||||
@ -42,7 +42,7 @@ proc formatTweetForMastoAPI*(tweet: Tweet, cfg: Config, prefs: Prefs): string =
|
||||
if tweet.birdwatch.isSome():
|
||||
let
|
||||
note = get(tweet.birdwatch)
|
||||
noteContent = replaceUrls(note.text, prefs)
|
||||
noteContent = replaceUrls(note.text, prefs, absolute=getUrlPrefix(cfg)).replace("href=\"//", "href=\"http://")
|
||||
content &= &"\n\n<blockquote><b>ⓘ {note.title}</b>\n{noteContent}</blockquote>"
|
||||
|
||||
result = content.replace("\n", "<br>")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user