diff --git a/etc/init.shy b/etc/init.shy index 90a10ad6..6f02bb0d 100644 --- a/etc/init.shy +++ b/etc/init.shy @@ -1,3 +1,5 @@ +return + source etc/local.shy ~file1 diff --git a/src/contexts/ctx.go b/src/contexts/ctx.go index 3079e8eb..01f94e6c 100644 --- a/src/contexts/ctx.go +++ b/src/contexts/ctx.go @@ -2675,15 +2675,56 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Help: "用户组管理,查看、添加、删除用户组或是接口", Form: map[string]int{"check": 0, "add": 0, "del": 0, "brow": 0, "cache": 0, "config": 0, "command": 0}, Hand: func(m *Message, c *Context, key string, arg ...string) { - index := m.Target().Index // {{{ + index := m.target.Index if index == nil { - m.Target().Index = map[string]*Context{} - index = m.Target().Index + m.target.Index = map[string]*Context{} + index = m.target.Index } - current := m.Target() + current := m.target aaa := m.Sess("aaa", false) + if aaa.Cap("username") != aaa.Conf("rootname") { + current = index[aaa.Cap("username")] + } + m.Echo("username:%s\n", aaa.Cap("username")) + + if len(arg) == 0 { + if current != nil { + for k, x := range current.Caches { + m.Add("append", "ccc", "cache") + m.Add("append", "key", k) + m.Add("append", "name", x.Name) + } + for k, x := range current.Configs { + m.Add("append", "ccc", "config") + m.Add("append", "key", k) + m.Add("append", "name", x.Name) + } + for k, x := range current.Commands { + m.Add("append", "ccc", "command") + m.Add("append", "key", k) + m.Add("append", "name", x.Name) + } + for k, x := range current.Index { + m.Add("append", "ccc", "context") + m.Add("append", "key", k) + m.Add("append", "name", x.Name) + } + m.Table() + } + return + } + void := index["void"] + + switch arg[0] { + case "show": + case "add": + case "del": + } + return + // {{{ + if aaa != nil && aaa.Cap("username") != aaa.Conf("rootname") { if current = index[aaa.Cap("username")]; current == nil { if void != nil { diff --git a/src/contexts/web/web.go b/src/contexts/web/web.go index 721e758b..49f592c3 100644 --- a/src/contexts/web/web.go +++ b/src/contexts/web/web.go @@ -92,6 +92,7 @@ func (web *WEB) Merge(m *ctx.Message, uri string, arg ...string) string { // {{{ func (web *WEB) Trans(m *ctx.Message, key string, hand func(*ctx.Message, *ctx.Context, string, ...string)) { // {{{ web.HandleFunc(key, func(w http.ResponseWriter, r *http.Request) { msg := m.Spawn().Set("detail", key) + msg.Sess("request", m.Spawn()) msg.Option("terminal_color", false) msg.Option("method", r.Method) msg.Option("referer", r.Header.Get("Referer")) @@ -642,7 +643,6 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心", if !m.Options("dir") { m.Option("dir", m.Cap("directory")) } - // 输出文件 s, e := os.Stat(m.Option("dir")) if m.Assert(e); !s.IsDir() { @@ -651,6 +651,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心", } if false { + check := m.Spawn().Cmd("/share", "/upload", "dir", m.Option("dir")) if !check.Results(0) { m.Copy(check, "append") @@ -756,11 +757,11 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心", // }}} }}, "/create": &ctx.Command{Name: "/create", Help: "创建目录或文件", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) { - if check := m.Spawn().Cmd("/share", "/upload", "dir", m.Option("dir")); !check.Results(0) { // {{{ - m.Copy(check, "append") - return - } - + // if check := m.Spawn().Cmd("/share", "/upload", "dir", m.Option("dir")); !check.Results(0) { // {{{ + // m.Copy(check, "append") + // return + // } + // r := m.Optionv("request").(*http.Request) if m.Option("method") == "POST" { if m.Options("filename") { //添加文件或目录