1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 17:44:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-26 17:16:39 +08:00
parent 0ce48b54f4
commit cf10a5cf36
2 changed files with 15 additions and 14 deletions

View File

@ -24,6 +24,8 @@ const (
COOKIE = "cookie" COOKIE = "cookie"
REQUEST = "request" REQUEST = "request"
RESPONSE = "response" RESPONSE = "response"
TITLE = "title"
CONTENT = "content"
) )
func Render(m *ice.Message, cmd string, args ...ice.Any) bool { func Render(m *ice.Message, cmd string, args ...ice.Any) bool {

View File

@ -1,7 +1,6 @@
package web package web
import ( import (
"path"
"strings" "strings"
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
@ -27,25 +26,23 @@ func init() {
}}, }},
INSTALL: {Hand: func(m *ice.Message, arg ...string) { INSTALL: {Hand: func(m *ice.Message, arg ...string) {
if !kit.HasPrefixList(arg, ctx.RUN) { if !kit.HasPrefixList(arg, ctx.RUN) {
if !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME))) {
if strings.HasPrefix(m.Option(mdb.ICON), nfs.REQUIRE) { if strings.HasPrefix(m.Option(mdb.ICON), nfs.REQUIRE) {
m.Option(mdb.ICON, strings.TrimSuffix(strings.TrimPrefix(m.Option(mdb.ICON), nfs.REQUIRE), "?pod="+m.Option(mdb.NAME))) m.Option(mdb.ICON, strings.TrimSuffix(strings.TrimPrefix(m.Option(mdb.ICON), nfs.REQUIRE), "?pod="+m.Option(mdb.NAME)))
} }
m.OptionDefault(nfs.BINARY, m.Option(ORIGIN)+S(m.Option(mdb.NAME))) m.OptionDefault(nfs.BINARY, m.Option(ORIGIN)+S(m.Option(mdb.NAME)))
m.Cmdy(DREAM, mdb.CREATE, m.OptionSimple(mdb.NAME, mdb.ICON, nfs.REPOS, nfs.BINARY)) m.Cmdy(DREAM, mdb.CREATE, m.OptionSimple(mdb.NAME, mdb.ICON, nfs.REPOS, nfs.BINARY))
m.Cmdy(DREAM, cli.START, m.OptionSimple(mdb.NAME)) m.Cmdy(DREAM, cli.START, m.OptionSimple(mdb.NAME))
} defer m.Push(TITLE, m.Option(mdb.NAME))
defer m.Push("title", m.Option(mdb.NAME))
} }
ctx.ProcessField(m, CHAT_IFRAME, S(m.Option(mdb.NAME)), arg...) ctx.ProcessField(m, CHAT_IFRAME, S(m.Option(mdb.NAME)), arg...)
}}, }},
OPEN: {Hand: func(m *ice.Message, arg ...string) { OPEN: {Hand: func(m *ice.Message, arg ...string) {
ctx.ProcessField(m, CHAT_IFRAME, S(m.Option(mdb.NAME)), arg...) ctx.ProcessField(m, CHAT_IFRAME, S(m.Option(mdb.NAME)), arg...)
kit.If(!kit.HasPrefixList(arg, ctx.RUN), func() { m.Push("title", m.Option(mdb.NAME)) }) kit.If(!kit.HasPrefixList(arg, ctx.RUN), func() { m.Push(TITLE, m.Option(mdb.NAME)) })
}}, }},
PORTAL: {Hand: func(m *ice.Message, arg ...string) { PORTAL: {Hand: func(m *ice.Message, arg ...string) {
ctx.ProcessField(m, CHAT_IFRAME, m.Option(ORIGIN)+S(m.Option(mdb.NAME))+C(PORTAL), arg...) ctx.ProcessField(m, CHAT_IFRAME, m.Option(ORIGIN)+S(m.Option(mdb.NAME))+C(PORTAL), arg...)
kit.If(!kit.HasPrefixList(arg, ctx.RUN), func() { m.Push("title", m.Option(mdb.NAME)) }) kit.If(!kit.HasPrefixList(arg, ctx.RUN), func() { m.Push(TITLE, m.Option(mdb.NAME)) })
}}, }},
}, ctx.ConfAction(ctx.TOOLS, DREAM)), Hand: func(m *ice.Message, arg ...string) { }, ctx.ConfAction(ctx.TOOLS, DREAM)), Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 { if len(arg) == 0 {
@ -64,10 +61,12 @@ func init() {
} }
m.Push("", value, kit.Split("time,name,icon,repos,binary,module,version")) m.Push("", value, kit.Split("time,name,icon,repos,binary,module,version"))
m.Push(mdb.TEXT, kit.JoinLine(value[nfs.REPOS], value[nfs.BINARY])) m.Push(mdb.TEXT, kit.JoinLine(value[nfs.REPOS], value[nfs.BINARY]))
if m.Push(ORIGIN, origin); !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, value[mdb.NAME])) { m.Push(ORIGIN, origin)
m.PushButton(INSTALL, PORTAL) list := m.Spawn(ice.Maps{ice.MSG_FIELDS: ""}).CmdMap(DREAM, mdb.NAME)
} else { if _, ok := list[value[mdb.NAME]]; ok {
m.PushButton(OPEN, PORTAL) m.PushButton(OPEN, PORTAL)
} else {
m.PushButton(INSTALL, PORTAL)
} }
}) })
m.StatusTimeCount(ORIGIN, origin) m.StatusTimeCount(ORIGIN, origin)