More cleanup

This commit is contained in:
Zed 2022-01-02 11:21:03 +01:00
parent a9034928eb
commit 74c4377198
7 changed files with 11 additions and 11 deletions

View file

@ -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)] =

View file

@ -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

View file

@ -6,7 +6,7 @@ from parsecfg import nil
export genUpdatePrefs, genResetPrefs
var defaultPrefs* {.threadvar.}: Prefs
var defaultPrefs*: Prefs
proc updateDefaultPrefs*(cfg: parsecfg.Config) =
genDefaultPrefs()

View file

@ -9,7 +9,7 @@ const
baseCacheTime = 60 * 60
var
pool {.threadvar.}: RedisPool
pool: RedisPool
rssCacheTime: int
listCacheTime*: int

View file

@ -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 =

View file

@ -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

View file

@ -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"