forked from x/icebergs
add some
This commit is contained in:
parent
ec3a976337
commit
b91f83adb5
@ -111,7 +111,7 @@ func _dream_list_more(m *ice.Message, simple bool) *ice.Message {
|
||||
msg := gdb.Event(m.Spawn(value), DREAM_TABLES)
|
||||
defer m.PushButton(strings.Join(msg.Appendv(ctx.ACTION), ""))
|
||||
}
|
||||
case MASTER:
|
||||
case ORIGIN:
|
||||
if spide, ok := list[value[mdb.NAME]]; ok {
|
||||
value[mdb.ICONS] = kit.Select(value[mdb.ICONS], spide[mdb.ICONS])
|
||||
}
|
||||
@ -231,7 +231,7 @@ const DREAM = "dream"
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
DREAM: {Name: "dream refresh", Help: "梦想家", Icon: "Launchpad.png", Role: aaa.VOID, Meta: kit.Dict(
|
||||
ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict(WORKER, "空间", SERVER, "机器", MASTER, "服务")),
|
||||
ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict(WORKER, "空间", SERVER, "机器", ORIGIN, "主机")),
|
||||
), Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m = m.Spawn()
|
||||
@ -273,7 +273,7 @@ func init() {
|
||||
})
|
||||
m.RenameAppend(nfs.PATH, arg[0])
|
||||
mdb.HashInputs(m, arg)
|
||||
DreamListSpide(m, []string{ice.DEV}, MASTER, func(dev, origin string) {
|
||||
DreamListSpide(m, []string{ice.DEV}, ORIGIN, func(dev, origin string) {
|
||||
m.Spawn().SplitIndex(m.Cmdx(SPIDE, dev, SPIDE_RAW, http.MethodGet, S(), cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH)).Table(func(value ice.Maps) {
|
||||
m.Push(arg[0], origin+S(value[mdb.NAME])).Push(nfs.SIZE, value[nfs.SIZE]).Push(mdb.TIME, value[mdb.TIME])
|
||||
})
|
||||
@ -422,7 +422,7 @@ func init() {
|
||||
nfs.Trash(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME)))
|
||||
}},
|
||||
OPEN: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Option(mdb.TYPE) == MASTER && m.IsLocalhost() {
|
||||
if m.Option(mdb.TYPE) == ORIGIN && m.IsLocalhost() {
|
||||
m.ProcessOpen(SpideOrigin(m, m.Option(mdb.NAME)))
|
||||
} else {
|
||||
m.ProcessOpen(S(m.Option(mdb.NAME)))
|
||||
@ -468,7 +468,7 @@ func init() {
|
||||
msg.Table(func(value ice.Maps) { stat[value[mdb.TYPE]]++; stat[value[mdb.STATUS]]++ })
|
||||
PushStats(m, kit.Keys(m.CommandKey(), cli.START), stat[cli.START], "", "已启动空间")
|
||||
PushStats(m, kit.Keys(m.CommandKey(), SERVER), stat[SERVER], "", "已连接机器")
|
||||
PushStats(m, kit.Keys(m.CommandKey(), MASTER), stat[MASTER], "", "已连接服务")
|
||||
PushStats(m, kit.Keys(m.CommandKey(), ORIGIN), stat[ORIGIN], "", "已连接主机")
|
||||
}
|
||||
}},
|
||||
}, StatsAction(), DreamAction(), DreamTablesAction(), mdb.ImportantHashAction(
|
||||
@ -492,7 +492,7 @@ func init() {
|
||||
} else {
|
||||
m.Action(html.FILTER, mdb.CREATE, STARTALL, STOPALL)
|
||||
}
|
||||
m.Sort("type,status,name", []string{aaa.LOGIN, WORKER, SERVER, MASTER}, []string{cli.START, cli.STOP, cli.BEGIN}, ice.STR_R)
|
||||
m.Sort("type,status,name", []string{aaa.LOGIN, WORKER, SERVER, ORIGIN}, []string{cli.START, cli.STOP, cli.BEGIN}, ice.STR_R)
|
||||
m.StatusTimeCountStats(mdb.TYPE, mdb.STATUS)
|
||||
ctx.DisplayTableCard(m)
|
||||
if !m.IsDebug() {
|
||||
|
@ -23,7 +23,7 @@ fieldset.web.matrix>div.output>table.content div.item:hover { background-color:u
|
||||
fieldset.web.matrix>div.output:not(.process)>table.content div.item.notice { background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
||||
fieldset.web.matrix>div.output:not(.process)>table.content div.item.danger { background-color:var(--danger-bg-color); color:var(--danger-fg-color); }
|
||||
fieldset.web.matrix>div.output:not(.process)>table.content div.item.server { border:var(--notice-bg-color) solid 3px; }
|
||||
fieldset.web.matrix>div.output:not(.process)>table.content div.item.master { border:var(--danger-bg-color) solid 3px; }
|
||||
fieldset.web.matrix>div.output:not(.process)>table.content div.item.origin { border:var(--danger-bg-color) solid 3px; }
|
||||
fieldset.web.matrix>div.output:not(.process)>table.content div.item.danger div.status div.item { color:var(--danger-fg-color); }
|
||||
fieldset.web.matrix>div.output:not(.process)>table.content div.item.notice div.status div.item { color:var(--notice-fg-color); }
|
||||
fieldset.web.matrix>div.output:not(.process)>table.content div.item.stop div.title>span { color:var(--disable-fg-color); }
|
||||
|
@ -38,7 +38,7 @@ func _matrix_list(m *ice.Message, domain, typ string, meta ice.Maps, fields ...s
|
||||
kit.If(value[mdb.STATUS] == cli.STOP, func() { value[mdb.ICONS] = nfs.USR_ICONS_ICEBERGS })
|
||||
kit.If(value[mdb.STATUS] == cli.STOP && istech, func() { button = []ice.Any{cli.START, mdb.REMOVE} })
|
||||
m.PushRecord(value, fields...).PushButton(button...)
|
||||
case SERVER, MASTER:
|
||||
case SERVER, ORIGIN:
|
||||
server = append(server, kit.Keys(domain, value[mdb.NAME]))
|
||||
icons = append(icons, value[mdb.ICONS])
|
||||
types = append(types, value[mdb.TYPE])
|
||||
@ -53,7 +53,7 @@ func _matrix_action(m *ice.Message, action string, arg ...string) {
|
||||
ProcessIframe(m, "", "", arg...)
|
||||
} else {
|
||||
title, link := kit.Keys(domain, action), kit.Select("", S(domain), domain != "")+C(action)
|
||||
if m.Option(mdb.TYPE) == MASTER {
|
||||
if m.Option(mdb.TYPE) == ORIGIN {
|
||||
link = kit.MergeURL2(SpideOrigin(m, m.Option(DOMAIN)), C(action))
|
||||
if kit.IsIn(action, ADMIN) {
|
||||
m.ProcessOpen(link)
|
||||
@ -64,9 +64,9 @@ func _matrix_action(m *ice.Message, action string, arg ...string) {
|
||||
}
|
||||
case OPEN:
|
||||
link := kit.Select(nfs.PS, S(domain), domain != "")
|
||||
if m.Option(mdb.TYPE) == MASTER {
|
||||
if m.Option(mdb.TYPE) == ORIGIN {
|
||||
link = SpideOrigin(m, m.Option(DOMAIN))
|
||||
} else if m.Option("server.type") == MASTER {
|
||||
} else if m.Option("server.type") == ORIGIN {
|
||||
link = kit.MergeURL2(SpideOrigin(m, m.Option(DOMAIN)), S(m.Option(mdb.NAME)))
|
||||
}
|
||||
m.ProcessOpen(link)
|
||||
@ -94,7 +94,7 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
MATRIX: {Name: "matrix refresh", Help: "矩阵", Icon: "Mission Control.png", Meta: kit.Dict(
|
||||
ice.CTX_ICONS, kit.Dict(STATUS, "bi bi-git"), ice.CTX_TRANS, kit.Dict(
|
||||
STATUS, "源码", html.INPUT, kit.Dict(MYSELF, "本机", MASTER, "主机"),
|
||||
STATUS, "源码", html.INPUT, kit.Dict(MYSELF, "本机", ORIGIN, "主机"),
|
||||
),
|
||||
), Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(DREAM, mdb.INPUTS, arg) }},
|
||||
@ -151,7 +151,7 @@ func init() {
|
||||
return value
|
||||
})
|
||||
m.Action(html.FILTER, mdb.CREATE, UPGRADE).StatusTimeCountStats(mdb.TYPE, mdb.STATUS).Display("")
|
||||
m.Sort("type,status,name,domain", []string{MYSELF, SERVER, MASTER, WORKER, ""}, []string{cli.START, cli.STOP, ""}, ice.STR_R, ice.STR_R)
|
||||
m.Sort("type,status,name,domain", []string{MYSELF, SERVER, ORIGIN, WORKER, ""}, []string{cli.START, cli.STOP, ""}, ice.STR_R, ice.STR_R)
|
||||
ctx.Toolkit(m)
|
||||
return nil
|
||||
})
|
||||
|
@ -203,7 +203,6 @@ const (
|
||||
HTTP = "http"
|
||||
HTTPS = "https"
|
||||
DOMAIN = "domain"
|
||||
ORIGIN = "origin"
|
||||
FORM = "form"
|
||||
BODY = "body"
|
||||
HOME = "home"
|
||||
|
@ -193,7 +193,7 @@ func ProxyUpload(m *ice.Message, pod string, p string) string {
|
||||
} else if s, e := file.StatFile(p); e == nil {
|
||||
size, cache = s.Size(), s.ModTime()
|
||||
}
|
||||
if m.Cmdv(SPACE, pod, mdb.TYPE) == MASTER {
|
||||
if m.Cmdv(SPACE, pod, mdb.TYPE) == ORIGIN {
|
||||
m.Cmd(SPIDE, pod, SPIDE_SAVE, pp, p)
|
||||
} else {
|
||||
kit.If(p == ice.BIN_ICE_BIN, func() { m.Option(ice.MSG_USERROLE, aaa.TECH) })
|
||||
|
@ -41,7 +41,7 @@ func _space_dial(m *ice.Message, dev, name string, arg ...string) {
|
||||
next := time.Duration(rand.Intn(a*(i+1))+b*i) * time.Millisecond
|
||||
m.Cmd(tcp.CLIENT, tcp.DIAL, args, func(c net.Conn) {
|
||||
if c, e := websocket.NewClient(c, u); !m.WarnNotValid(e, tcp.DIAL, dev, SPACE, u.String()) {
|
||||
defer mdb.HashCreateDeferRemove(m, kit.SimpleKV("", MASTER, dev, origin), kit.Dict(mdb.TARGET, c))()
|
||||
defer mdb.HashCreateDeferRemove(m, kit.SimpleKV("", ORIGIN, dev, origin), kit.Dict(mdb.TARGET, c))()
|
||||
kit.If(ice.Info.Colors, func() { once.Do(func() { m.Go(func() { _space_qrcode(m, dev) }) }) })
|
||||
_space_handle(m.Spawn(), true, dev, c)
|
||||
i = 0
|
||||
@ -144,7 +144,7 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
|
||||
m.WarnNotFound(!mdb.HashSelectDetail(m, next, func(value ice.Map) {
|
||||
switch c := value[mdb.TARGET].(type) {
|
||||
case (*websocket.Conn): // 转发报文
|
||||
kit.If(value[mdb.TYPE] == MASTER && msg.Option(ice.MSG_HANDLE) == ice.FALSE, func() {
|
||||
kit.If(value[mdb.TYPE] == ORIGIN && msg.Option(ice.MSG_HANDLE) == ice.FALSE, func() {
|
||||
msg.Optionv(ice.MSG_USERWEB, kit.Simple(value[mdb.TEXT], msg.Optionv(ice.MSG_USERWEB)))
|
||||
msg.Optionv(ice.MSG_USERPOD, kit.Simple(kit.Keys(target[1:]), msg.Optionv(ice.MSG_USERPOD)))
|
||||
})
|
||||
@ -215,7 +215,7 @@ func _space_send(m *ice.Message, name string, arg ...string) (h string) {
|
||||
}
|
||||
if target := kit.Split(name, nfs.PT, nfs.PT); !mdb.HashSelectDetail(m, target[0], func(value ice.Map) {
|
||||
if c, ok := value[mdb.TARGET].(*websocket.Conn); !m.WarnNotValid(!ok, mdb.TARGET) {
|
||||
kit.If(kit.Format(value[mdb.TYPE]) == MASTER, func() {
|
||||
kit.If(kit.Format(value[mdb.TYPE]) == ORIGIN, func() {
|
||||
m.Optionv(ice.MSG_USERWEB, kit.Simple(value[mdb.TEXT], m.Optionv(ice.MSG_USERWEB)))
|
||||
m.Optionv(ice.MSG_USERPOD, kit.Simple(kit.Keys(target[1:]), m.Optionv(ice.MSG_USERPOD)))
|
||||
m.Options(ice.MSG_USERHOST, "", ice.MSG_USERWEB0, m.Option(ice.MSG_USERWEB), ice.MSG_USERPOD0, name)
|
||||
@ -253,7 +253,7 @@ const (
|
||||
WORKER = "worker"
|
||||
SERVER = "server"
|
||||
MYSELF = "myself"
|
||||
MASTER = "master"
|
||||
ORIGIN = "origin"
|
||||
|
||||
REDIAL = "redial"
|
||||
AGENT = "agent"
|
||||
@ -289,7 +289,7 @@ func init() {
|
||||
switch value[mdb.TYPE] {
|
||||
case SERVER:
|
||||
m.PushSearch(mdb.TEXT, m.MergePod(value[mdb.NAME]), value)
|
||||
case MASTER:
|
||||
case ORIGIN:
|
||||
m.PushSearch(mdb.TEXT, m.Cmdv(SPIDE, value[mdb.NAME], CLIENT_ORIGIN), value)
|
||||
}
|
||||
})
|
||||
@ -320,7 +320,7 @@ func init() {
|
||||
}},
|
||||
OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch m.Option(mdb.TYPE) {
|
||||
case MASTER:
|
||||
case ORIGIN:
|
||||
ProcessIframe(m, m.Option(mdb.NAME), SpideOrigin(m, m.Option(mdb.NAME)), arg...)
|
||||
default:
|
||||
ProcessIframe(m, m.Option(mdb.NAME), m.MergePod(m.Option(mdb.NAME)), arg...)
|
||||
@ -344,14 +344,14 @@ func init() {
|
||||
m.Push(mdb.LINK, m.MergeLink(value[mdb.TEXT]))
|
||||
} else if kit.IsIn(value[mdb.TYPE], WORKER, SERVER) {
|
||||
m.Push(mdb.LINK, m.MergePod(value[mdb.NAME]))
|
||||
} else if kit.IsIn(value[mdb.TYPE], MASTER) {
|
||||
} else if kit.IsIn(value[mdb.TYPE], ORIGIN) {
|
||||
m.Push(mdb.LINK, value[mdb.TEXT])
|
||||
} else {
|
||||
m.Push(mdb.LINK, "")
|
||||
}
|
||||
m.PushButton(kit.Select(OPEN, LOGIN, value[mdb.TYPE] == LOGIN), mdb.REMOVE)
|
||||
})
|
||||
m.Sort("", kit.Simple(aaa.LOGIN, WEIXIN, PORTAL, WORKER, SERVER, MASTER))
|
||||
m.Sort("", kit.Simple(aaa.LOGIN, WEIXIN, PORTAL, WORKER, SERVER, ORIGIN))
|
||||
} else {
|
||||
// m.OptionDefault(ice.MSG_USERPOD, arg[0])
|
||||
for i := 0; i < 5; i++ {
|
||||
|
@ -407,8 +407,14 @@ func init() {
|
||||
if p := path.Join(ice.SRC_TEMPLATE, m.PrefixKey(), path.Join(arg...)); nfs.Exists(m, p) {
|
||||
return p + kit.Select("", nfs.PS, len(arg) == 0)
|
||||
} else {
|
||||
return kit.MergeURL2(SpideOrigin(m, ice.OPS)+m.FileURI(ctx.GetCmdFile(m, m.PrefixKey())), path.Join(arg...))
|
||||
return kit.MergeURL2(UserHost(m)+m.FileURI(ctx.GetCmdFile(m, m.PrefixKey())), path.Join(arg...))
|
||||
p := m.FileURI(ctx.GetCmdFile(m, m.PrefixKey()))
|
||||
if p := strings.TrimPrefix(path.Join(path.Dir(p), path.Join(arg...)), "/require/"); nfs.Exists(m, p) {
|
||||
return p
|
||||
}
|
||||
if ice.Info.Important {
|
||||
return kit.MergeURL2(SpideOrigin(m, ice.OPS)+p, path.Join(arg...))
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
nfs.DocumentPath = func(m *ice.Message, arg ...string) string {
|
||||
|
@ -22,7 +22,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
}},
|
||||
mdb.CREATE: {Name: "create type*=worker,server,master, name*"},
|
||||
mdb.CREATE: {Name: "create type*=worker,server,origin, name*"},
|
||||
tcp.SEND: {Name: "send text=hi", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.SPACE, m.Option(mdb.NAME), Prefix(MESSAGE), tcp.RECV, mdb.TEXT, m.Option(mdb.TEXT))
|
||||
}},
|
||||
|
@ -164,7 +164,7 @@ func init() {
|
||||
web.DREAM_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(arg[0] == REPOS, func() {
|
||||
mdb.HashSelect(m).Sort(REPOS).Cut("repos,version,time")
|
||||
web.DreamListSpide(m, []string{ice.DEV}, web.MASTER, func(dev, origin string) {
|
||||
web.DreamListSpide(m, []string{ice.DEV}, web.ORIGIN, func(dev, origin string) {
|
||||
m.Spawn().SplitIndex(m.Cmdx(web.SPIDE, dev, web.SPIDE_RAW, http.MethodGet, web.C(web.CODE_GIT_SERVICE))).Table(func(value ice.Maps) {
|
||||
value[nfs.REPOS] = origin + web.X(value[nfs.REPOS])
|
||||
m.Push("", value, kit.Split("repos,version,time"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user