1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-17 22:46:59 +08:00
parent ac90f10b41
commit 53b6706863
12 changed files with 30 additions and 6 deletions

View File

@ -27,6 +27,9 @@ func _role_black(m *ice.Message, role, key string) { _role_set(m, role, BLACK, k
func _role_check(value ice.Map, key []string, ok bool) bool {
white, black := value[WHITE].(ice.Map), value[BLACK].(ice.Map)
for i := 0; i < len(key); i++ {
ice.Pulse.Info("debug what %v", kit.Join(key[:i+1], ice.PT))
ice.Pulse.Info("debug what %v", white[kit.Join(key[:i+1], ice.PT)])
ice.Pulse.Info("debug what %v", black[kit.Join(key[:i+1], ice.PT)])
kit.If(white[kit.Join(key[:i+1], ice.PT)], func() { ok = true })
kit.If(black[kit.Join(key[:i+1], ice.PT)], func() { ok = false })
}
@ -164,3 +167,6 @@ func Right(m *ice.Message, key ...ice.Any) bool {
return m.Option(ice.MSG_USERROLE) == ROOT || !m.Warn(m.Cmdx(ROLE, RIGHT, m.Option(ice.MSG_USERROLE), key, logs.FileLineMeta(-1)) != ice.OK,
ice.ErrNotRight, kit.Keys(key...), USERROLE, m.Option(ice.MSG_USERROLE), logs.FileLineMeta(-1))
}
func IsTechOrRoot(m *ice.Message) bool {
return kit.IsIn(m.Option(ice.MSG_USERROLE), TECH, ROOT)
}

View File

@ -5,6 +5,7 @@ import (
"path"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
kit "shylinux.com/x/toolkits"
@ -14,7 +15,8 @@ const ADMIN = "admin"
func init() {
Index.MergeCommands(ice.Commands{
ADMIN: {Name: "admin index list", Help: "管理", Actions: ice.Actions{
ADMIN: {Name: "admin index list", Help: "管理", Role: aaa.VOID, Actions: ice.Actions{
ice.CTX_INIT: {Hand: DreamWhiteHandle},
DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(ADMIN, "后台")) }},
DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) {
if kit.HasPrefixList(arg, ctx.ACTION, ADMIN) && len(arg) == 2 {

View File

@ -437,3 +437,8 @@ func DreamEach(m *ice.Message, name string, status string, cb func(string)) *ice
func DreamList(m *ice.Message) *ice.Message {
return m.SplitIndex(AdminCmd(m, DREAM))
}
func DreamWhiteHandle(m *ice.Message, arg ...string) {
aaa.White(m, kit.Keys(DREAM, ctx.ACTION, m.CommandKey()))
aaa.White(m, kit.Keys(DREAM, ctx.ACTION, m.PrefixKey()))
aaa.White(m, kit.Keys(ctx.ShortCmd(m.PrefixKey()), ctx.ACTION, DREAM_ACTION))
}

View File

@ -278,7 +278,9 @@ func init() {
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
})
case ORIGIN:
m.Cmdy(SPIDE, kit.Dict(ice.MSG_FIELDS, CLIENT_ORIGIN)).CutTo(CLIENT_ORIGIN, arg[0]).Sort(arg[0])
m.SetAppend()
m.Push(arg[0], SpideOrigin(m, ice.DEV))
m.Copy(m.Cmd(SPIDE, kit.Dict(ice.MSG_FIELDS, CLIENT_ORIGIN)).CutTo(CLIENT_ORIGIN, arg[0]).Sort(arg[0]))
case mdb.ICONS:
m.Options(nfs.DIR_REG, kit.ExtReg(nfs.PNG, nfs.JPG, nfs.JPEG), nfs.DIR_DEEP, ice.TRUE)
m.Cmdy(nfs.DIR, nfs.SRC, nfs.PATH)

View File

@ -41,9 +41,10 @@ func init() {
AppInstall(m, cmd.Icon, m.PrefixKey())
})
})
Notify(m, "Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
Notify(m, "usr/icons/Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
}},
DESKTOP: {Help: "应用桌面", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: web.DreamWhiteHandle},
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(m.CommandKey(), "桌面")) }},
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }},
}, PodCmdAction(), CmdHashAction(), mdb.ExportHashAction())},

View File

@ -9,7 +9,7 @@ Volcanos(chat.ONIMPORT, {
var tabs = can.misc.sessionStorage(can, [can.ConfIndex(), html.TABS])
sub.onexport.output = function() { can.onimport._desktop(can, can._msg)
var sess = can.misc.SearchHash(can)[0]||can.Conf("session")
sess? can.runActionCommand(event, "session", [sess], function(msg) {
sess? can.runActionCommand(event, "web.chat.macos.session", [sess], function(msg) {
var item = msg.TableDetail(); can.onimport.session(can, can.base.Obj(item.args))
}): !window.parent && can.isCmdMode() && can.onimport.session(can, tabs)
}

View File

@ -2,6 +2,7 @@ package macos
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/mdb"
)
@ -9,7 +10,7 @@ const SESSION = "session"
func init() {
Index.MergeCommands(ice.Commands{
SESSION: {Help: "会话", Actions: ice.MergeActions(CmdHashAction(mdb.NAME), mdb.ExportHashAction()), Hand: func(m *ice.Message, arg ...string) {
SESSION: {Help: "会话", Role: aaa.VOID, Actions: ice.MergeActions(CmdHashAction(mdb.NAME), mdb.ExportHashAction()), Hand: func(m *ice.Message, arg ...string) {
if mdb.HashSelect(m, arg...); len(arg) > 0 {
m.EchoIFrame(m.MergePodCmd("", DESKTOP) + "#" + m.Append(mdb.NAME))
}

View File

@ -202,6 +202,7 @@ func init() {
kit.If(m.Option(mdb.TYPE) == nfs.FILE, func() { m.Push(arg[0], ice.SRC_MAIN_SHY, ice.SRC_MAIN_GO, ice.SRC_MAIN_JS) })
}
}},
ice.CTX_INIT: {Hand: web.DreamWhiteHandle},
chat.FAVOR_TABLES: {Hand: func(m *ice.Message, arg ...string) {
kit.If(m.Option(mdb.TYPE) == nfs.FILE, func() { m.PushButton(kit.Dict(m.CommandKey(), "源码")) })
}},

View File

@ -6,6 +6,7 @@ import (
"strings"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/lex"
@ -153,7 +154,9 @@ func init() {
ctx.ProcessField(m, m.PrefixKey(), m.Cmdx("", mdb.CREATE, mdb.TYPE, m.Option(mdb.TEXT), mdb.NAME, m.Option(mdb.NAME), mdb.TEXT, ""))
})
}},
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(m.CommandKey(), "终端")) }},
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
kit.If(aaa.IsTechOrRoot(m), func() { m.PushButton(kit.Dict(m.CommandKey(), "终端")) })
}},
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, cli.Shell(m), arg...) }},
}, chat.FavorAction(), ctx.ProcessAction(), mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,path")), Hand: func(m *ice.Message, arg ...string) {
if mdb.HashSelect(m, arg...); len(arg) == 0 {

View File

@ -80,6 +80,7 @@ func init() {
m.Copy(m.Spawn([]byte(m.Cmdx(nfs.CAT, p))))
}
}},
ice.CTX_INIT: {Hand: web.DreamWhiteHandle},
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(PORTAL, "官网")) }},
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }},
}, aaa.WhiteAction("")), Hand: func(m *ice.Message, arg ...string) {

View File

@ -36,6 +36,7 @@ func init() {
WordAlias(m, LABEL, CHART, LABEL)
WordAlias(m, CHAIN, CHART, CHAIN)
WordAlias(m, SEQUENCE, CHART, SEQUENCE)
web.DreamWhiteHandle(m, arg...)
}},
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
if mdb.IsSearchPreview(m, arg) {

View File

@ -49,6 +49,7 @@ func init() {
mdb.Config(m, aaa.USERNAME, m.Option(aaa.USERNAME))
mdb.Config(m, aaa.EMAIL, m.Option(aaa.EMAIL))
}},
ice.CTX_INIT: {Hand: web.DreamWhiteHandle},
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
if !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), _GIT)) {
m.Push(mdb.TEXT, "").PushButton(kit.Dict(m.CommandKey(), "源码"))