mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-22 18:55:41 +00:00
More cleanup
This commit is contained in:
parent
a9034928eb
commit
74c4377198
|
@ -5,7 +5,7 @@ import types, tokens, consts, parserutils, http_pool
|
|||
|
||||
const rl = "x-rate-limit-"
|
||||
|
||||
var pool {.threadvar.}: HttpPool
|
||||
var pool: HttpPool
|
||||
|
||||
proc genParams*(pars: openarray[(string, string)] = @[]; cursor="";
|
||||
count="20"; ext=true): seq[(string, string)] =
|
||||
|
|
|
@ -5,8 +5,8 @@ type
|
|||
HttpPool* = ref object
|
||||
conns*: seq[AsyncHttpClient]
|
||||
|
||||
var maxConns {.threadvar.}: int
|
||||
var proxy {.threadvar.}: Proxy
|
||||
var maxConns: int
|
||||
var proxy: Proxy
|
||||
|
||||
proc setMaxHttpConns*(n: int) =
|
||||
maxConns = n
|
||||
|
|
|
@ -6,7 +6,7 @@ from parsecfg import nil
|
|||
|
||||
export genUpdatePrefs, genResetPrefs
|
||||
|
||||
var defaultPrefs* {.threadvar.}: Prefs
|
||||
var defaultPrefs*: Prefs
|
||||
|
||||
proc updateDefaultPrefs*(cfg: parsecfg.Config) =
|
||||
genDefaultPrefs()
|
||||
|
|
|
@ -9,7 +9,7 @@ const
|
|||
baseCacheTime = 60 * 60
|
||||
|
||||
var
|
||||
pool {.threadvar.}: RedisPool
|
||||
pool: RedisPool
|
||||
rssCacheTime: int
|
||||
listCacheTime*: int
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ const
|
|||
failDelay = initDuration(minutes=30)
|
||||
|
||||
var
|
||||
clientPool {.threadvar.}: HttpPool
|
||||
tokenPool {.threadvar.}: seq[Token]
|
||||
clientPool: HttpPool
|
||||
tokenPool: seq[Token]
|
||||
lastFailed: Time
|
||||
|
||||
proc getPoolInfo*: string =
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
import strutils, strformat, sequtils, uri, tables, base64
|
||||
import strutils, strformat, uri, tables, base64
|
||||
import nimcrypto, regex
|
||||
|
||||
var
|
||||
hmacKey {.threadvar.}: string
|
||||
hmacKey: string
|
||||
base64Media = false
|
||||
|
||||
const
|
||||
https* = "https://"
|
||||
twimg* = "pbs.twimg.com/"
|
||||
nitterParams = ["name", "tab", "id", "list", "referer", "scroll"]
|
||||
twitterDomains = @[
|
||||
"twitter.com",
|
||||
"pic.twitter.com",
|
||||
|
@ -17,7 +18,6 @@ const
|
|||
"pbs.twimg.com",
|
||||
"video.twimg.com"
|
||||
]
|
||||
nitterParams = ["name", "tab", "id", "list", "referer", "scroll"]
|
||||
|
||||
proc setHmacKey*(key: string) =
|
||||
hmacKey = key
|
||||
|
|
|
@ -86,7 +86,7 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
|
|||
|
||||
if banner.len > 0:
|
||||
let bannerUrl = getPicUrl(banner)
|
||||
link(rel="preload", type="image/png", href=getPicUrl(banner), `as`="image")
|
||||
link(rel="preload", type="image/png", href=bannerUrl, `as`="image")
|
||||
|
||||
for url in images:
|
||||
let suffix = if "400x400" in url: "" else: "?name=small"
|
||||
|
|
Loading…
Reference in a new issue