1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-26 01:04:06 +08:00

tce add usr/shy

This commit is contained in:
shaoying 2018-08-19 10:47:40 +08:00
parent 6b93a52249
commit 100d49f1b2
4 changed files with 39 additions and 6 deletions

View File

@ -230,7 +230,9 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
m.Wait()
m.Target().Close(m)
if arg[0] == "stdio" {
m.Spawn().Cmd("source", m.Conf("exit.shy"))
if f, e := os.Stat(m.Conf("exit.shy")); e == nil && !f.IsDir() {
m.Spawn().Cmd("source", m.Conf("exit.shy"))
}
}
}
}},

View File

@ -2950,14 +2950,23 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
m.Capi("list_count", 1)
return
case "list":
if m.Cap("list_begin") == "" {
return
}
begin, end := m.Capi("list_begin"), m.Capi("list_count")
if len(arg) > 1 {
n, e := strconv.Atoi(arg[1])
if e != nil {
return
}
m.Assert(e)
begin = n
}
if len(arg) > 2 {
n, e := strconv.Atoi(arg[2])
if e != nil {
return
}
m.Assert(e)
end = n
}

View File

@ -36,9 +36,11 @@ func (log *LOG) Begin(m *ctx.Message, arg ...string) ctx.Server { // {{{
// }}}
func (log *LOG) Start(m *ctx.Message, arg ...string) bool { // {{{
log.nfs = m.Sess("nfs").Cmd("append", m.Confx("bench.log", arg, 0), "", "日志文件")
log.out = log.nfs.Optionv("out").(*os.File)
fmt.Fprintln(log.out, "\n\n")
if f, e := os.Stat(m.Confx("bench.log", arg, 0)); e == nil && !f.IsDir() {
log.nfs = m.Sess("nfs").Cmd("append", m.Confx("bench.log", arg, 0), "", "日志文件")
log.out = log.nfs.Optionv("out").(*os.File)
fmt.Fprintln(log.out, "\n\n")
}
return false
}

View File

@ -323,6 +323,21 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
"argument": []interface{}{"duyu"},
"template": "append", "title": "lark",
},
map[string]interface{}{
"module": "nfs", "command": "dir",
"argument": []interface{}{"dir_type", "all", "dir_deep", "false", "dir_field", "time size line filename", "sort_field", "time", "sort_order", "time_r"},
"template": "append", "title": "",
},
map[string]interface{}{
"template": "upload", "title": "upload",
},
map[string]interface{}{
"template": "create", "title": "create",
},
map[string]interface{}{
"module": "nfs", "detail": []interface{}{"pwd"},
"template": "detail", "title": "pwd",
},
},
"shy": []interface{}{
map[string]interface{}{
@ -694,13 +709,18 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
r := m.Optionv("request").(*http.Request) // {{{
w := m.Optionv("response").(http.ResponseWriter)
if login := m.Spawn().Cmd("/login"); login.Has("template") {
m.Echo("no").Copy(login, "append")
return
}
m.Option("username", m.Append("username"))
//权限检查
dir := m.Option("dir", path.Join(m.Cap("directory"), m.Option("dir", strings.TrimPrefix(m.Option("path"), "/index"))))
dir := m.Option("dir", path.Join(m.Cap("directory"), m.Option("username"), m.Option("dir", strings.TrimPrefix(m.Option("path"), "/index"))))
if check := m.Spawn(c).Cmd("/check", "command", "/index/", "dir", dir); !check.Results(0) {
m.Copy(check, "append")
return
}
m.Option("username", m.Append("username"))
//执行命令
if m.Has("details") {