1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-02-22 13:27:49 +08:00
parent 5d386d63e2
commit 8fe47b6ca7
5 changed files with 25 additions and 5 deletions

View File

@ -386,7 +386,13 @@ func init() {
nfs.Trash(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME)))
}},
OPEN: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
ProcessIframe(m, m.Option(mdb.NAME), kit.Select(S(m.Option(mdb.NAME)), SpideOrigin(m, m.Option(mdb.NAME)), m.Option(mdb.TYPE) == MASTER), arg...)
m.Debug("what %v", m.Option(ice.MSG_USERHOST))
m.Debug("what %v", m.Option(ice.MSG_USERWEB))
if m.Option(mdb.TYPE) == MASTER && m.IsLocalhost() {
m.ProcessOpen(SpideOrigin(m, m.Option(mdb.NAME)))
} else {
ProcessIframe(m, m.Option(mdb.NAME), kit.Select(S(m.Option(mdb.NAME)), SpideOrigin(m, m.Option(mdb.NAME)), m.Option(mdb.TYPE) == MASTER), arg...)
}
}},
GRANT: {Hand: func(m *ice.Message, arg ...string) {
m.Cmd(CHAT_GRANT, aaa.CONFIRM, kit.Dict(SPACE, m.Option(mdb.NAME)))
@ -463,12 +469,19 @@ func DreamWhiteHandle(m *ice.Message, arg ...string) {
aaa.White(m, kit.Keys(m.ShortKey(), ctx.ACTION, DREAM_ACTION))
}
func DreamProcessIframe(m *ice.Message, arg ...string) {
if kit.HasPrefixList(arg, ctx.ACTION, m.CommandKey()) && len(arg) == 2 {
if !kit.HasPrefixList(arg, ctx.ACTION, m.ShortKey()) && !kit.HasPrefixList(arg, ctx.ACTION, m.CommandKey()) {
return
}
if m.Option(mdb.TYPE) == MASTER && m.IsLocalhost() {
m.ProcessOpen(SpideOrigin(m, m.Option(mdb.NAME)) + C(m.ShortKey()))
return
}
if len(arg) == 2 {
defer m.Push(TITLE, kit.Keys(m.Option(mdb.NAME), m.ShortKey()))
}
DreamProcess(m, CHAT_IFRAME, func() string {
if m.Option(mdb.TYPE) == MASTER {
return SpideOrigin(m, kit.Keys(m.Option(ice.MSG_USERPOD), m.Option(mdb.NAME))) + C(m.ShortKey())
return SpideOrigin(m, m.Option(mdb.NAME)) + C(m.ShortKey())
}
return S(kit.Keys(m.Option(ice.MSG_USERPOD), m.Option(mdb.NAME))) + C(m.ShortKey())
}, arg...)

View File

@ -293,6 +293,9 @@ func init() {
m.Options(ice.MSG_USERIP, msg.Append(aaa.IP), ice.MSG_USERUA, msg.Append(aaa.UA))
m.Cmd("", kit.Select(m.Option(mdb.NAME), arg, 0), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
}},
SPACE_LOGIN: {Hand: func(m *ice.Message, arg ...string) {
kit.If(m.Option(ice.FROM_DAEMON), func(p string) { m.Cmd("", p, GRANT, m.Option(mdb.NAME), -1) })
}},
OPEN: {Hand: func(m *ice.Message, arg ...string) {
switch m.Option(mdb.TYPE) {
case MASTER:
@ -302,7 +305,7 @@ func init() {
}
}},
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
}, mdb.HashAction(mdb.LIMIT, 1000, mdb.LEAST, 500, mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text,module,version,agent,system,ip,usernick,username,userrole", ctx.ACTION, OPEN, REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000)), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
}, gdb.EventsAction(SPACE_LOGIN), mdb.HashAction(mdb.LIMIT, 1000, mdb.LEAST, 500, mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text,module,version,agent,system,ip,usernick,username,userrole", ctx.ACTION, OPEN, REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000)), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
if len(arg) < 2 {
if len(arg) == 1 && strings.Contains(arg[0], nfs.PT) {
ls := kit.Split(arg[0], nfs.PT)

View File

@ -241,6 +241,7 @@ const ( // MSG
LOG_TRACEID = "log.id"
MSG_NODETYPE = "node.type"
FROM_DAEMON = "from.daemon"
TABLE_CHECKBOX = "table.checkbox"
TOAST_DURATION = "toast.duration"
)

View File

@ -104,7 +104,7 @@ func init() {
aaa.LOGOUT: {Hand: aaa.SessLogout},
cli.QRCODE: {Hand: func(m *ice.Message, arg ...string) {
link := tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB))
m.Push(mdb.NAME, link).PushQRCode(mdb.TEXT, link)
m.Push(mdb.NAME, link).PushQRCode(mdb.TEXT, kit.MergeURL(link, ice.FROM_DAEMON, m.Option(ice.MSG_DAEMON)))
}},
mdb.CREATE: {Name: "create type*=plugin,qrcode,oauth name* help icons link order space index args", Hand: func(m *ice.Message, arg ...string) { mdb.HashCreate(m, m.OptionSimple()) }},
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { mdb.HashRemove(m, m.OptionSimple(mdb.NAME)) }},

View File

@ -138,6 +138,9 @@ func (m *Message) IsMetaKey() bool {
func (m *Message) IsGetMethod() bool {
return m.Option(MSG_METHOD) == http.MethodGet
}
func (m *Message) IsLocalhost() bool {
return strings.HasPrefix(m.Option(MSG_USERWEB), "http://localhost:9020")
}
func (m *Message) PushSearch(arg ...Any) {
data := kit.Dict(arg...)
kit.For(arg, func(k, v Any) {