Browse Source

Silence some warnings

Zed 6 năm trước cách đây
mục cha
commit
bde3c3662d

+ 1 - 1
src/prefs.nim

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

+ 0 - 1
src/query.nim

@@ -62,7 +62,6 @@ proc genQueryParam*(query: Query): string =
   if "nativeretweets" notin query.excludes:
     param &= "include:nativeretweets "
 
-  let rewrite = query.fromUser.len > 0 and query.kind in {posts, media}
   for f in query.filters:
     filters.add "filter:" & f
   for e in query.excludes:

+ 1 - 1
src/redis_cache.nim

@@ -6,7 +6,7 @@ import types, api
 const redisNil = "\0\0"
 
 var
-  pool: RedisPool
+  pool {.threadvar.}: RedisPool
   baseCacheTime = 60 * 60
   rssCacheTime: int
   listCacheTime*: int

+ 1 - 1
src/routes/rss.nim

@@ -103,7 +103,7 @@ proc createRssRouter*(cfg: Config) =
 
       var key = @"name" & "/" & @"tab"
       if @"tab" == "search":
-        key &= hash(genQueryUrl(query))
+        key &= $hash(genQueryUrl(query))
       key &= getCursor()
 
       var rss = await getCachedRss(key)

+ 1 - 1
src/tokens.nim

@@ -1,7 +1,7 @@
 import asyncdispatch, httpclient, times, sequtils, strutils
 import types
 
-var tokenPool: seq[Token]
+var tokenPool {.threadvar.}: seq[Token]
 
 proc fetchToken(): Future[Token] {.async.} =
   let

+ 2 - 2
src/utils.nim

@@ -2,7 +2,7 @@ import strutils, strformat, sequtils, uri, tables, base64
 import nimcrypto, regex
 
 var
-  hmacKey = "secretkey"
+  hmacKey {.threadvar.}: string
   base64Media = false
 
 const
@@ -51,7 +51,7 @@ proc cleanFilename*(filename: string): string =
     result &= ".png"
 
 proc filterParams*(params: Table): seq[(string, string)] =
-  let filter = ["name", "id", "list", "referer", "scroll"]
+  const filter = ["name", "id", "list", "referer", "scroll"]
   toSeq(params.pairs()).filterIt(it[0] notin filter and it[1].len > 0)
 
 proc isTwitterUrl*(uri: Uri): bool =

+ 2 - 2
src/views/preferences.nim

@@ -1,5 +1,5 @@
-import tables, macros, strutils, os
-import karax/[karaxdsl, vdom, vstyles]
+import tables, macros, strutils
+import karax/[karaxdsl, vdom]
 
 import renderutils
 import ../types, ../prefs_impl

+ 1 - 1
src/views/search.nim

@@ -4,7 +4,7 @@ import karax/[karaxdsl, vdom]
 import renderutils, timeline
 import ".."/[types, query]
 
-let toggles = {
+const toggles = {
   "nativeretweets": "Retweets",
   "media": "Media",
   "videos": "Videos",

+ 2 - 2
src/views/timeline.nim

@@ -1,5 +1,5 @@
-import strutils, strformat, sequtils, algorithm, times, uri, options
-import karax/[karaxdsl, vdom, vstyles]
+import strutils, strformat, sequtils, algorithm, uri, options
+import karax/[karaxdsl, vdom]
 
 import ".."/[types, query, formatters]
 import tweet, renderutils