online help facility
Ted Unangst tedu@tedunangst.com
Mon, 07 Oct 2019 01:25:41 -0400
3 files changed,
9 insertions(+),
0 deletions(-)
M
docs/mandoc.css
→
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%;
M
views/header.html
→
views/header.html
@@ -40,6 +40,7 @@ <li><a href="/xzone">xzone</a>
<li><a href="/hfcs">hfcs</a> <li><a href="/funzone">funzone</a> <li><a href="/account">account</a> +<li><a href="/help/honk.1.html">help</a> <li> <form action="/q" method="GET"> <input type="text" name="q" autocomplete=off size=10 placeholder="search">
M
web.go
→
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 @@ getters.HandleFunc("/about", servehtml)
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)