From d57610e4cd34e641385eb8650717bd1b2ab54504 Mon Sep 17 00:00:00 2001 From: shaoying Date: Thu, 22 Apr 2021 22:45:39 +0800 Subject: [PATCH] opt some --- base/web/render.go | 17 ++++++----------- core/code/binpack.go | 10 ++++++---- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/base/web/render.go b/base/web/render.go index a76e72d3..2263fe6e 100644 --- a/base/web/render.go +++ b/base/web/render.go @@ -65,17 +65,12 @@ func Render(msg *ice.Message, cmd string, args ...interface{}) { // no output default: - msg.Set("_option") - msg.Set("_handle") - msg.Set("_output") - - msg.Set("") - msg.Set("sessid") - msg.Set("domain") - msg.Set("river") - msg.Set("storm") - msg.Set("cmds") - msg.Set("fields") + for _, k := range []string{ + "_option", "_handle", "_output", "", + "sessid", "domain", "river", "storm", "cmds", "fields", + } { + msg.Set(k) + } if cmd != "" { // [str [arg...]] msg.Echo(kit.Format(cmd, args...)) diff --git a/core/code/binpack.go b/core/code/binpack.go index 0e64f206..bad51818 100644 --- a/core/code/binpack.go +++ b/core/code/binpack.go @@ -56,14 +56,16 @@ func _pack_volcanos(m *ice.Message, pack *os.File, dir string) { m.Option(nfs.DIR_DEEP, "true") m.Option(nfs.DIR_TYPE, nfs.CAT) - for _, k := range []string{"favicon.ico", "proto.js", "frame.js", "index.html"} { + for _, k := range []string{"favicon.ico", "proto.js", "frame.js"} { pack.WriteString(fmt.Sprintf(" \"/%s\": %s,\n", - kit.Select("", k, k != "index.html"), _pack_file(m, path.Join(dir, k)))) + kit.Select("", k, k != "index.html"), + _pack_file(m, path.Join(dir, k)))) } - for _, k := range []string{"lib", "page", "pane", "plugin"} { + for _, k := range []string{"lib", "page", "panel", "plugin"} { m.Cmd(nfs.DIR, k).Table(func(index int, value map[string]string, head []string) { pack.WriteString(fmt.Sprintf(" \"/%s\": %s,\n", - value[kit.MDB_PATH], _pack_file(m, path.Join(dir, value[kit.MDB_PATH])))) + kit.Select("", value[kit.MDB_PATH], value[kit.MDB_PATH] != "page/index.html"), + _pack_file(m, path.Join(dir, value[kit.MDB_PATH])))) }) } pack.WriteString("\n")