1
0
forked from x/ContextOS

tce fix some

This commit is contained in:
shaoying 2018-07-02 22:35:16 +08:00
parent bb3caf5dc6
commit 7ce1cc5ba5
4 changed files with 19 additions and 18 deletions

View File

@ -1,2 +1,3 @@
var a = "0"
source etc/local.shy
~aaa login root root

View File

@ -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) {

View File

@ -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))
}

View File

@ -25,8 +25,10 @@
<tr>
{{range $key := index $meta "append"}}
{{if eq $key "name"}}
{{$type := index $meta "type" $i}}
<td class="{{$key}}">
<a download="{{index $meta $key $i}}" href="/upload?dir={{index $meta "path" $i}}"><code>{{index $meta $key $i}}</code></a>
<a {{if eq $type "file"}} download="{{index $meta $key $i}}" {{end}}
href="/upload?dir={{index $meta "path" $i}}"><code>{{index $meta $key $i}}</code></a>
</td>
{{else if eq $key "path"}}
{{else}}