forked from x/icebergs
add some
This commit is contained in:
parent
b54e6b0a01
commit
37d2d84381
@ -95,7 +95,7 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo
|
|||||||
}
|
}
|
||||||
func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.ResponseWriter, r *http.Request) {
|
func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.ResponseWriter, r *http.Request) {
|
||||||
debug := strings.Contains(r.URL.String(), "debug=true") || strings.Contains(r.Header.Get(html.Referer), "debug=true")
|
debug := strings.Contains(r.URL.String(), "debug=true") || strings.Contains(r.Header.Get(html.Referer), "debug=true")
|
||||||
m.Options(ice.LOG_TRACEID, r.Header.Get(ice.LOG_TRACEID), ice.MSG_LANGUAGE, "")
|
m.Options(ice.LOG_TRACEID, r.Header.Get(ice.LOG_TRACEID))
|
||||||
_log := func(level string, arg ...ice.Any) *ice.Message {
|
_log := func(level string, arg ...ice.Any) *ice.Message {
|
||||||
if debug || arg[0] == ice.MSG_CMDS {
|
if debug || arg[0] == ice.MSG_CMDS {
|
||||||
return m.Logs(strings.Title(level), arg...)
|
return m.Logs(strings.Title(level), arg...)
|
||||||
@ -167,6 +167,11 @@ func _serve_domain(m *ice.Message) string {
|
|||||||
}
|
}
|
||||||
func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) {
|
func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) {
|
||||||
kit.If(len(cmds) > 0, func() { cmds = append(kit.Split(cmds[0], ","), cmds[1:]...) })
|
kit.If(len(cmds) > 0, func() { cmds = append(kit.Split(cmds[0], ","), cmds[1:]...) })
|
||||||
|
defer func() {
|
||||||
|
kit.For(m.Optionv(""), func(key string) {
|
||||||
|
kit.If(strings.HasPrefix(key, ice.MSG_SESSID), func() { m.Set(ice.MSG_OPTION, key) })
|
||||||
|
})
|
||||||
|
}()
|
||||||
if r.URL.Path == PP(SPACE) {
|
if r.URL.Path == PP(SPACE) {
|
||||||
aaa.SessCheck(m, m.Option(ice.MSG_SESSID))
|
aaa.SessCheck(m, m.Option(ice.MSG_SESSID))
|
||||||
return cmds, true
|
return cmds, true
|
||||||
|
@ -29,6 +29,7 @@ func (f *Frame) Begin(m *ice.Message, arg ...string) {}
|
|||||||
func (f *Frame) Start(m *ice.Message, arg ...string) {
|
func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||||
f.Message, f.Server = m, &http.Server{Handler: f}
|
f.Message, f.Server = m, &http.Server{Handler: f}
|
||||||
list := map[*ice.Context]string{}
|
list := map[*ice.Context]string{}
|
||||||
|
m.Options(ice.MSG_LANGUAGE, "")
|
||||||
m.Travel(func(p *ice.Context, c *ice.Context) {
|
m.Travel(func(p *ice.Context, c *ice.Context) {
|
||||||
f, ok := c.Server().(*Frame)
|
f, ok := c.Server().(*Frame)
|
||||||
if !ok || f.ServeMux != nil {
|
if !ok || f.ServeMux != nil {
|
||||||
|
12
meta.go
12
meta.go
@ -21,6 +21,18 @@ func (m *Message) Set(key string, arg ...string) *Message {
|
|||||||
} else if len(arg) > 0 {
|
} else if len(arg) > 0 {
|
||||||
if m.delete(arg[0]); len(arg) > 1 {
|
if m.delete(arg[0]); len(arg) > 1 {
|
||||||
m.value(arg[0], arg[1:]...)
|
m.value(arg[0], arg[1:]...)
|
||||||
|
} else {
|
||||||
|
list := m.value(key)
|
||||||
|
for i, k := range list {
|
||||||
|
if k == arg[0] {
|
||||||
|
for ; i < len(list)-1; i++ {
|
||||||
|
list[i] = list[i+1]
|
||||||
|
}
|
||||||
|
list = list[:len(list)-1]
|
||||||
|
m.value(key, list...)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
kit.For(m.value(key), func(k string) { m.delete(k) })
|
kit.For(m.value(key), func(k string) { m.delete(k) })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user