|
@@ -1,5 +1,6 @@
|
|
|
import asyncdispatch, strformat
|
|
import asyncdispatch, strformat
|
|
|
from net import Port
|
|
from net import Port
|
|
|
|
|
+from htmlgen import a
|
|
|
|
|
|
|
|
import jester
|
|
import jester
|
|
|
|
|
|
|
@@ -9,6 +10,8 @@ import routes/[
|
|
|
preferences, timeline, status, media, search, rss, list,
|
|
preferences, timeline, status, media, search, rss, list,
|
|
|
unsupported, embed, resolver, router_utils]
|
|
unsupported, embed, resolver, router_utils]
|
|
|
|
|
|
|
|
|
|
+const instancesUrl = "https://github.com/zedeus/nitter/wiki/Instances"
|
|
|
|
|
+
|
|
|
const configPath {.strdefine.} = "./nitter.conf"
|
|
const configPath {.strdefine.} = "./nitter.conf"
|
|
|
let (cfg, fullCfg) = getConfig(configPath)
|
|
let (cfg, fullCfg) = getConfig(configPath)
|
|
|
|
|
|
|
@@ -71,6 +74,12 @@ routes:
|
|
|
error Http404:
|
|
error Http404:
|
|
|
resp Http404, showError("Page not found", cfg)
|
|
resp Http404, showError("Page not found", cfg)
|
|
|
|
|
|
|
|
|
|
+ error RateLimitError:
|
|
|
|
|
+ echo error.exc.msg
|
|
|
|
|
+ resp Http429, showError("Instance has been rate limited.<br>Use " &
|
|
|
|
|
+ a("another instance", href = instancesUrl) &
|
|
|
|
|
+ " or try again later.", cfg)
|
|
|
|
|
+
|
|
|
extend unsupported, ""
|
|
extend unsupported, ""
|
|
|
extend preferences, ""
|
|
extend preferences, ""
|
|
|
extend resolver, ""
|
|
extend resolver, ""
|