From 19524faa67fcfc8d8820580438f54b02b450909b Mon Sep 17 00:00:00 2001 From: shylinux Date: Sat, 18 Feb 2023 00:09:41 +0800 Subject: [PATCH] opt some --- base/cli/qrcode.go | 5 +++-- base/web/space.go | 3 +++ core/code/binpack.go | 2 +- core/code/publish.go | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/base/cli/qrcode.go b/base/cli/qrcode.go index 09a7a451..db494524 100644 --- a/base/cli/qrcode.go +++ b/base/cli/qrcode.go @@ -126,8 +126,9 @@ func init() { } }}, }, Hand: func(m *ice.Message, arg ...string) { - m.Option(FG, kit.Select(kit.Select(BLACK, WHITE, kit.IndexOf([]string{BLACK, "dark"}, m.Option(ice.MSG_THEME)) > -1), arg, 1)) - m.Option(BG, kit.Select(kit.Select(WHITE, BLACK, kit.IndexOf([]string{BLACK, "dark"}, m.Option(ice.MSG_THEME)) > -1), arg, 2)) + dark := kit.IndexOf([]string{BLACK, "dark"}, m.Option(ice.MSG_THEME)) > -1 + m.Option(FG, kit.Select(kit.Select(BLACK, WHITE, dark), arg, 1)) + m.Option(BG, kit.Select(kit.Select(WHITE, BLACK, dark), arg, 2)) if m.IsCliUA() { _qrcode_cli(m, kit.Select(kit.Select(ice.Info.Make.Domain, ice.Info.Domain), arg, 0)) } else { diff --git a/base/web/space.go b/base/web/space.go index aa6cd138..0833b630 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -184,6 +184,9 @@ func init() { } aaa.SessAuth(m, kit.Dict(aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERROLE, m.Option(ice.MSG_USERROLE))) }}, + aaa.LOGIN: {Hand: func(m *ice.Message, arg ...string) { + m.Cmd(SPACE, arg[0], ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME))) + }}, DOMAIN: {Hand: func(m *ice.Message, arg ...string) { m.Echo(_space_domain(m)) }}, OPEN: {Hand: func(m *ice.Message, arg ...string) { ctx.ProcessOpen(m, MergePod(m, m.Option(mdb.NAME), arg)) }}, ice.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }}, diff --git a/core/code/binpack.go b/core/code/binpack.go index 35c96a35..65ac6bf8 100644 --- a/core/code/binpack.go +++ b/core/code/binpack.go @@ -18,7 +18,7 @@ import ( func _binpack_file(m *ice.Message, w io.Writer, arg ...string) { if f, e := nfs.OpenFile(m, arg[0]); !m.Warn(e, ice.ErrNotFound, arg[0]) { defer f.Close() - if b, e := ioutil.ReadAll(f); !m.Warn(e, ice.ErrNotValid, arg[0]) && len(b) > 0 { + if b, e := ioutil.ReadAll(f); !m.Warn(e, ice.ErrNotValid, arg[0]) && len(b) > 0 || strings.Contains(arg[0], "/cache.") { fmt.Fprintf(w, " \"%s\": \"%s\",\n", kit.Select(arg[0], arg, 1), base64.StdEncoding.EncodeToString(b)) } } diff --git a/core/code/publish.go b/core/code/publish.go index 340d5348..5a7e78c8 100644 --- a/core/code/publish.go +++ b/core/code/publish.go @@ -123,6 +123,9 @@ export ctx_dev={{.Option "httphost"}}{{.Option "ctx_env"}}; ctx_temp=$(mktemp); export ctx_dev={{.Option "httphost"}}{{.Option "ctx_env"}}; ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL $ctx_dev; source $ctx_temp app username {{.Option "user.name"}} usernick {{.Option "user.nick"}} `, ice.CORE, ` +# 下载命令 wget Busybox +ctx_temp=$(mktemp); wget -O $ctx_temp -q http://shylinux.com; source $ctx_temp binary + # 下载命令 wget Alpine ctx_temp=$(mktemp); wget -O $ctx_temp -q {{.Cmdx "spide" "shy" "client.origin"}}; source $ctx_temp binary