forked from x/icebergs
opt some
This commit is contained in:
parent
2f43d52c2d
commit
5b3b3df314
@ -147,7 +147,7 @@ func init() {
|
||||
)},
|
||||
}, Commands: ice.Commands{
|
||||
CAT: {Name: "cat path auto", Help: "文件", Actions: ice.Actions{
|
||||
ctx.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, ice.SRC_MAIN_SHY)
|
||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, ice.SRC_MAIN_GO)
|
||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, ice.USR_PUBLISH)
|
||||
|
@ -23,7 +23,7 @@ const (
|
||||
STATUS = "status"
|
||||
)
|
||||
|
||||
func Render(m *ice.Message, cmd string, args ...ice.Any) {
|
||||
func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
|
||||
if cmd != "" {
|
||||
defer func() { m.Logs(mdb.EXPORT, cmd, args) }()
|
||||
}
|
||||
@ -84,6 +84,7 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) {
|
||||
fmt.Fprint(m.W, m.FormatsMeta())
|
||||
// fmt.Fprint(m.W, m.FormatMeta())
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func RenderType(w http.ResponseWriter, name, mime string) {
|
||||
@ -163,15 +164,34 @@ func RenderCmd(m *ice.Message, index string, args ...ice.Any) {
|
||||
mdb.LIST, kit.UnMarshal(msg.Append(mdb.LIST)), mdb.META, kit.UnMarshal(msg.Append(mdb.META)),
|
||||
)))
|
||||
}
|
||||
m.Echo(kit.Format(_cans, list))
|
||||
m.RenderResult()
|
||||
m.Echo(kit.Format(_cmd_template, list)).RenderResult()
|
||||
}
|
||||
func RenderMain(m *ice.Message, index string, args ...ice.Any) *ice.Message {
|
||||
return m.Echo(kit.Format(_main_template, m.Cmdx(nfs.CAT, index))).RenderResult()
|
||||
}
|
||||
|
||||
var _cans = `<!DOCTYPE html>
|
||||
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=0.8,maximum-scale=0.8,user-scalable=no">
|
||||
var _cmd_template = `<!DOCTYPE html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=0.8,maximum-scale=0.8,user-scalable=no">
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="/page/can.css">
|
||||
</head>
|
||||
<body>
|
||||
<script src="/page/can.js"></script><script>Volcanos(%s)</script>
|
||||
</body>
|
||||
`
|
||||
var _main_template = `<!DOCTYPE html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=0.8,maximum-scale=0.8,user-scalable=no"/>
|
||||
<meta charset="utf-8">
|
||||
<title>volcanos</title>
|
||||
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="/page/cache.css">
|
||||
<link rel="stylesheet" type="text/css" href="/page/index.css">
|
||||
</head>
|
||||
<body>
|
||||
<script src="/proto.js"></script>
|
||||
<script src="/page/cache.js"></script>
|
||||
<script>%s</script>
|
||||
</body>
|
||||
`
|
||||
|
@ -36,16 +36,15 @@ func _serve_rewrite(m *ice.Message) {
|
||||
switch r.URL.Path {
|
||||
case ice.PS:
|
||||
if repos == ice.VOLCANOS {
|
||||
if nfs.ExistsFile(ice.SRC_MAIN_JS) {
|
||||
return
|
||||
if nfs.ExistsFile(m, ice.SRC_MAIN_JS) {
|
||||
RenderMain(msg, ice.SRC_MAIN_JS)
|
||||
return Render(msg, ice.RENDER_RESULT, msg.Result())
|
||||
}
|
||||
if s := msg.Cmdx("web.chat.website", lex.PARSE, ice.INDEX_IML, "Header", "", "River", "", "Footer", ""); s != "" {
|
||||
Render(msg, ice.RENDER_RESULT, s)
|
||||
return true // 定制主页
|
||||
return Render(msg, ice.RENDER_RESULT, s)
|
||||
}
|
||||
}
|
||||
Render(msg, ice.RENDER_DOWNLOAD, path.Join(msg.Config(kit.Keys(repos, nfs.PATH)), msg.Config(kit.Keys(repos, INDEX))))
|
||||
return true // 默认主页
|
||||
return Render(msg, ice.RENDER_DOWNLOAD, path.Join(msg.Config(kit.Keys(repos, nfs.PATH)), msg.Config(kit.Keys(repos, INDEX))))
|
||||
|
||||
case PP(ice.HELP):
|
||||
r.URL.Path = P(ice.HELP, ice.TUTOR_SHY)
|
||||
|
2
conf.go
2
conf.go
@ -139,8 +139,8 @@ const ( // DIR
|
||||
SRC_HELP = "src/help"
|
||||
SRC_DEBUG = "src/debug"
|
||||
SRC_RELEASE = "src/release"
|
||||
SRC_MAIN_JS = "src/main.js"
|
||||
SRC_MAIN_GO = "src/main.go"
|
||||
SRC_MAIN_GO = "src/main.js"
|
||||
SRC_MAIN_SHY = "src/main.shy"
|
||||
SRC_MAIN_SVG = "src/main.svg"
|
||||
SRC_VERSION_GO = "src/version.go"
|
||||
|
@ -27,6 +27,9 @@ func init() {
|
||||
}, mdb.ZoneAction(mdb.SHORT, mdb.ZONE, mdb.FIELD, "time,id,type,name,text,path,file,line")), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(mdb.CACHE_LIMIT, "30")
|
||||
if mdb.ZoneSelectPage(m, arg...); len(arg) > 0 && arg[0] != "" {
|
||||
if arg[0] == "_recent_file" {
|
||||
m.Sort(nfs.FILE)
|
||||
}
|
||||
m.Tables(func(value ice.Maps) {
|
||||
m.PushButton(kit.Select(INNER, XTERM, value[mdb.TEXT] == "" || value[nfs.FILE] == ""))
|
||||
}).Option(ctx.STYLE, arg[0])
|
||||
|
Loading…
x
Reference in New Issue
Block a user