1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-25 17:18:05 +08:00
This commit is contained in:
harveyshao 2022-03-01 16:36:28 +08:00
parent 7b99b1cc29
commit b4ab171037
4 changed files with 12 additions and 9 deletions

View File

@ -158,7 +158,6 @@ func _serve_handle(key string, cmd *ice.Command, msg *ice.Message, w http.Respon
msg.Option(ice.MSG_USERADDR, kit.Select(r.RemoteAddr, r.Header.Get(ice.MSG_USERADDR)))
msg.Option(ice.MSG_USERIP, r.Header.Get(ice.MSG_USERIP))
msg.Option(ice.MSG_USERUA, r.Header.Get("User-Agent"))
msg.Debug("what %v", msg.FormatMeta())
// 会话别名
if sessid := msg.Option(CookieName(msg.Option(ice.MSG_USERWEB))); sessid != "" {

View File

@ -22,7 +22,10 @@ func _website_url(m *ice.Message, file string) string {
}
return strings.Split(kit.MergeURL2(m.Option(ice.MSG_USERWEB), path.Join("/chat", p)), "?")[0]
}
func _website_parse(m *ice.Message, text string) map[string]interface{} {
func _website_parse(m *ice.Message, text string) (map[string]interface{}, bool) {
if text == "" {
return nil, false
}
m.Option(nfs.CAT_CONTENT, text)
river, storm, last := kit.Dict(
"Header", kit.Dict("menus", kit.List(), "style", kit.Dict("display", "none")),
@ -58,7 +61,7 @@ func _website_parse(m *ice.Message, text string) map[string]interface{} {
}
return ls
})
return river
return river, true
}
func _website_render(m *ice.Message, w http.ResponseWriter, r *http.Request, kind, text string) bool {
msg := m.Spawn(w, r)
@ -73,7 +76,7 @@ func _website_render(m *ice.Message, w http.ResponseWriter, r *http.Request, kin
return false
}
case nfs.TXT:
res := _website_parse(msg, text)
res, _ := _website_parse(msg, text)
msg.RenderResult(_website_template2, kit.Format(res))
case nfs.JSON:
msg.RenderResult(_website_template2, kit.Format(kit.UnMarshal(text)))
@ -118,11 +121,11 @@ func init() {
})
}},
"show": {Hand: func(m *ice.Message, arg ...string) {
res := _website_parse(m, m.Cmdx(nfs.CAT, path.Join(SRC_WEBSITE, arg[0])))
m.Echo(_website_template2, kit.Format(res))
}},
"inner": {Hand: func(m *ice.Message, arg ...string) {
if res, ok := _website_parse(m, m.Cmdx(nfs.CAT, path.Join(SRC_WEBSITE, arg[0]))); ok {
m.Echo(_website_template2, kit.Format(res))
}
}},
"inner": {Hand: func(m *ice.Message, arg ...string) {}},
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
m.EchoIFrame(_website_url(m, strings.TrimPrefix(path.Join(arg[2], arg[1]), SRC_WEBSITE)))
}},

View File

@ -128,6 +128,7 @@ func init() {
_binpack_dir(m, f, ice.USR_LEARNING)
_binpack_can(m, f, ice.USR_VOLCANOS)
_binpack_dir(m, f, ice.USR_INTSHELL)
_binpack_dir(m, f, ice.USR_ICEBERGS)
_binpack_ctx(m, f)
fmt.Fprintln(f, ` }`)

View File

@ -31,6 +31,6 @@ chapter "应用"
field "会话流" web.code.vim.sess
field "同步流" web.code.vim.sync
field "收藏夹" web.code.vim.favor
field "输入法" web.code.vim.input
# field "输入法" web.code.vim.input
field "索引" web.code.vim.tags