Compare commits

...

11 commits

Author SHA1 Message Date
Butter Cat de2dea20c8
Merge ffcbec77b5 into c6edec0490 2024-02-25 22:05:36 -08:00
somini c6edec0490
Update auth.nim (#1164)
Avoid expiring the tokens for now.

See:
- https://github.com/zedeus/nitter/issues/983#issuecomment-1923046398
- https://github.com/zedeus/nitter/issues/1155#issuecomment-1917167072

Thanks @cmj
2024-02-26 03:08:25 +00:00
Butter Cat ffcbec77b5 Bring up to date with guest_accounts branch 2023-11-14 19:25:16 -05:00
Butter Cat e6ff628103 Remove commented out services 2023-11-14 19:22:08 -05:00
Butter Cat dbbfa39c9d
Merge branch 'zedeus:master' into more_link_replacements 2023-11-14 19:19:22 -05:00
Butter Cat 4a6b998640 Add in link replacement for medium.com 2023-11-13 21:06:27 -05:00
Butter Cat a5c6fe0ed3 Fix accounting for imgur.io 2023-11-13 20:52:28 -05:00
Butter Cat 8a741f4d5f Account for imgur.io 2023-11-13 20:32:22 -05:00
Butter Cat 8670a71c30 Fix missing parentheses in Imgur regex 2023-11-13 20:28:21 -05:00
Butter Cat 1a804dc6e2 Account for more Imgur domains 2023-11-13 20:24:39 -05:00
Butter Cat cc931d02bb Initial test of imgur redirect 2023-11-13 20:03:26 -05:00
3 changed files with 19 additions and 1 deletions

View file

@ -202,7 +202,7 @@ proc initAccountPool*(cfg: Config; path: string) =
quit 1
let accountsPrePurge = accountPool.len
accountPool.keepItIf(not it.hasExpired)
#accountPool.keepItIf(not it.hasExpired)
log "Successfully added ", accountPool.len, " valid accounts."
if accountsPrePurge > accountPool.len:

View file

@ -20,6 +20,10 @@ let
# so v.redd.it links will not be replaced.
# Images aren't supported due to errors from Teddit when the image
# wasn't first displayed via a post on the Teddit instance.
imgurRegex = re"((i|i.stack)\.)?imgur\.(com|io)"
mediumRegex = re"([a-zA-Z0-9_.-]+\.)?medium\.com"
wwwRegex = re"https?://(www[0-9]?\.)?"
m3u8Regex = re"""url="(.+.m3u8)""""
@ -68,6 +72,12 @@ proc replaceUrls*(body: string; prefs: Prefs; absolute=""): string =
result = result.replace(rdRegex, prefs.replaceReddit)
if prefs.replaceReddit in result and "/gallery/" in result:
result = result.replace("/gallery/", "/comments/")
if prefs.replaceImgur.len > 0 and "imgur" in result:
result = result.replace(imgurRegex, prefs.replaceImgur)
if prefs.replaceMedium.len > 0 and "medium.com" in result:
result = result.replace(mediumRegex, prefs.replaceMedium)
if absolute.len > 0 and "href" in result:
result = result.replace("href=\"/", &"href=\"{absolute}/")

View file

@ -106,6 +106,14 @@ genPrefs:
replaceReddit(input, ""):
"Reddit -> Teddit/Libreddit"
placeholder: "Teddit hostname"
replaceImgur(input, ""):
"Imgur -> Rimgo"
placeholder: "Rimgo hostname"
replaceMedium(input, ""):
"Medium -> Scribe"
placeholder: "Scribe hostname"
iterator allPrefs*(): Pref =
for k, v in prefList: