1
0
forked from x/icebergs

add relay

This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-12-02 15:38:36 +08:00
parent 35007a3e6e
commit ec7f5eba8e
2 changed files with 12 additions and 7 deletions

View File

@ -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))
}
}},
})
}

View File

@ -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 {