diff --git a/base/nfs/nfs.go b/base/nfs/nfs.go index 97a528a7..e50bffd6 100644 --- a/base/nfs/nfs.go +++ b/base/nfs/nfs.go @@ -18,7 +18,9 @@ import ( func dir(m *ice.Message, root string, name string, level int, deep bool, dir_type string, dir_reg *regexp.Regexp, fields []string, format string) { - if fs, e := ioutil.ReadDir(path.Join(root, name)); m.Assert(e) { + if fs, e := ioutil.ReadDir(path.Join(root, name)); e != nil { + m.Log(ice.LOG_WARN, "%s", e) + } else { for _, f := range fs { if f.Name() == "." || f.Name() == ".." { continue diff --git a/base/web/web.go b/base/web/web.go index f6c3a42a..2c7ff6a0 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -739,7 +739,7 @@ var Index = &ice.Context{Name: "web", Help: "网页模块", if len(arg) > 0 { // 规范命名 - if !strings.Contains(arg[0], "-") { + if !strings.Contains(arg[0], "-") || !strings.HasPrefix(arg[0], "20") { arg[0] = m.Time("20060102-") + arg[0] } @@ -1256,6 +1256,8 @@ var Index = &ice.Context{Name: "web", Help: "网页模块", } if s, e := websocket.Upgrade(m.W, m.R, nil, m.Confi(ice.WEB_SPACE, "meta.buffer.r"), m.Confi(ice.WEB_SPACE, "meta.buffer.w")); m.Assert(e) { + m.Option("name", strings.Replace(m.Option("name"), ".", "_", -1)) + // 共享空间 share := m.Option("share") if m.Richs(ice.WEB_SHARE, nil, share, nil) == nil { diff --git a/build.sh b/build.sh index 25fd2f8f..fc3423d8 100755 --- a/build.sh +++ b/build.sh @@ -47,7 +47,7 @@ prepare() { curl \$ctx_dev/publish/\${bin} -o ice.bin && chmod u+x ice.bin } start() { - while true; do + trap HUP hup && while true; do date && ice.bin \$@ 2>boot.log && echo -e "\n\nrestarting..." || break done } diff --git a/core/code/code.go b/core/code/code.go index 51651504..0620123a 100644 --- a/core/code/code.go +++ b/core/code/code.go @@ -189,7 +189,9 @@ var Index = &ice.Context{Name: "code", Help: "编程模块", m.Cmdy("login", "exit") case "upload": // 缓存文件 - msg := m.Cmd(ice.WEB_CACHE, "upload") + you := m.Option("you") + m.Option("you", "") + msg := m.Cmd(ice.WEB_STORY, "upload") m.Echo("data: %s\n", msg.Append("data")) m.Echo("time: %s\n", msg.Append("time")) m.Echo("type: %s\n", msg.Append("type")) @@ -198,6 +200,7 @@ var Index = &ice.Context{Name: "code", Help: "编程模块", m.Push("_output", "result") // 下发文件 + m.Option("you", you) m.Cmd(ice.WEB_SPACE, msg.Option("you"), ice.WEB_SPACE, "download", msg.Append("type"), msg.Append("name"), "self", msg.Append("data")) case "download": diff --git a/type.go b/type.go index 49cbf686..df068ec5 100644 --- a/type.go +++ b/type.go @@ -190,6 +190,12 @@ func (m *Message) Format(key interface{}) string { return kit.FmtTime(kit.Int64(time.Now().Sub(m.time))) case "meta": return kit.Format(m.meta) + case "append": + if len(m.meta["append"]) == 0 { + return fmt.Sprintf("%dx%d %s", 0, len(m.meta["append"]), kit.Format(m.meta["append"])) + } else { + return fmt.Sprintf("%dx%d %s", len(m.meta[m.meta["append"][0]]), len(m.meta["append"]), kit.Format(m.meta["append"])) + } case "time": return m.Time() case "ship":