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