diff --git a/core/chat/cmd.go b/core/chat/cmd.go index 5c9baf72..761e3ae1 100644 --- a/core/chat/cmd.go +++ b/core/chat/cmd.go @@ -11,7 +11,12 @@ const CMD = "cmd" func init() { Index.MergeCommands(ice.Commands{ CMD: {Help: "命令", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { - web.RenderCmd(m, kit.Select(web.WIKI_WORD, arg, 0), kit.Slice(arg, 1)) + switch cmd := kit.Select(web.WIKI_WORD, arg, 0); cmd { + case web.CHAT_PORTAL: + web.RenderMain(m) + default: + web.RenderCmd(m, cmd, kit.Slice(arg, 1)) + } }}, }) } diff --git a/core/chat/iframe.go b/core/chat/iframe.go index f2bc0a22..77dd7621 100644 --- a/core/chat/iframe.go +++ b/core/chat/iframe.go @@ -66,18 +66,18 @@ func init() { }}, }, FavorAction(), mdb.HashAction(mdb.SHORT, web.LINK, mdb.FIELD, "time,hash,type,name,link")), Hand: func(m *ice.Message, arg ...string) { list := []string{m.MergePodCmd("", web.WIKI_PORTAL, log.DEBUG, m.Option(log.DEBUG))} - list = append(list, web.MergeLink(m, "/chat/portal/", ice.POD, m.Option(ice.MSG_USERPOD), log.DEBUG, m.Option(log.DEBUG))) + list = append(list, web.MergeLink(m, web.CHAT_PORTAL, ice.POD, m.Option(ice.MSG_USERPOD), log.DEBUG, m.Option(log.DEBUG))) if mdb.HashSelect(m, arg...); len(arg) == 0 { for _, link := range list { if u := kit.ParseURL(link); u != nil { m.Push("", kit.Dict(mdb.TIME, m.Time(), mdb.HASH, kit.Hashs(link), mdb.TYPE, web.LINK, mdb.NAME, u.Path, web.LINK, link)) } } - if m.Length() == 0 { - m.Action(mdb.CREATE, ice.APP) - } else { - m.PushAction(web.OPEN, mdb.REMOVE).Action(mdb.CREATE, mdb.PRUNES, ice.APP) - } + m.PushAction(web.OPEN, mdb.REMOVE) + list := kit.List(mdb.CREATE) + kit.If(m.Length() > 0, func() { list = append(list, mdb.PRUNES) }) + kit.If(web.IsLocalHost(m), func() { list = append(list, ice.APP) }) + m.Action(list...) } else { kit.If(m.Length() == 0, func() { for _, link := range list {