diff --git a/base/gdb/event.go b/base/gdb/event.go index 5d4a3b34..6c1adb1f 100644 --- a/base/gdb/event.go +++ b/base/gdb/event.go @@ -25,7 +25,7 @@ func init() { HAPPEN: {Name: "happen event*", Help: "触发", Hand: func(m *ice.Message, arg ...string) { defer m.Cost() m.OptionCB(mdb.SELECT, "") - mdb.ZoneSelect(m.Spawn(ice.OptionFields("")), arg[1]).Table(func(value ice.Maps) { + mdb.ZoneSelectAll(m.Spawn(ice.OptionFields("")), arg[1]).Table(func(value ice.Maps) { m.Cmdy(kit.Split(value[ice.CMD]), arg[1], arg[2:], ice.OptionFields("")) }) _waitMap.Range(func(key, cb ice.Any) bool { cb.(func(*ice.Message, ...string))(m, arg...); return true }) diff --git a/base/web/dream.go b/base/web/dream.go index 4647568f..c59fa578 100644 --- a/base/web/dream.go +++ b/base/web/dream.go @@ -147,27 +147,33 @@ func _dream_start(m *ice.Message, name string) { } func _dream_check(m *ice.Message, name string) string { p := path.Join(ice.USR_LOCAL_WORK, name) + msg := m.Spawn(kit.Dict(ice.MSG_USERROLE, aaa.ROOT)) if pp := path.Join(p, ice.VAR_LOG_ICE_PID); nfs.Exists(m, pp) { - for i := 0; i < 5; i++ { - pid := m.Cmdx(nfs.CAT, pp, kit.Dict(ice.MSG_USERROLE, aaa.TECH)) + for i := 0; i < 10; i++ { + pid := msg.Cmdx(nfs.CAT, pp) if pid == "" { return p } - if runtime.GOOS == cli.LINUX && !kit.HasPrefix(m.Cmdx(nfs.CAT, "/proc/"+pid+"/cmdline"), kit.Path("bin/ice.bin"), kit.Path(p, "bin/ice.bin")) { - return p - } - if nfs.Exists(m, "/proc/"+pid) { - m.Info("already exists %v", pid) - } else if gdb.SignalProcess(m, pid) { - m.Info("already exists %v", pid) - } else if m.Cmd(SPACE, name).Length() > 0 { + m.Sleep("1s") + if m.Cmd(SPACE, name).Length() > 0 { m.Info("already exists %v", name) - } else { + return "" + } + if runtime.GOOS == cli.LINUX && !nfs.Exists(m, "/proc/"+pid) { return p } - m.Sleep300ms() + if nfs.Exists(m, "/proc/"+pid) && runtime.GOOS == cli.LINUX { + if !kit.HasPrefix(msg.Cmdx(nfs.CAT, "/proc/"+pid+"/cmdline"), kit.Path("bin/ice.bin"), kit.Path(p, "bin/ice.bin")) { + return p + } else { + return "" + } + } + if gdb.SignalProcess(m, pid) { + m.Info("already exists %v", pid) + return "" + } } - return "" } return p } diff --git a/base/web/serve.go b/base/web/serve.go index adc9bd81..6b680cad 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -169,6 +169,7 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response m.Options(ice.MSG_METHOD, r.Method, ice.MSG_COUNT, "0") m.Options(ice.MSG_REFERER, r.Header.Get(html.Referer)) m.Options(ice.MSG_USERWEB, _serve_domain(m), ice.MSG_USERPOD, m.Option(ice.POD)) + // m.Option(ice.POD, "") m.Options(ice.MSG_USERUA, r.Header.Get(html.UserAgent), ice.MSG_USERIP, r.Header.Get(ice.MSG_USERIP)) m.Options(ice.MSG_SESSID, kit.Select(m.Option(ice.MSG_SESSID), m.Option(CookieName(m.Option(ice.MSG_USERWEB))))) kit.If(m.Optionv(ice.MSG_CMDS) == nil, func() { diff --git a/base/web/space.go b/base/web/space.go index 52d4b652..1680f3e4 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -365,6 +365,7 @@ func init() { cli.START: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("", tcp.DIAL, arg) }}, tcp.DIAL: {Name: "dial dev=ops name", Hand: func(m *ice.Message, arg ...string) { _space_dial(m, m.Option(ice.DEV), kit.Select(ice.Info.NodeName, m.Option(mdb.NAME)), arg...) + ice.Info.Important = ice.HasVar() }}, cli.CLOSE: {Hand: func(m *ice.Message, arg ...string) { mdb.HashRemove(m, m.OptionSimple(mdb.NAME)) }}, mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { diff --git a/base/web/toast.go b/base/web/toast.go index 54508009..ca7e08ed 100644 --- a/base/web/toast.go +++ b/base/web/toast.go @@ -123,9 +123,6 @@ func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title } kit.If(len(arg) == 0, func() { arg = append(arg, "") }) kit.If(len(arg) > 0 && arg[0] == "", func() { arg[0] = toastTitle(m) }) - if m.IsDebug() { - // arg[0] = kit.Format(arg[0]) + "\t" + kit.FileLine(-1, 3) - } PushNoticeToast(m, text, arg) return m } diff --git a/core/chat/oauth/client.go b/core/chat/oauth/client.go index 19fac1b2..281fab2a 100644 --- a/core/chat/oauth/client.go +++ b/core/chat/oauth/client.go @@ -136,7 +136,7 @@ func (s Client) User(m *ice.Message, arg ...string) { func (s Client) Orgs(m *ice.Message, arg ...string) {} func (s Client) Repo(m *ice.Message, arg ...string) {} -func init() { ice.ChatCtxCmd(Client{}) } +func init() { ice.Cmd("web.chat.oauth.client", Client{}) } func (s Client) Login(m *ice.Message, arg ...string) { if state, code := m.Option(STATE), m.Option(CODE); !m.WarnNotValid(state == "" || code == "") { diff --git a/core/chat/oauth/server.go b/core/chat/oauth/server.go index 22056e2b..3625e88c 100644 --- a/core/chat/oauth/server.go +++ b/core/chat/oauth/server.go @@ -4,4 +4,4 @@ import "shylinux.com/x/ice" type Server struct{ ice.Hash } -func init() { ice.ChatCtxCmd(Client{}) } +func init() { ice.Cmd("web.chat.oauth.server", Server{}) } diff --git a/lock.go b/lock.go index 6674016d..c83c387d 100644 --- a/lock.go +++ b/lock.go @@ -85,7 +85,15 @@ func (m *Message) Optionv(key string, arg ...Any) Any { case nil: delete(m._meta, key) case string: - m._meta[key] = kit.Simple(arg...) + func() { + for i := 0; i < len(arg); i++ { + if _, ok := arg[i].(string); !ok { + m._data[key] = arg + return + } + } + m._meta[key] = kit.Simple(arg...) + }() case []string: m._meta[key] = v default: diff --git a/misc/wx/agent.go b/misc/wx/agent.go index d38594ac..b2d354d0 100644 --- a/misc/wx/agent.go +++ b/misc/wx/agent.go @@ -40,9 +40,12 @@ func init() { Index.MergeCommands(ice.Commands{ AGENT: {Name: "agent auto", Help: "代理", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{ chat.HEADER_AGENT: {Hand: func(m *ice.Message, arg ...string) { + m.Info("what %v", m.Option(ice.MSG_USERUA)) kit.If(strings.Index(m.Option(ice.MSG_USERUA), "MicroMessenger") > -1, func() { + m.Info("what %v", m.Option(ice.MSG_USERUA)) m.Optionv(mdb.PLUGIN, m.PrefixKey(), mdb.Config(m, web.SPACE)) }) + m.Info("what %v", m.FormatMeta()) }}, "getLocation": {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(location.LOCATION, mdb.CREATE, arg) }}, "scanQRCode1": {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(chat.FAVOR, mdb.CREATE, arg) }}, diff --git a/misc/wx/agent.js b/misc/wx/agent.js index b9114143..0ae4d7d3 100644 --- a/misc/wx/agent.js +++ b/misc/wx/agent.js @@ -37,10 +37,10 @@ Volcanos(chat.ONIMPORT, { wx.updateTimelineShareData({title: title, link: location.href, imgUrl: icons}) } var p = can.misc.Resource(can, can.user.info.favicon); can.base.beginWith(p, "/") && (p = location.origin + p) - can.user.agent.init = function(can, content) { if (!can) { return } - p = can.misc.Resource(can, can.Conf(mdb.ICONS))||p; can.base.beginWith(p, "/") && (p = location.origin + p) + can.user.agent.init = function(can, content, icons) { if (!can) { return } + p = can.misc.Resource(can, icons||can.Conf(mdb.ICONS))||p; can.base.beginWith(p, "/") && (p = location.origin + p) share(document.title, p, content) - }, can.user.agent.init(can.user.agent.cmd, can.user.agent._init_content) + }, can.user.agent.init(can.user.agent.cmd, can.user.agent._init_content, can.user.agent._init_icons) }) }) },