From baf9763256e10b9a8a8be619da3a3ebe1b2cd7c6 Mon Sep 17 00:00:00 2001 From: shylinux Date: Fri, 17 Feb 2023 22:14:24 +0800 Subject: [PATCH] opt some --- base/ssh/script.go | 2 +- base/web/serve.go | 11 ++++++++++- base/web/spide.go | 2 +- core/code/publish.go | 8 ++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/base/ssh/script.go b/base/ssh/script.go index b9add60f..22f5649d 100644 --- a/base/ssh/script.go +++ b/base/ssh/script.go @@ -117,7 +117,7 @@ func (f *Frame) parse(m *ice.Message, h, line string) string { func (f *Frame) scan(m *ice.Message, h, line string) *Frame { f.ps1 = kit.Simple(m.Confv(PROMPT, kit.Keym(PS1))) f.ps2 = kit.Simple(m.Confv(PROMPT, kit.Keym(PS2))) - m.Options(MESSAGE, m, ice.LOG_DISABLE, ice.TRUE) + // m.Options(MESSAGE, m, ice.LOG_DISABLE, ice.TRUE) m.I, m.O = f.stdin, f.stdout ps, bio := f.ps1, bufio.NewScanner(f.stdin) for f.prompt(m, ps...); f.stdin != nil && bio.Scan(); f.prompt(m, ps...) { diff --git a/base/web/serve.go b/base/web/serve.go index 413a2292..07e9a551 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -73,7 +73,16 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool { } func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.ResponseWriter, r *http.Request) { if u, e := url.Parse(r.Header.Get(Referer)); e == nil && r.URL.Path != PP(SPACE) { - gdb.Event(m, SERVE_PARSE, strings.Split(strings.TrimPrefix(u.Path, ice.PS), ice.PS)) + add := func(k, v string) { m.Logs("path", k, m.Option(k, v)) } + switch arg := strings.Split(strings.TrimPrefix(u.Path, ice.PS), ice.PS); arg[0] { + case "share": + add(arg[0], arg[1]) + case "chat": + for i := 1; i < len(arg); i += 2 { + add(arg[i], arg[i+1]) + } + } + // gdb.Event(m, SERVE_PARSE, strings.Split(strings.TrimPrefix(u.Path, ice.PS), ice.PS)) kit.Fetch(u.Query(), func(k string, v []string) { m.Logs("Refer", k, v).Optionv(k, v) }) } m.Option(ice.MSG_USERUA, r.Header.Get(UserAgent)) diff --git a/base/web/spide.go b/base/web/spide.go index 8021d3a7..c2120f20 100644 --- a/base/web/spide.go +++ b/base/web/spide.go @@ -290,7 +290,7 @@ func init() { MERGE: {Hand: func(m *ice.Message, arg ...string) { m.Echo(kit.MergeURL2(m.CmdAppend("", arg[0], CLIENT_URL), arg[1], arg[2:])) }}, - }, mdb.HashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,client.name,client.url", LOGHEADERS, ice.FALSE), mdb.ClearHashOnExitAction()), Hand: func(m *ice.Message, arg ...string) { + }, mdb.HashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,client.name,client.url,client.origin", LOGHEADERS, ice.FALSE), mdb.ClearHashOnExitAction()), Hand: func(m *ice.Message, arg ...string) { if len(arg) < 2 || arg[0] == "" || (len(arg) > 3 && arg[3] == "") { mdb.HashSelect(m, kit.Slice(arg, 0, 1)...).Sort(CLIENT_NAME) } else { diff --git a/core/code/publish.go b/core/code/publish.go index e5ae6053..340d5348 100644 --- a/core/code/publish.go +++ b/core/code/publish.go @@ -124,16 +124,16 @@ export ctx_dev={{.Option "httphost"}}{{.Option "ctx_env"}}; ctx_temp=$(mktemp); `, ice.CORE, ` # 下载命令 wget Alpine -ctx_temp=$(mktemp); wget -O $ctx_temp -q {{.Cmdx "spide" "shy" "client.url"}}; source $ctx_temp binary +ctx_temp=$(mktemp); wget -O $ctx_temp -q {{.Cmdx "spide" "shy" "client.origin"}}; source $ctx_temp binary # 下载命令 curl Centos / MacOS -ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL {{.Cmdx "spide" "shy" "client.url"}}; source $ctx_temp binary +ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL {{.Cmdx "spide" "shy" "client.origin"}}; source $ctx_temp binary `, ice.BASE, ` # 下载源码 wget Alpine -ctx_temp=$(mktemp); wget -O $ctx_temp -q {{.Cmdx "spide" "shy" "client.url"}}; source $ctx_temp source +ctx_temp=$(mktemp); wget -O $ctx_temp -q {{.Cmdx "spide" "shy" "client.origin"}}; source $ctx_temp source # 下载源码 curl Centos / MacOS -ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL {{.Cmdx "spide" "shy" "client.url"}}; source $ctx_temp source +ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL {{.Cmdx "spide" "shy" "client.origin"}}; source $ctx_temp source `, )