1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-23 21:14:09 +08:00
parent 45e2bcfeb6
commit 000804dd06
3 changed files with 43 additions and 19 deletions

View File

@ -460,10 +460,7 @@ func DreamEach(m *ice.Message, name string, status string, cb func(string)) *ice
return m
}
GoToast(m, "", func(toast func(string, int, int)) []string {
kit.For(list, func(index int, name string) {
toast(name, index, len(list))
cb(name)
})
kit.For(list, func(index int, name string) { toast(name, index, len(list)); cb(name) })
return nil
})
return m

View File

@ -1,6 +1,7 @@
package web
import (
"path"
"strings"
ice "shylinux.com/x/icebergs"
@ -19,28 +20,50 @@ func init() {
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
m.Cmds(SPIDE).Table(func(value ice.Maps) { kit.If(value[CLIENT_TYPE] == nfs.REPOS, func() { m.Push("", value, arg[0]) }) })
}},
"install": {Help: "安装", Hand: func(m *ice.Message, arg ...string) {
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))
}},
PORTAL: {Help: "详情", Hand: func(m *ice.Message, arg ...string) {
ctx.ProcessField(m, CHAT_IFRAME, m.Option(ORIGIN)+S(m.Option(mdb.NAME))+C(PORTAL), arg...)
}},
mdb.CREATE: {Name: "create name* origin*", Hand: func(m *ice.Message, arg ...string) {
m.Option(mdb.TYPE, nfs.REPOS)
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("name,origin,type"))
}},
"install": {Help: "安装", 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))
}
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) {
if !kit.HasPrefixList(arg, ctx.RUN) {
defer m.Push("title", m.Option(mdb.NAME))
}
ctx.ProcessField(m, CHAT_IFRAME, S(m.Option(mdb.NAME)), arg...)
}},
PORTAL: {Help: "官网", Hand: func(m *ice.Message, arg ...string) {
if !kit.HasPrefixList(arg, ctx.RUN) {
defer m.Push("title", m.Option(mdb.NAME))
}
ctx.ProcessField(m, CHAT_IFRAME, m.Option(ORIGIN)+S(m.Option(mdb.NAME))+C(PORTAL), arg...)
}},
}, ctx.ConfAction(ctx.TOOLS, DREAM)), Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 {
m.Cmdy(SPIDE, arg, kit.Dict(ice.MSG_FIELDS, "time,client.type,client.name,client.origin")).Action(mdb.CREATE).Display("")
ctx.Toolkit(m)
} else {
origin := SpideOrigin(m, arg[0])
m.SetAppend().SplitIndex(m.Cmdx(SPIDE, arg[0], C(DREAM))).Table(func(value ice.Maps) { m.Push(ORIGIN, origin) }).PushAction("install", PORTAL)
m.SetAppend().SplitIndex(m.Cmdx(SPIDE, arg[0], C(DREAM))).Table(func(value ice.Maps) {
if !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, value[mdb.NAME])) {
m.PushButton("install", PORTAL)
} else {
m.PushButton(OPEN, PORTAL)
}
m.Push(ORIGIN, origin)
})
}
}},
})

View File

@ -2,6 +2,9 @@ Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.ui = can.onappend.layout(can), can.onappend.style(can, "output card", can.ui.content), can.onimport._project(can, msg)
can.onmotion.delay(can, function() { can.onimport.layout(can) })
can.sup.onimport._field = function(sup, msg) { msg.Table(function(item) {
can.onappend._plugin(can, item, {style: html.FLOAT}, function(sub) {})
}) }
},
_project: function(can, msg) { var select
msg.Table(function(value) { if (value["client.type"] != nfs.REPOS) { return } value.name = `${value["client.name"]}`
@ -30,9 +33,10 @@ Volcanos(chat.ONIMPORT, {
}))
},
layout: function(can) {
can.page.style(can, can.ui.project, html.HEIGHT, can.ConfHeight())
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight())
can.page.style(can, can._output, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
can.ui.layout(can.ConfHeight(), can.ConfWidth())
// can.page.style(can, can.ui.project, html.HEIGHT, can.ConfHeight())
// can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight())
// can.page.style(can, can._output, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
can.onlayout.expand(can, can.ui.content, can.user.isMobile && !can.user.isLandscape()? can.ConfWidth(): 320)
},
}, [""])