diff --git a/base/web/matrix.go b/base/web/matrix.go index ea23be97..9acc98ba 100644 --- a/base/web/matrix.go +++ b/base/web/matrix.go @@ -49,13 +49,11 @@ func _matrix_action(m *ice.Message, action string, arg ...string) { ProcessIframe(m, title, link, arg...).ProcessField(ctx.ACTION, action, ctx.RUN) } default: - if kit.HasPrefixList(arg, ctx.RUN) { - ctx.ProcessFloat(m, action, arg, arg...) - } else { - m.Option(ice.POD, domain) + if !kit.HasPrefixList(arg, ctx.RUN) { kit.If(action == XTERM, func() { arg = []string{cli.SH} }) - ctx.ProcessFloat(m, action, arg, arg...).ProcessField(ctx.ACTION, action, ctx.RUN) + defer m.ProcessField(ctx.ACTION, action, ctx.RUN, domain, action) } + ProcessPodCmd(m, domain, action, arg, arg...) } } func _matrix_dream(m *ice.Message, action string, arg ...string) { diff --git a/base/web/space.go b/base/web/space.go index a69e1c43..705b7e81 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -140,7 +140,7 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) { m.WarnNotFound(!mdb.HashSelectDetail(m, next, func(value ice.Map) { switch c := value[mdb.TARGET].(type) { case (*websocket.Conn): // 转发报文 - kit.If(value[mdb.TYPE] == MASTER, func() { + kit.If(value[mdb.TYPE] == MASTER && msg.Option(ice.MSG_HANDLE) == ice.FALSE, func() { msg.Options(ice.MSG_USERWEB, value[mdb.TEXT], ice.MSG_USERPOD, kit.Keys(target[1:])) }) _space_echo(msg, source, target, c) @@ -187,9 +187,9 @@ func _space_exec(m *ice.Message, name string, source, target []string, c *websoc kit.If(aaa.Right(m, m.Detailv()), func() { m.TryCatch(true, func(_ *ice.Message) { m = m.Cmd() }) }) kit.If(m.Optionv(ice.MSG_ARGS) != nil, func() { m.Options(ice.MSG_ARGS, kit.Simple(m.Optionv(ice.MSG_ARGS))) }) } - defer m.Cost(kit.Format("%v->%v %v %v", source, target, m.Detailv(), m.FormatSize())) - _space_echo(m.Set(ice.MSG_OPTS).Options(m.OptionSimple(ice.MSG_USERWEB, ice.MSG_USERPOD, ice.LOG_DEBUG, ice.LOG_DISABLE, ice.LOG_TRACEID)), []string{}, kit.Reverse(kit.Simple(source)), c) m.Option(ice.MSG_HANDLE, ice.TRUE) + defer m.Cost(kit.Format("%v->%v %v %v", source, target, m.Detailv(), m.FormatSize())) + _space_echo(m.Set(ice.MSG_OPTS).Options(m.OptionSimple(ice.MSG_USERWEB, ice.MSG_USERPOD, ice.MSG_HANDLE, ice.LOG_DEBUG, ice.LOG_DISABLE, ice.LOG_TRACEID)), []string{}, kit.Reverse(kit.Simple(source)), c) } func _space_echo(m *ice.Message, source, target []string, c *websocket.Conn) { defer func() { m.WarnNotValid(recover()) }() @@ -215,6 +215,7 @@ func _space_send(m *ice.Message, name string, arg ...string) (h string) { m.Options(ice.MSG_USERWEB, value[mdb.TEXT], ice.MSG_USERPOD, "", ice.MSG_USERHOST, "", ice.MSG_USERWEB0, m.Option(ice.MSG_USERWEB), ice.MSG_USERPOD0, name) }) kit.For([]string{ice.MSG_USERROLE, ice.LOG_TRACEID}, func(k string) { m.Optionv(k, m.Optionv(k)) }) + m.Option(ice.MSG_HANDLE, ice.FALSE) kit.For(m.Optionv(ice.MSG_OPTS), func(k string) { kit.If(!kit.IsIn(k, "task.id", "work.id"), func() { m.Optionv(k, m.Optionv(k)) @@ -404,7 +405,7 @@ func init() { if ls := kit.Simple(m.Optionv(ice.MSG_UPLOAD)); len(ls) > 1 { m.Cmd(SPACE, pod, SPIDE, ice.DEV, CACHE, SHARE_CACHE+ls[0]) } - m.Options(ice.POD, []string{}, ice.MSG_USERPOD, pod).Cmdy(append(kit.List(ice.SPACE, pod), arg...)...) + m.Options(ice.POD, []string{}, ice.MSG_USERPOD, strings.TrimPrefix(pod, "ops.")).Cmdy(append(kit.List(ice.SPACE, pod), arg...)...) return true } return false @@ -418,7 +419,7 @@ func Space(m *ice.Message, arg ice.Any) []string { } func PodCmd(m *ice.Message, key string, arg ...string) bool { if pod := m.Option(key); pod != "" { - m.Options(key, "", ice.MSG_USERPOD, pod).Cmdy(SPACE, pod, m.ShortKey(), arg) + m.Options(key, "", ice.MSG_USERPOD, strings.TrimPrefix(pod, "ops.")).Cmdy(SPACE, pod, m.ShortKey(), arg) return true } else { return false diff --git a/misc/ssh/relay/matrix.go b/misc/ssh/relay/matrix.go index 377c2892..7653092a 100644 --- a/misc/ssh/relay/matrix.go +++ b/misc/ssh/relay/matrix.go @@ -15,14 +15,16 @@ import ( ) type matrix struct { - status string `name:"status" icon:"bi bi-git"` + status string `name:"status" help:"源码" icon:"bi bi-git"` list string `name:"list refresh" help:"矩阵"` } func (s matrix) List(m *ice.Message, arg ...string) { m.Cmdy(SSH_RELAY, web.DREAM).Table(func(value ice.Maps) { - if value[web.SPACE] == ice.CONTEXTS { - m.PushButton(s.Portal, s.Desktop, s.Admin, s.Open, s.Word, s.Status, s.Vimer, s.Compile, s.Runtime, s.Xterm) + if value[mdb.STATUS] == cli.STOP { + m.PushButton() + } else if value[web.SPACE] == ice.CONTEXTS { + m.PushButton(s.Portal, s.Desktop, s.Dream, s.Admin, s.Open, s.Word, s.Status, s.Vimer, s.Compile, s.Runtime, s.Xterm) } else if value[MACHINE] == tcp.LOCALHOST { m.PushButton(s.Portal, s.Word, s.Status, s.Vimer, s.Compile, s.Runtime, s.Xterm, s.Desktop, s.Admin, s.Open) } else { @@ -32,6 +34,7 @@ func (s matrix) List(m *ice.Message, arg ...string) { } func (s matrix) Portal(m *ice.Message, arg ...string) { s.iframe(m, arg...) } func (s matrix) Desktop(m *ice.Message, arg ...string) { s.plug(m, arg...) } +func (s matrix) Dream(m *ice.Message, arg ...string) { s.plug(m, arg...) } func (s matrix) Admin(m *ice.Message, arg ...string) { s.open(m, arg...) } func (s matrix) Open(m *ice.Message, arg ...string) { s.open(m, arg...) } func (s matrix) Word(m *ice.Message, arg ...string) { s.plug(m, arg...) }