about.nim 770 B

1234567891011121314151617181920212223242526
  1. # SPDX-License-Identifier: AGPL-3.0-only
  2. import os, strformat
  3. import karax/[karaxdsl, vdom]
  4. const
  5. date = staticExec("git show -s --format=\"%cd\" --date=format:\"%Y.%m.%d\"")
  6. hash = staticExec("git show -s --format=\"%h\"")
  7. link = "https://github.com/zedeus/nitter/commit/" & hash
  8. version = &"{date}-{hash}"
  9. var aboutHtml: string
  10. proc initAboutPage*(dir: string) =
  11. try:
  12. aboutHtml = readFile(dir/"md/about.html")
  13. except IOError:
  14. stderr.write (dir/"md/about.html") & " not found, please run `nimble md`\n"
  15. aboutHtml = "<h1>About page is missing</h1><br><br>"
  16. proc renderAbout*(): VNode =
  17. buildHtml(tdiv(class="overlay-panel")):
  18. verbatim aboutHtml
  19. h2: text "Instance info"
  20. p:
  21. text "Version "
  22. a(href=link): text version