mirror of
https://github.com/zedeus/nitter.git
synced 2024-11-15 21:21:09 +00:00
35 lines
694 B
Nim
35 lines
694 B
Nim
import asyncdispatch
|
|
from net import Port
|
|
|
|
import jester
|
|
|
|
import types, config, prefs
|
|
import views/general
|
|
import routes/[preferences, timeline, media]
|
|
|
|
const configPath {.strdefine.} = "./nitter.conf"
|
|
let cfg = getConfig(configPath)
|
|
|
|
createPrefRouter(cfg)
|
|
createTimelineRouter(cfg)
|
|
createMediaRouter(cfg)
|
|
|
|
settings:
|
|
port = Port(cfg.port)
|
|
staticDir = cfg.staticDir
|
|
bindAddr = cfg.address
|
|
|
|
routes:
|
|
get "/":
|
|
resp renderMain(renderSearch(), Prefs(), cfg.title)
|
|
|
|
post "/search":
|
|
if @"query".len == 0:
|
|
resp Http404, showError("Please enter a username.", cfg.title)
|
|
redirect("/" & @"query")
|
|
|
|
extend preferences, ""
|
|
extend timeline, ""
|
|
extend media, ""
|
|
|
|
runForever()
|