mirror of
https://github.com/zedeus/nitter.git
synced 2025-03-04 01:51:12 +00:00
Always print sessions logs
This commit is contained in:
parent
cb334a7d68
commit
4f9ba9c7d6
1 changed files with 5 additions and 5 deletions
10
src/auth.nim
10
src/auth.nim
|
@ -27,7 +27,7 @@ var
|
||||||
enableLogging = false
|
enableLogging = false
|
||||||
|
|
||||||
template log(str: varargs[string, `$`]) =
|
template log(str: varargs[string, `$`]) =
|
||||||
if enableLogging: echo "[sessions] ", str.join("")
|
echo "[sessions] ", str.join("")
|
||||||
|
|
||||||
proc snowflakeToEpoch(flake: int64): int64 =
|
proc snowflakeToEpoch(flake: int64): int64 =
|
||||||
int64(((flake shr 22) + 1288834974657) div 1000)
|
int64(((flake shr 22) + 1288834974657) div 1000)
|
||||||
|
@ -188,15 +188,15 @@ proc initSessionPool*(cfg: Config; path: string) =
|
||||||
enableLogging = cfg.enableDebug
|
enableLogging = cfg.enableDebug
|
||||||
|
|
||||||
if path.endsWith(".json"):
|
if path.endsWith(".json"):
|
||||||
echo "[sessions] ERROR: .json is not supported, the file must be a valid JSONL file ending in .jsonl"
|
log "ERROR: .json is not supported, the file must be a valid JSONL file ending in .jsonl"
|
||||||
quit 1
|
quit 1
|
||||||
|
|
||||||
if not fileExists(path):
|
if not fileExists(path):
|
||||||
echo "[sessions] ERROR: ", path, " not found. This file is required to authenticate API requests."
|
log "ERROR: ", path, " not found. This file is required to authenticate API requests."
|
||||||
quit 1
|
quit 1
|
||||||
|
|
||||||
log "Parsing JSONL account sessions file: ", path
|
log "parsing JSONL account sessions file: ", path
|
||||||
for line in path.lines:
|
for line in path.lines:
|
||||||
sessionPool.add parseSession(line)
|
sessionPool.add parseSession(line)
|
||||||
|
|
||||||
log "Successfully added ", sessionPool.len, " valid account sessions."
|
log "successfully added ", sessionPool.len, " valid account sessions"
|
||||||
|
|
Loading…
Reference in a new issue