forked from x/ContextOS
mac mod something
This commit is contained in:
parent
cc702194b4
commit
cfdac033de
@ -1302,6 +1302,7 @@ func (m *Message) Exec(key string, arg ...string) string { // {{{
|
|||||||
|
|
||||||
if x, ok := s.Commands[key]; ok && x.Hand != nil && c.Check(m, "commands", key) {
|
if x, ok := s.Commands[key]; ok && x.Hand != nil && c.Check(m, "commands", key) {
|
||||||
m.AssertOne(m, true, func(m *Message) {
|
m.AssertOne(m, true, func(m *Message) {
|
||||||
|
fmt.Printf("fuck1-------- %v\n", m.Meta)
|
||||||
m.Log("cmd", s, "%d %s %v %v", len(m.target.Historys), key, arg, m.Meta["option"])
|
m.Log("cmd", s, "%d %s %v %v", len(m.target.Historys), key, arg, m.Meta["option"])
|
||||||
|
|
||||||
if x.Options != nil {
|
if x.Options != nil {
|
||||||
@ -2621,6 +2622,7 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
|
|||||||
m.Target().Index = map[string]*Context{}
|
m.Target().Index = map[string]*Context{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("fuck3\n")
|
||||||
current := m.Target()
|
current := m.Target()
|
||||||
aaa := m.Sesss("aaa")
|
aaa := m.Sesss("aaa")
|
||||||
void := index["void"]
|
void := index["void"]
|
||||||
|
@ -696,29 +696,35 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
m.Option("file", m.Cap("directory"))
|
m.Option("file", m.Cap("directory"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a := m
|
||||||
auth := m.Spawn(m.Target()).Put("option", "request", r).Put("option", "response", w)
|
auth := m.Spawn(m.Target()).Put("option", "request", r).Put("option", "response", w)
|
||||||
auth.CallBack(true, func(aaa *ctx.Message) *ctx.Message {
|
auth.CallBack(true, func(aaa *ctx.Message) *ctx.Message {
|
||||||
m.Log("fuck", nil, "upload-----------%v", aaa.Meta)
|
|
||||||
if aaa != nil {
|
if aaa != nil {
|
||||||
m.Sesss("aaa", aaa)
|
a = aaa
|
||||||
|
// m.Sesss("aaa", aaa)
|
||||||
}
|
}
|
||||||
return aaa
|
return aaa
|
||||||
}, "/check", "command", "/upload", "file", m.Option("file"))
|
}, "/check", "command", "/upload", "file", m.Option("file"))
|
||||||
m.Log("fuck", nil, "upload>>>>>>>>>>>%v", auth.Meta)
|
|
||||||
|
|
||||||
if auth.Append("right") != "ok" {
|
if auth.Append("right") != "ok" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
m.Log("fuck", nil, "why %v", auth.Meta)
|
||||||
|
|
||||||
if m.Option("method") == "POST" {
|
if m.Option("method") == "POST" {
|
||||||
if m.Options("notshareto") { // 取消共享
|
if m.Options("notshareto") { // 取消共享
|
||||||
msg := m.Spawn(m.Target())
|
msg := m.Spawn(m.Target())
|
||||||
|
msg.Sesss("aaa", a)
|
||||||
msg.Cmd("right", "del", m.Option("notshareto"), "command", "/upload", "file", m.Option("sharefile"))
|
msg.Cmd("right", "del", m.Option("notshareto"), "command", "/upload", "file", m.Option("sharefile"))
|
||||||
m.Append("link", "hello")
|
m.Append("link", "hello")
|
||||||
return
|
return
|
||||||
} else if m.Options("shareto") { //共享目录
|
} else if m.Options("shareto") { //共享目录
|
||||||
|
m.Log("fuck", nil, "why %v", auth.Meta)
|
||||||
msg := m.Spawn(m.Target()) //TODO
|
msg := m.Spawn(m.Target()) //TODO
|
||||||
|
msg.Sesss("aaa", a)
|
||||||
|
fmt.Printf("fuck1--------\n")
|
||||||
msg.Cmd("right", "add", m.Option("shareto"), "command", "/upload", "file", m.Option("sharefile"))
|
msg.Cmd("right", "add", m.Option("shareto"), "command", "/upload", "file", m.Option("sharefile"))
|
||||||
|
fmt.Printf("fuck2---------\n")
|
||||||
m.Append("link", "hello")
|
m.Append("link", "hello")
|
||||||
return
|
return
|
||||||
} else if m.Options("filename") { //添加文件或目录
|
} else if m.Options("filename") { //添加文件或目录
|
||||||
@ -759,10 +765,6 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析模板
|
|
||||||
render := m.Spawn(m.Target()).Put("option", "request", r).Put("option", "response", w)
|
|
||||||
defer render.Cmd(m.Conf("upload_main"), m.Conf("upload_tmpl"))
|
|
||||||
|
|
||||||
// 输出文件
|
// 输出文件
|
||||||
s, e := os.Stat(m.Option("file"))
|
s, e := os.Stat(m.Option("file"))
|
||||||
if m.Assert(e); !s.IsDir() {
|
if m.Assert(e); !s.IsDir() {
|
||||||
@ -770,11 +772,17 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解析模板
|
||||||
|
render := m.Spawn(m.Target()).Put("option", "request", r).Put("option", "response", w)
|
||||||
|
|
||||||
|
m.Log("fuck", nil, "group: %v", a.Meta)
|
||||||
// 共享列表
|
// 共享列表
|
||||||
share := m.Sesss("share", m.Target())
|
share := render.Sesss("share", m.Target())
|
||||||
index := share.Target().Index
|
index := share.Target().Index
|
||||||
if index != nil && index[m.Option("group")] != nil {
|
if index != nil && index[a.Append("group")] != nil {
|
||||||
for k, v := range index[m.Option("group")].Index {
|
m.Log("fuck", nil, "group: %v", index)
|
||||||
|
for k, v := range index[a.Append("group")].Index {
|
||||||
|
m.Log("fuck", nil, "group: %v", a.Meta)
|
||||||
for i, j := range v.Commands {
|
for i, j := range v.Commands {
|
||||||
for v, n := range j.Shares {
|
for v, n := range j.Shares {
|
||||||
for _, nn := range n {
|
for _, nn := range n {
|
||||||
@ -795,7 +803,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
fs, e := ioutil.ReadDir(m.Option("file"))
|
fs, e := ioutil.ReadDir(m.Option("file"))
|
||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
fs = append(fs, s)
|
fs = append(fs, s)
|
||||||
list := m.Sesss("list", m.Target())
|
list := render.Sesss("list", m.Target())
|
||||||
list.Option("file", m.Option("file"))
|
list.Option("file", m.Option("file"))
|
||||||
|
|
||||||
// 目录排序
|
// 目录排序
|
||||||
@ -856,7 +864,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
// 执行命令
|
// 执行命令
|
||||||
switch m.Option("cmd") {
|
switch m.Option("cmd") {
|
||||||
case "git":
|
case "git":
|
||||||
git := m.Sesss("git", m.Target())
|
git := render.Sesss("git", m.Target())
|
||||||
|
|
||||||
branch := m.Find("nfs").Cmd("git", "-C", m.Option("file"), "branch")
|
branch := m.Find("nfs").Cmd("git", "-C", m.Option("file"), "branch")
|
||||||
git.Option("branch", branch.Result(0))
|
git.Option("branch", branch.Result(0))
|
||||||
@ -865,8 +873,9 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
git.Option("status", status.Result(0))
|
git.Option("status", status.Result(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Option("title", "upload")
|
render.Option("title", "upload")
|
||||||
m.Option("tmpl", "userinfo", "share", "list", "git", "upload", "create")
|
render.Option("tmpl", "userinfo", "share", "list", "git", "upload", "create")
|
||||||
|
render.Cmd("/render", m.Conf("upload_main"), m.Conf("upload_tmpl"))
|
||||||
// }}}
|
// }}}
|
||||||
}},
|
}},
|
||||||
"/render": &ctx.Command{Name: "/render [main [tmpl]]", Help: "生成模板", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
"/render": &ctx.Command{Name: "/render [main [tmpl]]", Help: "生成模板", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||||
@ -891,14 +900,12 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
|
|
||||||
user := m.Spawn(m.Target()).Put("option", "request", r).Put("option", "response", w)
|
user := m.Spawn(m.Target()).Put("option", "request", r).Put("option", "response", w)
|
||||||
user.CallBack(true, func(aaa *ctx.Message) *ctx.Message {
|
user.CallBack(true, func(aaa *ctx.Message) *ctx.Message {
|
||||||
if aaa.Caps("group") {
|
if aaa.Appends("group") {
|
||||||
msg := aaa.Spawn(m.Target()).Cmd("right", "check", aaa.Cap("group"), arg)
|
msg := aaa.Spawn(m.Target()).Cmd("right", "check", aaa.Append("group"), arg)
|
||||||
m.Append("right", msg.Result(0))
|
m.Append("right", msg.Result(0))
|
||||||
}
|
}
|
||||||
m.Log("fuck", nil, "aaa: %v", aaa)
|
|
||||||
return aaa
|
return aaa
|
||||||
}, "/login")
|
}, "/login")
|
||||||
m.Log("fuck", nil, "aaa----: %v", m)
|
|
||||||
}},
|
}},
|
||||||
"/login": &ctx.Command{Name: "/login", Help: "用户登录", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
"/login": &ctx.Command{Name: "/login", Help: "用户登录", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||||
r := m.Data["request"].(*http.Request)
|
r := m.Data["request"].(*http.Request)
|
||||||
@ -908,7 +915,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
if aaa := m.Find("aaa").Cmd("login", m.Option("sessid")); aaa.Result(0) != "error: " {
|
if aaa := m.Find("aaa").Cmd("login", m.Option("sessid")); aaa.Result(0) != "error: " {
|
||||||
m.Append("username", aaa.Cap("username"))
|
m.Append("username", aaa.Cap("username"))
|
||||||
m.Append("group", aaa.Cap("group"))
|
m.Append("group", aaa.Cap("group"))
|
||||||
m.Back(aaa)
|
m.Back(m)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user