diff --git a/etc/init.shy b/etc/init.shy index 87afb658..74d24350 100644 --- a/etc/init.shy +++ b/etc/init.shy @@ -1,2 +1,3 @@ +var a = "0" source etc/local.shy ~aaa login root root diff --git a/src/contexts/cli/cli.go b/src/contexts/cli/cli.go index 3d8f0364..85c02b9e 100644 --- a/src/contexts/cli/cli.go +++ b/src/contexts/cli/cli.go @@ -270,8 +270,6 @@ func (cli *CLI) Close(m *ctx.Message, arg ...string) bool { // {{{ if _, ok := m.Source().Server.(*CLI); ok { // p.target = cli.target } - msg := m.Sesss("nfs") - msg.Target().Close(msg) case m.Source(): if m.Name == "aaa" { if !cli.Context.Close(m.Spawn(cli.Context), arg...) { @@ -659,16 +657,18 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心", } // }}} }}, "source": &ctx.Command{Name: "source file", Help: "运行脚本, file: 脚本文件名", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) { - target := m.Target() + target := m.Target() // {{{ if _, ok := m.Source().Server.(*CLI); ok { target = m.Source() } - if !m.Caps("skip") { // {{{ + if !m.Caps("skip") { msg := m.Spawn(target) msg.Start(fmt.Sprintf("%s_%d_%s", key, msg.Optioni("level", msg.Capi("level")+1), arg[0]), "脚本文件", arg[0]) <-msg.Target().Exit m.Copy(msg, "result").Copy(msg, "append") + nfs := msg.Sesss("nfs") + nfs.Target().Close(nfs) } // }}} }}, "return": &ctx.Command{Name: "return result...", Help: "结束脚本, rusult: 返回值", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) { diff --git a/src/contexts/web/web.go b/src/contexts/web/web.go index 53c48967..6fe246cc 100644 --- a/src/contexts/web/web.go +++ b/src/contexts/web/web.go @@ -48,18 +48,13 @@ func (web *WEB) generate(m *ctx.Message, uri string, arg ...string) string { // add, e := url.Parse(uri) m.Assert(e) - adds := []string{m.Confx("protocol", add.Scheme, "%s://")} - if add.Host == "" { - adds = append(adds, m.Confx("hostname", "", "%s%s", m.Confx("port", "", ":%s"))) - } else { - adds = append(adds, add.Host) - } + adds := []string{m.Confx("protocol", add.Scheme, "%s://"), m.Confx("hostname", add.Host)} if dir, file := path.Split(add.EscapedPath()); path.IsAbs(dir) { adds = append(adds, dir) adds = append(adds, file) } else { - adds = append(adds, m.Conf("dir")) + adds = append(adds, m.Conf("path")) if dir == "" && file == "" { adds = append(adds, m.Conf("file")) } else { @@ -295,8 +290,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心", m.Assert(e) m.Conf("method", "method", "GET", "请求方法") m.Conf("protocol", "protocol", uri.Scheme, "服务协议") - m.Conf("hostname", "hostname", uri.Hostname(), "服务主机") - m.Conf("port", "port", uri.Port(), "服务端口") + m.Conf("hostname", "hostname", uri.Host, "服务主机") dir, file := path.Split(uri.EscapedPath()) m.Conf("path", "path", dir, "服务路由") @@ -655,14 +649,18 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心", continue } - if v.IsDir() { - name += "/" - } - list.Add("append", "time_i", fmt.Sprintf("%d", v.ModTime().Unix())) list.Add("append", "size_i", fmt.Sprintf("%d", v.Size())) list.Add("append", "time", v.ModTime().Format("2006-01-02 15:04:05")) list.Add("append", "size", kit.FmtSize(v.Size())) + + if v.IsDir() { + name += "/" + list.Add("append", "type", "dir") + } else { + list.Add("append", "type", "file") + } + list.Add("append", "name", name) list.Add("append", "path", path.Join(m.Option("dir"), name)) } diff --git a/usr/template/upload.html b/usr/template/upload.html index 70a7c419..61651ee3 100644 --- a/usr/template/upload.html +++ b/usr/template/upload.html @@ -25,8 +25,10 @@ {{range $key := index $meta "append"}} {{if eq $key "name"}} + {{$type := index $meta "type" $i}} - {{index $meta $key $i}} + {{index $meta $key $i}} {{else if eq $key "path"}} {{else}}