forked from x/ContextOS
tce fix some
This commit is contained in:
parent
bb3caf5dc6
commit
7ce1cc5ba5
@ -1,2 +1,3 @@
|
|||||||
|
var a = "0"
|
||||||
source etc/local.shy
|
source etc/local.shy
|
||||||
~aaa login root root
|
~aaa login root root
|
||||||
|
@ -270,8 +270,6 @@ func (cli *CLI) Close(m *ctx.Message, arg ...string) bool { // {{{
|
|||||||
if _, ok := m.Source().Server.(*CLI); ok {
|
if _, ok := m.Source().Server.(*CLI); ok {
|
||||||
// p.target = cli.target
|
// p.target = cli.target
|
||||||
}
|
}
|
||||||
msg := m.Sesss("nfs")
|
|
||||||
msg.Target().Close(msg)
|
|
||||||
case m.Source():
|
case m.Source():
|
||||||
if m.Name == "aaa" {
|
if m.Name == "aaa" {
|
||||||
if !cli.Context.Close(m.Spawn(cli.Context), arg...) {
|
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) {
|
"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 {
|
if _, ok := m.Source().Server.(*CLI); ok {
|
||||||
target = m.Source()
|
target = m.Source()
|
||||||
}
|
}
|
||||||
|
|
||||||
if !m.Caps("skip") { // {{{
|
if !m.Caps("skip") {
|
||||||
msg := m.Spawn(target)
|
msg := m.Spawn(target)
|
||||||
msg.Start(fmt.Sprintf("%s_%d_%s", key, msg.Optioni("level", msg.Capi("level")+1), arg[0]), "脚本文件", arg[0])
|
msg.Start(fmt.Sprintf("%s_%d_%s", key, msg.Optioni("level", msg.Capi("level")+1), arg[0]), "脚本文件", arg[0])
|
||||||
<-msg.Target().Exit
|
<-msg.Target().Exit
|
||||||
m.Copy(msg, "result").Copy(msg, "append")
|
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) {
|
"return": &ctx.Command{Name: "return result...", Help: "结束脚本, rusult: 返回值", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||||
|
@ -48,18 +48,13 @@ func (web *WEB) generate(m *ctx.Message, uri string, arg ...string) string { //
|
|||||||
add, e := url.Parse(uri)
|
add, e := url.Parse(uri)
|
||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
|
|
||||||
adds := []string{m.Confx("protocol", add.Scheme, "%s://")}
|
adds := []string{m.Confx("protocol", add.Scheme, "%s://"), m.Confx("hostname", add.Host)}
|
||||||
if add.Host == "" {
|
|
||||||
adds = append(adds, m.Confx("hostname", "", "%s%s", m.Confx("port", "", ":%s")))
|
|
||||||
} else {
|
|
||||||
adds = append(adds, add.Host)
|
|
||||||
}
|
|
||||||
|
|
||||||
if dir, file := path.Split(add.EscapedPath()); path.IsAbs(dir) {
|
if dir, file := path.Split(add.EscapedPath()); path.IsAbs(dir) {
|
||||||
adds = append(adds, dir)
|
adds = append(adds, dir)
|
||||||
adds = append(adds, file)
|
adds = append(adds, file)
|
||||||
} else {
|
} else {
|
||||||
adds = append(adds, m.Conf("dir"))
|
adds = append(adds, m.Conf("path"))
|
||||||
if dir == "" && file == "" {
|
if dir == "" && file == "" {
|
||||||
adds = append(adds, m.Conf("file"))
|
adds = append(adds, m.Conf("file"))
|
||||||
} else {
|
} else {
|
||||||
@ -295,8 +290,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
m.Conf("method", "method", "GET", "请求方法")
|
m.Conf("method", "method", "GET", "请求方法")
|
||||||
m.Conf("protocol", "protocol", uri.Scheme, "服务协议")
|
m.Conf("protocol", "protocol", uri.Scheme, "服务协议")
|
||||||
m.Conf("hostname", "hostname", uri.Hostname(), "服务主机")
|
m.Conf("hostname", "hostname", uri.Host, "服务主机")
|
||||||
m.Conf("port", "port", uri.Port(), "服务端口")
|
|
||||||
|
|
||||||
dir, file := path.Split(uri.EscapedPath())
|
dir, file := path.Split(uri.EscapedPath())
|
||||||
m.Conf("path", "path", dir, "服务路由")
|
m.Conf("path", "path", dir, "服务路由")
|
||||||
@ -655,14 +649,18 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.IsDir() {
|
|
||||||
name += "/"
|
|
||||||
}
|
|
||||||
|
|
||||||
list.Add("append", "time_i", fmt.Sprintf("%d", v.ModTime().Unix()))
|
list.Add("append", "time_i", fmt.Sprintf("%d", v.ModTime().Unix()))
|
||||||
list.Add("append", "size_i", fmt.Sprintf("%d", v.Size()))
|
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", "time", v.ModTime().Format("2006-01-02 15:04:05"))
|
||||||
list.Add("append", "size", kit.FmtSize(v.Size()))
|
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", "name", name)
|
||||||
list.Add("append", "path", path.Join(m.Option("dir"), name))
|
list.Add("append", "path", path.Join(m.Option("dir"), name))
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
{{range $key := index $meta "append"}}
|
{{range $key := index $meta "append"}}
|
||||||
{{if eq $key "name"}}
|
{{if eq $key "name"}}
|
||||||
|
{{$type := index $meta "type" $i}}
|
||||||
<td class="{{$key}}">
|
<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>
|
</td>
|
||||||
{{else if eq $key "path"}}
|
{{else if eq $key "path"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user