This commit is contained in:
Zed
2020-06-07 07:55:57 +02:00
parent ea7222bc86
commit 47c87f7068
5 changed files with 31 additions and 18 deletions

View File

@@ -4,6 +4,8 @@ import nimcrypto, regex
var hmacKey = "secretkey"
const
https* = "https://"
twimg* = "pbs.twimg.com/"
badJpgExts = @["1500x500", "jpgn", "jpg:", "jpg_", "_jpg"]
badPngExts = @["pngn", "png:", "png_", "_png"]
twitterDomains = @[
@@ -43,5 +45,8 @@ proc filterParams*(params: Table): seq[(string, string)] =
let filter = ["name", "id", "list", "referer", "scroll"]
toSeq(params.pairs()).filterIt(it[0] notin filter and it[1].len > 0)
proc isTwitterUrl*(uri: Uri): bool =
uri.hostname in twitterDomains
proc isTwitterUrl*(url: string): bool =
parseUri(url).hostname in twitterDomains