1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-10 13:31:25 +08:00
parent e2acf4baf2
commit 3c9db97ffa
7 changed files with 29 additions and 17 deletions

View File

@ -18,6 +18,7 @@ import (
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
)
@ -149,13 +150,14 @@ func init() {
m.Cmd(DREAM, cli.START, kit.Dict(mdb.NAME, value[mdb.NAME]))
}
})
for _, cmd := range kit.Reverse(kit.Split(mdb.Config(m, html.BUTTON))) {
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_TABLES, ice.CMD, cmd)
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_ACTION, ice.CMD, cmd)
}
})
}},
ctx.CONFIG: {Hand: func(m *ice.Message, arg ...string) {
for _, cmd := range kit.Reverse(arg) {
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_TABLES, ice.CMD, cmd)
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_ACTION, ice.CMD, cmd)
}
html.BUTTON: {Hand: func(m *ice.Message, arg ...string) {
mdb.Config(m, html.BUTTON, kit.Join(arg))
}},
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
if mdb.IsSearchPreview(m, arg) {
@ -315,10 +317,10 @@ func init() {
PushStats(m, kit.Keys(m.CommandKey(), mdb.TOTAL), msg.Length(), "", "已启动空间")
}
}},
}, StatsAction(), DreamAction(), mdb.ImportantHashAction(ctx.TOOLS, "web.code.git.search,route", mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template,restart")), Hand: func(m *ice.Message, arg ...string) {
if ice.Info.NodeType == WORKER {
return
} else if len(arg) == 0 {
}, StatsAction(), DreamAction(), mdb.ImportantHashAction(
html.BUTTON, "web.wiki.portal web.chat.portal web.chat.macos.desktop web.code.git.status web.code.vimer web.code.xterm web.code.compile",
ctx.TOOLS, "web.code.git.search,route", mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template,restart")), Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 {
_dream_list(m).RewriteAppend(func(value, key string, index int) string {
if key == mdb.ICON {
if kit.HasPrefix(value, HTTP, nfs.PS) {

View File

@ -192,6 +192,7 @@ func _space_exec(m *ice.Message, name string, source, target []string, c *websoc
m.OptionDefault(ice.MSG_COUNT, "0")
m.Option(ice.MSG_DAEMON, kit.Keys(kit.Slice(kit.Reverse(kit.Simple(source)), 0, -1), m.Option(ice.MSG_DAEMON)))
kit.If(aaa.Right(m, m.Detailv()), func() { m.TryCatch(true, func(_ *ice.Message) { m = m.Cmd() }) })
kit.If(m.Optionv(ice.MSG_ARGS) != nil, func() { m.Options(ice.MSG_ARGS, kit.Simple(m.Optionv(ice.MSG_ARGS))) })
}
defer m.Cost(kit.Format("%v->%v %v %v", source, target, m.Detailv(), m.FormatSize()))
_space_echo(m.Set(ice.MSG_OPTS).Options(log.DEBUG, m.Option(log.DEBUG)), []string{}, kit.Reverse(kit.Simple(source)), c)

View File

@ -80,7 +80,7 @@ func init() {
aaa.BACKGROUND: {Hand: _header_users},
aaa.THEME: {Hand: func(m *ice.Message, arg ...string) {
if tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
m.Cmd(cli.SYSTEM, "osascript", "-e", `tell app "System Events" to tell appearance preferences to set dark mode to `+
cli.TellApp(m, "System Events", `tell appearance preferences to set dark mode to `+
kit.Select(ice.TRUE, ice.FALSE, kit.IsIn(kit.Select(html.LIGHT, arg, 0), html.LIGHT, html.WHITE)))
}
}},

View File

@ -87,7 +87,7 @@ func init() {
}
m.Append(web.LINK, arg[0])
})
m.Action(web.FULL, web.OPEN, ice.APP).StatusTime(m.AppendSimple(web.LINK))
m.StatusTime(m.AppendSimple(web.LINK))
ctx.DisplayLocal(m, "")
}
}},

View File

@ -46,7 +46,7 @@ func init() {
m.Cmdy(web.SPACE, arg[0], web.SPACE, ice.MAIN)
} else if kit.IsIn(arg[1], CMD, "c") {
if arg[2] == web.CHAT_PORTAL {
m.Cmdy(web.SPACE, arg[0], web.SPACE, ice.MAIN)
m.Cmdy(web.SPACE, arg[0], arg[2])
} else {
web.RenderPodCmd(m, arg[0], arg[2], arg[3:])
}

View File

@ -2,13 +2,24 @@ package chat
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
)
const PORTAL = "portal"
func init() {
Index.MergeCommands(ice.Commands{
PORTAL: {Help: "门户", Actions: web.ApiAction(), Hand: func(m *ice.Message, arg ...string) { web.RenderMain(m) }},
PORTAL: {Help: "门户", Actions: ice.MergeActions(ice.Actions{
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(web.ADMIN, "后台")) }},
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) {
if kit.HasPrefixList(arg, ctx.ACTION, web.ADMIN) && len(arg) == 2 {
ctx.ProcessField(m, web.CHAT_IFRAME, m.MergePodCmd(m.Option(mdb.NAME), m.PrefixKey()), arg...)
m.ProcessField(ctx.ACTION, ctx.RUN, web.CHAT_IFRAME)
}
}},
}, web.ApiAction()), Hand: func(m *ice.Message, arg ...string) { web.RenderMain(m) }},
})
}

View File

@ -615,12 +615,10 @@ func init() {
kit.If(m.Option(REPOS), func(p string) {
p = strings.Split(p, mdb.QS)[0]
kit.If(!strings.Contains(p, "://"), func() { p = kit.MergeURL2(web.UserHost(m), web.X(p)) })
m.Cmd("", CLONE, ORIGIN, p, nfs.PATH, m.Option(cli.CMD_DIR), ice.Maps{cli.CMD_DIR: ""})
m.Cmd("", CLONE, ORIGIN, p, nfs.PATH, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME)), ice.Maps{cli.CMD_DIR: ""})
})
}},
web.DREAM_TRASH: {Hand: func(m *ice.Message, arg ...string) {
m.Cmd("", mdb.REMOVE, kit.Dict(REPOS, m.Option(mdb.NAME)))
}},
web.DREAM_TRASH: {Hand: func(m *ice.Message, arg ...string) { m.Cmd("", mdb.REMOVE, kit.Dict(REPOS, m.Option(mdb.NAME))) }},
web.SPACE_OPEN: {Hand: func(m *ice.Message, arg ...string) {
if m.Option(mdb.TYPE) == web.SERVER {
m.Cmd(web.DREAM).Table(func(value ice.Maps) {