forked from x/icebergs
add some
This commit is contained in:
parent
1f0f934ec0
commit
21fdda3335
@ -85,6 +85,7 @@ func (s apply) Login(m *ice.Message, arg ...string) {
|
||||
}
|
||||
func (s apply) List(m *ice.Message, arg ...string) *ice.Message {
|
||||
kit.If(m.Option(_cookie_key(m)), func(p string) { arg = []string{p} })
|
||||
kit.If(!m.IsTech(), func() { m.Option(ice.MSG_ONLINE, ice.FALSE) })
|
||||
if m.IsTech() || (len(arg) > 0 && arg[0] != "") {
|
||||
s.Hash.List(m, arg...).Table(func(value ice.Maps) {
|
||||
switch value[mdb.STATUS] {
|
||||
|
@ -71,6 +71,6 @@ func DisplayBase(m *ice.Message, file string, arg ...ice.Any) *ice.Message {
|
||||
return Toolkit(m, "")
|
||||
}
|
||||
func Toolkit(m *ice.Message, arg ...string) *ice.Message {
|
||||
m.Option("sess.online", mdb.Config(m, "online"))
|
||||
m.OptionDefault(ice.MSG_ONLINE, mdb.Config(m, "online"))
|
||||
return m.Options(ice.MSG_TOOLKIT, kit.Select(mdb.Config(m, mdb.TOOLS), kit.Fields(arg)))
|
||||
}
|
||||
|
@ -100,7 +100,10 @@ func _space_fork(m *ice.Message) {
|
||||
case SERVER:
|
||||
defer gdb.EventDeferEvent(m, SPACE_OPEN, args)(SPACE_CLOSE, args)
|
||||
m.Go(func() {
|
||||
m.Cmd(SPACE, name, cli.PWD, name, kit.Dict(mdb.TIME, ice.Info.Make.Time, nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(), AGENT, "Go-http-client", cli.SYSTEM, runtime.GOOS))
|
||||
m.Cmd(SPACE, name, cli.PWD, name, kit.Dict(
|
||||
ice.MSG_USERROLE, aaa.TECH, ice.MSG_USERNAME, ice.Info.Make.Username,
|
||||
mdb.TIME, ice.Info.Make.Time, nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(),
|
||||
AGENT, "Go-http-client", cli.SYSTEM, runtime.GOOS))
|
||||
m.Cmd(SPACE).Table(func(value ice.Maps) {
|
||||
if kit.IsIn(value[mdb.TYPE], WORKER) && value[mdb.NAME] != name {
|
||||
m.Cmd(SPACE, value[mdb.NAME], gdb.EVENT, gdb.HAPPEN, gdb.EVENT, OPS_SERVER_OPEN, args, kit.Dict(ice.MSG_USERROLE, aaa.TECH))
|
||||
@ -123,8 +126,7 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
|
||||
}
|
||||
msg := m.Spawn(b)
|
||||
if safe { // 下行权限
|
||||
kit.If(msg.Option(ice.MSG_USERROLE) == aaa.VOID, func() { msg.Option(ice.MSG_USERROLE, "") })
|
||||
msg.OptionDefault(ice.MSG_USERROLE, aaa.UserRole(msg, msg.Option(ice.MSG_USERNAME)))
|
||||
kit.If(kit.IsIn(msg.Option(ice.MSG_USERROLE), "", aaa.VOID), func() { msg.Option(ice.MSG_USERROLE, aaa.UserRole(msg, msg.Option(ice.MSG_USERNAME))) })
|
||||
} else { // 上行权限
|
||||
kit.If(msg.Option(ice.MSG_USERROLE), func() { msg.Option(ice.MSG_USERROLE, aaa.VOID) })
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"path"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
@ -29,7 +30,7 @@ func DevTokenAction(name, origin string) ice.Actions {
|
||||
return ice.Actions{
|
||||
DEV_REQUEST_TEXT: {Hand: func(m *ice.Message, arg ...string) { m.Echo(UserHost(m)) }},
|
||||
DEV_CREATE_TOKEN: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||
mdb.DEV_REQUEST: {Name: "dev.request", Help: "连接", Icon: "bi bi-person-down", Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.DEV_REQUEST: {Help: "请求", Icon: "bi bi-person-down", Hand: func(m *ice.Message, arg ...string) {
|
||||
back := m.Options(ice.MSG_USERWEB, m.Option(ice.MSG_USERHOST)).MergePod("")
|
||||
m.ProcessOpen(m.Options(ice.MSG_USERWEB, m.Option(origin), ice.MSG_USERPOD, "").MergePodCmd("", m.ShortKey(),
|
||||
ctx.ACTION, mdb.DEV_CHOOSE, cli.BACK, back, cli.DAEMON, m.Option(ice.MSG_DAEMON),
|
||||
@ -37,7 +38,7 @@ func DevTokenAction(name, origin string) ice.Actions {
|
||||
))
|
||||
}},
|
||||
mdb.DEV_CHOOSE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.EchoInfoButton(kit.JoinWord(m.ShortKey(), m.Cmdx(nfs.CAT, nfs.SRC_TEMPLATE+"web.token/saveto.html"), m.Option(cli.BACK)), mdb.DEV_RESPONSE)
|
||||
m.EchoInfoButton(kit.JoinWord(m.ShortKey(), m.Cmdx(nfs.CAT, path.Join(nfs.SRC_TEMPLATE, m.PrefixKey(), "saveto.html")), m.Option(cli.BACK)), mdb.DEV_RESPONSE)
|
||||
}},
|
||||
mdb.DEV_RESPONSE: {Help: "确认", Hand: func(m *ice.Message, arg ...string) {
|
||||
if !m.WarnNotAllow(m.Option(ice.MSG_METHOD) != http.MethodPost) {
|
||||
@ -46,7 +47,7 @@ func DevTokenAction(name, origin string) ice.Actions {
|
||||
}
|
||||
}},
|
||||
mdb.DEV_CONFIRM: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.EchoInfoButton(kit.JoinWord(m.ShortKey(), m.Cmdx(nfs.CAT, nfs.SRC_TEMPLATE+"web.token/savefrom.html"), m.Option(name)), mdb.DEV_CREATE)
|
||||
m.EchoInfoButton(kit.JoinWord(m.ShortKey(), m.Cmdx(nfs.CAT, path.Join(nfs.SRC_TEMPLATE, m.PrefixKey(), "savefrom.html")), m.Option(name)), mdb.DEV_CREATE)
|
||||
}},
|
||||
mdb.DEV_CREATE: {Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
if !m.WarnNotAllow(m.Option(ice.MSG_METHOD) != http.MethodPost) {
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
// "shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
@ -22,7 +22,7 @@ func init() {
|
||||
web.RenderMain(m)
|
||||
return
|
||||
}
|
||||
m.Cmdx(web.SPACE, m.Option(web.SPACE), aaa.USER, mdb.CREATE, m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME)).AppendSimple(aaa.USERNICK, aaa.USERNAME, aaa.USERROLE, aaa.USERZONE, aaa.AVATAR, aaa.AVATAR_URL, aaa.BACKGROUND, aaa.LANGUAGE))
|
||||
// m.Cmdx(web.SPACE, m.Option(web.SPACE), aaa.USER, mdb.CREATE, m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME)).AppendSimple(aaa.USERROLE, aaa.USERNAME, aaa.USERNICK, aaa.LANGUAGE, aaa.AVATAR, aaa.AVATAR_URL, aaa.BACKGROUND, aaa.USERZONE))
|
||||
m.RenderRedirect(kit.MergeURL2(m.Option(cli.BACK), web.P(web.SHARE, m.Cmdx(web.SPACE, m.Option(web.SPACE), web.SHARE, mdb.CREATE, mdb.TYPE, web.LOGIN, mdb.TEXT, m.Option(cli.BACK)))))
|
||||
web.Count(m, SSO, m.Option(web.SPACE))
|
||||
}},
|
||||
|
Loading…
x
Reference in New Issue
Block a user