1
0
forked from x/icebergs

opt publish

This commit is contained in:
shaoying 2020-05-11 14:32:13 +08:00
parent b978f0a8eb
commit b9317a23b0
2 changed files with 27 additions and 17 deletions

View File

@ -2420,6 +2420,21 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
}
m.Render(ice.RENDER_DOWNLOAD, path.Join(prefix, repos, path.Join(arg[2:]...)))
}},
"/publish/": {Name: "/publish/", Help: "空间站", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if p := m.Option("pod"); p != "" {
m.Option("pod", "")
m.Cmdy(ice.WEB_SPACE, p, "web./publish/", arg)
m.Render(ice.RENDER_RESULT)
return
}
p := path.Join(kit.Simple(m.Conf(ice.WEB_SERVE, "meta.publish"), arg)...)
if m.W == nil {
m.Cmdy("nfs.cat", p)
return
}
m.Render(ice.RENDER_DOWNLOAD, p)
}},
"/local/": {Name: "/space/", Help: "空间站", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
p := path.Join(cmd)
switch strings.TrimSuffix(path.Ext(p), ".") {
@ -2427,14 +2442,6 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
m.Render(ice.RENDER_DOWNLOAD, p)
}
}},
"/publish/": {Name: "/publish/", Help: "空间站", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if m.Option("pod") != "" {
m.Cmdy(ice.WEB_SPACE, m.Option("pod"), "web./publish", arg)
m.Render(ice.RENDER_RESULT)
return
}
m.Render(ice.RENDER_DOWNLOAD, path.Join(kit.Simple(m.Conf(ice.WEB_SERVE, "meta.publish"), arg)...))
}},
},
}

View File

@ -415,14 +415,24 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
"/target": {Name: "/target", Help: "对话框", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
"/source": {Name: "/source", Help: "输入框", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
"/action": {Name: "/action", Help: "工作台", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
// 代理命令
proxy := []string{}
if m.Option("pod") != "" {
proxy = append(proxy, ice.WEB_PROXY, m.Option("pod"))
m.Option("pod", "")
}
if m.Warn(m.Option(ice.MSG_RIVER) == "" || m.Option(ice.MSG_STORM) == "", "not join") {
m.Set(ice.MSG_RESULT)
cmds := kit.Simple(kit.Keys(m.Option("group"), m.Option("index")), arg[3:])
if !m.Right(cmds) {
m.Render("status", 403, "not auth")
return
}
m.Set(ice.MSG_RESULT)
m.Cmdy(cmds).Option("cmds", cmds)
// 执行命令
m.Cmdy(proxy, cmds).Option("cmds", cmds)
return
// m.Render("status", 402, "not join")
}
@ -541,13 +551,6 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
return
}
// 代理命令
proxy := []string{}
if m.Option("pod") != "" {
proxy = append(proxy, ice.WEB_PROXY, m.Option("pod"))
m.Option("pod", "")
}
// 执行命令
m.Cmdy(proxy, cmds).Option("cmds", cmds)
}},