diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -9,6 +9,7 @@ import ( "net/http" "strconv" "sync/atomic" + "time" ) //go:embed index.html @@ -18,6 +19,7 @@ var pageTemplate *template.Template var open atomic.Uint64 var done atomic.Uint64 +var start time.Time var broker *Broker @@ -144,10 +146,11 @@ func pageHandler(w http.ResponseWriter, r *http.Request) { } tempData := struct { - Open uint64 - Done uint64 - IsAdmin bool - }{open.Load(), done.Load() + 1, r.URL.Query().Has(*passwd)} + Open uint64 + Done uint64 + StartTime string + IsAdmin bool + }{open.Load(), done.Load() + 1, start.Format(time.RFC3339), r.URL.Query().Has(*passwd)} if err := pageTemplate.Execute(w, tempData); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -178,6 +181,8 @@ var passwd = flag.String("password", "admin", "the admin password") func main() { flag.Parse() + start = time.Now() + broker = &Broker{ make(map[chan string]bool), make(chan (chan string)), |
