1
0
forked from x/icebergs
This commit is contained in:
shylinux 2020-04-14 09:34:56 +08:00
parent e78deae00b
commit 28b0916688
4 changed files with 25 additions and 16 deletions

View File

@ -367,6 +367,12 @@ func (web *Frame) ServeHTTP(w http.ResponseWriter, r *http.Request) {
Render(m, "refresh") Render(m, "refresh")
m.Event(ice.SYSTEM_INIT) m.Event(ice.SYSTEM_INIT)
m.W = nil m.W = nil
} else if r.URL.Path == "/share" && r.Method == "GET" {
http.ServeFile(w, r, m.Conf(ice.WEB_SERVE, "meta.page.share"))
} else if r.URL.Path == "/" && r.Method == "GET" {
http.ServeFile(w, r, m.Conf(ice.WEB_SERVE, "meta.page.index"))
} else { } else {
web.ServeMux.ServeHTTP(w, r) web.ServeMux.ServeHTTP(w, r)
} }
@ -444,19 +450,22 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
Configs: map[string]*ice.Config{ Configs: map[string]*ice.Config{
ice.WEB_SPIDE: {Name: "spide", Help: "蜘蛛侠", Value: kit.Data(kit.MDB_SHORT, "client.name")}, ice.WEB_SPIDE: {Name: "spide", Help: "蜘蛛侠", Value: kit.Data(kit.MDB_SHORT, "client.name")},
ice.WEB_SERVE: {Name: "serve", Help: "服务器", Value: kit.Data( ice.WEB_SERVE: {Name: "serve", Help: "服务器", Value: kit.Data(
"static", map[string]interface{}{"/": "usr/volcanos/", "page", kit.Dict(
"/static/volcanos/": "usr/volcanos/", "index", "usr/volcanos/page/index.html",
"/publish/": "usr/publish/", "share", "usr/volcanos/page/share.html",
}, ),
"static", kit.Dict("/", "usr/volcanos/",
"/static/volcanos/", "usr/volcanos/",
"/publish/", "usr/publish/",
),
"volcanos", kit.Dict("path", "usr/volcanos", "branch", "master", "volcanos", kit.Dict("path", "usr/volcanos", "branch", "master",
"repos", "https://github.com/shylinux/volcanos", "repos", "https://github.com/shylinux/volcanos",
"require", "usr/local", "require", "usr/local",
), ),
"template", map[string]interface{}{"path": "usr/template", "list": []interface{}{ "template", kit.Dict("path", "usr/template", "list", []interface{}{
`{{define "raw"}}{{.Result}}{{end}}`, `{{define "raw"}}{{.Result}}{{end}}`,
}}, }),
"logheaders", "false", "logheaders", "false", "init", "false",
"init", "false",
)}, )},
ice.WEB_SPACE: {Name: "space", Help: "空间站", Value: kit.Data(kit.MDB_SHORT, kit.MDB_NAME, ice.WEB_SPACE: {Name: "space", Help: "空间站", Value: kit.Data(kit.MDB_SHORT, kit.MDB_NAME,
"redial.a", 3000, "redial.b", 1000, "redial.c", 1000, "redial.a", 3000, "redial.b", 1000, "redial.c", 1000,
@ -2099,7 +2108,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
if arg[1] == "" { if arg[1] == "" {
// 返回主页 // 返回主页
Render(m, ice.RENDER_DOWNLOAD, m.Conf(ice.WEB_SHARE, "meta.index")) Render(m, ice.RENDER_DOWNLOAD, m.Conf(ice.WEB_SERVE, "meta.page.share"))
break break
} }

View File

@ -212,7 +212,7 @@ var Index = &ice.Context{Name: "team", Help: "团队中心",
}) })
}}, }},
"plan": {Name: "plan scale:select=day|week|month|year begin_time=@date end_time=@date auto", Help: "计划", Meta: kit.Dict( "plan": {Name: "plan scale:select=day|week|month|year begin_time=@date end_time=@date auto", Help: "计划", Meta: kit.Dict(
"display", "team/plan", "detail", []string{"process", "finish", "cancel"}, "display", "local/team/plan", "detail", []string{"process", "finish", "cancel"},
), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
// 起始日期 // 起始日期
first := time.Now() first := time.Now()

View File

@ -323,7 +323,7 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心",
m.Render(ice.RENDER_TEMPLATE, m.Conf("chart", "meta.suffix")) m.Render(ice.RENDER_TEMPLATE, m.Conf("chart", "meta.suffix"))
}}, }},
"draw": {Name: "draw path auto", Help: "思维导图", Meta: kit.Dict("display", "wiki/draw"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { "draw": {Name: "draw path auto", Help: "思维导图", Meta: kit.Dict("display", "local/wiki/draw"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) > 0 && arg[0] == "action" { if len(arg) > 0 && arg[0] == "action" {
switch arg[1] { switch arg[1] {
case "保存": case "保存":
@ -334,7 +334,7 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心",
reply(m, cmd, arg...) reply(m, cmd, arg...)
}}, }},
"data": {Name: "data path auto", Help: "数据表格", Meta: kit.Dict("display", "wiki/data"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { "data": {Name: "data path auto", Help: "数据表格", Meta: kit.Dict("display", "local/wiki/data"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) > 0 && arg[0] == "action" { if len(arg) > 0 && arg[0] == "action" {
switch arg[1] { switch arg[1] {
case "保存": case "保存":
@ -350,7 +350,7 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心",
// 解析数据 // 解析数据
m.CSV(m.Result()) m.CSV(m.Result())
}}, }},
"word": {Name: "word path auto", Help: "语言文字", Meta: kit.Dict("display", "wiki/word"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { "word": {Name: "word path auto", Help: "语言文字", Meta: kit.Dict("display", "local/wiki/word"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) > 0 && arg[0] == "action" { if len(arg) > 0 && arg[0] == "action" {
switch arg[1] { switch arg[1] {
case "story": case "story":
@ -414,7 +414,7 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心",
m.Set("result").Cmdy(ice.SSH_SOURCE, path.Join(m.Conf(cmd, "meta.path"), arg[0])) m.Set("result").Cmdy(ice.SSH_SOURCE, path.Join(m.Conf(cmd, "meta.path"), arg[0]))
}}, }},
"feel": {Name: "feel path auto 上传:button=@upload", Help: "影音媒体", Meta: kit.Dict( "feel": {Name: "feel path auto 上传:button=@upload", Help: "影音媒体", Meta: kit.Dict(
"display", "wiki/feel", "detail", []string{"标签", "删除"}, "display", "local/wiki/feel", "detail", []string{"标签", "删除"},
), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if m.Option("_action") == "上传" { if m.Option("_action") == "上传" {
m.Cmd(ice.WEB_CACHE, "watch", m.Option("_data"), path.Join(m.Option("name"), m.Option("_name"))) m.Cmd(ice.WEB_CACHE, "watch", m.Option("_data"), path.Join(m.Option("name"), m.Option("_name")))
@ -460,7 +460,7 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心",
// 下载文件 // 下载文件
m.Echo(path.Join(m.Conf(cmd, "meta.path"), arg[0])) m.Echo(path.Join(m.Conf(cmd, "meta.path"), arg[0]))
}}, }},
"walk": {Name: "walk path=@province auto", Help: "走遍世界", Meta: kit.Dict("display", "wiki/walk"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { "walk": {Name: "walk path=@province auto", Help: "走遍世界", Meta: kit.Dict("display", "local/wiki/walk"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) > 0 && arg[0] == "action" { if len(arg) > 0 && arg[0] == "action" {
switch arg[1] { switch arg[1] {
case "保存": case "保存":

View File

@ -824,7 +824,7 @@ func (m *Message) Log(level string, str string, arg ...interface{}) *Message {
prefix, suffix = "\033[31m", "\033[0m" prefix, suffix = "\033[31m", "\033[0m"
} }
if os.Getenv("ctx_mod") != "" { if os.Getenv("ctx_mod") != "" && m != nil {
// 输出日志 // 输出日志
fmt.Fprintf(os.Stderr, "%s %02d %9s %s%s %s%s\n", fmt.Fprintf(os.Stderr, "%s %02d %9s %s%s %s%s\n",
m.time.Format(ICE_TIME), m.code, fmt.Sprintf("%s->%s", m.source.Name, m.target.Name), m.time.Format(ICE_TIME), m.code, fmt.Sprintf("%s->%s", m.source.Name, m.target.Name),