forked from x/icebergs
opt some
This commit is contained in:
parent
9357c73cd7
commit
3cf004299e
@ -90,6 +90,19 @@ func RenderCookie(msg *ice.Message, value string, arg ...string) { // name path
|
|||||||
func RenderRedirect(msg *ice.Message, arg ...string) {
|
func RenderRedirect(msg *ice.Message, arg ...string) {
|
||||||
http.Redirect(msg.W, msg.R, kit.MergeURL(arg[0], arg[1:]), http.StatusTemporaryRedirect)
|
http.Redirect(msg.W, msg.R, kit.MergeURL(arg[0], arg[1:]), http.StatusTemporaryRedirect)
|
||||||
}
|
}
|
||||||
|
func RenderRefresh(msg *ice.Message, arg ...string) { // url text delay
|
||||||
|
msg.Render(ice.RENDER_VOID)
|
||||||
|
Render(msg, ice.RENDER_RESULT, kit.Format(`
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="%s; url='%s'">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
%s
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`, kit.Select("3", arg, 2), kit.Select(msg.Option(ice.MSG_USERWEB), arg, 0), kit.Select("loading...", arg, 1)))
|
||||||
|
}
|
||||||
func RenderType(w http.ResponseWriter, name, mime string) {
|
func RenderType(w http.ResponseWriter, name, mime string) {
|
||||||
if mime != "" {
|
if mime != "" {
|
||||||
w.Header().Set(ContentType, mime)
|
w.Header().Set(ContentType, mime)
|
||||||
|
@ -6,7 +6,9 @@ import (
|
|||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
@ -33,6 +35,9 @@ func init() {
|
|||||||
m.RenderCmd(web.ROUTE)
|
m.RenderCmd(web.ROUTE)
|
||||||
|
|
||||||
} else if len(arg) == 1 { // 节点首页
|
} else if len(arg) == 1 { // 节点首页
|
||||||
|
if m.Cmd(web.SPACE, arg[0]).Length() == 0 {
|
||||||
|
m.Cmd(web.DREAM, cli.START, mdb.NAME, arg[0])
|
||||||
|
}
|
||||||
aaa.UserRoot(m)
|
aaa.UserRoot(m)
|
||||||
if m.RenderWebsite(arg[0], "index.iml", "Header", "", "River", "", "Action", "", "Footer", ""); m.Result() == "" {
|
if m.RenderWebsite(arg[0], "index.iml", "Header", "", "River", "", "Action", "", "Footer", ""); m.Result() == "" {
|
||||||
m.RenderIndex(web.SERVE, ice.VOLCANOS)
|
m.RenderIndex(web.SERVE, ice.VOLCANOS)
|
||||||
|
@ -76,8 +76,7 @@ func (m *Message) RenderDownload(args ...interface{}) *Message {
|
|||||||
return m.Render(RENDER_DOWNLOAD, args...)
|
return m.Render(RENDER_DOWNLOAD, args...)
|
||||||
}
|
}
|
||||||
func (m *Message) RenderWebsite(pod string, dir string, arg ...string) *Message {
|
func (m *Message) RenderWebsite(pod string, dir string, arg ...string) *Message {
|
||||||
m.Cmdy("space", pod, "website", "action", "show", dir, arg)
|
return m.Cmdy("space", pod, "website", "action", "show", dir, arg).RenderResult()
|
||||||
return m.RenderResult()
|
|
||||||
}
|
}
|
||||||
func (m *Message) RenderIndex(serve, repos string, file ...string) *Message {
|
func (m *Message) RenderIndex(serve, repos string, file ...string) *Message {
|
||||||
return m.RenderDownload(path.Join(m.Conf(serve, kit.Keym(repos, "path")), kit.Select(m.Conf(serve, kit.Keym(repos, INDEX)), path.Join(file...))))
|
return m.RenderDownload(path.Join(m.Conf(serve, kit.Keym(repos, "path")), kit.Select(m.Conf(serve, kit.Keym(repos, INDEX)), path.Join(file...))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user