diff --git a/base/web/admin.go b/base/web/admin.go index b5e53157..e843ac55 100644 --- a/base/web/admin.go +++ b/base/web/admin.go @@ -3,7 +3,6 @@ package web import ( "net/http" "os" - "path" ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/aaa" @@ -11,6 +10,7 @@ import ( "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" ) @@ -25,12 +25,12 @@ func init() { RenderMain(m) } else { 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, 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 }, - ))) + )), ice.OPS) args := []string{} for i := range arg { if arg[i] == "--" { @@ -38,7 +38,8 @@ func init() { 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) } }}, }) diff --git a/base/web/broad.go b/base/web/broad.go index e63b27d8..2e86920f 100644 --- a/base/web/broad.go +++ b/base/web/broad.go @@ -70,7 +70,7 @@ func init() { 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, 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) { m.ProcessOpen(HostPort(m, m.Option(mdb.NAME), m.Option(tcp.PORT))) diff --git a/base/web/matrix.go b/base/web/matrix.go index a2ac395f..817f3230 100644 --- a/base/web/matrix.go +++ b/base/web/matrix.go @@ -99,15 +99,8 @@ func init() { ), Actions: ice.MergeActions(ice.Actions{ 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) { - if u := kit.ParseURL(m.Option(ORIGIN)); m.Warn(u.Query().Get(TOKEN) == "", ice.ErrNotValid, TOKEN) { - return - } 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)}) - } + m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("origin,name,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, "") }}, cli.START: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, "") }}, diff --git a/base/web/serve.go b/base/web/serve.go index 6950587a..695c091b 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -235,7 +235,7 @@ func init() { _serve_start(m) }}, 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)) kit.If(m.Option(ice.DEMO) == ice.TRUE, func() { m.Cmd(CHAT_HEADER, ice.DEMO) }) switch cb := m.Optionv(SERVE_START).(type) { diff --git a/base/web/space.go b/base/web/space.go index cccb32d7..26c9981b 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -310,7 +310,7 @@ func init() { 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) { 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) } _space_dial(m, m.Option(ice.DEV), kit.Select(ice.Info.NodeName, m.Option(mdb.NAME)), arg...) diff --git a/misc/ssh/relay/relay.go b/misc/ssh/relay/relay.go index ea7d782d..bfcef6b4 100644 --- a/misc/ssh/relay/relay.go +++ b/misc/ssh/relay/relay.go @@ -364,6 +364,7 @@ func (s relay) foreachScript(m *ice.Message, script string, arg ...string) { if msg.Option(cli.GO) == "" { 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) { 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) })