forked from x/icebergs
opt role
This commit is contained in:
parent
da2b486b7c
commit
d2e3cada57
@ -2,7 +2,6 @@ package aaa
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -13,10 +12,6 @@ const (
|
||||
)
|
||||
const AAA = "aaa"
|
||||
|
||||
var Index = &ice.Context{Name: AAA, Help: "认证模块", Commands: ice.Commands{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
ice.Info.Load(m).Cmd(ROLE, ice.CTX_INIT).Cmd(ROLE, mdb.CREATE, TECH, VOID)
|
||||
}},
|
||||
}}
|
||||
var Index = &ice.Context{Name: AAA, Help: "认证模块"}
|
||||
|
||||
func init() { ice.Index.Register(Index, nil, APPLY, OFFER, EMAIL, USER, TOTP, SESS, ROLE, RSA) }
|
||||
|
@ -29,7 +29,7 @@ func init() {
|
||||
DF = ": "
|
||||
)
|
||||
Index.MergeCommands(ice.Commands{
|
||||
EMAIL: {Help: "邮件", Actions: ice.MergeActions(ice.Actions{
|
||||
EMAIL: {Help: "邮件", Role: VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create name*=admin service*='mail.shylinux.com:25' username*='shy@shylinux.com' password*"},
|
||||
MAILBOX: {Help: "邮箱", Hand: func(m *ice.Message, arg ...string) {
|
||||
if p := mdb.Config(m, MAILBOX); !m.Warn(p == "", ice.ErrNotValid, MAILBOX) {
|
||||
@ -47,9 +47,9 @@ func init() {
|
||||
auth := smtp.PlainAuth("", msg.Append(USERNAME), msg.Append(PASSWORD), kit.Split(msg.Append(SERVICE), ice.DF)[0])
|
||||
m.Logs(EMAIL, SEND, string(content)).Warn(smtp.SendMail(msg.Append(SERVICE), auth, msg.Append(USERNAME), kit.Split(m.Option(TO)), content))
|
||||
}},
|
||||
LOGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
LOGIN: {Role: VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo("input email: ")
|
||||
}},
|
||||
}, RoleAction(LOGIN), mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,service,username", ice.ACTION, SEND))},
|
||||
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,service,username", ice.ACTION, SEND))},
|
||||
})
|
||||
}
|
||||
|
@ -15,14 +15,14 @@ const OFFER = "offer"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
OFFER: {Help: "邀请", Actions: ice.MergeActions(ice.Actions{
|
||||
OFFER: {Help: "邀请", Role: VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create email*='shy@shylinux.com' subject content", Help: "邀请", Hand: func(m *ice.Message, arg ...string) {
|
||||
h := mdb.HashCreate(m.Spawn(), m.OptionSimple(EMAIL, SUBJECT, CONTENT), INVITE, m.Option(ice.MSG_USERNAME), mdb.STATUS, INVITE)
|
||||
m.Cmd(EMAIL, SEND, m.Option(EMAIL), "", m.OptionDefault(SUBJECT, "welcome to contexts, please continue"),
|
||||
m.OptionDefault(CONTENT, ice.Render(m, ice.RENDER_ANCHOR, m.Cmdx("host", "publish", m.MergePodCmd("", "", mdb.HASH, h)))),
|
||||
)
|
||||
}},
|
||||
ACCEPT: {Help: "接受", Hand: func(m *ice.Message, arg ...string) {
|
||||
ACCEPT: {Help: "接受", Role: VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Warn(m.Option(mdb.HASH) == "", ice.ErrNotValid, mdb.HASH) {
|
||||
return
|
||||
}
|
||||
@ -33,7 +33,7 @@ func init() {
|
||||
mdb.HashModify(m, m.OptionSimple(mdb.HASH), mdb.STATUS, ACCEPT)
|
||||
}
|
||||
}},
|
||||
}, RoleAction(ACCEPT), mdb.ImportantHashAction(mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,status,invite,email,title,content")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, mdb.ImportantHashAction(mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,status,invite,email,title,content")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if !m.Warn(len(arg) == 0 && m.Option(ice.MSG_USERROLE) == VOID, ice.ErrNotRight) {
|
||||
kit.If(mdb.HashSelect(m, arg...).FieldsIsDetail(), func() { m.PushAction(ACCEPT) })
|
||||
}
|
||||
|
@ -71,7 +71,22 @@ const ROLE = "role"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ROLE: {Name: "role role key auto insert filter:text", Help: "角色", Actions: ice.MergeActions(ice.Actions{
|
||||
ROLE: {Name: "role role key auto insert filter:text simple", Help: "角色", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(ROLE, mdb.CREATE, VOID, TECH)
|
||||
has := map[string]bool{VOID: true, TECH: true}
|
||||
m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) {
|
||||
role := map[string][]string{}
|
||||
kit.For(kit.Split(cmd.Role), func(k string) { role[k] = []string{} })
|
||||
for sub, action := range cmd.Actions {
|
||||
kit.For(kit.Split(action.Role), func(k string) { role[k] = append(role[k], sub) })
|
||||
}
|
||||
kit.For(role, func(role string, list []string) {
|
||||
kit.If(!has[role], func() { m.Cmd(ROLE, mdb.CREATE, role); has[role] = true })
|
||||
roleHandle(m, role, list...)
|
||||
})
|
||||
})
|
||||
}},
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case mdb.KEY:
|
||||
@ -83,7 +98,7 @@ func init() {
|
||||
mdb.Rich(m, ROLE, nil, kit.Dict(mdb.NAME, role, BLACK, kit.Dict(), WHITE, kit.Dict()))
|
||||
})
|
||||
}},
|
||||
mdb.INSERT: {Name: "insert role*=void,tech zone*=white,black key*", Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.INSERT: {Name: "insert role*=void zone*=white,black key*", Hand: func(m *ice.Message, arg ...string) {
|
||||
_role_set(m, m.Option(ROLE), m.Option(mdb.ZONE), m.Option(mdb.KEY), true)
|
||||
}},
|
||||
mdb.DELETE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -94,30 +109,44 @@ func init() {
|
||||
RIGHT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(_role_right(m, arg[0], kit.Split(_role_keys(arg[1:]...), ice.PT)...), func() { m.Echo(ice.OK) })
|
||||
}},
|
||||
"whiteblack": {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.For(arg, func(cmd string) { m.Cmd(ROLE, WHITE, VOID, cmd); m.Cmd(ROLE, BLACK, VOID, cmd, ice.ACTION) })
|
||||
"simple": {Hand: func(m *ice.Message, arg ...string) {
|
||||
list := map[string][]string{}
|
||||
m.Cmd("", func(value ice.Maps) {
|
||||
if value[mdb.ZONE] == WHITE {
|
||||
if strings.Contains(value[mdb.KEY], ".action.") {
|
||||
ls := strings.Split(value[mdb.KEY], ".action.")
|
||||
list[ls[0]] = append(list[ls[0]], ls[1])
|
||||
} else {
|
||||
list[value[mdb.KEY]] = []string{}
|
||||
}
|
||||
}
|
||||
})
|
||||
kit.For(list, func(cmd string, action []string) {
|
||||
m.Push(ice.CMD, cmd).Push("actions", kit.Join(action))
|
||||
})
|
||||
}},
|
||||
}, mdb.HashAction(mdb.SHORT, mdb.NAME)), Hand: func(m *ice.Message, arg ...string) {
|
||||
_role_list(m, kit.Select("", arg, 0), kit.Slice(arg, 1)...).PushAction(mdb.DELETE)
|
||||
}},
|
||||
})
|
||||
}
|
||||
func RoleAction(key ...string) ice.Actions {
|
||||
return ice.Actions{ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
func roleHandle(m *ice.Message, role string, key ...string) {
|
||||
role = kit.Select(VOID, role)
|
||||
cmd := m.PrefixKey()
|
||||
if c, ok := ice.Info.Index[m.CommandKey()].(*ice.Context); ok && c == m.Target() {
|
||||
cmd = m.CommandKey()
|
||||
}
|
||||
m.Cmd(ROLE, WHITE, VOID, cmd)
|
||||
m.Cmd(ROLE, BLACK, VOID, cmd, ice.ACTION)
|
||||
kit.For(key, func(key string) { m.Cmd(ROLE, WHITE, VOID, cmd, ice.ACTION, key) })
|
||||
}}}
|
||||
m.Cmd(ROLE, WHITE, role, cmd)
|
||||
m.Cmd(ROLE, BLACK, role, cmd, ice.ACTION)
|
||||
kit.For(key, func(key string) { m.Cmd(ROLE, WHITE, role, cmd, ice.ACTION, key) })
|
||||
}
|
||||
func WhiteAction(key ...string) ice.Actions {
|
||||
func WhiteAction(role string, key ...string) ice.Actions {
|
||||
role = kit.Select(VOID, role)
|
||||
return ice.Actions{ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(ROLE, WHITE, VOID, m.CommandKey())
|
||||
m.Cmd(ROLE, BLACK, VOID, m.CommandKey(), ice.ACTION)
|
||||
kit.For(key, func(key string) { m.Cmd(ROLE, WHITE, VOID, m.CommandKey(), ice.ACTION, key) })
|
||||
cmd := m.CommandKey()
|
||||
m.Cmd(ROLE, WHITE, role, cmd)
|
||||
m.Cmd(ROLE, BLACK, role, cmd, ice.ACTION)
|
||||
kit.For(key, func(key string) { m.Cmd(ROLE, WHITE, role, cmd, ice.ACTION, key) })
|
||||
}}}
|
||||
}
|
||||
func White(m *ice.Message, key ...string) {
|
||||
|
@ -49,7 +49,7 @@ const QRCODE = "qrcode"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
QRCODE: {Name: "qrcode text fg@key bg@key size auto", Help: "二维码", Meta: kit.Dict(
|
||||
QRCODE: {Name: "qrcode text fg@key bg@key size auto", Help: "二维码", Role: aaa.VOID, Meta: kit.Dict(
|
||||
ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict(
|
||||
mdb.TEXT, "文本", BG, "背景色", FG, "字体色",
|
||||
)),
|
||||
@ -65,7 +65,7 @@ func init() {
|
||||
m.Push(arg[0], BLACK, WHITE)
|
||||
}
|
||||
}},
|
||||
}, aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
}), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.IsCliUA() {
|
||||
m.OptionDefault(FG, BLACK, BG, WHITE)
|
||||
_qrcode_cli(m, kit.Select(kit.Select(ice.Info.Make.Domain, ice.Info.Domain), arg, 0))
|
||||
|
@ -75,7 +75,7 @@ const COMMAND = "command"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
COMMAND: {Name: "command key auto", Help: "命令", Actions: ice.MergeActions(ice.Actions{
|
||||
COMMAND: {Name: "command key auto", Help: "命令", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
TravelCmd(m, func(key, file, line string) { AddFileCmd(file, key) })
|
||||
m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) {
|
||||
@ -111,7 +111,7 @@ func init() {
|
||||
m.Echo(`%s %s %s;" f`+lex.NL, value[mdb.NAME], value[nfs.FILE], value[nfs.LINE])
|
||||
}).Cmd(nfs.SAVE, nfs.TAGS, m.Result())
|
||||
}},
|
||||
}, aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
}), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
m.Cmdy("", mdb.SEARCH, COMMAND, ice.OptionFields(INDEX)).Action(mdb.EXPORT)
|
||||
DisplayStory(m.Options(nfs.DIR_ROOT, "ice."), "spide.js?split=.")
|
||||
|
@ -143,7 +143,7 @@ const DREAM = "dream"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
DREAM: {Name: "dream name@key auto create repos startall stopall build publish", Help: "梦想家", Icon: "Launchpad.png", Actions: ice.MergeActions(ice.Actions{
|
||||
DREAM: {Name: "dream name@key auto create repos startall stopall build publish", Help: "梦想家", Icon: "Launchpad.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m = m.Spawn()
|
||||
m.GoSleep("10s", func() {
|
||||
@ -310,7 +310,7 @@ func init() {
|
||||
PushStats(m, kit.Keys(m.CommandKey(), mdb.TOTAL), msg.Length(), "", "已启动空间")
|
||||
}
|
||||
}},
|
||||
}, aaa.RoleAction(), StatsAction(), DreamAction(), mdb.ImportantHashAction(ctx.TOOLS, ROUTE, mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template,restart")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, StatsAction(), DreamAction(), mdb.ImportantHashAction(ctx.TOOLS, 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 {
|
||||
|
@ -71,7 +71,7 @@ const SHARE = "share"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SHARE: {Name: "share hash auto login", Help: "共享链", Actions: ice.MergeActions(ice.Actions{
|
||||
SHARE: {Name: "share hash auto login", Help: "共享链", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||
// kit.If(m.Option(mdb.TYPE) == LOGIN, func() { arg = append(arg, mdb.TEXT, tcp.PublishLocalhost(m, m.Option(mdb.TEXT))) })
|
||||
kit.If(m.Option(mdb.TYPE) == LOGIN && m.Option(mdb.TEXT) == "", func() { arg = append(arg, mdb.TEXT, tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB))) })
|
||||
@ -113,7 +113,7 @@ func init() {
|
||||
RenderMain(m)
|
||||
}
|
||||
}},
|
||||
}, aaa.WhiteAction(), mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,usernick,username,userrole", mdb.EXPIRE, mdb.DAYS)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,usernick,username,userrole", mdb.EXPIRE, mdb.DAYS)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if kit.IsIn(m.Option(ice.MSG_USERROLE), aaa.ROOT, aaa.TECH) || len(arg) > 0 && arg[0] != "" {
|
||||
mdb.HashSelect(m, arg...)
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ func init() {
|
||||
PushStats(m, "", m.Cmd(aaa.USER).Length()-2, "", "用户总数", aaa.USER)
|
||||
}
|
||||
PushStats(m, "", "", "", "会话总数", aaa.SESS)
|
||||
PushStats(m, "", m.Cmd(mdb.SELECT, aaa.ROLE, "", mdb.HASH).Length(), "", "角色总数", aaa.ROLE)
|
||||
PushStats(m, "", "", "", "令牌总数", TOKEN)
|
||||
PushStats(m, "", "", "", "共享总数", SHARE)
|
||||
PushStats(m, "", "", "", "命令总数", ctx.COMMAND)
|
||||
|
@ -87,7 +87,7 @@ func init() {
|
||||
|
||||
func ApiAction(arg ...string) ice.Actions { return ice.Actions{kit.Select(nfs.PS, arg, 0): {}} }
|
||||
func ApiWhiteAction() ice.Actions {
|
||||
return ice.MergeActions(ApiAction(), aaa.WhiteAction())
|
||||
return ice.MergeActions(ApiAction(), aaa.WhiteAction(""))
|
||||
}
|
||||
func Prefix(arg ...string) string {
|
||||
for i, k := range arg {
|
||||
|
@ -68,7 +68,7 @@ func init() {
|
||||
m.Cmdy(mdb.MODIFY, RIVER, _storm_key(m), mdb.LIST, m.OptionSimple(mdb.ID), arg)
|
||||
}},
|
||||
web.SHARE: {Hand: func(m *ice.Message, arg ...string) { _action_share(m, arg...) }},
|
||||
}, web.ApiAction(), aaa.WhiteAction(web.SHARE)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, web.ApiAction(""), aaa.WhiteAction(web.SHARE)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, arg) {
|
||||
return
|
||||
} else if m.Warn(!_river_right(m, arg[0]), ice.ErrNotRight, arg) {
|
||||
|
@ -19,7 +19,7 @@ const GRANT = "grant"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
GRANT: {Name: "grant space auto", Help: "授权", Actions: ice.MergeActions(ice.Actions{
|
||||
GRANT: {Name: "grant space auto", Help: "授权", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
web.SPACE_LOGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.GoSleep30ms(func() {
|
||||
p := m.Cmdx(web.SPACE, web.DOMAIN)
|
||||
@ -28,7 +28,7 @@ func init() {
|
||||
})
|
||||
}},
|
||||
web.HOME: {Help: "首页", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(web.MergeLink(m, web.CHAT_PORTAL)) }},
|
||||
aaa.CONFIRM: {Help: "授权", Hand: func(m *ice.Message, arg ...string) {
|
||||
aaa.CONFIRM: {Help: "授权", Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Warn(m.R.Method == http.MethodGet, ice.ErrNotAllow) {
|
||||
return
|
||||
} else if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin) || m.Warn(m.Option(web.SPACE) == "", ice.ErrNotValid, web.SPACE) {
|
||||
@ -49,7 +49,7 @@ func init() {
|
||||
gdb.Event(m, web.SPACE_GRANT, m.OptionSimple(web.SPACE))
|
||||
}
|
||||
}},
|
||||
}, aaa.RoleAction(aaa.CONFIRM), gdb.EventsAction(web.SPACE_LOGIN)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, gdb.EventsAction(web.SPACE_LOGIN)), Hand: func(m *ice.Message, arg ...string) {
|
||||
msg := m.Cmd(web.SPACE, m.Option(web.SPACE, arg[0]))
|
||||
m.Options(tcp.HOSTNAME, ice.Info.Hostname, nfs.PATH, msg.Append(mdb.TEXT))
|
||||
if !m.Warn(m.Option(nfs.PATH) == "", ice.ErrNotFound, arg[0]) {
|
||||
|
@ -43,10 +43,10 @@ func init() {
|
||||
})
|
||||
Notify(m, "Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
|
||||
}},
|
||||
DESKTOP: {Help: "应用桌面", Actions: ice.MergeActions(ice.Actions{
|
||||
DESKTOP: {Help: "应用桌面", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
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...) }},
|
||||
}, aaa.RoleAction(), PodCmdAction(), CmdHashAction(), mdb.ExportHashAction())},
|
||||
}, PodCmdAction(), CmdHashAction(), mdb.ExportHashAction())},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ const DOCK = "dock"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
DOCK: {Help: "工具栏", Actions: ice.MergeActions(ice.Actions{}, aaa.RoleAction(), CmdHashAction(), mdb.ExportHashAction())},
|
||||
DOCK: {Help: "工具栏", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{}, CmdHashAction(), mdb.ExportHashAction())},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ const MENU = "menu"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
MENU: {Help: "菜单栏", Actions: ice.MergeActions(aaa.RoleAction(), CmdHashAction(), mdb.ClearOnExitHashAction())},
|
||||
MENU: {Help: "菜单栏", Role: aaa.VOID, Actions: ice.MergeActions(CmdHashAction(), mdb.ClearOnExitHashAction())},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ const INNER = "inner"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
INNER: {Name: "inner path=src/ file=main.go line=1 auto", Help: "源代码", Actions: ice.MergeActions(ice.Actions{
|
||||
INNER: {Name: "inner path=src/ file=main.go line=1 auto", Help: "源代码", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(FAVOR, mdb.INPUTS, arg) }},
|
||||
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmdy(mdb.PLUGIN, arg); m.Result() == "" {
|
||||
@ -101,7 +101,7 @@ func init() {
|
||||
NAVIGATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(NAVIGATE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH))
|
||||
}},
|
||||
}, aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
}), Hand: func(m *ice.Message, arg ...string) {
|
||||
if kit.HasPrefix(arg[0], "/volcanos/", "/require/", ice.HTTP) {
|
||||
if kit.HasPrefix(arg[0], nfs.REQUIRE_SRC) {
|
||||
m.Option(nfs.FILE, strings.Split(strings.TrimPrefix(arg[0], nfs.REQUIRE_SRC), "?")[0])
|
||||
|
@ -75,12 +75,12 @@ const PUBLISH = "publish"
|
||||
|
||||
func init() {
|
||||
web.Index.MergeCommands(ice.Commands{
|
||||
web.PP(ice.PUBLISH): {Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
web.PP(ice.PUBLISH): {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
web.ShareLocalFile(m, ice.USR_PUBLISH, path.Join(arg...))
|
||||
}},
|
||||
})
|
||||
Index.MergeCommands(ice.Commands{
|
||||
PUBLISH: {Name: "publish path auto create volcanos icebergs intshell", Help: "发布", Actions: ice.MergeActions(ice.Actions{
|
||||
PUBLISH: {Name: "publish path auto create volcanos icebergs intshell", Help: "发布", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
ice.VOLCANOS: {Help: "火山架", Hand: func(m *ice.Message, arg ...string) { _publish_list(m, kit.ExtReg(HTML, CSS, JS)) }},
|
||||
ice.ICEBERGS: {Help: "冰山架", Hand: func(m *ice.Message, arg ...string) { _publish_bin_list(m).Cmdy("", ice.CONTEXTS) }},
|
||||
ice.INTSHELL: {Help: "神农架", Hand: func(m *ice.Message, arg ...string) { _publish_list(m, kit.ExtReg(SH, VIM, CONF)) }},
|
||||
@ -113,7 +113,7 @@ func init() {
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.DIR, arg[1:], nfs.DIR_CLI_FIELDS) }},
|
||||
mdb.CREATE: {Hand: func(m *ice.Message, arg ...string) { _publish_file(m, m.Option(nfs.PATH)) }},
|
||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) { nfs.Trash(m, path.Join(ice.USR_PUBLISH, m.Option(nfs.PATH))) }},
|
||||
}, aaa.RoleAction(), ctx.ConfAction(mdb.FIELD, nfs.PATH)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, ctx.ConfAction(mdb.FIELD, nfs.PATH)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Option(nfs.DIR_ROOT, ice.USR_PUBLISH); len(arg) == 0 {
|
||||
_publish_list(m).Cmdy("", ice.CONTEXTS, ice.APP)
|
||||
} else {
|
||||
|
@ -74,7 +74,7 @@ func init() {
|
||||
}},
|
||||
})
|
||||
Index.MergeCommands(ice.Commands{
|
||||
VIMER: {Name: "vimer path=src/ file=main.go line=1 list", Help: "编辑器", Icon: "vimer.png", Meta: kit.Dict(
|
||||
VIMER: {Name: "vimer path=src/ file=main.go line=1 list", Help: "编辑器", Icon: "vimer.png", Role: aaa.VOID, Meta: kit.Dict(
|
||||
ctx.STYLE, INNER, ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict(cli.MAIN, "程序")),
|
||||
), Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -211,7 +211,7 @@ func init() {
|
||||
}},
|
||||
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...) }},
|
||||
}, aaa.RoleAction(), chat.FavorAction(), ctx.ConfAction(ctx.TOOLS, "xterm,compile,runtime")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, chat.FavorAction(), ctx.ConfAction(ctx.TOOLS, "xterm,compile,runtime")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmdy(INNER, arg); arg[0] != ctx.ACTION {
|
||||
if web.IsLocalHost(m) {
|
||||
m.Action(nfs.SAVE, COMPILE, mdb.SHOW, cli.EXEC, ice.APP)
|
||||
|
@ -13,7 +13,7 @@ const CART = "cart"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
CART: {Name: "cart list", Help: "购物车", Actions: ice.MergeActions(ice.Actions{
|
||||
CART: {Name: "cart list", Help: "购物车", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INSERT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Options(mdb.SUBKEY, kit.Keys(mdb.HASH, mdb.HashCreate(m.Spawn(), aaa.USERNAME, m.Option(ice.MSG_USERNAME), mdb.SHORT, GOODS)))
|
||||
mdb.HashCreate(m.Spawn(), GOODS, m.Option(mdb.HASH), m.OptionSimple(mdb.COUNT))
|
||||
@ -31,7 +31,7 @@ func init() {
|
||||
m.Options(mdb.HASH, m.Cmdx(ORDER, mdb.CREATE, aaa.USERNAME, m.Option(ice.MSG_USERNAME), mdb.STATUS, ORDER_CONFIRM, AMOUNT, amount))
|
||||
msg.Table(func(value ice.Maps) { m.Cmd(ORDER, mdb.INSERT, kit.Simple(value)) })
|
||||
}},
|
||||
}, aaa.RoleAction(), mdb.ExportHashAction(mdb.SHORT, aaa.USERNAME, mdb.FIELD, "time,username", mdb.FIELDS, "time,goods,count")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, mdb.ExportHashAction(mdb.SHORT, aaa.USERNAME, mdb.FIELD, "time,username", mdb.FIELDS, "time,goods,count")), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Options(mdb.SUBKEY, kit.KeyHash(m.Option(ice.MSG_USERNAME))).OptionFields(mdb.Config(m, mdb.FIELDS))
|
||||
mdb.HashSelect(m, arg...).Options(mdb.SUBKEY, "").Table(func(value ice.Maps) {
|
||||
m.Cmd(GOODS, value[GOODS], func(value ice.Maps) {
|
||||
|
@ -19,7 +19,7 @@ const GOODS = "goods"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
GOODS: {Help: "商品", Icon: "mall.png", Actions: ice.MergeActions(ice.Actions{
|
||||
GOODS: {Help: "商品", Icon: "mall.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create zone* name* text price* count*=1 units*=件 image*=4@img"},
|
||||
// mdb.MODIFY: {Name: "modify zone* name* text price* count*=1 units*=件 image*=4@img"},
|
||||
ORDER: {Name: "order count*=1", Help: "选购", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(CART, mdb.INSERT, arg) }},
|
||||
@ -36,7 +36,7 @@ func init() {
|
||||
web.PushStats(m, kit.Keys(m.CommandKey(), mdb.COUNT), msg.Length(), "", "商品数量")
|
||||
}
|
||||
}},
|
||||
}, aaa.RoleAction(), web.StatsAction(), web.ExportCacheAction(nfs.IMAGE), mdb.ExportHashAction(ctx.TOOLS, kit.Fields(Prefix(CART), Prefix(ORDER)), mdb.FIELD, "time,hash,zone,name,text,price,count,units,image")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, web.StatsAction(), web.ExportCacheAction(nfs.IMAGE), mdb.ExportHashAction(ctx.TOOLS, kit.Fields(Prefix(CART), Prefix(ORDER)), mdb.FIELD, "time,hash,zone,name,text,price,count,units,image")), Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(len(arg) == 0 && m.IsMobileUA(), func() { m.OptionDefault(ice.MSG_FIELDS, "zone,name,price,count,units,text,hash,time,image") })
|
||||
mdb.HashSelect(m, arg...).PushAction(ORDER).Action("filter:text")
|
||||
web.PushPodCmd(m, "", arg...).Sort("zone,name")
|
||||
|
@ -27,7 +27,7 @@ const ORDER = "order"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ORDER: {Help: "订单", Actions: ice.MergeActions(ice.Actions{
|
||||
ORDER: {Help: "订单", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INSERT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Options(mdb.SUBKEY, kit.Keys(mdb.HASH, m.Option(mdb.HASH)))
|
||||
mdb.HashCreate(m, arg)
|
||||
@ -38,7 +38,7 @@ func init() {
|
||||
RECEIVE: {Help: "收货", Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, mdb.STATUS, ORDER_RECEIVED) }},
|
||||
RETURN: {Help: "退货", Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, mdb.STATUS, ORDER_RETURNED) }},
|
||||
REFUND: {Help: "退钱", Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, mdb.STATUS, ORDER_REFUNDED) }},
|
||||
}, aaa.RoleAction(), mdb.ExportHashAction(mdb.FIELD, "time,hash,username,status,amount", mdb.FIELDS, "time,goods,price,count,units,name,text,image")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, mdb.ExportHashAction(mdb.FIELD, "time,hash,username,status,amount", mdb.FIELDS, "time,goods,price,count,units,name,text,image")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
stats := map[string]int{}
|
||||
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||
|
@ -57,7 +57,7 @@ const PLAN = "plan"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
PLAN: {Name: "plan scale=month,day,week,month,year,long begin_time@date list insert prev next", Icon: "Calendar.png", Help: "计划表", Meta: kit.Dict(
|
||||
PLAN: {Name: "plan scale=month,day,week,month,year,long begin_time@date list insert prev next", Help: "计划表", Icon: "Calendar.png", Role: aaa.VOID, Meta: kit.Dict(
|
||||
ctx.TRANS, kit.Dict(html.INPUT, kit.Dict(
|
||||
SCALE, "跨度", "view", "视图",
|
||||
DAY, "日", WEEK, "周", MONTH, "月", YEAR, "年", LONG, "代",
|
||||
@ -77,7 +77,7 @@ func init() {
|
||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.WORKER, web.SERVER), func() { m.PushButton(kit.Dict(m.CommandKey(), "计划")) })
|
||||
}},
|
||||
}, aaa.RoleAction(), ctx.ConfAction(mdb.TOOLS, "todo,epic"), TASK), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, ctx.ConfAction(mdb.TOOLS, "todo,epic"), TASK), Hand: func(m *ice.Message, arg ...string) {
|
||||
begin_time, end_time := _plan_scope(m, kit.Slice(arg, 0, 2)...)
|
||||
_plan_list(m, begin_time.Format(ice.MOD_TIME), end_time.Format(ice.MOD_TIME))
|
||||
web.PushPodCmd(m, "", arg...)
|
||||
|
@ -14,7 +14,7 @@ const DRAW = "draw"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
DRAW: {Name: "draw path=src/main.svg pid list save actions", Icon: "Grapher.png", Help: "思维导图", Actions: ice.MergeActions(ice.Actions{
|
||||
DRAW: {Name: "draw path=src/main.svg pid list save actions", Help: "思维导图", Icon: "Grapher.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, mdb.Config(m, lex.REGEXP), m.PrefixKey())
|
||||
}},
|
||||
@ -22,6 +22,6 @@ func init() {
|
||||
defer m.Echo("<!DOCTYPE html><html><body>").Echo("</body></html>")
|
||||
m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1]))
|
||||
}},
|
||||
}, aaa.RoleAction(), WikiAction("", nfs.SVG))},
|
||||
}, WikiAction("", nfs.SVG))},
|
||||
})
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ const PORTAL = "portal"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
PORTAL: {Name: "portal path auto", Help: "网站门户", Actions: ice.MergeActions(ice.Actions{
|
||||
PORTAL: {Name: "portal path auto", Help: "网站门户", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { web.RenderCmd(m, "", arg) }},
|
||||
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if p := path.Join(ice.USR_PORTAL, path.Join(arg...)); (m.Option(ice.DEBUG) == ice.TRUE || !nfs.ExistsFile(m, p)) && aaa.Right(m.Spawn(), arg) {
|
||||
@ -82,7 +82,7 @@ func init() {
|
||||
}},
|
||||
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(), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, aaa.WhiteAction("")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Push(HEADER, m.Cmdx(WORD, path.Join(nfs.SRC_DOCUMENT, INDEX_SHY))); len(arg) > 0 {
|
||||
kit.If(path.Join(arg...) == "commands", func() { _portal_commands(m, arg...) })
|
||||
m.Push(NAV, m.Cmdx(WORD, path.Join(nfs.SRC_DOCUMENT, path.Join(arg...), INDEX_SHY)))
|
||||
|
@ -25,7 +25,7 @@ const WORD = "word"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
WORD: {Name: "word path=src/main.shy@key auto play favor", Help: "上下文", Icon: "Books.png", Actions: ice.MergeActions(ice.Actions{
|
||||
WORD: {Name: "word path=src/main.shy@key auto play favor", Help: "上下文", Icon: "Books.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
WordAlias(m, NAVMENU, TITLE, NAVMENU)
|
||||
WordAlias(m, PREMENU, TITLE, PREMENU)
|
||||
@ -73,7 +73,7 @@ func init() {
|
||||
m.Cmd(web.CHAT_FAVOR, mdb.CREATE, mdb.TYPE, nfs.SHY, mdb.NAME, path.Base(arg[0]), mdb.TEXT, arg[0])
|
||||
m.ProcessHold("favor success")
|
||||
}},
|
||||
}, aaa.RoleAction(), WikiAction("", nfs.SHY), mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, WikiAction("", nfs.SHY), mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) > 0 {
|
||||
mdb.HashCreate(m.Spawn(), nfs.PATH, arg[0])
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ func init() {
|
||||
}},
|
||||
})
|
||||
Index.MergeCommands(ice.Commands{
|
||||
REPOS: {Name: "repos repos branch:text commit:text file:text auto", Help: "代码库", Actions: ice.MergeActions(ice.Actions{
|
||||
REPOS: {Name: "repos repos branch:text commit:text file:text auto", Help: "代码库", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
_repos_insert(m, kit.Path(""))
|
||||
m.Cmd(nfs.DIR, nfs.USR, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) })
|
||||
@ -454,7 +454,7 @@ func init() {
|
||||
_git_cmd(m, CONFIG, GLOBAL, "url."+m.Option(REMOTE)+_INSTEADOF, strings.TrimSuffix(ice.Info.Make.Remote, path.Base(ice.Info.Make.Remote)))
|
||||
}
|
||||
}},
|
||||
REMOTE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
REMOTE: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
repos := _repos_open(m, kit.Select(path.Base(kit.Path("")), kit.Select(m.Option(REPOS), arg, 0)))
|
||||
if _remote, err := repos.Remote(ORIGIN); err == nil {
|
||||
m.Push(REMOTE, kit.Select("", _remote.Config().URLs, 0))
|
||||
@ -635,7 +635,14 @@ func init() {
|
||||
m.Cmd("", CLONE, ORIGIN, "node_modules", mdb.NAME, "", nfs.PATH, "")
|
||||
m.Cmd("", CLONE, ORIGIN, "icons", mdb.NAME, "", nfs.PATH, "")
|
||||
}},
|
||||
}, aaa.RoleAction(REMOTE), web.StatsAction("", "代码库总数"), web.DreamAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,message,origin"), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
web.STATS_TABLES: {Hand: func(m *ice.Message, _ ...string) {
|
||||
if ice.Info.NodeType == web.SERVER {
|
||||
if msg := mdb.HashSelects(m.Spawn()); msg.Length() > 0 {
|
||||
web.PushStats(m, kit.Keys(m.CommandKey(), mdb.TOTAL), msg.Length(), "", "代码库总数")
|
||||
}
|
||||
}
|
||||
}},
|
||||
}, web.StatsAction("", "代码库总数"), web.DreamAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,message,origin"), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
mdb.HashSelect(m, arg...).Sort(REPOS).PushAction(STATUS, mdb.REMOVE).Action(CLONE, PULL, PUSH, STATUS)
|
||||
} else if repos := _repos_open(m, arg[0]); len(arg) == 1 {
|
||||
|
@ -107,7 +107,7 @@ const (
|
||||
const SERVICE = "service"
|
||||
|
||||
func init() {
|
||||
web.Index.MergeCommands(ice.Commands{"/x/": {Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
web.Index.MergeCommands(ice.Commands{"/x/": {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
if !m.IsCliUA() {
|
||||
web.RenderCmd(m, web.CODE_GIT_SERVICE, arg)
|
||||
return
|
||||
|
@ -29,7 +29,7 @@ const STATUS = "status"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
STATUS: {Name: "status repos:text auto", Help: "代码库", Icon: "git.png", Meta: kit.Dict(
|
||||
STATUS: {Name: "status repos:text auto", Help: "代码库", Icon: "git.png", Role: aaa.VOID, Meta: kit.Dict(
|
||||
ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict("actions", "操作", "message", "信息")),
|
||||
), Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -70,7 +70,7 @@ func init() {
|
||||
m.PushButton(kit.Dict(m.CommandKey(), "源码"))
|
||||
}},
|
||||
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }},
|
||||
}, aaa.RoleAction(), Prefix(REPOS)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, Prefix(REPOS)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) > 0 && arg[0] == ctx.ACTION {
|
||||
m.Cmdy(REPOS, arg)
|
||||
} else if config, err := config.LoadConfig(config.GlobalScope); err == nil && config.User.Email == "" && mdb.Config(m, aaa.EMAIL) == "" {
|
||||
|
@ -50,7 +50,7 @@ const ACCESS = "access"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ACCESS: {Help: "认证", Meta: Meta(), Actions: ice.MergeActions(ice.Actions{
|
||||
ACCESS: {Help: "认证", Role: aaa.VOID, Meta: Meta(), Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, WX, mdb.Config(m, tcp.SERVER))
|
||||
}},
|
||||
@ -89,7 +89,7 @@ func init() {
|
||||
m.Cmd(web.CHAT_HEADER, mdb.CREATE, mdb.TYPE, mdb.PLUGIN, m.OptionSimple(mdb.NAME, mdb.ORDER),
|
||||
ctx.INDEX, m.PrefixKey(), ctx.ARGS, kit.Join(kit.Simple(aaa.LOGIN, m.Option(ACCESS), m.Option(tcp.WIFI), m.Option(ENV))))
|
||||
}},
|
||||
aaa.LOGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
aaa.LOGIN: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmd("", m.Option(ACCESS, arg[0])).Append(mdb.TYPE) == ice.WEB {
|
||||
m.Cmdy(SCAN, mdb.CREATE, mdb.TYPE, QR_STR_SCENE, mdb.NAME, "请授权登录", mdb.TEXT, m.Option(web.SPACE), ctx.INDEX, web.CHAT_GRANT, ctx.ARGS, m.Option(web.SPACE))
|
||||
} else {
|
||||
@ -109,7 +109,7 @@ func init() {
|
||||
m.Cmd(mdb.PRUNES, m.Prefix(SCAN), "", mdb.HASH, m.OptionSimple(mdb.NAME))
|
||||
m.Cmd(mdb.PRUNES, m.Prefix(IDE), "", mdb.HASH, m.OptionSimple(mdb.NAME))
|
||||
}},
|
||||
}, aaa.RoleAction(aaa.LOGIN), gdb.EventsAction(web.SPACE_GRANT, web.SPACE_LOGIN_CLOSE), mdb.ImportantHashAction(mdb.SHORT, ACCESS, mdb.FIELD, "time,type,access,icons,usernick,appid", tcp.SERVER, CGI_BIN)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, gdb.EventsAction(web.SPACE_GRANT, web.SPACE_LOGIN_CLOSE), mdb.ImportantHashAction(mdb.SHORT, ACCESS, mdb.FIELD, "time,type,access,icons,usernick,appid", tcp.SERVER, CGI_BIN)), Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m, arg...).PushAction(web.SSO, mdb.REMOVE).StatusTimeCount(mdb.ConfigSimple(m, ACCESS, APPID), web.SERVE, web.MergeLink(m, "/chat/wx/login/"))
|
||||
m.RewriteAppend(func(value, key string, index int) string {
|
||||
kit.If(key == cli.QRCODE, func() { value = ice.Render(m, ice.RENDER_QRCODE, value) })
|
||||
|
@ -36,13 +36,13 @@ const AGENT = "agent"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
AGENT: {Name: "agent auto", Help: "代理", Actions: ice.MergeActions(ice.Actions{
|
||||
AGENT: {Name: "agent auto", Help: "代理", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
chat.HEADER_AGENT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(strings.Index(m.Option(ice.MSG_USERUA), "MicroMessenger") > -1, func() { m.Option(mdb.PLUGIN, m.PrefixKey()) })
|
||||
}},
|
||||
"getLocation": {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(location.LOCATION, mdb.CREATE, arg) }},
|
||||
"scanQRCode1": {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(chat.FAVOR, mdb.CREATE, arg) }},
|
||||
}, aaa.RoleAction(), gdb.EventsAction(chat.HEADER_AGENT), ctx.ConfAction(nfs.SCRIPT, "https://res.wx.qq.com/open/js/jweixin-1.6.0.js")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, gdb.EventsAction(chat.HEADER_AGENT), ctx.ConfAction(nfs.SCRIPT, "https://res.wx.qq.com/open/js/jweixin-1.6.0.js")), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(ACCESS, AGENT).Options(SIGNATURE, _wx_sign(m, m.Option(NONCESTR, ice.Info.Pathname), m.Option(TIMESTAMP, kit.Format(time.Now().Unix())))).Display("")
|
||||
ctx.OptionFromConfig(m, nfs.SCRIPT)
|
||||
}},
|
||||
|
@ -76,7 +76,7 @@ func init() {
|
||||
)
|
||||
if false {
|
||||
web.Index.MergeCommands(ice.Commands{
|
||||
"/MP_verify_0xp0zkW3fIzIq2Bo.txt": {Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) { m.RenderResult("0xp0zkW3fIzIq2Bo") }},
|
||||
"/MP_verify_0xp0zkW3fIzIq2Bo.txt": {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) { m.RenderResult("0xp0zkW3fIzIq2Bo") }},
|
||||
})
|
||||
}
|
||||
Index.MergeCommands(ice.Commands{
|
||||
@ -98,7 +98,7 @@ func init() {
|
||||
}},
|
||||
SCENE: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(IDE, m.Option(SCENE)) }},
|
||||
SCAN: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(web.CHAT_FAVOR, mdb.CREATE, mdb.TYPE, "", arg) }},
|
||||
}, aaa.WhiteAction(aaa.SESS, aaa.USER, SCENE)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, aaa.WhiteAction("", aaa.SESS, aaa.USER, SCENE)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmdx(ACCESS, aaa.CHECK) == "" {
|
||||
return
|
||||
} else if m.Option("echostr") != "" {
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
func init() {
|
||||
web.Index.MergeCommands(ice.Commands{
|
||||
web.PP(PAGES): {Actions: aaa.WhiteAction(ctx.ACTION), Hand: func(m *ice.Message, arg ...string) {
|
||||
web.PP(PAGES): {Actions: aaa.WhiteAction("", ctx.ACTION), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg[0]) == 0 || arg[0] == "" || arg[0] == chat.RIVER {
|
||||
web.RenderMain(m)
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user