better migrator and page timing

This commit is contained in:
ston1th 2019-08-24 18:33:13 +02:00
commit 9ecaf33d86
4 changed files with 19 additions and 12 deletions

View file

@ -11,6 +11,7 @@ import (
"html/template"
"net/http"
"net/url"
"strconv"
"time"
)
@ -60,7 +61,7 @@ type Context struct {
type webData struct {
Version string
Time int64
Time string
Title string
BodyTitle string
@ -112,7 +113,12 @@ func (c *Context) Exec() {
c.Data.Admin = c.Admin()
c.Data.User = c.User()
c.Data.Login = c.LoggedOn()
c.Data.Time = time.Since(c.Time).Nanoseconds() / 1e6
t := strconv.Itoa(int(time.Since(c.Time).Nanoseconds()/1e6)) + "ms"
if t == "0ms" {
t = strconv.Itoa(int(time.Since(c.Time).Nanoseconds()/1e5)) + "µs"
}
c.Data.Time = t
if c.Data.Msg != "" {
c.Status = http.StatusBadRequest

View file

@ -69,7 +69,7 @@ const (
<li><a href="/blacklist">Blacklist</a></li>
{{end}}
</ul>
<p>© GoWiki {{.Version}} Request: <strong>{{.Time}}ms</strong></p>
<p>© GoWiki {{.Version}} Request: <strong>{{.Time}}</strong></p>
</div>
</div>
</footer>