forked from x/icebergs
add some
This commit is contained in:
parent
299f3ea184
commit
931ff8c428
@ -63,3 +63,10 @@ func AdminCmd(m *ice.Message, cmd string, arg ...string) string {
|
||||
return m.Cmdx(cmd, arg)
|
||||
}
|
||||
}
|
||||
func AdminCmdPost(m *ice.Message, cmd string, action string, arg ...string) string {
|
||||
if ice.Info.NodeType == WORKER {
|
||||
return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodPost, C(path.Join(cmd, ctx.ACTION, action))+"?debug=true", SPIDE_FORM, arg)
|
||||
} else {
|
||||
return m.Cmdx(cmd, cmd, action, arg)
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ const BROAD = "broad"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
BROAD: {Help: "广播台", Actions: ice.MergeActions(ice.Actions{
|
||||
BROAD: {Help: "广播台", Icon: "Podcasts.png", Actions: ice.MergeActions(ice.Actions{
|
||||
SERVE_START: {Hand: func(m *ice.Message, arg ...string) { gdb.Go(m, _broad_serve) }},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.IsSearchPreview(m, arg) {
|
||||
|
@ -84,7 +84,7 @@ func _dream_more_list(m *ice.Message) *ice.Message {
|
||||
msg := gdb.Event(m.Spawn(value), DREAM_TABLES)
|
||||
defer m.PushButton(strings.Join(msg.Appendv(ctx.ACTION), ""))
|
||||
case aaa.LOGIN:
|
||||
value[mdb.ICON] = kit.Select(value[mdb.ICON], agentIcon[value[AGENT]])
|
||||
value[mdb.ICON] = kit.Select(value[mdb.ICON], agentIcons[value[AGENT]])
|
||||
value[mdb.TEXT] = kit.JoinWord(value[AGENT], value[cli.SYSTEM], value[aaa.IP])
|
||||
defer m.PushButton(GRANT)
|
||||
default:
|
||||
@ -404,7 +404,7 @@ func init() {
|
||||
}
|
||||
}},
|
||||
}, StatsAction(), DreamAction(), mdb.ImportantHashAction(
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template,restart", ctx.TOOLS, kit.Simple(STORE, SPIDE, ROUTE),
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template,restart", ctx.TOOLS, kit.Simple(STORE, SPIDE),
|
||||
html.BUTTON, kit.JoinWord(PORTAL, ADMIN, DESKTOP, WIKI_WORD, STATUS, VIMER, XTERM, COMPILE),
|
||||
)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
|
@ -69,7 +69,7 @@ const ROUTE = "route"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ROUTE: {Name: "route space:text cmds:text auto build travel diagram prunes", Help: "路由表", Icon: "Podcasts.png", Actions: ice.MergeActions(ice.Actions{
|
||||
ROUTE: {Name: "route space:text cmds:text auto build travel diagram prunes", Help: "路由表", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.MAIN: {Help: "首页", Hand: func(m *ice.Message, arg ...string) { ctx.ProcessField(m, CHAT_IFRAME, m.MergePod(""), arg...) }},
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch mdb.HashInputs(m, arg); arg[0] {
|
||||
|
@ -75,7 +75,7 @@ func init() {
|
||||
mdb.CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||
// kit.If(m.Option(mdb.TYPE) == LOGIN, func() { arg = append(arg, mdb.TEXT, tcp.PublishLocalhost(m, m.Option(mdb.TEXT))) })
|
||||
kit.If(m.Option(mdb.TYPE) == LOGIN && m.Option(mdb.TEXT) == "", func() { arg = append(arg, mdb.TEXT, tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB))) })
|
||||
mdb.HashCreate(m, m.OptionSimple(mdb.TEXT), arg, SPACE, m.Option(ice.MSG_USERPOD), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
|
||||
mdb.HashCreate(m, m.OptionSimple("type,name,text"), arg, SPACE, m.Option(ice.MSG_USERPOD), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
|
||||
m.Option(mdb.LINK, tcp.PublishLocalhost(m, m.MergeLink(P(SHARE, m.Result()))))
|
||||
Count(m, "", m.Option(mdb.TYPE))
|
||||
}},
|
||||
|
@ -24,12 +24,12 @@ import (
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
func _spide_create(m *ice.Message, name, link, types, icon string) {
|
||||
func _spide_create(m *ice.Message, name, link, types, icons string) {
|
||||
if u, e := url.Parse(link); !m.Warn(e != nil || link == "", ice.ErrNotValid, link) {
|
||||
dir, file := path.Split(u.EscapedPath())
|
||||
m.Logs(mdb.INSERT, SPIDE, name, LINK, link)
|
||||
mdb.HashSelectUpdate(m, mdb.HashCreate(m, CLIENT_NAME, name), func(value ice.Map) {
|
||||
value[mdb.ICON] = icon
|
||||
value[mdb.ICONS] = icons
|
||||
value[SPIDE_CLIENT] = kit.Dict(
|
||||
mdb.NAME, name, mdb.TYPE, types,
|
||||
SPIDE_METHOD, http.MethodGet, URL, link, ORIGIN, u.Scheme+"://"+u.Host,
|
||||
@ -271,7 +271,7 @@ const (
|
||||
QS = "?"
|
||||
)
|
||||
|
||||
var agentIcon = map[string]string{
|
||||
var agentIcons = map[string]string{
|
||||
"Safari": "usr/icons/Safari.png",
|
||||
"Chrome": "usr/icons/Chrome.png",
|
||||
"Edg": "usr/icons/Edg.png",
|
||||
@ -320,8 +320,8 @@ func init() {
|
||||
conf := mdb.Confm(m, cli.RUNTIME, cli.CONF)
|
||||
dev := kit.Select("https://2021.shylinux.com", ice.Info.Make.Domain, conf[cli.CTX_DEV])
|
||||
m.Cmd("", mdb.CREATE, ice.SHY, kit.Select("https://shylinux.com", conf[cli.CTX_SHY]), nfs.REPOS, nfs.USR_ICONS_CONTEXTS)
|
||||
m.Cmd("", mdb.CREATE, ice.DEV, dev, nfs.REPOS, nfs.USR_ICONS_ICEBERGS)
|
||||
m.Cmd("", mdb.CREATE, ice.DEV_IP, kit.Select(dev, os.Getenv("ctx_dev_ip")), "", nfs.USR_ICONS_ICEBERGS)
|
||||
m.Cmd("", mdb.CREATE, ice.DEV, dev, nfs.REPOS)
|
||||
m.Cmd("", mdb.CREATE, ice.DEV_IP, kit.Select(dev, os.Getenv("ctx_dev_ip")))
|
||||
m.Cmd("", mdb.CREATE, ice.OPS, kit.Select("http://localhost:9020", conf[cli.CTX_OPS]), nfs.REPOS, nfs.USR_ICONS_VOLCANOS)
|
||||
m.Cmd("", mdb.CREATE, ice.DEMO, kit.Select("http://localhost:20000", conf[cli.CTX_DEMO]), "", nfs.USR_ICONS_VOLCANOS)
|
||||
m.Cmd("", mdb.CREATE, ice.MAIL, kit.Select("https://mail.shylinux.com", conf[cli.CTX_MAIL]), "", "usr/icons/Mail.png")
|
||||
@ -355,11 +355,19 @@ func init() {
|
||||
})
|
||||
m.Sort(arg[0])
|
||||
default:
|
||||
mdb.HashSelectValue(m.Spawn(), func(value ice.Map) { m.Push(kit.Select(ORIGIN, arg, 0), kit.Value(value, CLIENT_ORIGIN)) })
|
||||
switch arg[0] {
|
||||
case mdb.ICON, mdb.ICONS:
|
||||
mdb.HashInputs(m, arg)
|
||||
default:
|
||||
mdb.HashSelectValue(m.Spawn(), func(value ice.Map) {
|
||||
m.Push(kit.Select(ORIGIN, arg, 0), kit.Value(value, kit.Keys("client", arg[0])))
|
||||
})
|
||||
kit.If(arg[0] == mdb.TYPE, func() { m.Push(arg[0], nfs.REPOS) })
|
||||
}
|
||||
}
|
||||
}},
|
||||
mdb.CREATE: {Name: "create name origin type icon", Hand: func(m *ice.Message, arg ...string) {
|
||||
_spide_create(m, m.Option(mdb.NAME), m.Option(ORIGIN), m.Option(mdb.TYPE), m.Option(mdb.ICON))
|
||||
mdb.CREATE: {Name: "create name* origin* type icons", Hand: func(m *ice.Message, arg ...string) {
|
||||
_spide_create(m, m.Option(mdb.NAME), m.Option(ORIGIN), m.Option(mdb.TYPE), m.OptionDefault(mdb.ICONS, nfs.USR_ICONS_ICEBERGS))
|
||||
}},
|
||||
COOKIE: {Name: "cookie key* value", Help: "状态量", Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashModify(m, m.OptionSimple(CLIENT_NAME), kit.Keys(COOKIE, m.Option(mdb.KEY)), m.Option(mdb.VALUE))
|
||||
@ -382,7 +390,7 @@ func init() {
|
||||
m.Cmd(SPACE, tcp.DIAL, ice.DEV, m.Option(CLIENT_NAME), m.OptionSimple(TOKEN))
|
||||
m.Sleep300ms()
|
||||
}},
|
||||
}, DevTokenAction(CLIENT_NAME, CLIENT_URL), mdb.HashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,icon,client.name,client.url,client.type,token")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, DevTokenAction(CLIENT_NAME, CLIENT_URL), mdb.HashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,icons,client.name,client.url,client.type,token")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) < 2 || arg[0] == "" || (len(arg) > 3 && arg[3] == "") {
|
||||
list := m.CmdMap(SPACE, mdb.NAME)
|
||||
mdb.HashSelect(m, kit.Slice(arg, 0, 1)...).Sort("client.type,client.name", []string{nfs.REPOS, ""})
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/tcp"
|
||||
"shylinux.com/x/icebergs/base/web/html"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
@ -19,10 +20,11 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
STORE: {Name: "store refresh", Help: "系统商店", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
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]) }) })
|
||||
m.Cmdy(SPIDE, mdb.INPUTS, arg)
|
||||
// m.Cmds(SPIDE).Table(func(value ice.Maps) { kit.If(value[CLIENT_TYPE] == nfs.REPOS, func() { m.Push("", value, arg[0]) }) })
|
||||
}},
|
||||
mdb.CREATE: {Name: "create name* origin*", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("name,origin"), mdb.TYPE, nfs.REPOS)
|
||||
mdb.CREATE: {Name: "create name* origin* icons", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("name,origin,icons"), mdb.TYPE, nfs.REPOS)
|
||||
}},
|
||||
INSTALL: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if !kit.HasPrefixList(arg, ctx.RUN) {
|
||||
@ -41,17 +43,21 @@ func init() {
|
||||
PORTAL: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
ProcessIframe(m, m.Option(mdb.NAME), m.Option(ORIGIN)+S(m.Option(mdb.NAME))+C(PORTAL), arg...)
|
||||
}},
|
||||
}, ctx.ConfAction(ctx.TOOLS, DREAM)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Display("")
|
||||
if len(arg) == 0 {
|
||||
m.Cmd(SPIDE, arg, kit.Dict(ice.MSG_FIELDS, "time,client.type,client.name,client.origin")).Table(func(value ice.Maps) {
|
||||
kit.If(value[CLIENT_TYPE] == nfs.REPOS, func() { m.Push(mdb.NAME, value[CLIENT_NAME]) })
|
||||
m.Cmd(SPIDE, arg, kit.Dict(ice.MSG_FIELDS, "time,icon,client.type,client.name,client.origin")).Table(func(value ice.Maps) {
|
||||
kit.If(value[CLIENT_TYPE] == nfs.REPOS, func() { m.Push(mdb.NAME, value[CLIENT_NAME]).Push(mdb.ICON, value[mdb.ICON]) })
|
||||
})
|
||||
if ctx.Toolkit(m.Display("")); ice.Info.NodeType == WORKER {
|
||||
if ice.Info.NodeType == WORKER {
|
||||
return
|
||||
}
|
||||
m.Action(html.FILTER, mdb.CREATE)
|
||||
} else {
|
||||
origin := SpideOrigin(m, arg[0])
|
||||
if arg[0] == ice.OPS {
|
||||
origin = tcp.PublishLocalhost(m, origin)
|
||||
}
|
||||
list := m.Spawn(ice.Maps{ice.MSG_FIELDS: ""}).CmdMap(DREAM, mdb.NAME)
|
||||
m.SetAppend().Spawn().SplitIndex(m.Cmdx(SPIDE, arg[0], C(DREAM))).Table(func(value ice.Maps) {
|
||||
if value[mdb.TYPE] != WORKER {
|
||||
|
@ -1,8 +1,3 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { can.ui = can.onappend.layout(can), can.onimport.__project(can, msg) },
|
||||
_layout: function(can) {
|
||||
can.page.style(can, can.ui.content, html.HEIGHT, can._output.style[html.HEIGHT], html.MAX_HEIGHT, can._output.style[html.MAX_HEIGHT])
|
||||
can.page.style(can, can.ui.project, html.HEIGHT, can.ui.content.offsetHeight+can.ui.display.offsetHeight)
|
||||
can.onlayout.expand(can, can.ui.content)
|
||||
},
|
||||
}, [""])
|
||||
|
@ -75,6 +75,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
if (can.user.isMobile) { item.height = can.ConfHeight()-125, item.top = 25, item.width = can.ConfWidth(), item.left = 0 }
|
||||
item.height = can.base.Max(html.DESKTOP_HEIGHT, item.height), item.width = can.base.Max(html.DESKTOP_WIDTH, item.width)
|
||||
if (can.base.isIn(item.index, web.CODE_VIMER)) { item.width = can.base.Max(1600, can.ConfWidth()), item.left = (can.ConfWidth()-item.width)/2 }
|
||||
item.style = {left: item.left, top: item.top, height: item.height, width: item.width}
|
||||
can.onappend.plugin(can, item, function(sub) { can.ondetail.select(can, sub._target)
|
||||
can.page.style(can, sub._target, html.HEIGHT, item.height, html.WIDTH, item.width)
|
||||
var index = 0; can.core.Item({
|
||||
@ -98,6 +99,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
sub.onaction._close = function() { can.page.Remove(can, sub._target), can.onexport.tabs(can) }
|
||||
sub.onappend.desktop = function(item) { can.onimport._item(can, item) }
|
||||
can.onmotion.move(can, sub._target, {top: item.top, left: item.left})
|
||||
sub.Conf("style.left", ""), sub.Conf("style.top", "")
|
||||
sub.onmotion.resize(can, sub._target, function(height, width) {
|
||||
sub.onimport.size(sub, item.height = height, item.width = width, false)
|
||||
sub._target._meta.height = height, sub._target._meta.width = width, can.onexport.tabs(can)
|
||||
|
@ -123,6 +123,9 @@ func (m *Message) IsCliUA() bool {
|
||||
func (m *Message) IsMetaKey() bool {
|
||||
return m.Option("metaKey") == TRUE
|
||||
}
|
||||
func (m *Message) IsGetMethod() bool {
|
||||
return m.Option(MSG_METHOD) == http.MethodGet
|
||||
}
|
||||
func (m *Message) IsMobileUA() bool {
|
||||
return strings.Contains(m.Option(MSG_USERUA), "Mobile")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user