forked from x/icebergs
add some
This commit is contained in:
parent
ac90f10b41
commit
53b6706863
@ -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 {
|
func _role_check(value ice.Map, key []string, ok bool) bool {
|
||||||
white, black := value[WHITE].(ice.Map), value[BLACK].(ice.Map)
|
white, black := value[WHITE].(ice.Map), value[BLACK].(ice.Map)
|
||||||
for i := 0; i < len(key); i++ {
|
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(white[kit.Join(key[:i+1], ice.PT)], func() { ok = true })
|
||||||
kit.If(black[kit.Join(key[:i+1], ice.PT)], func() { ok = false })
|
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,
|
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))
|
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)
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
@ -14,7 +15,8 @@ const ADMIN = "admin"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
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_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(ADMIN, "后台")) }},
|
||||||
DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if kit.HasPrefixList(arg, ctx.ACTION, ADMIN) && len(arg) == 2 {
|
if kit.HasPrefixList(arg, ctx.ACTION, ADMIN) && len(arg) == 2 {
|
||||||
|
@ -437,3 +437,8 @@ func DreamEach(m *ice.Message, name string, status string, cb func(string)) *ice
|
|||||||
func DreamList(m *ice.Message) *ice.Message {
|
func DreamList(m *ice.Message) *ice.Message {
|
||||||
return m.SplitIndex(AdminCmd(m, DREAM))
|
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))
|
||||||
|
}
|
||||||
|
@ -278,7 +278,9 @@ func init() {
|
|||||||
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
|
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
|
||||||
})
|
})
|
||||||
case ORIGIN:
|
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:
|
case mdb.ICONS:
|
||||||
m.Options(nfs.DIR_REG, kit.ExtReg(nfs.PNG, nfs.JPG, nfs.JPEG), nfs.DIR_DEEP, ice.TRUE)
|
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)
|
m.Cmdy(nfs.DIR, nfs.SRC, nfs.PATH)
|
||||||
|
@ -41,9 +41,10 @@ func init() {
|
|||||||
AppInstall(m, cmd.Icon, m.PrefixKey())
|
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{
|
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_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...) }},
|
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }},
|
||||||
}, PodCmdAction(), CmdHashAction(), mdb.ExportHashAction())},
|
}, PodCmdAction(), CmdHashAction(), mdb.ExportHashAction())},
|
||||||
|
@ -9,7 +9,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
var tabs = can.misc.sessionStorage(can, [can.ConfIndex(), html.TABS])
|
var tabs = can.misc.sessionStorage(can, [can.ConfIndex(), html.TABS])
|
||||||
sub.onexport.output = function() { can.onimport._desktop(can, can._msg)
|
sub.onexport.output = function() { can.onimport._desktop(can, can._msg)
|
||||||
var sess = can.misc.SearchHash(can)[0]||can.Conf("session")
|
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))
|
var item = msg.TableDetail(); can.onimport.session(can, can.base.Obj(item.args))
|
||||||
}): !window.parent && can.isCmdMode() && can.onimport.session(can, tabs)
|
}): !window.parent && can.isCmdMode() && can.onimport.session(can, tabs)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package macos
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -9,7 +10,7 @@ const SESSION = "session"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
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 {
|
if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
||||||
m.EchoIFrame(m.MergePodCmd("", DESKTOP) + "#" + m.Append(mdb.NAME))
|
m.EchoIFrame(m.MergePodCmd("", DESKTOP) + "#" + m.Append(mdb.NAME))
|
||||||
}
|
}
|
||||||
|
@ -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) })
|
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) {
|
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(), "源码")) })
|
kit.If(m.Option(mdb.TYPE) == nfs.FILE, func() { m.PushButton(kit.Dict(m.CommandKey(), "源码")) })
|
||||||
}},
|
}},
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/lex"
|
"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, ""))
|
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...) }},
|
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) {
|
}, 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 {
|
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
||||||
|
@ -80,6 +80,7 @@ func init() {
|
|||||||
m.Copy(m.Spawn([]byte(m.Cmdx(nfs.CAT, p))))
|
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_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...) }},
|
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }},
|
||||||
}, aaa.WhiteAction("")), Hand: func(m *ice.Message, arg ...string) {
|
}, aaa.WhiteAction("")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -36,6 +36,7 @@ func init() {
|
|||||||
WordAlias(m, LABEL, CHART, LABEL)
|
WordAlias(m, LABEL, CHART, LABEL)
|
||||||
WordAlias(m, CHAIN, CHART, CHAIN)
|
WordAlias(m, CHAIN, CHART, CHAIN)
|
||||||
WordAlias(m, SEQUENCE, CHART, SEQUENCE)
|
WordAlias(m, SEQUENCE, CHART, SEQUENCE)
|
||||||
|
web.DreamWhiteHandle(m, arg...)
|
||||||
}},
|
}},
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if mdb.IsSearchPreview(m, arg) {
|
if mdb.IsSearchPreview(m, arg) {
|
||||||
|
@ -49,6 +49,7 @@ func init() {
|
|||||||
mdb.Config(m, aaa.USERNAME, m.Option(aaa.USERNAME))
|
mdb.Config(m, aaa.USERNAME, m.Option(aaa.USERNAME))
|
||||||
mdb.Config(m, aaa.EMAIL, m.Option(aaa.EMAIL))
|
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) {
|
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)) {
|
if !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), _GIT)) {
|
||||||
m.Push(mdb.TEXT, "").PushButton(kit.Dict(m.CommandKey(), "源码"))
|
m.Push(mdb.TEXT, "").PushButton(kit.Dict(m.CommandKey(), "源码"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user