From 74c4377198aa982dc925da1cb1412c7d9295cd2f Mon Sep 17 00:00:00 2001 From: Zed Date: Sun, 2 Jan 2022 11:21:03 +0100 Subject: [PATCH] More cleanup --- src/apiutils.nim | 2 +- src/http_pool.nim | 4 ++-- src/prefs.nim | 2 +- src/redis_cache.nim | 2 +- src/tokens.nim | 4 ++-- src/utils.nim | 6 +++--- src/views/general.nim | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/apiutils.nim b/src/apiutils.nim index fc433ae..4f9af56 100644 --- a/src/apiutils.nim +++ b/src/apiutils.nim @@ -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)] = diff --git a/src/http_pool.nim b/src/http_pool.nim index 45aeea2..8f4bcda 100644 --- a/src/http_pool.nim +++ b/src/http_pool.nim @@ -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 diff --git a/src/prefs.nim b/src/prefs.nim index 91bdfe2..fa40a6d 100644 --- a/src/prefs.nim +++ b/src/prefs.nim @@ -6,7 +6,7 @@ from parsecfg import nil export genUpdatePrefs, genResetPrefs -var defaultPrefs* {.threadvar.}: Prefs +var defaultPrefs*: Prefs proc updateDefaultPrefs*(cfg: parsecfg.Config) = genDefaultPrefs() diff --git a/src/redis_cache.nim b/src/redis_cache.nim index 66ef415..8e8f529 100644 --- a/src/redis_cache.nim +++ b/src/redis_cache.nim @@ -9,7 +9,7 @@ const baseCacheTime = 60 * 60 var - pool {.threadvar.}: RedisPool + pool: RedisPool rssCacheTime: int listCacheTime*: int diff --git a/src/tokens.nim b/src/tokens.nim index b0bd263..ba90ad2 100644 --- a/src/tokens.nim +++ b/src/tokens.nim @@ -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 = diff --git a/src/utils.nim b/src/utils.nim index 2ca0617..02d8288 100644 --- a/src/utils.nim +++ b/src/utils.nim @@ -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 diff --git a/src/views/general.nim b/src/views/general.nim index 1286c2c..cae9147 100644 --- a/src/views/general.nim +++ b/src/views/general.nim @@ -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"