From cf10a5cf36d1690ddb4a5210faf10d1f1bf922c1 Mon Sep 17 00:00:00 2001 From: shy Date: Fri, 26 Jan 2024 17:16:39 +0800 Subject: [PATCH] add some --- base/web/render.go | 2 ++ base/web/store.go | 27 +++++++++++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/base/web/render.go b/base/web/render.go index c7eaddf6..8f13428d 100644 --- a/base/web/render.go +++ b/base/web/render.go @@ -24,6 +24,8 @@ const ( COOKIE = "cookie" REQUEST = "request" RESPONSE = "response" + TITLE = "title" + CONTENT = "content" ) func Render(m *ice.Message, cmd string, args ...ice.Any) bool { diff --git a/base/web/store.go b/base/web/store.go index 6972611b..89474595 100644 --- a/base/web/store.go +++ b/base/web/store.go @@ -1,7 +1,6 @@ package web import ( - "path" "strings" ice "shylinux.com/x/icebergs" @@ -27,25 +26,23 @@ func init() { }}, INSTALL: {Hand: func(m *ice.Message, arg ...string) { 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) { - 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.Cmdy(DREAM, mdb.CREATE, m.OptionSimple(mdb.NAME, mdb.ICON, nfs.REPOS, nfs.BINARY)) - m.Cmdy(DREAM, cli.START, m.OptionSimple(mdb.NAME)) + 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))) } - defer m.Push("title", 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, cli.START, m.OptionSimple(mdb.NAME)) + defer m.Push(TITLE, m.Option(mdb.NAME)) } ctx.ProcessField(m, CHAT_IFRAME, S(m.Option(mdb.NAME)), arg...) }}, OPEN: {Hand: func(m *ice.Message, arg ...string) { 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) { 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) { if len(arg) == 0 { @@ -64,10 +61,12 @@ func init() { } m.Push("", value, kit.Split("time,name,icon,repos,binary,module,version")) 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.PushButton(INSTALL, PORTAL) - } else { + m.Push(ORIGIN, origin) + list := m.Spawn(ice.Maps{ice.MSG_FIELDS: ""}).CmdMap(DREAM, mdb.NAME) + if _, ok := list[value[mdb.NAME]]; ok { m.PushButton(OPEN, PORTAL) + } else { + m.PushButton(INSTALL, PORTAL) } }) m.StatusTimeCount(ORIGIN, origin)