Show error page when rate limited
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import asyncdispatch, strformat
|
||||
from net import Port
|
||||
from htmlgen import a
|
||||
|
||||
import jester
|
||||
|
||||
@ -9,6 +10,8 @@ import routes/[
|
||||
preferences, timeline, status, media, search, rss, list,
|
||||
unsupported, embed, resolver, router_utils]
|
||||
|
||||
const instancesUrl = "https://github.com/zedeus/nitter/wiki/Instances"
|
||||
|
||||
const configPath {.strdefine.} = "./nitter.conf"
|
||||
let (cfg, fullCfg) = getConfig(configPath)
|
||||
|
||||
@ -71,6 +74,12 @@ routes:
|
||||
error Http404:
|
||||
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 preferences, ""
|
||||
extend resolver, ""
|
||||
|
Reference in New Issue
Block a user