From 3c2088bac96e4e121fc85c9ae60891a7dd25a227 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Mon, 7 Oct 2019 01:25:41 -0400 Subject: [PATCH] online help facility --- docs/mandoc.css | 2 ++ views/header.html | 1 + web.go | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/docs/mandoc.css b/docs/mandoc.css index 9cb6032..a76e82c 100644 --- a/docs/mandoc.css +++ b/docs/mandoc.css @@ -52,6 +52,8 @@ table.results { margin-top: 1em; margin-left: 2em; font-size: smaller; } +img { max-width: 100%; } + /* Header and footer lines. */ table.head { width: 100%; diff --git a/views/header.html b/views/header.html index 90c808d..cbfe6ca 100644 --- a/views/header.html +++ b/views/header.html @@ -40,6 +40,7 @@
  • hfcs
  • funzone
  • account +
  • help
  • diff --git a/web.go b/web.go index 5e9b1b3..26d2e81 100644 --- a/web.go +++ b/web.go @@ -1449,6 +1449,11 @@ func serveasset(w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", "max-age=7776000") http.ServeFile(w, r, "views"+r.URL.Path) } +func servehelp(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + w.Header().Set("Cache-Control", "max-age=0") + http.ServeFile(w, r, "docs/" + name) +} func servehtml(w http.ResponseWriter, r *http.Request) { templinfo := getInfo(r) err := readviews.Execute(w, r.URL.Path[1:]+".html", templinfo) @@ -1615,6 +1620,7 @@ func serve() { getters.HandleFunc("/login", servehtml) posters.HandleFunc("/dologin", login.LoginFunc) getters.HandleFunc("/logout", login.LogoutFunc) + getters.HandleFunc("/help/{name:[[:alnum:]_.-]+}", servehelp) loggedin := mux.NewRoute().Subrouter() loggedin.Use(login.Required)