diff --git a/base/web/dream.go b/base/web/dream.go index 1d036826..e604803f 100644 --- a/base/web/dream.go +++ b/base/web/dream.go @@ -148,7 +148,9 @@ require miss.sh ish_miss_prepare_develop ish_miss_prepare_install +ish_miss_prepare release # ish_miss_prepare wubi-dict +# ish_miss_prepare word-dict ish_miss_prepare_contexts # ish_miss_prepare_intshell diff --git a/base/web/serve.go b/base/web/serve.go index 228bef95..c052aa05 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -12,6 +12,7 @@ import ( "shylinux.com/x/icebergs/base/cli" "shylinux.com/x/icebergs/base/ctx" "shylinux.com/x/icebergs/base/mdb" + "shylinux.com/x/icebergs/base/nfs" "shylinux.com/x/icebergs/base/tcp" kit "shylinux.com/x/toolkits" ) @@ -292,6 +293,12 @@ func init() { m.RenderIndex(SERVE, ice.INTSHELL, arg...) }}, "/publish/": {Name: "/publish/", Help: "私有云", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + if arg[0] == ice.ORDER_JS { + if p := path.Join(ice.USR_PUBLISH, ice.ORDER_JS); m.PodCmd(nfs.CAT, p) { + m.RenderResult() + return + } + } _share_local(m, m.Conf(SERVE, kit.Keym(ice.PUBLISH)), path.Join(arg...)) }}, "/require/": {Name: "/require/", Help: "公有云", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { diff --git a/base/web/spide.go b/base/web/spide.go index 197c105e..e3166e9d 100644 --- a/base/web/spide.go +++ b/base/web/spide.go @@ -178,6 +178,7 @@ func _spide_part(m *ice.Message, arg ...string) (io.Reader, string) { } if strings.HasPrefix(arg[i+1], "@") { if s, e := os.Stat(arg[i+1][1:]); e == nil { + m.Debug("local: %s cache: %s", s.ModTime(), cache) if s.ModTime().Before(cache) { break } @@ -185,7 +186,9 @@ func _spide_part(m *ice.Message, arg ...string) (io.Reader, string) { if f, e := os.Open(arg[i+1][1:]); m.Assert(e) { defer f.Close() if p, e := mp.CreateFormFile(arg[i], path.Base(arg[i+1][1:])); m.Assert(e) { - io.Copy(p, f) + if n, e := io.Copy(p, f); m.Assert(e) { + m.Debug("upload: %s %d", arg[i+1], n) + } } } } else { diff --git a/base/web/web.go b/base/web/web.go index 76cf666f..8b5fd998 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -70,6 +70,12 @@ func (web *Frame) Start(m *ice.Message, arg ...string) bool { }) web.m, web.Server = m, &http.Server{Handler: web} + switch cb := m.Optionv(kit.Keycb(SERVE)).(type) { + case func(http.Handler): + cb(web) + return true + } + m.Option(kit.Keycb(tcp.LISTEN), func(l net.Listener) { m.Cmdy(mdb.INSERT, SERVE, "", mdb.HASH, arg, kit.MDB_STATUS, tcp.START, kit.MDB_PROTO, m.Option(kit.MDB_PROTO), SPIDE_DEV, m.Option(SPIDE_DEV)) defer m.Cmd(mdb.MODIFY, SERVE, "", mdb.HASH, kit.MDB_NAME, m.Option(kit.MDB_NAME), kit.MDB_STATUS, tcp.STOP) @@ -88,27 +94,25 @@ func (web *Frame) Close(m *ice.Message, arg ...string) bool { const WEB = "web" -var Index = &ice.Context{Name: WEB, Help: "网络模块", - Commands: map[string]*ice.Command{ - ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - m.Load() - m.Conf(SPACE, kit.MDB_HASH, "") - m.Cmd(mdb.SEARCH, mdb.CREATE, SPACE, m.Prefix(SPACE)) +var Index = &ice.Context{Name: WEB, Help: "网络模块", Commands: map[string]*ice.Command{ + ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + m.Load() + m.Conf(SPACE, kit.MDB_HASH, "") + m.Cmd(mdb.SEARCH, mdb.CREATE, SPACE, m.Prefix(SPACE)) - m.Cmd(SPIDE, mdb.CREATE, SPIDE_DEV, kit.Select("http://:9020", m.Conf(cli.RUNTIME, "conf.ctx_dev"))) - m.Cmd(SPIDE, mdb.CREATE, SPIDE_SELF, kit.Select("http://:9020", m.Conf(cli.RUNTIME, "conf.ctx_self"))) - m.Cmd(SPIDE, mdb.CREATE, SPIDE_SHY, kit.Select("https://shylinux.com:443", m.Conf(cli.RUNTIME, "conf.ctx_shy"))) - }}, - ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - m.Save() + m.Cmd(SPIDE, mdb.CREATE, SPIDE_DEV, kit.Select("http://:9020", m.Conf(cli.RUNTIME, "conf.ctx_dev"))) + m.Cmd(SPIDE, mdb.CREATE, SPIDE_SELF, kit.Select("http://:9020", m.Conf(cli.RUNTIME, "conf.ctx_self"))) + m.Cmd(SPIDE, mdb.CREATE, SPIDE_SHY, kit.Select("https://shylinux.com:443", m.Conf(cli.RUNTIME, "conf.ctx_shy"))) + }}, + ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + m.Save() - m.Done(true) - m.Cmd(SERVE).Table(func(index int, value map[string]string, head []string) { - m.Done(value[kit.MDB_STATUS] == tcp.START) - }) - }}, - }, -} + m.Done(true) + m.Cmd(SERVE).Table(func(index int, value map[string]string, head []string) { + m.Done(value[kit.MDB_STATUS] == tcp.START) + }) + }}, +}} func init() { ice.Index.Register(Index, &Frame{}, diff --git a/core/code/autogen.go b/core/code/autogen.go index 8604f201..05c9e3c1 100644 --- a/core/code/autogen.go +++ b/core/code/autogen.go @@ -22,6 +22,7 @@ func _defs(m *ice.Message, args ...string) { } func _autogen_script(m *ice.Message, dir string) { buf, _ := kit.Render(`chapter "{{.Option "name"}}" + field "{{.Option "help"}}" {{.Option "key"}} `, m) m.Cmd(nfs.DEFS, dir, string(buf)) @@ -38,17 +39,15 @@ import ( type {{.Option "name"}} struct { ice.{{.Option "type"}} + + list string {{.Option "list"}} } func (h {{.Option "name"}}) List(m *ice.Message, arg ...string) { h.{{.Option "type"}}.List(m, arg...) } -func init() { - ice.Cmd("{{.Option "key"}}", &{{.Option "name"}}{}, []*ice.Show{ - {Name: "{{.Option "list"}}", Help: "{{.Option "help"}}"}, - }) -} +func init() { ice.Cmd("{{.Option "key"}}", &{{.Option "name"}}{}) } `, m) m.Cmd(nfs.SAVE, dir, string(buf)) } @@ -157,6 +156,7 @@ func init() { case "Data": _defs(m, "list", "list path auto upload") } + m.Option("list", kit.Format("`name:\"%s\" help:\"%s\"`", m.Option("list"), m.Option("help"))) if p := path.Join(kit.SSH_SRC, m.Option(kit.MDB_ZONE), kit.Keys(m.Option(kit.MDB_NAME), SHY)); !kit.FileExists(p) { _autogen_script(m, p) diff --git a/core/code/publish.go b/core/code/publish.go index d8f965a8..8a75795d 100644 --- a/core/code/publish.go +++ b/core/code/publish.go @@ -150,7 +150,7 @@ func init() { echo "hello world" `, JS, `Volcanos("onengine", {_init: function(can, sub) { - can.base.Log("hello volcanos world") + can.misc.Log("hello volcanos world") }, river: { }}) diff --git a/core/code/vimer.go b/core/code/vimer.go index 5ec8820b..56de93c3 100644 --- a/core/code/vimer.go +++ b/core/code/vimer.go @@ -33,10 +33,6 @@ func init() { nfs.SAVE: {Name: "save type file path", Help: "保存", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.SAVE, path.Join(m.Option(kit.MDB_PATH), m.Option(kit.MDB_FILE))) }}, - BINPACK: {Name: "binpack", Help: "打包:生成 src/binpack.go", Hand: func(m *ice.Message, arg ...string) { - _autogen_version(m) - m.Cmd(BINPACK, mdb.CREATE) - }}, AUTOGEN: {Name: "create main=src/main.go@key key= zone= type=Zone,Hash,List,Data name=hi list= help=", Help: "模块", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(AUTOGEN, mdb.CREATE, arg) }}, @@ -44,6 +40,7 @@ func init() { if p := os.Getenv(cli.PATH); !strings.Contains(p, "usr/local/go/bin") { m.Option(cli.CMD_ENV, cli.PATH, kit.Path("usr/local/go/bin")+":"+p) } + _autogen_version(m) if m.Cmdy(cli.SYSTEM, "go", "build", "-v", "-o", "bin/ice.bin", "src/main.go", "src/version.go"); m.Append(cli.CMD_CODE) == "0" { m.Cmd("exit", "1") }