From a7ca869a169c26e8c34c26e10fcb77518a4000d6 Mon Sep 17 00:00:00 2001 From: shy Date: Sat, 24 Feb 2024 00:32:05 +0800 Subject: [PATCH] add some --- base/web/space.go | 8 ++++---- misc.go | 4 ++++ misc/ssh/relay/relay.go | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/base/web/space.go b/base/web/space.go index 624389ca..21144f1f 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -195,12 +195,12 @@ func _space_echo(m *ice.Message, source, target []string, c *websocket.Conn) { func _space_send(m *ice.Message, name string, arg ...string) (h string) { withecho := m.Option("space.noecho") != ice.TRUE kit.If(len(arg) > 0 && arg[0] == TOAST, func() { withecho = false; m.Option(ice.MSG_DEBUG, ice.FALSE) }) - wait, done := m.Wait(kit.Select("", m.OptionDefault("space.timeout", "600s"), withecho), func(msg *ice.Message, arg ...string) { + wait, done := m.Wait(kit.Select("", m.OptionDefault("space.timeout", "180s"), withecho), func(msg *ice.Message, arg ...string) { m.Cost(kit.Format("%v->[%v] %v %v", m.Optionv(ice.MSG_SOURCE), name, m.Detailv(), msg.FormatSize())).Copy(msg) }) if withecho { - h = mdb.HashCreate(m.Spawn(), mdb.TYPE, tcp.SEND, mdb.NAME, kit.Keys(name, m.Target().ID()), mdb.TEXT, kit.Join(arg, lex.SP), kit.Dict(mdb.TARGET, done)) - defer mdb.HashRemove(m.Spawn(), mdb.HASH, h) + h = mdb.HashCreate(m.SpawnSilent(), mdb.TYPE, tcp.SEND, mdb.NAME, kit.Keys(name, m.Target().ID()), mdb.TEXT, kit.Join(arg, lex.SP), kit.Dict(mdb.TARGET, done)) + defer mdb.HashRemove(m.SpawnSilent(), mdb.HASH, h) } 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.WarnNotValid(!ok, mdb.TARGET) { @@ -396,7 +396,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, pod, ice.MSG_DEBUG, ice.FALSE).Cmdy(append(kit.List(ice.SPACE, pod), arg...)...) return true } return false diff --git a/misc.go b/misc.go index f5cf5f7d..313d6f29 100644 --- a/misc.go +++ b/misc.go @@ -184,3 +184,7 @@ func (m *Message) Trans(en string, zh string) string { func (m *Message) IsEnglish() bool { return kit.IsIn(strings.ToLower(m.Option(MSG_LANGUAGE)), "en", "en-us") } + +func (m *Message) SpawnSilent(arg ...Any) *Message { + return m.Spawn(Maps{LOG_DISABLE: TRUE}) +} diff --git a/misc/ssh/relay/relay.go b/misc/ssh/relay/relay.go index 19a5daf8..9aa8e040 100644 --- a/misc/ssh/relay/relay.go +++ b/misc/ssh/relay/relay.go @@ -324,7 +324,12 @@ func (s relay) Upgrade(m *ice.Message, arg ...string) { return } ssh.PushShell(msg.Message, strings.Split(msg.Template(UPGRADE_SH), lex.NL), func(res string) { - web.PushNoticeGrow(m.Options(ice.MSG_COUNT, "0", ctx.DISPLAY, web.PLUGIN_XTERM).Message, res) + web.PushNoticeGrow(m.Options( + ctx.DISPLAY, web.PLUGIN_XTERM, + ice.MSG_COUNT, "0", + ice.MSG_DEBUG, ice.FALSE, + ice.LOG_DISABLE, ice.TRUE, + ).Message, res) }) }) } else { @@ -338,7 +343,12 @@ func (s relay) Version(m *ice.Message, arg ...string) { return } ssh.PushShell(msg.Message, strings.Split(msg.Template(VERSION_SH), lex.NL), func(res string) { - web.PushNoticeGrow(m.Options(ctx.DISPLAY, web.PLUGIN_XTERM).Message, res) + web.PushNoticeGrow(m.Options( + ctx.DISPLAY, web.PLUGIN_XTERM, + ice.MSG_COUNT, "0", + ice.MSG_DEBUG, ice.FALSE, + ice.LOG_DISABLE, ice.TRUE, + ).Message, res) }) }) }