mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-25 16:58:06 +08:00
add web.serve.open
This commit is contained in:
parent
dd200672cb
commit
f4e9c04228
@ -7,5 +7,5 @@ var version = struct {
|
||||
self int
|
||||
}{
|
||||
[]string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"},
|
||||
`2019-09-29 17:30:47`, `centos`, 612,
|
||||
`2019-09-29 18:40:19`, `centos`, 617,
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package ctx
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
|
||||
"io"
|
||||
"path"
|
||||
"strings"
|
||||
@ -74,6 +75,21 @@ func index(name string, arg ...interface{}) interface{} {
|
||||
}
|
||||
|
||||
var CGI = template.FuncMap{
|
||||
"conf": func(arg ...interface{}) interface{} {
|
||||
switch m := arg[0].(type) {
|
||||
case *Message:
|
||||
switch c := arg[1].(type) {
|
||||
case string:
|
||||
if len(arg) == 2 {
|
||||
return m.Confv(c)
|
||||
}
|
||||
if len(arg) == 3 {
|
||||
return m.Confv(c, arg[2])
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
},
|
||||
"option": func(arg ...interface{}) interface{} {
|
||||
return index("option", arg...)
|
||||
},
|
||||
|
@ -404,6 +404,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
"key": "etc/key.pem",
|
||||
"site": "",
|
||||
"index": "/chat/",
|
||||
"open": []interface{}{},
|
||||
}, Help: "服务配置"},
|
||||
"route": &ctx.Config{Name: "route", Value: map[string]interface{}{
|
||||
"index": "/render",
|
||||
|
@ -30,7 +30,9 @@
|
||||
{{range $index, $lib := option . "scripts"}}
|
||||
<script src="/static/librarys/{{$lib}}"></script>
|
||||
{{end}}
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak="></script>
|
||||
{{range $index, $lib := conf . "serve" "open"}}
|
||||
<script src="{{$lib}}"></script>
|
||||
{{end}}
|
||||
</body>
|
||||
{{end}}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user