1
0
mirror of https://github.com/zedeus/nitter synced 2024-11-22 01:45:22 +01:00

Use staticDir to load about page

Fixes #414
Closes #406
This commit is contained in:
Zed 2022-01-09 23:48:25 +01:00
parent 8c2e0c66e2
commit 4ec2874008
2 changed files with 8 additions and 5 deletions

View File

@ -32,6 +32,7 @@ setHmacKey(cfg.hmacKey)
setProxyEncoding(cfg.base64Media) setProxyEncoding(cfg.base64Media)
setMaxHttpConns(cfg.httpMaxConns) setMaxHttpConns(cfg.httpMaxConns)
setHttpProxy(cfg.proxy, cfg.proxyAuth) setHttpProxy(cfg.proxy, cfg.proxyAuth)
initAboutPage(cfg.staticDir)
waitFor initRedisPool(cfg) waitFor initRedisPool(cfg)
stdout.write &"Connected to Redis at {cfg.redisHost}:{cfg.redisPort}\n" stdout.write &"Connected to Redis at {cfg.redisHost}:{cfg.redisPort}\n"

View File

@ -8,16 +8,18 @@ const
link = "https://github.com/zedeus/nitter/commit/" & hash link = "https://github.com/zedeus/nitter/commit/" & hash
version = &"{date}-{hash}" version = &"{date}-{hash}"
let about = var aboutHtml: string
proc initAboutPage*(dir: string) =
try: try:
readFile("public/md/about.html") aboutHtml = readFile(&"{dir}/md/about.html")
except IOError: except IOError:
stderr.write "public/md/about.html not found, please run `nimble md`\n" stderr.write &"{dir}/about.html not found, please run `nimble md`\n"
"<h1>About page is missing</h1><br><br>" aboutHtml = "<h1>About page is missing</h1><br><br>"
proc renderAbout*(): VNode = proc renderAbout*(): VNode =
buildHtml(tdiv(class="overlay-panel")): buildHtml(tdiv(class="overlay-panel")):
verbatim about verbatim aboutHtml
h2: text "Instance info" h2: text "Instance info"
p: p:
text "Version " text "Version "