Code cleanup, template updates.

master
J. David Lee 2019-06-11 15:47:46 +02:00
parent 00a213a0e7
commit f1200c0d7c
3 changed files with 10 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
"net/http"
"os"
"strings"
"time"
"golang.org/x/crypto/acme/autocert"
)
@ -37,7 +38,12 @@ func Main() {
var err error
// Initialize globals.
tmpl = template.Must(template.New("").Parse(tmpls))
tmpl = template.Must(template.New("").Funcs(template.FuncMap{
"now": func() string {
return time.Now().UTC().Format("2006-01-02 15:04")
},
}).Parse(tmpls))
if db, err = newDB("database.sqlite3"); err != nil {
os.Exit(1)
}

View File

@ -11,7 +11,9 @@
<li><a href="/log/list">Log</a></li>
<li><a href="/source/list">Sources</a></li>
<li><a href="/user/list">Users</a></li>
<li style="float:right"><a>{{now}}</a></li>
</ul>
{{end}}
{{define "PageEnd" -}}

View File

@ -14,6 +14,7 @@ var tmpls = `
<li><a href="/log/list">Log</a></li>
<li><a href="/source/list">Sources</a></li>
<li><a href="/user/list">Users</a></li>
<li style="float:right"><a>{{now}}</a></li>
</ul>
{{end}}