2019-02-01 04:48:18 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hunterlong/statping/core"
|
|
|
|
"html/template"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2020-01-13 07:11:53 +00:00
|
|
|
var (
|
|
|
|
basePath = "/"
|
|
|
|
)
|
|
|
|
|
2019-02-01 04:48:18 +00:00
|
|
|
var handlerFuncs = func(w http.ResponseWriter, r *http.Request) template.FuncMap {
|
|
|
|
return template.FuncMap{
|
|
|
|
"VERSION": func() string {
|
|
|
|
return core.VERSION
|
|
|
|
},
|
2020-02-19 08:13:09 +00:00
|
|
|
"CoreApp": func() core.Core {
|
|
|
|
c := *core.CoreApp
|
|
|
|
if c.Name == "" {
|
|
|
|
c.Name = "Statping"
|
|
|
|
}
|
|
|
|
return c
|
2019-02-01 04:48:18 +00:00
|
|
|
},
|
|
|
|
"USE_CDN": func() bool {
|
|
|
|
return core.CoreApp.UseCdn.Bool
|
|
|
|
},
|
2020-01-13 07:11:53 +00:00
|
|
|
"BasePath": func() string {
|
|
|
|
return basePath
|
|
|
|
},
|
2019-02-01 04:48:18 +00:00
|
|
|
}
|
|
|
|
}
|