apply patches from the old upstream and cleanup
Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
import asyncdispatch, strformat, logging
|
||||
import config
|
||||
from net import Port
|
||||
from htmlgen import a
|
||||
from os import getEnv
|
||||
@ -13,7 +12,13 @@ import routes/[
|
||||
preferences, timeline, status, media, search, rss, list, debug,
|
||||
unsupported, embed, resolver, router_utils]
|
||||
|
||||
initAccountPool(cfg)
|
||||
let
|
||||
configPath = getEnv("NITTER_CONF_FILE", "./nitter.conf")
|
||||
(cfg, fullCfg) = getConfig(configPath)
|
||||
|
||||
sessionsPath = getEnv("NITTER_SESSIONS_FILE", "./sessions.jsonl")
|
||||
|
||||
initSessionPool(cfg, sessionsPath)
|
||||
|
||||
if not cfg.enableDebug:
|
||||
# Silence Jester's query warning
|
||||
@ -66,7 +71,7 @@ routes:
|
||||
|
||||
error InternalError:
|
||||
echo error.exc.name, ": ", error.exc.msg
|
||||
const link = a("https://git.ngn.tf/ngn/nitter", href = "https://git.ngn.tf/ngn/nitter")
|
||||
const link = a("ngn@ngn.tf", href = "mailto:ngn@ngn.tf")
|
||||
resp Http500, showError(
|
||||
&"An error occurred, please report to {link}", cfg)
|
||||
|
||||
@ -78,6 +83,11 @@ routes:
|
||||
resp Http429, showError(
|
||||
&"Instance has been rate limited.", cfg)
|
||||
|
||||
error NoSessionsError:
|
||||
const link = a("another instance", href = instancesUrl)
|
||||
resp Http429, showError(
|
||||
&"Instance has no auth tokens, or is fully rate limited.<br>Use {link} or try again later.", cfg)
|
||||
|
||||
extend rss, ""
|
||||
extend status, ""
|
||||
extend search, ""
|
||||
|
Reference in New Issue
Block a user