Adds ability to specify scripts in config to be added to HTML.

This commit is contained in:
Dominik Picheta 2018-05-22 22:15:42 +01:00
commit b895bf3d75
3 changed files with 5 additions and 1 deletions

View file

@ -17,5 +17,6 @@
<div id="ROOT" />
<script type="text/javascript" src="/js/forum.js?t=$timestamp"></script>
$scripts
</body>
</html>

View file

@ -266,7 +266,8 @@ proc initialise() =
karaxHtml = readFile("public/karax.html") %
{
"title": config.title,
"timestamp": encodeUrl(CompileDate & CompileTime)
"timestamp": encodeUrl(CompileDate & CompileTime),
"scripts": config.scripts
}.newStringTable()

View file

@ -28,6 +28,7 @@ type
dbPath*: string
hostname*: string
name*, title*: string
scripts*: string
ForumError* = object of Exception
data*: PostError
@ -64,6 +65,7 @@ proc loadConfig*(filename = getCurrentDir() / "forum.json"): Config =
result.hostname = root["hostname"].getStr()
result.name = root["name"].getStr()
result.title = root["title"].getStr()
result.scripts = root{"scripts"}.getStr()
proc processGT(n: XmlNode, tag: string): (int, XmlNode, string) =
result = (0, newElement(tag), tag)