Compare commits
4 Commits
bb6728b6ec
...
2e2a96d7d8
| Author | SHA1 | Date | |
|---|---|---|---|
|
2e2a96d7d8
|
|||
|
5e60c28ce5
|
|||
|
3256ba8b03
|
|||
|
b45ae21354
|
@@ -29,10 +29,13 @@ proxyAuth = ""
|
||||
|
||||
# Change default preferences here, see src/prefs_impl.nim for a complete list
|
||||
[Preferences]
|
||||
theme = "Nitter"
|
||||
replaceTwitter = "nitter.net"
|
||||
replaceYouTube = "piped.video"
|
||||
replaceReddit = "teddit.net"
|
||||
theme = "Black"
|
||||
replaceTwitter = "nt.kuuro.net"
|
||||
replaceYouTube = "inv.nadeko.net"
|
||||
replaceReddit = "rd.kuuro.net"
|
||||
replaceImgur = "rd.kuuro.net"
|
||||
replaceFandom = "ph.kuuro.net"
|
||||
replaceSoundCloud = "sc.kuuro.net"
|
||||
proxyVideos = true
|
||||
hlsPlayback = false
|
||||
infiniteScroll = false
|
||||
|
||||
@@ -13,6 +13,12 @@ let
|
||||
twLinkRegex = re"""<a href="https:\/\/twitter.com([^"]+)">twitter\.com(\S+)</a>"""
|
||||
xRegex = re"(?<=(?<!\S)https:\/\/|(?<=\s))(www\.|mobile\.)?x\.com"
|
||||
xLinkRegex = re"""<a href="https:\/\/x.com([^"]+)">x\.com(\S+)</a>"""
|
||||
imgurRegex = re"(?<=(?<!\S)https:\/\/|(?<=\s))(i\.)?imgur\.com"
|
||||
imgurLinkRegex = re"""<a href="https://(i\.)?imgur.com([^"]+)">(i\.)?imgur\.com(\S+)</a>"""
|
||||
fandomRegex = re"(?<=(?<!\S)https:\/\/|(?<=\s))([a-z0-9-]+)\.fandom\.com"
|
||||
fandomLinkRegex = re"""<a href="https://([a-z0-9-]+)\.fandom\.com([^"]+)">([a-z0-9-]+)\.fandom\.com(\S+)</a>"""
|
||||
soundcloudRegex = re"(?<=(?<!\S)https:\/\/|(?<=\s))(www\.)?soundcloud\.com"
|
||||
soundcloudLinkRegex = re"""<a href="https://(www\.)?soundcloud\.com([^"]+)">(www\.)?soundcloud\.com(\S+)</a>"""
|
||||
|
||||
ytRegex = re(r"([A-z.]+\.)?youtu(be\.com|\.be)", {reStudy, reIgnoreCase})
|
||||
|
||||
@@ -73,6 +79,20 @@ proc replaceUrls*(body: string; prefs: Prefs; absolute=""): string =
|
||||
result = result.replace(twRegex, prefs.replaceTwitter)
|
||||
result = result.replacef(twLinkRegex, a(
|
||||
prefs.replaceTwitter & "$2", href = https & prefs.replaceTwitter & "$1"))
|
||||
if "imgur.com" in result:
|
||||
result = result.replace(imgurRegex, prefs.replaceImgur)
|
||||
result = result.replacef(imgurLinkRegex, a(
|
||||
prefs.replaceImgur & "$4", href = https & prefs.replaceImgur & "$2"))
|
||||
|
||||
if prefs.replaceFandom.len > 0 and "fandom.com" in result:
|
||||
result = result.replace(fandomRegex, prefs.replaceFandom & "/$1")
|
||||
result = result.replacef(fandomLinkRegex, a(
|
||||
prefs.replaceFandom & "/$1$2", href = https & prefs.replaceFandom & "/$1$2"))
|
||||
|
||||
if prefs.replaceSoundCloud.len > 0 and "soundcloud.com" in result:
|
||||
result = result.replace(soundcloudRegex, prefs.replaceSoundCloud)
|
||||
result = result.replacef(soundcloudLinkRegex, a(
|
||||
prefs.replaceSoundCloud & "$4", href = https & prefs.replaceSoundCloud & "$2"))
|
||||
|
||||
if prefs.replaceReddit.len > 0 and ("reddit.com" in result or "redd.it" in result):
|
||||
result = result.replace(rdShortRegex, prefs.replaceReddit & "/comments/")
|
||||
|
||||
@@ -107,6 +107,18 @@ genPrefs:
|
||||
"Reddit -> Teddit/Libreddit"
|
||||
placeholder: "Teddit hostname"
|
||||
|
||||
replaceImgur(input, ""):
|
||||
"Imgur -> Rimgo"
|
||||
placeholder: "Rimgo hostname"
|
||||
|
||||
replaceFandom(input, ""):
|
||||
"Fandom -> Phantom"
|
||||
placeholder: "Phantom hostname"
|
||||
|
||||
replaceSoundCloud(input, ""):
|
||||
"SoundCloud -> SoundCloak"
|
||||
placeholder: "SoundCloak hostname"
|
||||
|
||||
iterator allPrefs*(): Pref =
|
||||
for k, v in prefList:
|
||||
for pref in v:
|
||||
|
||||
Reference in New Issue
Block a user