forked from x/icebergs
add some
This commit is contained in:
parent
06a89de015
commit
555be526e3
@ -292,7 +292,7 @@ func init() {
|
|||||||
kit.If(mdb.Config(m, nfs.BINARY), func(p string) { m.OptionDefault(nfs.BINARY, p+m.Option(mdb.NAME)) })
|
kit.If(mdb.Config(m, nfs.BINARY), func(p string) { m.OptionDefault(nfs.BINARY, p+m.Option(mdb.NAME)) })
|
||||||
kit.If(mdb.Config(m, nfs.REPOS), func(p string) { m.OptionDefault(nfs.REPOS, p+m.Option(mdb.NAME)) })
|
kit.If(mdb.Config(m, nfs.REPOS), func(p string) { m.OptionDefault(nfs.REPOS, p+m.Option(mdb.NAME)) })
|
||||||
m.Option(nfs.REPOS, kit.Select("", kit.Split(m.Option(nfs.REPOS)), -1))
|
m.Option(nfs.REPOS, kit.Select("", kit.Split(m.Option(nfs.REPOS)), -1))
|
||||||
m.OptionDefault(mdb.ICONS, nfs.USR_ICONS_CONTEXTS)
|
// m.OptionDefault(mdb.ICONS, nfs.USR_ICONS_CONTEXTS)
|
||||||
if mdb.HashCreate(m); ice.Info.Important == true {
|
if mdb.HashCreate(m); ice.Info.Important == true {
|
||||||
_dream_start(m, m.Option(mdb.NAME))
|
_dream_start(m, m.Option(mdb.NAME))
|
||||||
StreamPushRefreshConfirm(m, m.Trans("refresh for new space ", "刷新列表查看新空间 ")+m.Option(mdb.NAME))
|
StreamPushRefreshConfirm(m, m.Trans("refresh for new space ", "刷新列表查看新空间 ")+m.Option(mdb.NAME))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
$project div.list { margin-left:25px; }
|
$project div.list { margin-left:25px; }
|
||||||
// $project div.list { border-left:var(--box-notice3); margin-left:25px; }
|
$project div.item span.exists { color:var(--notice-bg-color); padding:0 var(--input-padding); }
|
||||||
$content>div.item { box-shadow:var(--th-box-shadow); border:var(--plugin-border); border-radius:var(--plugin-radius); }
|
$content>div.item { box-shadow:var(--th-box-shadow); border:var(--plugin-border); border-radius:var(--plugin-radius); }
|
||||||
$content>div.item:hover { box-shadow:var(--notice-box-shadow); }
|
$content>div.item:hover { box-shadow:var(--notice-box-shadow); }
|
||||||
$content>div.item div.title div.label { font-size:var(--status-font-size); font-weight:normal; margin-top:var(--input-margin); }
|
$content>div.item div.title div.label { font-size:var(--status-font-size); font-weight:normal; margin-top:var(--input-margin); }
|
||||||
$content>div.item div.title div.label span { padding:var(--input-padding); padding-right:var(--input-margin); }
|
$content>div.item div.title div.label span { padding:var(--input-padding); padding-right:var(--input-margin); }
|
||||||
$content>div.item div.content { height:70px; }
|
$content>div.item div.content { height:70px; }
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package web
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/url"
|
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
@ -47,7 +45,13 @@ func init() {
|
|||||||
ADMIN: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
ADMIN: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||||
ProcessIframe(m, kit.Keys(m.Option(mdb.NAME), m.ActionKey()), S(m.Option(mdb.NAME))+C(m.ActionKey()), arg...)
|
ProcessIframe(m, kit.Keys(m.Option(mdb.NAME), m.ActionKey()), S(m.Option(mdb.NAME))+C(m.ActionKey()), arg...)
|
||||||
}},
|
}},
|
||||||
OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(S(m.Option(mdb.NAME))) }},
|
OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option(mdb.TYPE) == ORIGIN {
|
||||||
|
m.ProcessOpen(m.Option(ORIGIN))
|
||||||
|
} else {
|
||||||
|
m.ProcessOpen(S(m.Option(mdb.NAME)))
|
||||||
|
}
|
||||||
|
}},
|
||||||
"connect": {Help: "连接", Hand: func(m *ice.Message, arg ...string) {
|
"connect": {Help: "连接", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Options(m.Cmd(SPIDE, m.Option(mdb.NAME)).AppendSimple())
|
m.Options(m.Cmd(SPIDE, m.Option(mdb.NAME)).AppendSimple())
|
||||||
m.Cmdy(SPIDE, mdb.DEV_REQUEST)
|
m.Cmdy(SPIDE, mdb.DEV_REQUEST)
|
||||||
@ -56,20 +60,23 @@ func init() {
|
|||||||
if kit.HasPrefixList(arg, ctx.ACTION) {
|
if kit.HasPrefixList(arg, ctx.ACTION) {
|
||||||
m.Cmdy(DREAM, arg)
|
m.Cmdy(DREAM, arg)
|
||||||
} else if m.Display("").DisplayCSS(""); len(arg) == 0 {
|
} else if m.Display("").DisplayCSS(""); len(arg) == 0 {
|
||||||
list := []string{}
|
list := m.Spawn(ice.Maps{ice.MSG_FIELDS: ""}).CmdMap(SPACE, mdb.NAME)
|
||||||
m.Cmd(SPIDE, arg, kit.Dict(ice.MSG_FIELDS, "time,icons,client.type,client.name,client.origin")).Table(func(value ice.Maps) {
|
m.Cmd(SPIDE, arg, kit.Dict(ice.MSG_FIELDS, "time,icons,client.type,client.name,client.origin")).Table(func(value ice.Maps) {
|
||||||
kit.If(value[CLIENT_TYPE] == nfs.REPOS && value[CLIENT_NAME] != ice.SHY, func() {
|
kit.If(value[CLIENT_TYPE] == nfs.REPOS && value[CLIENT_NAME] != ice.SHY, func() {
|
||||||
list = append(list, value[CLIENT_NAME])
|
kit.If(value[CLIENT_NAME] == ice.OPS, func() { value[CLIENT_ORIGIN] = UserHost(m) })
|
||||||
if value[CLIENT_NAME] == ice.OPS {
|
m.Push(mdb.TYPE, ORIGIN)
|
||||||
value[CLIENT_ORIGIN] = UserHost(m)
|
|
||||||
}
|
|
||||||
m.Push(mdb.NAME, value[CLIENT_NAME]).Push(mdb.ICONS, value[mdb.ICONS]).Push(ORIGIN, value[CLIENT_ORIGIN])
|
m.Push(mdb.NAME, value[CLIENT_NAME]).Push(mdb.ICONS, value[mdb.ICONS]).Push(ORIGIN, value[CLIENT_ORIGIN])
|
||||||
|
if _, ok := list[value[CLIENT_NAME]]; ok || kit.IsIn(value[CLIENT_NAME], ice.OPS, ice.DEV) {
|
||||||
|
m.Push("exists", ice.TRUE)
|
||||||
|
} else {
|
||||||
|
m.Push("exists", ice.FALSE)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
if ice.Info.NodeType == WORKER || !aaa.IsTechOrRoot(m) {
|
if ice.Info.NodeType == WORKER || !aaa.IsTechOrRoot(m) {
|
||||||
m.Action()
|
m.Action()
|
||||||
} else {
|
} else {
|
||||||
m.PushAction("connect", mdb.REMOVE).Action(mdb.CREATE)
|
m.PushAction(OPEN, "connect", mdb.REMOVE).Action(mdb.CREATE)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
defer ToastProcess(m, ice.LIST, arg[0])()
|
defer ToastProcess(m, ice.LIST, arg[0])()
|
||||||
@ -86,13 +93,18 @@ func init() {
|
|||||||
origin = tcp.PublishLocalhost(m, origin)
|
origin = tcp.PublishLocalhost(m, origin)
|
||||||
}
|
}
|
||||||
stat := map[string]int{}
|
stat := map[string]int{}
|
||||||
list := m.Spawn(ice.Maps{ice.MSG_FIELDS: ""}).CmdMap(DREAM, mdb.NAME)
|
list := m.Spawn(ice.Maps{ice.MSG_FIELDS: ""}).CmdMap(SPACE, mdb.NAME)
|
||||||
m.SetAppend().Spawn().SplitIndex(m.Cmdx(SPIDE, arg[0], dream, kit.Dict(mdb.ConfigSimple(m, CLIENT_TIMEOUT)))).Table(func(value ice.Maps) {
|
m.SetAppend().Spawn().SplitIndex(m.Cmdx(SPIDE, arg[0], dream, kit.Dict(mdb.ConfigSimple(m, CLIENT_TIMEOUT)))).Table(func(value ice.Maps) {
|
||||||
stat[value[mdb.TYPE]]++
|
stat[value[mdb.TYPE]]++
|
||||||
if value[nfs.BINARY] == "" {
|
if value[nfs.BINARY] == "" {
|
||||||
value[nfs.BINARY] = origin + S(value[mdb.NAME])
|
value[nfs.BINARY] = origin + S(value[mdb.NAME])
|
||||||
}
|
}
|
||||||
m.Push("", value, kit.Split("time,type,name,icons,repos,binary,module,version"))
|
m.Push("", value, kit.Split("time,type,name,icons,repos,binary,module,version"))
|
||||||
|
if _, ok := list[value[mdb.NAME]]; ok {
|
||||||
|
m.Push("exists", ice.TRUE)
|
||||||
|
} else {
|
||||||
|
m.Push("exists", ice.FALSE)
|
||||||
|
}
|
||||||
if value[mdb.TYPE] == SERVER {
|
if value[mdb.TYPE] == SERVER {
|
||||||
m.Push(mdb.TEXT, value[mdb.TEXT]).Push(ORIGIN, value[mdb.TEXT]).PushButton()
|
m.Push(mdb.TEXT, value[mdb.TEXT]).Push(ORIGIN, value[mdb.TEXT]).PushButton()
|
||||||
return
|
return
|
||||||
@ -106,10 +118,6 @@ func init() {
|
|||||||
m.PushButton(PORTAL, INSTALL)
|
m.PushButton(PORTAL, INSTALL)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
m.RewriteAppend(func(value, key string, index int) string {
|
|
||||||
value, _ = url.QueryUnescape(value)
|
|
||||||
return value
|
|
||||||
})
|
|
||||||
m.StatusTimeCount(ORIGIN, origin, stat)
|
m.StatusTimeCount(ORIGIN, origin, stat)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
@ -6,6 +6,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
},
|
},
|
||||||
_project: function(can, msg, dev, target) {
|
_project: function(can, msg, dev, target) {
|
||||||
msg.Table(function(value) { if (value.type == web.WORKER) { return }
|
msg.Table(function(value) { if (value.type == web.WORKER) { return }
|
||||||
|
value.nick = [{text: value.name}, value.exists == "true" && {text: ["●", "", "exists"]}]
|
||||||
value._hash = dev.concat([value.name]).join(":"), value._select = can.base.beginWith(can.db.hash.join(":"), value._hash)
|
value._hash = dev.concat([value.name]).join(":"), value._select = can.base.beginWith(can.db.hash.join(":"), value._hash)
|
||||||
value.icons = can.misc.Resource(can, value.icons||"usr/icons/icebergs.png", "", value.origin)
|
value.icons = can.misc.Resource(can, value.icons||"usr/icons/icebergs.png", "", value.origin)
|
||||||
can.onimport.itemlist(can, [value], function(event, item, show, target) {
|
can.onimport.itemlist(can, [value], function(event, item, show, target) {
|
||||||
|
8
misc.go
8
misc.go
@ -1,6 +1,7 @@
|
|||||||
package ice
|
package ice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
@ -68,7 +69,12 @@ func (m *Message) Split(str string, arg ...string) *Message {
|
|||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func (m *Message) SplitIndex(str string, arg ...string) *Message {
|
func (m *Message) SplitIndex(str string, arg ...string) *Message {
|
||||||
return m.Split(str, kit.Simple(INDEX, arg)...)
|
m.Split(str, kit.Simple(INDEX, arg)...)
|
||||||
|
m.RewriteAppend(func(value, key string, index int) string {
|
||||||
|
value, _ = url.QueryUnescape(value)
|
||||||
|
return value
|
||||||
|
})
|
||||||
|
return m
|
||||||
}
|
}
|
||||||
func (m *Message) SplitIndexReplace(str string, arg ...string) *Message {
|
func (m *Message) SplitIndexReplace(str string, arg ...string) *Message {
|
||||||
return m.SplitIndex(kit.Replace(str, arg...))
|
return m.SplitIndex(kit.Replace(str, arg...))
|
||||||
|
@ -79,6 +79,7 @@ type relay struct {
|
|||||||
pushbin string `name:"pushbin dream portal nodename dev" icon:"bi bi-box-arrow-in-up"`
|
pushbin string `name:"pushbin dream portal nodename dev" icon:"bi bi-box-arrow-in-up"`
|
||||||
adminCmd string `name:"adminCmd cmd" icon:"bi bi-terminal-plus"`
|
adminCmd string `name:"adminCmd cmd" icon:"bi bi-terminal-plus"`
|
||||||
pushkey string `name:"pushkey server" icon:"bi bi-person-fill-up"`
|
pushkey string `name:"pushkey server" icon:"bi bi-person-fill-up"`
|
||||||
|
setIcon string `name:"setIcon icons*"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s relay) Init(m *ice.Message, arg ...string) {
|
func (s relay) Init(m *ice.Message, arg ...string) {
|
||||||
@ -117,9 +118,14 @@ func (s relay) Inputs(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (s relay) Create(m *ice.Message, arg ...string) {
|
func (s relay) Create(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option(mdb.ICONS) == "" {
|
||||||
|
res := m.Cmdx(web.SPIDE, ice.DEV, web.SPIDE_RAW, http.MethodGet, "http://"+m.Option(tcp.HOST)+"/c/space/action/info")
|
||||||
|
msg := m.Spawn().SplitIndex(res)
|
||||||
|
m.Option(mdb.ICONS, m.Resource(msg.Append(mdb.ICONS), msg.Append(web.ORIGIN)))
|
||||||
|
}
|
||||||
s.Hash.Create(m, kit.Simple(arg, tcp.PORT, m.OptionDefault(tcp.PORT, tcp.PORT_22),
|
s.Hash.Create(m, kit.Simple(arg, tcp.PORT, m.OptionDefault(tcp.PORT, tcp.PORT_22),
|
||||||
tcp.MACHINE, m.OptionDefault(tcp.MACHINE, kit.Split(m.Option(tcp.HOST), nfs.PT)[0]),
|
tcp.MACHINE, m.OptionDefault(tcp.MACHINE, kit.Split(m.Option(tcp.HOST), nfs.PT)[0]),
|
||||||
mdb.ICONS, m.OptionDefault(mdb.ICONS, html.ICONS_SSH),
|
mdb.ICONS, m.Option(mdb.ICONS),
|
||||||
)...)
|
)...)
|
||||||
}
|
}
|
||||||
func (s relay) Stats(m *ice.Message) {
|
func (s relay) Stats(m *ice.Message) {
|
||||||
@ -233,6 +239,7 @@ func (s relay) List(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
s.Pushbin,
|
s.Pushbin,
|
||||||
s.Pushkey,
|
s.Pushkey,
|
||||||
s.Xterm,
|
s.Xterm,
|
||||||
|
s.SetIcon,
|
||||||
s.Remove)
|
s.Remove)
|
||||||
kit.If(len(arg) > 0, func() { m.PushQRCode(cli.QRCODE, m.Append(web.LINK)) })
|
kit.If(len(arg) > 0, func() { m.PushQRCode(cli.QRCODE, m.Append(web.LINK)) })
|
||||||
}
|
}
|
||||||
@ -356,6 +363,9 @@ func (s relay) Admin(m *ice.Message, arg ...string) { s.iframe(m, "", arg...)
|
|||||||
func (s relay) Dream(m *ice.Message, arg ...string) { s.iframe(m, "", arg...) }
|
func (s relay) Dream(m *ice.Message, arg ...string) { s.iframe(m, "", arg...) }
|
||||||
func (s relay) Desktop(m *ice.Message, arg ...string) { s.iframe(m, "", arg...) }
|
func (s relay) Desktop(m *ice.Message, arg ...string) { s.iframe(m, "", arg...) }
|
||||||
func (s relay) Portal(m *ice.Message, arg ...string) { s.iframe(m, "", arg...) }
|
func (s relay) Portal(m *ice.Message, arg ...string) { s.iframe(m, "", arg...) }
|
||||||
|
func (s relay) SetIcon(m *ice.Message, arg ...string) {
|
||||||
|
s.Hash.Modify(m, arg...)
|
||||||
|
}
|
||||||
|
|
||||||
func init() { ice.Cmd(SSH_RELAY, relay{}) }
|
func init() { ice.Cmd(SSH_RELAY, relay{}) }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user