forked from statping/statping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.go
46 lines (42 loc) · 839 Bytes
/
function.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package handlers
import (
"github.com/statping/statping/source"
"github.com/statping/statping/types/core"
"github.com/statping/statping/utils"
"html/template"
"net/http"
"net/url"
)
var (
basePath = "/"
)
func parseForm(r *http.Request) url.Values {
r.ParseForm()
return r.PostForm
}
var handlerFuncs = func(w http.ResponseWriter, r *http.Request) template.FuncMap {
return template.FuncMap{
"VERSION": func() string {
return core.App.Version
},
"CoreApp": func() core.Core {
c := *core.App
if c.Name == "" {
c.Name = "Statping"
}
return c
},
"USE_CDN": func() bool {
return core.App.UseCdn.Bool
},
"USING_ASSETS": func() bool {
return source.UsingAssets(utils.Directory)
},
"BasePath": func() string {
return basePath
},
"Icon": func() string {
return basePath
},
}
}