forked from x/icebergs
add some
This commit is contained in:
parent
4b6531a015
commit
ae7afafe13
@ -7,9 +7,11 @@ import (
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/tcp"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -41,7 +43,7 @@ func init() {
|
||||
func() string { return m.Cmdx(nfs.CAT, ice.VAR_LOG_ICE_PORT) },
|
||||
func() string { return m.Cmdx(nfs.CAT, kit.Path(os.Args[0], "../", ice.VAR_LOG_ICE_PORT)) },
|
||||
func() string { return m.Cmdx(nfs.CAT, kit.Path(os.Args[0], "../../", ice.VAR_LOG_ICE_PORT)) },
|
||||
func() string { return "9020" },
|
||||
func() string { return tcp.PORT_9020 },
|
||||
)))
|
||||
args := []string{}
|
||||
for i := range arg {
|
||||
@ -50,7 +52,7 @@ func init() {
|
||||
break
|
||||
}
|
||||
}
|
||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, http.MethodPost, C(path.Join(arg...)), "pwd", kit.Path(""), args)
|
||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, http.MethodPost, C(path.Join(arg...)), cli.PWD, kit.Path(""), args)
|
||||
}
|
||||
}},
|
||||
})
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func _broad_send(m *ice.Message, to_host, to_port string, host, port string, arg ...string) {
|
||||
m.Cmd(tcp.CLIENT, tcp.DIAL, mdb.TYPE, tcp.UDP4, tcp.HOST, to_host, tcp.PORT, kit.Select("9020", to_port), func(s *net.UDPConn) {
|
||||
m.Cmd(tcp.CLIENT, tcp.DIAL, mdb.TYPE, tcp.UDP4, tcp.HOST, to_host, tcp.PORT, kit.Select(tcp.PORT_9020, to_port), func(s *net.UDPConn) {
|
||||
msg := m.Spawn(kit.Dict(tcp.HOST, host, tcp.PORT, port, arg))
|
||||
msg.Logs(tcp.SEND, BROAD, msg.FormatsMeta(nil), nfs.TO, tcp.HostPort(to_host, to_port)).FormatsMeta(s)
|
||||
})
|
||||
@ -28,7 +28,13 @@ func _broad_serve(m *ice.Message) {
|
||||
})
|
||||
})
|
||||
m.Cmd(tcp.SERVER, tcp.LISTEN, mdb.TYPE, tcp.UDP4, mdb.NAME, logs.FileLine(1), m.OptionSimple(tcp.HOST, tcp.PORT), func(from *net.UDPAddr, buf []byte) {
|
||||
if m.Warn(len(buf) > 1024, "broad recv buf size too large") {
|
||||
return
|
||||
}
|
||||
msg := m.Spawn(buf).Logs(tcp.RECV, BROAD, string(buf), nfs.FROM, from)
|
||||
if strings.HasPrefix(msg.Option(tcp.HOST), "169.254") {
|
||||
return
|
||||
}
|
||||
if m.Cmd(BROAD, mdb.CREATE, msg.OptionSimple(kit.Simple(msg.Optionv(ice.MSG_OPTION))...)); msg.Option(gdb.EVENT) == tcp.LISTEN {
|
||||
m.Cmds(BROAD, func(value ice.Maps) {
|
||||
_broad_send(m, msg.Option(tcp.HOST), msg.Option(tcp.PORT), value[tcp.HOST], value[tcp.PORT], kit.Simple(value)...)
|
||||
@ -42,6 +48,7 @@ const BROAD = "broad"
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
BROAD: {Help: "广播台", 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) {
|
||||
host, domain := m.Cmdv(tcp.HOST, aaa.IP), UserWeb(m).Hostname()
|
||||
@ -55,14 +62,12 @@ func init() {
|
||||
})
|
||||
}
|
||||
}},
|
||||
SERVE_START: {Hand: func(m *ice.Message, arg ...string) { gdb.Go(m, _broad_serve) }},
|
||||
SERVE: {Name: "serve port=9020 host", Hand: func(m *ice.Message, arg ...string) { gdb.Go(m, _broad_serve) }},
|
||||
ADMIN: {Hand: func(m *ice.Message, arg ...string) { broadOpen(m) }},
|
||||
DREAM: {Hand: func(m *ice.Message, arg ...string) { broadOpen(m) }},
|
||||
VIMER: {Hand: func(m *ice.Message, arg ...string) { broadOpen(m) }},
|
||||
SPIDE: {Name: "spide name type=repos", Icon: "bi bi-house-add", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPIDE, mdb.CREATE,
|
||||
m.OptionSimple(mdb.NAME), ORIGIN, "http://"+m.Option(mdb.NAME)+":"+m.Option(tcp.PORT))
|
||||
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple(mdb.NAME), ORIGIN, Domain(m.Option(mdb.NAME), m.Option(tcp.PORT)))
|
||||
}},
|
||||
OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(Domain(m.Option(mdb.NAME), m.Option(tcp.PORT))) }},
|
||||
tcp.SEND: {Hand: func(m *ice.Message, arg ...string) { _broad_send(m, "", "", "", "", arg...) }},
|
||||
@ -72,5 +77,5 @@ func init() {
|
||||
})
|
||||
}
|
||||
func broadOpen(m *ice.Message) {
|
||||
m.ProcessOpen(Domain(strings.TrimSuffix(m.Option(mdb.NAME), ".local")+".local", m.Option(tcp.PORT)) + C(m.ActionKey()))
|
||||
m.ProcessOpen(Domain(m.Option(mdb.NAME), m.Option(tcp.PORT)) + C(m.ActionKey()))
|
||||
}
|
||||
|
@ -325,7 +325,6 @@ func init() {
|
||||
m.Cmd("", mdb.CREATE, ice.OPS, kit.Select("http://localhost:9020", conf[cli.CTX_OPS]), "", 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")
|
||||
m.Cmd("", mdb.CREATE, nfs.REPOS, kit.Select("https://repos.shylinux.com", conf[cli.CTX_HUB]), "", "usr/icons/gitea.png")
|
||||
mdb.HashSelects(m.Spawn()).Table(func(value ice.Maps) {
|
||||
kit.If(value[TOKEN], func() { m.Cmd(SPACE, tcp.DIAL, ice.DEV, value[CLIENT_NAME], TOKEN, value[TOKEN], mdb.TYPE, SERVER) })
|
||||
})
|
||||
|
@ -85,7 +85,7 @@ body:not(.mobile) fieldset.macos.dock>div.output { overflow:visible; }
|
||||
body:not(.mobile) fieldset.macos.dock>div.output>div.item:hover { background-color:unset; margin-top:-80px; transition:margin-top 0.3s; }
|
||||
body:not(.mobile) fieldset.macos.dock>div.output>div.item img:hover { width:160px; transition:width 0.3s; }
|
||||
body:not(.mobile) fieldset.macos.desktop>div.output>fieldset.macos.dock:hover { margin-left:-40px; transition:margin-left 0.3s; }
|
||||
body:not(.mobile) fieldset.macos.desktop>div.output>div.desktop>fieldset:not(:hover)>form.option>div.icon { visibility:hidden; }
|
||||
/* body:not(.mobile) fieldset.macos.desktop>div.output>div.desktop>fieldset:not(:hover)>form.option>div.icon { visibility:hidden; } */
|
||||
body:not(.mobile) fieldset.macos.desktop>div.output>div.desktop>div.item { margin:var(--desktop-icon-margin); }
|
||||
body.mobile fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item.text>input { width:60px; }
|
||||
body.mobile fieldset.macos.dock>div.output { overflow-y:hidden; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user