mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 01:04:06 +08:00
add temp message
Change-Id: Iee1ace2bbbacb766da8dd2988c308924eab95f7c
This commit is contained in:
parent
0ce08465fe
commit
89b2883789
@ -295,6 +295,7 @@ type Message struct {
|
||||
}
|
||||
|
||||
func (m *Message) Spawn(arg ...interface{}) *Message {
|
||||
temp := false
|
||||
c := m.target
|
||||
if len(arg) > 0 {
|
||||
switch v := arg[0].(type) {
|
||||
@ -302,6 +303,8 @@ func (m *Message) Spawn(arg ...interface{}) *Message {
|
||||
c = v
|
||||
case *Message:
|
||||
c = v.target
|
||||
case string:
|
||||
temp = kit.Right(v)
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,6 +317,10 @@ func (m *Message) Spawn(arg ...interface{}) *Message {
|
||||
root: m.root,
|
||||
}
|
||||
|
||||
if temp {
|
||||
return msg
|
||||
}
|
||||
|
||||
m.messages = append(m.messages, msg)
|
||||
return msg
|
||||
}
|
||||
|
@ -133,7 +133,8 @@ func (web *WEB) Login(msg *ctx.Message, w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
func (web *WEB) HandleCmd(m *ctx.Message, key string, cmd *ctx.Command) {
|
||||
web.HandleFunc(key, func(w http.ResponseWriter, r *http.Request) {
|
||||
m.TryCatch(m.Spawn(), true, func(msg *ctx.Message) {
|
||||
|
||||
m.TryCatch(m.Spawn(m.Conf("serve", "autofree")), true, func(msg *ctx.Message) {
|
||||
msg.Option("remote_addr", r.RemoteAddr)
|
||||
msg.Option("remote_ip", r.Header.Get("remote_ip"))
|
||||
msg.Option("index_url", r.Header.Get("index_url"))
|
||||
@ -375,6 +376,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
},
|
||||
}, Help: "爬虫配置"},
|
||||
"serve": &ctx.Config{Name: "serve", Value: map[string]interface{}{
|
||||
"autofree": false,
|
||||
"logheaders": false,
|
||||
"form_size": "102400",
|
||||
"directory": "usr",
|
||||
|
Loading…
x
Reference in New Issue
Block a user