diff --git a/base/web/web.go b/base/web/web.go index fab5ac92..f9e40009 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -367,6 +367,12 @@ func (web *Frame) ServeHTTP(w http.ResponseWriter, r *http.Request) { Render(m, "refresh") m.Event(ice.SYSTEM_INIT) 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 { web.ServeMux.ServeHTTP(w, r) } @@ -444,19 +450,22 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", Configs: map[string]*ice.Config{ ice.WEB_SPIDE: {Name: "spide", Help: "蜘蛛侠", Value: kit.Data(kit.MDB_SHORT, "client.name")}, ice.WEB_SERVE: {Name: "serve", Help: "服务器", Value: kit.Data( - "static", map[string]interface{}{"/": "usr/volcanos/", - "/static/volcanos/": "usr/volcanos/", - "/publish/": "usr/publish/", - }, + "page", kit.Dict( + "index", "usr/volcanos/page/index.html", + "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", "repos", "https://github.com/shylinux/volcanos", "require", "usr/local", ), - "template", map[string]interface{}{"path": "usr/template", "list": []interface{}{ + "template", kit.Dict("path", "usr/template", "list", []interface{}{ `{{define "raw"}}{{.Result}}{{end}}`, - }}, - "logheaders", "false", - "init", "false", + }), + "logheaders", "false", "init", "false", )}, ice.WEB_SPACE: {Name: "space", Help: "空间站", Value: kit.Data(kit.MDB_SHORT, kit.MDB_NAME, "redial.a", 3000, "redial.b", 1000, "redial.c", 1000, @@ -2099,7 +2108,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", 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 } diff --git a/core/team/team.go b/core/team/team.go index 55ee137a..d69a88d9 100644 --- a/core/team/team.go +++ b/core/team/team.go @@ -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( - "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) { // 起始日期 first := time.Now() diff --git a/core/wiki/wiki.go b/core/wiki/wiki.go index 9924c8fc..d165dc99 100644 --- a/core/wiki/wiki.go +++ b/core/wiki/wiki.go @@ -323,7 +323,7 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心", 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" { switch arg[1] { case "保存": @@ -334,7 +334,7 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心", 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" { switch arg[1] { case "保存": @@ -350,7 +350,7 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心", // 解析数据 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" { switch arg[1] { 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])) }}, "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) { if m.Option("_action") == "上传" { 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])) }}, - "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" { switch arg[1] { case "保存": diff --git a/type.go b/type.go index 3b86ae08..25155ae8 100644 --- a/type.go +++ b/type.go @@ -824,7 +824,7 @@ func (m *Message) Log(level string, str string, arg ...interface{}) *Message { 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", m.time.Format(ICE_TIME), m.code, fmt.Sprintf("%s->%s", m.source.Name, m.target.Name),