diff --git a/http.go b/http.go
index b8cbb35..68af5c9 100644
--- a/http.go
+++ b/http.go
@@ -26,6 +26,8 @@ func HTTP(port int, db DB) error {
foo := func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" {
httpGUI(w, r)
+ } else if strings.HasPrefix(r.URL.Path, "/static/") {
+ httpStatic(w, r)
} else if strings.HasPrefix(r.URL.Path, "/api/questions") && strings.HasSuffix(r.URL.Path, "/answers") && r.Method == http.MethodPost {
httpPostQuestionAnswers(w, r)
} else {
@@ -105,6 +107,13 @@ func httpGUI(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(body))
}
+func httpStatic(w http.ResponseWriter, r *http.Request) {
+ p := strings.TrimPrefix(r.URL.Path, "/static/")
+ p = strings.ReplaceAll(p, "/..", "/")
+ p = path.Clean(p)
+ http.ServeFile(w, r, p)
+}
+
func httpAssignments(ctx context.Context) (interface{}, error) {
db := extract(ctx).DB
user := extract(ctx).User
diff --git a/public/root.html b/public/root.html
index 38479f6..5267b79 100644
--- a/public/root.html
+++ b/public/root.html
@@ -99,7 +99,13 @@
let clues = ""
for (var i in todo[1].Clues) {
- clues += `clue #${i}
${todo[1].Clues[i]} `
+ clues += `clue #${i}
`
+ if (todo[1].Clues[i].startsWith("img:")) {
+ clues += `
`
+ } else {
+ clues += todo[1].Clues[i]
+ }
+ clues += ` `
}
form.children.clues.innerHTML = clues
form.children.clues.value = todo[1].Clues
diff --git a/testdata/sample.yaml b/testdata/sample.yaml
index 69c2ea5..b584c38 100755
--- a/testdata/sample.yaml
+++ b/testdata/sample.yaml
@@ -7,7 +7,7 @@ knowledge:
- solution B
clues:
- clue1 of 2
- - clue2 of 2
+ - img:testdata/tofugu.d/sa-hiragana-0.png
tags:
- ops
- data-platform
@@ -52,5 +52,5 @@ users:
tags:
assignments:
- ops
- cadence: 5h0m0s
+ cadence: 5s
resolution: 1