flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 5b4a8b771c8c011af9c4f60ce0725225545b325d
parent 758676c26d0a87c9354a795aed370bc06b91be6b
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Mon,  1 Feb 2021 21:58:41 -0800

Add created time for users to admin page

Diffstat:
Mdb.go | 2+-
Mhttp.go | 4+++-
Mtemplates/admin.html | 1+
3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/db.go b/db.go @@ -73,7 +73,7 @@ type User struct { Email string Active bool Admin bool - CreatedAt int // timestamp + CreatedAt int64 // timestamp Reference string Domain string DomainEnabled bool diff --git a/http.go b/http.go @@ -726,7 +726,9 @@ func checkDomainHandler(w http.ResponseWriter, r *http.Request) { func runHTTPServer() { log.Printf("Running http server with hostname %s on port %d.", c.Host, c.HttpPort) var err error - t = template.New("main").Funcs(template.FuncMap{"parent": path.Dir, "hasSuffix": strings.HasSuffix, + t = template.New("main").Funcs(template.FuncMap{ + "unixTime": time.Unix, + "parent": path.Dir, "hasSuffix": strings.HasSuffix, "safeGeminiURL": func(u string) template.URL { if strings.HasPrefix(u, "gemini://") { return template.URL(u) diff --git a/templates/admin.html b/templates/admin.html @@ -10,6 +10,7 @@ <p>Email: <a href=mailto:{{.Email}}>{{.Email}}</a></p> <p>Reference: {{.Reference}}</p> <p>Domain: {{.Domain}}</p> + <p>Created: {{unixTime .CreatedAt 0}}</p> {{ if not .Active }} <p> <form action="/admin/user/{{.Username}}/activate" method="POST" class="inline">