1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-14 13:11:19 +08:00
parent e6e89563ef
commit 8fb70fa41d
4 changed files with 15 additions and 6 deletions

View File

@ -32,6 +32,10 @@ func init() {
}},
})
}
func AdminCmd(m *ice.Message, cmd string) string {
return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, C(cmd))
func AdminCmd(m *ice.Message, cmd string, arg ...string) string {
if ice.Info.NodeType == WORKER {
return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, path.Join(C(cmd), path.Join(arg...)))
} else {
return m.Cmdx(cmd, arg)
}
}

View File

@ -97,6 +97,7 @@ func _space_fork(m *ice.Message) {
args = _space_agent(m, args...)
if c, e := websocket.Upgrade(m.W, m.R); !m.Warn(e) {
gdb.Go(m, func() {
safe := false
defer mdb.HashCreateDeferRemove(m, args, kit.Dict(mdb.TARGET, c))()
switch m.Option(mdb.TYPE) {
case LOGIN:
@ -109,6 +110,7 @@ func _space_fork(m *ice.Message) {
m.Go(func() { m.Cmd(SPACE, name, cli.PWD, name) })
case WORKER:
defer gdb.EventDeferEvent(m, DREAM_OPEN, args)(DREAM_CLOSE, args)
safe = true
case SERVER:
defer gdb.EventDeferEvent(m, SPACE_OPEN, args)(SPACE_CLOSE, args)
m.Go(func() {
@ -121,7 +123,7 @@ func _space_fork(m *ice.Message) {
m.Cmd(gdb.EVENT, gdb.HAPPEN, gdb.EVENT, OPS_SERVER_OPEN, args, kit.Dict(ice.MSG_USERROLE, aaa.TECH))
})
}
_space_handle(m, false, name, c)
_space_handle(m, safe, name, c)
}, kit.Join(kit.Simple(SPACE, name), lex.SP))
}
}
@ -217,7 +219,10 @@ func _space_send(m *ice.Message, name string, arg ...string) (h string) {
}
if target := kit.Split(name, nfs.PT, nfs.PT); !mdb.HashSelectDetail(m, target[0], func(value ice.Map) {
if c, ok := value[mdb.TARGET].(*websocket.Conn); !m.Warn(!ok, ice.ErrNotValid, mdb.TARGET) {
kit.For([]string{ice.MSG_USERROLE}, func(k string) { m.Optionv(k, m.Optionv(k)) })
kit.For([]string{
ice.LOG_TRACEID,
ice.MSG_USERROLE,
}, func(k string) { m.Optionv(k, m.Optionv(k)) })
kit.For(m.Optionv(ice.MSG_OPTS), func(k string) { m.Optionv(k, m.Optionv(k)) })
if withecho {
_space_echo(m.Set(ice.MSG_DETAIL, arg...), []string{h}, target, c)

View File

@ -25,7 +25,7 @@ func init() {
LOCAL = "http://localhost:9020"
)
Index.MergeCommands(ice.Commands{
TOKEN: {Help: "令牌", Actions: ice.MergeActions(ice.Actions{
TOKEN: {Help: "令牌", Actions: ice.MergeActions(ice.Actions{
GEN: {Hand: func(m *ice.Message, arg ...string) {
m.EchoInfoButton(kit.Format("请授权 %s\n访问 %s\n", m.Option(tcp.HOST), m.Option(mdb.TYPE)), CONFIRM)
}},

View File

@ -29,7 +29,7 @@ func init() {
)
const SEARCH = "search"
Index.MergeCommands(ice.Commands{
SEARCH: {Name: "search keyword auto", Help: "代码源", Actions: ice.MergeActions(ice.Actions{
SEARCH: {Name: "search keyword auto", Help: "码库", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
macos.AppInstall(m, "App Store.png", m.PrefixKey())
}},