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) {
|
||||
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) {
|
||||
if mime != "" {
|
||||
w.Header().Set(ContentType, mime)
|
||||
|
@ -6,7 +6,9 @@ import (
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
@ -33,6 +35,9 @@ func init() {
|
||||
m.RenderCmd(web.ROUTE)
|
||||
|
||||
} 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)
|
||||
if m.RenderWebsite(arg[0], "index.iml", "Header", "", "River", "", "Action", "", "Footer", ""); m.Result() == "" {
|
||||
m.RenderIndex(web.SERVE, ice.VOLCANOS)
|
||||
|
@ -76,8 +76,7 @@ func (m *Message) RenderDownload(args ...interface{}) *Message {
|
||||
return m.Render(RENDER_DOWNLOAD, args...)
|
||||
}
|
||||
func (m *Message) RenderWebsite(pod string, dir string, arg ...string) *Message {
|
||||
m.Cmdy("space", pod, "website", "action", "show", dir, arg)
|
||||
return m.RenderResult()
|
||||
return m.Cmdy("space", pod, "website", "action", "show", dir, arg).RenderResult()
|
||||
}
|
||||
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...))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user