mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-28 18:02:02 +08:00
tce pro right
This commit is contained in:
parent
1cc1ab4b87
commit
fadba3ea48
@ -1,3 +1,5 @@
|
|||||||
|
return
|
||||||
|
|
||||||
source etc/local.shy
|
source etc/local.shy
|
||||||
|
|
||||||
~file1
|
~file1
|
||||||
|
@ -2675,15 +2675,56 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
|
|||||||
Help: "用户组管理,查看、添加、删除用户组或是接口",
|
Help: "用户组管理,查看、添加、删除用户组或是接口",
|
||||||
Form: map[string]int{"check": 0, "add": 0, "del": 0, "brow": 0, "cache": 0, "config": 0, "command": 0},
|
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) {
|
Hand: func(m *Message, c *Context, key string, arg ...string) {
|
||||||
index := m.Target().Index // {{{
|
index := m.target.Index
|
||||||
if index == nil {
|
if index == nil {
|
||||||
m.Target().Index = map[string]*Context{}
|
m.target.Index = map[string]*Context{}
|
||||||
index = m.Target().Index
|
index = m.target.Index
|
||||||
}
|
}
|
||||||
|
|
||||||
current := m.Target()
|
current := m.target
|
||||||
aaa := m.Sess("aaa", false)
|
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"]
|
void := index["void"]
|
||||||
|
|
||||||
|
switch arg[0] {
|
||||||
|
case "show":
|
||||||
|
case "add":
|
||||||
|
case "del":
|
||||||
|
}
|
||||||
|
return
|
||||||
|
// {{{
|
||||||
|
|
||||||
if aaa != nil && aaa.Cap("username") != aaa.Conf("rootname") {
|
if aaa != nil && aaa.Cap("username") != aaa.Conf("rootname") {
|
||||||
if current = index[aaa.Cap("username")]; current == nil {
|
if current = index[aaa.Cap("username")]; current == nil {
|
||||||
if void != nil {
|
if void != nil {
|
||||||
|
@ -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)) { // {{{
|
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) {
|
web.HandleFunc(key, func(w http.ResponseWriter, r *http.Request) {
|
||||||
msg := m.Spawn().Set("detail", key)
|
msg := m.Spawn().Set("detail", key)
|
||||||
|
msg.Sess("request", m.Spawn())
|
||||||
msg.Option("terminal_color", false)
|
msg.Option("terminal_color", false)
|
||||||
msg.Option("method", r.Method)
|
msg.Option("method", r.Method)
|
||||||
msg.Option("referer", r.Header.Get("Referer"))
|
msg.Option("referer", r.Header.Get("Referer"))
|
||||||
@ -642,7 +643,6 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
if !m.Options("dir") {
|
if !m.Options("dir") {
|
||||||
m.Option("dir", m.Cap("directory"))
|
m.Option("dir", m.Cap("directory"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 输出文件
|
// 输出文件
|
||||||
s, e := os.Stat(m.Option("dir"))
|
s, e := os.Stat(m.Option("dir"))
|
||||||
if m.Assert(e); !s.IsDir() {
|
if m.Assert(e); !s.IsDir() {
|
||||||
@ -651,6 +651,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
}
|
}
|
||||||
|
|
||||||
if false {
|
if false {
|
||||||
|
|
||||||
check := m.Spawn().Cmd("/share", "/upload", "dir", m.Option("dir"))
|
check := m.Spawn().Cmd("/share", "/upload", "dir", m.Option("dir"))
|
||||||
if !check.Results(0) {
|
if !check.Results(0) {
|
||||||
m.Copy(check, "append")
|
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) {
|
"/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) { // {{{
|
// if check := m.Spawn().Cmd("/share", "/upload", "dir", m.Option("dir")); !check.Results(0) { // {{{
|
||||||
m.Copy(check, "append")
|
// m.Copy(check, "append")
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
r := m.Optionv("request").(*http.Request)
|
r := m.Optionv("request").(*http.Request)
|
||||||
if m.Option("method") == "POST" {
|
if m.Option("method") == "POST" {
|
||||||
if m.Options("filename") { //添加文件或目录
|
if m.Options("filename") { //添加文件或目录
|
||||||
|
Loading…
x
Reference in New Issue
Block a user