load all into mem
parent
365a857e2a
commit
da6097c5e2
3
http.go
3
http.go
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue