forked from x/icebergs
add some
This commit is contained in:
parent
1bc8a05ca6
commit
ac3241b168
@ -67,7 +67,10 @@ func init() {
|
||||
)),
|
||||
), Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd("", func(value ice.Maps) { m.Cmd("", aaa.WHITE, LOCALHOST, value[aaa.IP]) })
|
||||
m.Cmd("", func(value ice.Maps) {
|
||||
ice.Info.Host = value[aaa.IP]
|
||||
m.Cmd("", aaa.WHITE, LOCALHOST, value[aaa.IP])
|
||||
})
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.IsSearchPreview(m, arg) && m.Cmd(HOST).Length() > 0 {
|
||||
|
@ -21,6 +21,9 @@ func UserHost(m *ice.Message) string {
|
||||
if p := m.Option(ice.MSG_USERHOST); p != "" {
|
||||
return p
|
||||
} else if u := UserWeb(m); u.Hostname() == tcp.LOCALHOST {
|
||||
if ice.Info.Host != "" {
|
||||
return m.Option(ice.MSG_USERHOST, strings.ReplaceAll(u.Scheme+"://"+u.Host, tcp.LOCALHOST, ice.Info.Host))
|
||||
}
|
||||
return m.Option(ice.MSG_USERHOST, tcp.PublishLocalhost(m, u.Scheme+"://"+u.Host))
|
||||
} else {
|
||||
return m.Option(ice.MSG_USERHOST, u.Scheme+"://"+u.Host)
|
||||
|
@ -86,14 +86,20 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
|
||||
return true
|
||||
}
|
||||
func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) bool {
|
||||
if strings.HasPrefix(r.URL.Path, nfs.V) {
|
||||
ispod := kit.Contains(r.URL.String(), S(), "pod=") || kit.Contains(r.Header.Get(html.Referer), S(), "pod=")
|
||||
if strings.HasPrefix(r.URL.Path, "/v/") {
|
||||
return Render(msg, ice.RENDER_DOWNLOAD, path.Join(ice.USR_VOLCANOS, strings.TrimPrefix(r.URL.Path, nfs.V)))
|
||||
} else if kit.HasPrefix(r.URL.Path, "/p/") {
|
||||
p := strings.TrimPrefix(r.URL.Path, "/p/")
|
||||
return (!ispod && kit.HasPrefix(p, nfs.SRC) || kit.HasPrefix(p, ice.USR_ICEBERGS, ice.USR_ICONS)) && nfs.Exists(msg, p) && Render(msg, ice.RENDER_DOWNLOAD, p)
|
||||
} else if kit.HasPrefix(r.URL.Path, "/m/") {
|
||||
p := nfs.USR_MODULES + strings.TrimPrefix(r.URL.Path, "/m/")
|
||||
return nfs.Exists(msg, p) && Render(msg, ice.RENDER_DOWNLOAD, p)
|
||||
} else if p := path.Join(kit.Select(ice.USR_VOLCANOS, ice.USR_INTSHELL, msg.IsCliUA()), r.URL.Path); nfs.Exists(msg, p) {
|
||||
return Render(msg, ice.RENDER_DOWNLOAD, p)
|
||||
} else if p = path.Join(nfs.USR, r.URL.Path); kit.HasPrefix(r.URL.Path, nfs.VOLCANOS, nfs.INTSHELL) && nfs.Exists(msg, p) {
|
||||
return Render(msg, ice.RENDER_DOWNLOAD, p)
|
||||
} else if p = strings.TrimPrefix(r.URL.Path, nfs.REQUIRE); kit.HasPrefix(r.URL.Path, nfs.REQUIRE_SRC, nfs.REQUIRE+ice.USR_ICONS, nfs.REQUIRE+ice.USR_ICEBERGS) && nfs.Exists(msg, p) {
|
||||
ispod := kit.Contains(r.URL.String(), S(), "pod=") || kit.Contains(r.Header.Get(html.Referer), S(), "pod=")
|
||||
return !ispod && Render(msg, ice.RENDER_DOWNLOAD, p)
|
||||
} else if p = path.Join(nfs.USR_MODULES, strings.TrimPrefix(r.URL.Path, nfs.REQUIRE_MODULES)); kit.HasPrefix(r.URL.Path, nfs.REQUIRE_MODULES) && nfs.Exists(msg, p) {
|
||||
return Render(msg, ice.RENDER_DOWNLOAD, p)
|
||||
|
@ -87,9 +87,6 @@ func init() {
|
||||
NAVIGATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(NAVIGATE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH))
|
||||
}},
|
||||
REPOS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(REPOS, ice.OptionFields(nfs.PATH)).Sort(nfs.PATH)
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, arg ...string) {
|
||||
if kit.HasPrefix(arg[0], nfs.P) {
|
||||
ls := nfs.SplitPath(m, arg[0])
|
||||
|
@ -114,7 +114,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
}},
|
||||
nfs.MODULE: {Name: "module name*=hi help type*=Hash,Zone,Code main*=main.go zone top", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
|
||||
nfs.MODULE: {Name: "module name*=hi help type*=Hash,Zone,Code main*=main.go zone top", Help: "创建模块", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(AUTOGEN, nfs.MODULE, arg)
|
||||
}},
|
||||
nfs.SCRIPT: {Name: "script file*", Help: "脚本", Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -135,7 +135,6 @@ func init() {
|
||||
m.Cmdy(TEMPLATE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH))
|
||||
}},
|
||||
COMPLETE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
return
|
||||
m.Cmdy(COMPLETE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH))
|
||||
}},
|
||||
COMPILE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -145,14 +144,18 @@ func init() {
|
||||
_vimer_make(m, nfs.PWD, msg)
|
||||
}
|
||||
}},
|
||||
ice.APP: {Hand: func(m *ice.Message, arg ...string) {
|
||||
REPOS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(REPOS, ice.OptionFields(nfs.PATH)).Sort(nfs.PATH)
|
||||
}},
|
||||
ice.APP: {Help: "本机", Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(len(arg) == 0, func() { arg = append(arg, m.Option(nfs.PATH), m.Option(nfs.FILE), m.Option(nfs.LINE)) })
|
||||
cli.OpenCmds(m, "cd "+kit.Path(""), "vim "+path.Join(arg[0], arg[1])+" +"+arg[2]).ProcessHold()
|
||||
}},
|
||||
}, web.DreamTablesAction("编程"), ctx.ConfAction(ctx.TOOLS, "xterm,compile,runtime", web.ONLINE, ice.TRUE)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmdy(INNER, arg); arg[0] == ctx.ACTION {
|
||||
return
|
||||
} else if len(arg) == 1 {
|
||||
m.PushAction(mdb.CREATE, mdb.RENAME, nfs.TRASH)
|
||||
m.PushAction(mdb.CREATE, mdb.RENAME, nfs.TRASH).Action(nfs.MODULE)
|
||||
return
|
||||
}
|
||||
if m.IsMobileUA() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user