Improve endpoint parity with twitter

This commit is contained in:
Zed 2019-09-23 16:12:20 +02:00
parent 372ce7867c
commit 43a2bd529c
3 changed files with 32 additions and 3 deletions

View File

@ -5,11 +5,13 @@ import jester
import types, config, prefs
import views/[general, about]
import routes/[preferences, timeline, status, media, search, rss, list]
import routes/[
preferences, timeline, status, media, search, rss, list, unsupported]
const configPath {.strdefine.} = "./nitter.conf"
let cfg = getConfig(configPath)
createUnsupportedRouter(cfg)
createPrefRouter(cfg)
createTimelineRouter(cfg)
createListRouter(cfg)
@ -30,9 +32,13 @@ routes:
get "/about":
resp renderMain(renderAbout(), request, cfg.title)
get "/about/feature":
resp renderMain(renderFeature(), request, cfg.title)
get "/explore":
redirect("/about")
get "/help":
redirect("/about")
extend unsupported, ""
extend preferences, ""
extend rss, ""
extend search, ""

View File

@ -28,3 +28,6 @@ proc createSearchRouter*(cfg: Config) =
resp renderMain(renderTweetSearch(tweets, prefs, getPath()), request, cfg.title)
else:
resp Http404, showError("Invalid search.", cfg.title)
get "/hashtag/@hash":
redirect("/search?text=" & encodeUrl("#" & @"hash"))

View File

@ -0,0 +1,20 @@
import jester
import router_utils
import ../types
import ../views/[general, about]
proc createUnsupportedRouter*(cfg: Config) =
router unsupported:
get "/about/feature":
resp renderMain(renderFeature(), request, cfg.title)
get "/intent/?@i?":
resp renderMain(renderFeature(), request, cfg.title)
get "/login/?@i?":
resp renderMain(renderFeature(), request, cfg.title)
get "/i/@i?/?@j?":
cond @"i" != "status"
resp renderMain(renderFeature(), request, cfg.title)