load all into mem

master
Bel LaPointe 2023-04-07 12:43:06 -06:00
parent 365a857e2a
commit da6097c5e2
2 changed files with 15 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"context"
_ "embed"
"encoding/json"
"fmt"
"net/http"
"os"
@ -62,5 +63,7 @@ func httpRoot(w http.ResponseWriter, r *http.Request) {
}
ctx := extract(r.Context())
body = strings.ReplaceAll(body, "{{USER}}", ctx.User)
assignments, _ := json.Marshal(nil)
body = strings.ReplaceAll(body, "{{ASSIGNMENTS_JSON}}", string(assignments))
w.Write([]byte(body))
}

View File

@ -13,9 +13,21 @@
).toString(36);
console.log("session", session);
</script>
<script>
let knowledgebase = {{ASSIGNMENTS_JSON}};
console.log(knowledgebase);
</script>
</header>
<body>
{{USER}}
<form id="flash" action="" onsubmit="trySolve(this.children.idq.value, this.children.answer.value); return false;">
<input type="text" name="idq" readonly=true value="" style="display: none;">
<div name="question"></div>
<div name="clues"></div>
<input type="button" value="clue">
<input type="text" name="answer">
<input type="submit" value="submit">
</form>
</body>
<footer>
</footer>