forked from x/icebergs
add some
This commit is contained in:
parent
3b2299b51f
commit
45f7f5bc8e
@ -3,7 +3,6 @@ package web
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
@ -11,6 +10,7 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/tcp"
|
"shylinux.com/x/icebergs/base/tcp"
|
||||||
|
"shylinux.com/x/icebergs/base/web/html"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,12 +25,12 @@ func init() {
|
|||||||
RenderMain(m)
|
RenderMain(m)
|
||||||
} else {
|
} else {
|
||||||
kit.If(len(arg) == 0, func() { arg = append(arg, SPACE, DOMAIN) })
|
kit.If(len(arg) == 0, func() { arg = append(arg, SPACE, DOMAIN) })
|
||||||
m.Cmd(SPIDE, mdb.CREATE, ice.OPS, HostPort(m, tcp.LOCALHOST, kit.GetValid(
|
m.Cmd(SPIDE, mdb.CREATE, HostPort(m, tcp.LOCALHOST, kit.GetValid(
|
||||||
func() string { return m.Cmdx(nfs.CAT, ice.VAR_LOG_ICE_PORT) },
|
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 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 tcp.PORT_9020 },
|
func() string { return tcp.PORT_9020 },
|
||||||
)))
|
)), ice.OPS)
|
||||||
args := []string{}
|
args := []string{}
|
||||||
for i := range arg {
|
for i := range arg {
|
||||||
if arg[i] == "--" {
|
if arg[i] == "--" {
|
||||||
@ -38,7 +38,8 @@ func init() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, http.MethodPost, C(path.Join(arg...)), cli.PWD, kit.Path(""), args)
|
kit.If(os.Getenv(cli.CTX_OPS), func(p string) { m.Optionv(SPIDE_HEADER, html.XHost, p) })
|
||||||
|
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, http.MethodPost, C(arg...), cli.PWD, kit.Path(""), args)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -70,7 +70,7 @@ func init() {
|
|||||||
DREAM: {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) }},
|
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) {
|
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, HostPort(m, m.Option(tcp.HOST), m.Option(tcp.PORT)))
|
m.Cmd(SPIDE, mdb.CREATE, HostPort(m, m.Option(tcp.HOST), m.Option(tcp.PORT)), m.Option(mdb.NAME))
|
||||||
}},
|
}},
|
||||||
OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.ProcessOpen(HostPort(m, m.Option(mdb.NAME), m.Option(tcp.PORT)))
|
m.ProcessOpen(HostPort(m, m.Option(mdb.NAME), m.Option(tcp.PORT)))
|
||||||
|
@ -99,15 +99,8 @@ func init() {
|
|||||||
), Actions: ice.MergeActions(ice.Actions{
|
), Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(SPIDE, mdb.INPUTS, arg) }},
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(SPIDE, mdb.INPUTS, arg) }},
|
||||||
mdb.CREATE: {Name: "create origin* name icons", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create origin* name icons", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if u := kit.ParseURL(m.Option(ORIGIN)); m.Warn(u.Query().Get(TOKEN) == "", ice.ErrNotValid, TOKEN) {
|
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("origin,name,icons,token"), mdb.TYPE, nfs.REPOS)
|
||||||
return
|
m.Cmd(SPIDE, DEV_CREATE_TOKEN, ice.Maps{CLIENT_NAME: m.Option(mdb.NAME)})
|
||||||
} else {
|
|
||||||
m.Option(TOKEN, u.Query().Get(TOKEN))
|
|
||||||
m.Option(ORIGIN, kit.Format("%s://%s", u.Scheme, u.Host))
|
|
||||||
m.OptionDefault(mdb.NAME, kit.Split(u.Hostname(), ".")[0])
|
|
||||||
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("name,origin,icons,token"), mdb.TYPE, nfs.REPOS)
|
|
||||||
m.Cmd(SPIDE, DEV_CREATE_TOKEN, ice.Maps{CLIENT_NAME: m.Option(mdb.NAME)})
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, nfs.TRASH); _matrix_dream(m, "") }},
|
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, nfs.TRASH); _matrix_dream(m, "") }},
|
||||||
cli.START: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, "") }},
|
cli.START: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, "") }},
|
||||||
|
@ -235,7 +235,7 @@ func init() {
|
|||||||
_serve_start(m)
|
_serve_start(m)
|
||||||
}},
|
}},
|
||||||
SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(SPIDE, mdb.CREATE, ice.OPS, kit.Format("http://localhost:%s", m.Option(tcp.PORT)), nfs.REPOS, nfs.USR_ICONS_CONTEXTS)
|
m.Cmd(SPIDE, mdb.CREATE, kit.Format("http://localhost:%s", m.Option(tcp.PORT)), ice.OPS, nfs.USR_ICONS_CONTEXTS, nfs.REPOS)
|
||||||
Count(m, m.ActionKey(), m.Option(tcp.PORT))
|
Count(m, m.ActionKey(), m.Option(tcp.PORT))
|
||||||
kit.If(m.Option(ice.DEMO) == ice.TRUE, func() { m.Cmd(CHAT_HEADER, ice.DEMO) })
|
kit.If(m.Option(ice.DEMO) == ice.TRUE, func() { m.Cmd(CHAT_HEADER, ice.DEMO) })
|
||||||
switch cb := m.Optionv(SERVE_START).(type) {
|
switch cb := m.Optionv(SERVE_START).(type) {
|
||||||
|
@ -310,7 +310,7 @@ func init() {
|
|||||||
cli.START: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("", tcp.DIAL, arg) }},
|
cli.START: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("", tcp.DIAL, arg) }},
|
||||||
tcp.DIAL: {Name: "dial dev=ops name", Hand: func(m *ice.Message, arg ...string) {
|
tcp.DIAL: {Name: "dial dev=ops name", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if strings.HasPrefix(m.Option(ice.DEV), HTTP) {
|
if strings.HasPrefix(m.Option(ice.DEV), HTTP) {
|
||||||
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple(ice.DEV))
|
m.Cmd(SPIDE, mdb.CREATE, m.Option(ice.DEV), ice.DEV)
|
||||||
m.Option(ice.DEV, ice.DEV)
|
m.Option(ice.DEV, ice.DEV)
|
||||||
}
|
}
|
||||||
_space_dial(m, m.Option(ice.DEV), kit.Select(ice.Info.NodeName, m.Option(mdb.NAME)), arg...)
|
_space_dial(m, m.Option(ice.DEV), kit.Select(ice.Info.NodeName, m.Option(mdb.NAME)), arg...)
|
||||||
|
@ -364,6 +364,7 @@ func (s relay) foreachScript(m *ice.Message, script string, arg ...string) {
|
|||||||
if msg.Option(cli.GO) == "" {
|
if msg.Option(cli.GO) == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
msg.Option(web.LINK, web.HostPort(m.Message, msg.Option(tcp.HOST), msg.Option(web.PORTAL)))
|
||||||
ssh.PushShell(msg.Message, strings.Split(msg.Template(script), lex.NL), func(res string) {
|
ssh.PushShell(msg.Message, strings.Split(msg.Template(script), lex.NL), func(res string) {
|
||||||
web.PushNoticeGrow(m.Options(ctx.DISPLAY, html.PLUGIN_XTERM, ice.MSG_COUNT, "0", ice.MSG_DEBUG, ice.FALSE, ice.LOG_DISABLE, ice.TRUE).Message, res)
|
web.PushNoticeGrow(m.Options(ctx.DISPLAY, html.PLUGIN_XTERM, ice.MSG_COUNT, "0", ice.MSG_DEBUG, ice.FALSE, ice.LOG_DISABLE, ice.TRUE).Message, res)
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user