forked from x/icebergs
opt url
This commit is contained in:
parent
f7bfc31de1
commit
35e635b3a9
@ -295,11 +295,11 @@ func IsWindows() bool { return runtime.GOOS == WINDOWS }
|
|||||||
func ParseMake(str string) []string {
|
func ParseMake(str string) []string {
|
||||||
res := kit.UnMarshal(str)
|
res := kit.UnMarshal(str)
|
||||||
data := kit.Value(res, MAKE)
|
data := kit.Value(res, MAKE)
|
||||||
return kit.Simple(
|
return kit.Simple(mdb.TIME, kit.Value(res, "boot.time"), ice.SPACE, kit.Format(kit.Value(res, "node.name")),
|
||||||
nfs.MODULE, kit.Value(data, nfs.MODULE), nfs.VERSION, kit.Join(kit.TrimArg(kit.Simple(
|
nfs.MODULE, kit.Value(data, nfs.MODULE), nfs.VERSION, kit.Join(kit.TrimArg(kit.Simple(
|
||||||
kit.Value(data, nfs.VERSION), kit.Value(data, "forword"), kit.Cut(kit.Format(kit.Value(data, mdb.HASH)), 6),
|
kit.Value(data, nfs.VERSION), kit.Value(data, "forword"), kit.Cut(kit.Format(kit.Value(data, mdb.HASH)), 6),
|
||||||
)...), "-"),
|
)...), "-"),
|
||||||
nfs.COMMIT, kit.Value(data, "when"), "compile", kit.Value(data, mdb.TIME), BOOT, kit.Value(res, "boot.time"),
|
"commitTime", kit.Value(data, "when"), "compileTime", kit.Value(data, mdb.TIME), "bootTime", kit.Value(res, "boot.time"),
|
||||||
ice.SPACE, kit.Value(res, "node.name"),
|
SHELL, kit.Format(kit.Value(res, "conf.SHELL")), "kernel", kit.Format(kit.Value(res, "host.GOOS")), "arch", kit.Format(kit.Value(res, "host.GOARCH")),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,11 @@ func _command_list(m *ice.Message, name string) *ice.Message {
|
|||||||
m.Push(mdb.META, kit.Format(cmd.Meta))
|
m.Push(mdb.META, kit.Format(cmd.Meta))
|
||||||
m.Push(mdb.LIST, kit.Format(cmd.List))
|
m.Push(mdb.LIST, kit.Format(cmd.List))
|
||||||
m.Push("_help", GetCmdHelp(m, name))
|
m.Push("_help", GetCmdHelp(m, name))
|
||||||
m.Push("_fileline", kit.MergeURL(FileURI(kit.Split(cmd.FileLine(), ":")[0]), ice.POD, m.Option(ice.MSG_USERPOD)))
|
if !nfs.Exists(m, kit.Split(cmd.FileLine(), ":")[0], func(p string) {
|
||||||
|
m.Push("_fileline", kit.MergeURL(FileURI(p), ice.POD, m.Option(ice.MSG_USERPOD)))
|
||||||
|
}) {
|
||||||
|
m.Push("_fileline", "")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,7 @@ const (
|
|||||||
BRANCH = "branch"
|
BRANCH = "branch"
|
||||||
MASTER = "master"
|
MASTER = "master"
|
||||||
VERSION = "version"
|
VERSION = "version"
|
||||||
|
COMPILE = "compile"
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
HTML = ice.HTML
|
HTML = ice.HTML
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package web
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
@ -56,29 +57,35 @@ func _dream_start(m *ice.Message, name string) {
|
|||||||
if m.Warn(name == "", ice.ErrNotValid, mdb.NAME) {
|
if m.Warn(name == "", ice.ErrNotValid, mdb.NAME) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer ToastProcess(m)()
|
||||||
defer mdb.Lock(m, m.PrefixKey(), cli.START, name)()
|
defer mdb.Lock(m, m.PrefixKey(), cli.START, name)()
|
||||||
defer m.ProcessOpen(m.MergePod(m.Option(mdb.NAME, name)))
|
// defer m.ProcessOpen(m.MergePod(m.Option(mdb.NAME, name)))
|
||||||
|
defer m.ProcessOpen(kit.MergeURL(S(name), m.Option(ice.MSG_DEBUG)))
|
||||||
p := path.Join(ice.USR_LOCAL_WORK, name)
|
p := path.Join(ice.USR_LOCAL_WORK, name)
|
||||||
if p := path.Join(p, ice.Info.PidPath); nfs.Exists(m, p) && nfs.Exists(m, "/proc/") {
|
if p := path.Join(p, ice.Info.PidPath); nfs.Exists(m, p) {
|
||||||
|
if nfs.Exists(m, "/proc/") {
|
||||||
if pid := m.Cmdx(nfs.CAT, p, kit.Dict(ice.MSG_USERROLE, aaa.TECH)); pid != "" && nfs.Exists(m, "/proc/"+pid) {
|
if pid := m.Cmdx(nfs.CAT, p, kit.Dict(ice.MSG_USERROLE, aaa.TECH)); pid != "" && nfs.Exists(m, "/proc/"+pid) {
|
||||||
m.Info("already exists %v", pid)
|
m.Info("already exists %v", pid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
if msg := m.Cmd(SPACE, name); msg.Length() > 0 {
|
if msg := m.Cmd(SPACE, name); msg.Length() > 0 {
|
||||||
m.Info("already exists %v", name)
|
m.Info("already exists %v", name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Sleep300ms()
|
m.Sleep300ms()
|
||||||
}
|
}
|
||||||
defer ToastProcess(m)()
|
}
|
||||||
defer m.Options(cli.CMD_DIR, "", cli.CMD_ENV, "", cli.CMD_OUTPUT, "")
|
defer m.Options(cli.CMD_DIR, "", cli.CMD_ENV, "", cli.CMD_OUTPUT, "")
|
||||||
m.Options(cli.CMD_DIR, kit.Path(p), cli.CMD_ENV, kit.EnvList(kit.Simple(m.OptionSimple("tcp_domain"),
|
m.Options(cli.CMD_DIR, kit.Path(p), cli.CMD_ENV, kit.EnvList(kit.Simple(m.OptionSimple("tcp_domain"),
|
||||||
cli.CTX_OPS, Domain(tcp.LOCALHOST, m.Cmdv(SERVE, tcp.PORT)), cli.CTX_LOG, ice.VAR_LOG_BOOT_LOG, cli.CTX_PID, ice.VAR_LOG_ICE_PID,
|
cli.CTX_OPS, Domain(tcp.LOCALHOST, m.Cmdv(SERVE, tcp.PORT)), cli.CTX_LOG, ice.VAR_LOG_BOOT_LOG, cli.CTX_PID, ice.VAR_LOG_ICE_PID,
|
||||||
cli.CTX_ROOT, kit.Path(""), cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.Username,
|
cli.CTX_ROOT, kit.Path(""), cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.Username,
|
||||||
)...), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG), mdb.CACHE_CLEAR_ONEXIT, ice.TRUE)
|
)...), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG), mdb.CACHE_CLEAR_ONEXIT, ice.TRUE)
|
||||||
gdb.Event(m, DREAM_CREATE, m.OptionSimple(mdb.NAME, mdb.TYPE))
|
gdb.Event(m, DREAM_CREATE, m.OptionSimple(mdb.NAME, mdb.TYPE))
|
||||||
|
if m.Option(nfs.BINARY) == "" && os.Getenv("ctx_dev") != "" && os.Getenv("ctx_pod") != "" {
|
||||||
|
m.Option(nfs.BINARY, os.Getenv("ctx_dev")+S(os.Getenv("ctx_pod")))
|
||||||
|
}
|
||||||
kit.If(m.Option(nfs.BINARY), func(p string) { _dream_binary(m, p) })
|
kit.If(m.Option(nfs.BINARY), func(p string) { _dream_binary(m, p) })
|
||||||
kit.If(m.Option(nfs.TEMPLATE), func(p string) { _dream_template(m, p) })
|
kit.If(m.Option(nfs.TEMPLATE), func(p string) { _dream_template(m, p) })
|
||||||
bin := kit.Select(kit.Path(os.Args[0]), cli.SystemFind(m, ice.ICE_BIN, nfs.PWD+path.Join(p, ice.BIN), nfs.PWD+ice.BIN))
|
bin := kit.Select(kit.Path(os.Args[0]), cli.SystemFind(m, ice.ICE_BIN, nfs.PWD+path.Join(p, ice.BIN), nfs.PWD+ice.BIN))
|
||||||
@ -87,6 +94,7 @@ func _dream_start(m *ice.Message, name string) {
|
|||||||
}
|
}
|
||||||
m.Cmd(cli.DAEMON, bin, SPACE, tcp.DIAL, ice.DEV, ice.OPS, mdb.TYPE, WORKER, m.OptionSimple(mdb.NAME), cli.DAEMON, ice.OPS)
|
m.Cmd(cli.DAEMON, bin, SPACE, tcp.DIAL, ice.DEV, ice.OPS, mdb.TYPE, WORKER, m.OptionSimple(mdb.NAME), cli.DAEMON, ice.OPS)
|
||||||
gdb.WaitEvent(m, DREAM_OPEN, func(m *ice.Message, arg ...string) bool { return m.Option(mdb.NAME) == name })
|
gdb.WaitEvent(m, DREAM_OPEN, func(m *ice.Message, arg ...string) bool { return m.Option(mdb.NAME) == name })
|
||||||
|
m.Sleep("1s")
|
||||||
}
|
}
|
||||||
func _dream_binary(m *ice.Message, p string) {
|
func _dream_binary(m *ice.Message, p string) {
|
||||||
if bin := path.Join(m.Option(cli.CMD_DIR), ice.BIN_ICE_BIN); nfs.Exists(m, bin) {
|
if bin := path.Join(m.Option(cli.CMD_DIR), ice.BIN_ICE_BIN); nfs.Exists(m, bin) {
|
||||||
@ -140,7 +148,7 @@ const DREAM = "dream"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
DREAM: {Name: "dream name@key auto create repos startall stopall publish cmd cat", Help: "梦想家", Icon: "Launchpad.png", Actions: ice.MergeActions(ice.Actions{
|
DREAM: {Name: "dream name@key auto create startall stopall publish repos", Help: "梦想家", Icon: "Launchpad.png", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m = m.Spawn()
|
m = m.Spawn()
|
||||||
m.GoSleep("10s", func() {
|
m.GoSleep("10s", func() {
|
||||||
@ -190,6 +198,10 @@ func init() {
|
|||||||
})
|
})
|
||||||
m.RenameAppend(nfs.PATH, arg[0])
|
m.RenameAppend(nfs.PATH, arg[0])
|
||||||
mdb.HashInputs(m, arg)
|
mdb.HashInputs(m, arg)
|
||||||
|
p := m.Cmdv(SPIDE, ice.DEV, CLIENT_ORIGIN)
|
||||||
|
m.Spawn().SplitIndex(m.Cmdx(SPIDE, ice.DEV, SPIDE_RAW, http.MethodGet, S(), cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH)).Table(func(value ice.Maps) {
|
||||||
|
m.Push(arg[0], p+S(value[mdb.NAME])).Push(nfs.SIZE, value[nfs.SIZE]).Push(mdb.TIME, value[mdb.TIME])
|
||||||
|
})
|
||||||
case ice.CMD:
|
case ice.CMD:
|
||||||
m.Cmdy(ctx.COMMAND)
|
m.Cmdy(ctx.COMMAND)
|
||||||
case nfs.FILE:
|
case nfs.FILE:
|
||||||
@ -254,7 +266,10 @@ func init() {
|
|||||||
gdb.Event(m, DREAM_TRASH, arg)
|
gdb.Event(m, DREAM_TRASH, arg)
|
||||||
nfs.Trash(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME)))
|
nfs.Trash(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME)))
|
||||||
}},
|
}},
|
||||||
OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.MergePod(m.Option(mdb.NAME))) }},
|
// OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.MergePod(m.Option(mdb.NAME))) }},
|
||||||
|
OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.ProcessOpen(kit.MergeURL(S(m.Option(mdb.NAME)), m.OptionSimple(ice.MSG_DEBUG)))
|
||||||
|
}},
|
||||||
MAIN: {Name: "main index", Help: "首页", Hand: func(m *ice.Message, arg ...string) {
|
MAIN: {Name: "main index", Help: "首页", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(SPACE, m.Option(mdb.NAME), SPACE, ice.MAIN, m.Option(ctx.INDEX))
|
m.Cmdy(SPACE, m.Option(mdb.NAME), SPACE, ice.MAIN, m.Option(ctx.INDEX))
|
||||||
}},
|
}},
|
||||||
@ -264,10 +279,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.Switch(m.Option(mdb.TYPE), []string{WORKER, SERVER}, func() { m.PushButton(OPEN, ice.MAIN) })
|
kit.Switch(m.Option(mdb.TYPE), []string{WORKER, SERVER}, func() { m.PushButton(OPEN) })
|
||||||
}},
|
|
||||||
DREAM_OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
}},
|
}},
|
||||||
|
DREAM_OPEN: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
STATS_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
STATS_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if msg := mdb.HashSelects(m.Spawn()); msg.Length() > 0 {
|
if msg := mdb.HashSelects(m.Spawn()); msg.Length() > 0 {
|
||||||
stats := map[string]int{}
|
stats := map[string]int{}
|
||||||
|
@ -69,7 +69,7 @@ const ROUTE = "route"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
ROUTE: {Name: "route space:text cmds:text auto spide cmds build travel prunes", Icon: "Podcasts.png", Help: "路由表", Actions: ice.MergeActions(ice.Actions{
|
ROUTE: {Name: "route space:text cmds:text auto diagram build travel prunes", Help: "路由表", Icon: "Podcasts.png", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.MAIN: {Help: "首页", Hand: func(m *ice.Message, arg ...string) { ctx.ProcessField(m, CHAT_IFRAME, m.MergePod(""), arg...) }},
|
ice.MAIN: {Help: "首页", Hand: func(m *ice.Message, arg ...string) { ctx.ProcessField(m, CHAT_IFRAME, m.MergePod(""), arg...) }},
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch mdb.HashInputs(m, arg); arg[0] {
|
switch mdb.HashInputs(m, arg); arg[0] {
|
||||||
@ -80,12 +80,12 @@ func init() {
|
|||||||
kit.For([]string{WORKER, SERVER}, func(key string) { push(kit.Format(":%s=", key)) })
|
kit.For([]string{WORKER, SERVER}, func(key string) { push(kit.Format(":%s=", key)) })
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
"spide": {Help: "导图", Icon: "bi bi-diagram-3", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
ctx.DisplayStorySpide(m.Cmdy(""), nfs.DIR_ROOT, ice.Info.NodeName, mdb.FIELD, SPACE, lex.SPLIT, nfs.PT, ctx.ACTION, ice.MAIN)
|
|
||||||
}},
|
|
||||||
ctx.CMDS: {Name: "cmds space index* args", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
ctx.CMDS: {Name: "cmds space index* args", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_route_toast(m, m.Option(SPACE), append([]string{m.Option(ctx.INDEX)}, kit.Split(m.Option(ctx.ARGS))...)...)
|
_route_toast(m, m.Option(SPACE), append([]string{m.Option(ctx.INDEX)}, kit.Split(m.Option(ctx.ARGS))...)...)
|
||||||
}},
|
}},
|
||||||
|
"diagram": {Help: "导图", Icon: "bi bi-diagram-3", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
ctx.DisplayStorySpide(m.Cmdy(""), nfs.DIR_ROOT, ice.Info.NodeName, mdb.FIELD, SPACE, lex.SPLIT, nfs.PT, ctx.ACTION, ice.MAIN)
|
||||||
|
}},
|
||||||
cli.BUILD: {Name: "build space", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
cli.BUILD: {Name: "build space", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_route_toast(m, m.Option(SPACE), m.PrefixKey(), "_build")
|
_route_toast(m, m.Option(SPACE), m.PrefixKey(), "_build")
|
||||||
func() { defer ToastProcess(m)(); m.Sleep3s() }()
|
func() { defer ToastProcess(m)(); m.Sleep3s() }()
|
||||||
@ -111,11 +111,11 @@ func init() {
|
|||||||
m.Push(key, ice.Info.Make.Module)
|
m.Push(key, ice.Info.Make.Module)
|
||||||
case nfs.VERSION:
|
case nfs.VERSION:
|
||||||
m.Push(key, ice.Info.Make.Versions())
|
m.Push(key, ice.Info.Make.Versions())
|
||||||
case "commit":
|
case "commitTime":
|
||||||
m.Push(key, ice.Info.Make.When)
|
m.Push(key, ice.Info.Make.When)
|
||||||
case "compile":
|
case "compileTime":
|
||||||
m.Push(key, ice.Info.Make.Time)
|
m.Push(key, ice.Info.Make.Time)
|
||||||
case "boot":
|
case "bootTime":
|
||||||
m.Push(key, m.Cmdx(cli.RUNTIME, "boot.time"))
|
m.Push(key, m.Cmdx(cli.RUNTIME, "boot.time"))
|
||||||
case "md5":
|
case "md5":
|
||||||
m.Push(key, ice.Info.Hash)
|
m.Push(key, ice.Info.Hash)
|
||||||
@ -142,8 +142,9 @@ func init() {
|
|||||||
m.Cmd("", func(value ice.Maps) {
|
m.Cmd("", func(value ice.Maps) {
|
||||||
kit.If(value[mdb.STATUS] == OFFLINE, func() { mdb.HashRemove(m, SPACE, value[SPACE]) })
|
kit.If(value[mdb.STATUS] == OFFLINE, func() { mdb.HashRemove(m, SPACE, value[SPACE]) })
|
||||||
})
|
})
|
||||||
|
m.ProcessRefresh()
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, SPACE, mdb.FIELD, "time,space,type,module,version,commit,compile,boot,md5,size,path,hostname", mdb.SORT, "type,space", html.CHECKBOX, ice.TRUE, mdb.ACTION, ice.MAIN)), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction(mdb.SHORT, SPACE, mdb.FIELD, "time,space,type,module,version,commitTime,compileTime,bootTime,md5,size,path,hostname", mdb.SORT, "type,space", html.CHECKBOX, ice.TRUE, mdb.ACTION, ice.MAIN)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 1 {
|
if len(arg) > 1 {
|
||||||
_route_match(m, arg[0], func(value ice.Maps, i int, list []ice.Maps) {
|
_route_match(m, arg[0], func(value ice.Maps, i int, list []ice.Maps) {
|
||||||
_route_push(m, value[SPACE], m.Cmd(SPACE, value[SPACE], arg[1:]))
|
_route_push(m, value[SPACE], m.Cmd(SPACE, value[SPACE], arg[1:]))
|
||||||
|
@ -110,6 +110,8 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
|
|||||||
kit.For(arg[1:], func(k, v string) { add(k, v) })
|
kit.For(arg[1:], func(k, v string) { add(k, v) })
|
||||||
case SHARE:
|
case SHARE:
|
||||||
add(arg[0], arg[1])
|
add(arg[0], arg[1])
|
||||||
|
case "s":
|
||||||
|
add(ice.POD, kit.Select("", arg, 1))
|
||||||
}
|
}
|
||||||
kit.For(u.Query(), func(k string, v []string) { m.Optionv(k, v) })
|
kit.For(u.Query(), func(k string, v []string) { m.Optionv(k, v) })
|
||||||
}
|
}
|
||||||
@ -203,6 +205,7 @@ const (
|
|||||||
BODY = "body"
|
BODY = "body"
|
||||||
HOME = "home"
|
HOME = "home"
|
||||||
|
|
||||||
|
OPS_SERVE_START = "ops.serve.start"
|
||||||
SERVE_START = "serve.start"
|
SERVE_START = "serve.start"
|
||||||
)
|
)
|
||||||
const SERVE = "serve"
|
const SERVE = "serve"
|
||||||
|
@ -101,6 +101,11 @@ func _space_fork(m *ice.Message) {
|
|||||||
defer gdb.EventDeferEvent(m, DREAM_OPEN, args)(DREAM_CLOSE, args)
|
defer gdb.EventDeferEvent(m, DREAM_OPEN, args)(DREAM_CLOSE, args)
|
||||||
case SERVER:
|
case SERVER:
|
||||||
m.Go(func() {
|
m.Go(func() {
|
||||||
|
m.Cmd(SPACE).Table(func(value ice.Maps) {
|
||||||
|
if kit.IsIn(value[mdb.TYPE], WORKER, SERVER) {
|
||||||
|
m.Cmd(SPACE, value[mdb.NAME], gdb.EVENT, gdb.HAPPEN, gdb.EVENT, OPS_SERVE_START, args, kit.Dict(ice.MSG_USERROLE, aaa.TECH))
|
||||||
|
}
|
||||||
|
})
|
||||||
m.Cmd(SPACE, name, cli.PWD, name, kit.Dict(nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(), AGENT, "Go-http-client", cli.SYSTEM, runtime.GOOS))
|
m.Cmd(SPACE, name, cli.PWD, name, kit.Dict(nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(), AGENT, "Go-http-client", cli.SYSTEM, runtime.GOOS))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -270,6 +275,8 @@ func init() {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
|
"s": {Help: "空间", Actions: ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { m.Cmdy("web.chat.pod", arg) }},
|
||||||
|
"c": {Help: "命令", Actions: ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { m.Cmdy("web.chat.cmd", arg) }},
|
||||||
SPACE: {Name: "space name cmds auto", Help: "空间站", Actions: ice.MergeActions(ice.Actions{
|
SPACE: {Name: "space name cmds auto", Help: "空间站", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { aaa.White(m, SPACE, ice.MAIN) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { aaa.White(m, SPACE, ice.MAIN) }},
|
||||||
ice.MAIN: {Name: "main index", Help: "首页", Hand: func(m *ice.Message, arg ...string) {
|
ice.MAIN: {Name: "main index", Help: "首页", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -365,9 +365,12 @@ func init() {
|
|||||||
func HostPort(m *ice.Message, host, port string, arg ...string) string {
|
func HostPort(m *ice.Message, host, port string, arg ...string) string {
|
||||||
p := ""
|
p := ""
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
kit.If(kit.Select("", arg, 0), func(pod string) { p += "/pod/" + pod })
|
kit.If(kit.Select("", arg, 0), func(pod string) { p += S(pod) })
|
||||||
kit.If(kit.Select("", arg, 1), func(cmd string) { p += "/cmd/" + cmd })
|
kit.If(kit.Select("", arg, 1), func(cmd string) { p += C(cmd) })
|
||||||
kit.If(p, func() { p = "/chat" + p })
|
// kit.If(p, func() { p = "/chat" + p })
|
||||||
|
// kit.If(kit.Select("", arg, 0), func(pod string) { p += "/pod/" + pod })
|
||||||
|
// kit.If(kit.Select("", arg, 1), func(cmd string) { p += "/cmd/" + cmd })
|
||||||
|
// kit.If(p, func() { p = "/chat" + p })
|
||||||
}
|
}
|
||||||
kit.If(host == "", func() { host = kit.ParseURL(UserHost(m)).Hostname() })
|
kit.If(host == "", func() { host = kit.ParseURL(UserHost(m)).Hostname() })
|
||||||
if port == tcp.PORT_443 {
|
if port == tcp.PORT_443 {
|
||||||
|
@ -99,5 +99,8 @@ func Prefix(arg ...string) string {
|
|||||||
return kit.Keys(WEB, arg)
|
return kit.Keys(WEB, arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func X(arg ...string) string { return "/x/" + path.Join(arg...) }
|
||||||
|
func S(arg ...string) string { return "/s/" + path.Join(arg...) }
|
||||||
|
func C(arg ...string) string { return "/c/" + path.Join(arg...) }
|
||||||
func P(arg ...string) string { return path.Join(nfs.PS, path.Join(arg...)) }
|
func P(arg ...string) string { return path.Join(nfs.PS, path.Join(arg...)) }
|
||||||
func PP(arg ...string) string { return P(arg...) + nfs.PS }
|
func PP(arg ...string) string { return P(arg...) + nfs.PS }
|
||||||
|
@ -54,9 +54,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
gdb.Event(m, "", arg)
|
gdb.Event(m, "", arg)
|
||||||
}},
|
}},
|
||||||
html.GetLocation: {Name: "favor create", Help: "定位"},
|
html.GetLocation: {Name: "favor create", Help: "定位", Icon: "bi bi-geo-alt"},
|
||||||
html.GetClipboardData: {Name: "favor create", Help: "粘贴"},
|
html.GetClipboardData: {Name: "favor create", Help: "粘贴", Icon: "bi bi-copy"},
|
||||||
html.ScanQRCode: {Name: "favor create", Help: "扫码"},
|
html.ScanQRCode: {Name: "favor create", Help: "扫码", Icon: "bi bi-qr-code-scan"},
|
||||||
html.Record1: {Name: "favor upload", Help: "截图"},
|
html.Record1: {Name: "favor upload", Help: "截图"},
|
||||||
html.Record2: {Name: "favor upload", Help: "录屏"},
|
html.Record2: {Name: "favor upload", Help: "录屏"},
|
||||||
mdb.CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -16,7 +16,8 @@ fieldset.macos.desktop>div.output>fieldset.macos.searchs { position:absolute; z-
|
|||||||
fieldset.macos.desktop>div.output>fieldset.macos.searchs>form.option>div.item.keyword input { background-color:transparent; width:var(--river-width); }
|
fieldset.macos.desktop>div.output>fieldset.macos.searchs>form.option>div.item.keyword input { background-color:transparent; width:var(--river-width); }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications { height:calc(100% - 125px); width:320px; overflow:auto; position:absolute; top:var(--desktop-menu-height); left:calc(100% - 320px); z-index:11; }
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications { height:calc(100% - 125px); width:320px; overflow:auto; position:absolute; top:var(--desktop-menu-height); left:calc(100% - 320px); z-index:11; }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.action>div.item { padding:0; }
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.action>div.item { padding:0; }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.action>div.item.refresh>span { font-size:24px; }
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.action>div.item.refresh>span { font-size:var(--action-height); margin-top:-5px; }
|
||||||
|
body.windows fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.action>div.item.refresh>span { font-size:24px; margin-top:0; }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.output>div.item { clear:both; display:flex; padding:var(--input-padding)}
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.output>div.item { clear:both; display:flex; padding:var(--input-padding)}
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.output>div.item:not(:last-child) { border-bottom:var(--box-border); }
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.output>div.item:not(:last-child) { border-bottom:var(--box-border); }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.output>div.item.read { color:var(--disable-fg-color); }
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.output>div.item.read { color:var(--disable-fg-color); }
|
||||||
|
@ -10,7 +10,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
var sess = can.misc.SearchHash(can)[0]||can.Conf("session")
|
var sess = can.misc.SearchHash(can)[0]||can.Conf("session")
|
||||||
sess? can.runActionCommand(event, "session", [sess], function(msg) {
|
sess? can.runActionCommand(event, "session", [sess], function(msg) {
|
||||||
var item = msg.TableDetail(); can.onimport.session(can, can.base.Obj(item.args))
|
var item = msg.TableDetail(); can.onimport.session(can, can.base.Obj(item.args))
|
||||||
}): can.isCmdMode() && can.onimport.session(can, tabs)
|
}): !window.parent && can.isCmdMode() && can.onimport.session(can, tabs)
|
||||||
}
|
}
|
||||||
sub.onexport.record = function(sub, value, key, item) { delete(can.onfigure._path)
|
sub.onexport.record = function(sub, value, key, item) { delete(can.onfigure._path)
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
@ -17,24 +17,41 @@ const POD = "pod"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
POD: {Help: "空间", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
POD: {Help: "空间", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if m.IsCliUA() {
|
||||||
if len(arg) == 0 || arg[0] == "" {
|
if len(arg) == 0 || arg[0] == "" {
|
||||||
web.RenderMain(m)
|
m.Cmd(web.SPACE, func(value ice.Maps) {
|
||||||
|
msg := m.Cmd(nfs.DIR, path.Join(ice.USR_LOCAL_WORK, value[mdb.NAME], ice.USR_PUBLISH, kit.Keys(ice.ICE, m.OptionDefault(cli.GOOS, cli.LINUX), m.OptionDefault(cli.GOARCH, cli.AMD64))))
|
||||||
|
if msg.Length() > 0 {
|
||||||
|
m.Push(mdb.NAME, value[mdb.NAME])
|
||||||
|
m.Copy(msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
m.RenderResult()
|
||||||
} else if strings.HasPrefix(m.Option(ice.MSG_USERUA), "git/") {
|
} else if strings.HasPrefix(m.Option(ice.MSG_USERUA), "git/") {
|
||||||
m.RenderRedirect(kit.MergeURL2(m.Cmdv(web.SPACE, arg[0], web.CODE_GIT_REPOS, nfs.REMOTE, nfs.REMOTE), "/info/refs", m.OptionSimple("service")))
|
m.RenderRedirect(kit.MergeURL2(m.Cmdv(web.SPACE, arg[0], web.CODE_GIT_REPOS, nfs.REMOTE, nfs.REMOTE), "/info/refs", m.OptionSimple("service")))
|
||||||
} else if m.Option(cli.GOOS) != "" && m.Option(cli.GOARCH) != "" {
|
} else if m.Option(cli.GOOS) != "" && m.Option(cli.GOARCH) != "" {
|
||||||
m.RenderDownload(path.Join(ice.USR_LOCAL_WORK, arg[0], ice.USR_PUBLISH, kit.Keys(ice.ICE, m.Option(cli.GOOS), m.Option(cli.GOARCH))))
|
m.RenderDownload(path.Join(ice.USR_LOCAL_WORK, arg[0], ice.USR_PUBLISH, kit.Keys(ice.ICE, m.Option(cli.GOOS), m.Option(cli.GOARCH))))
|
||||||
} else if m.IsCliUA() {
|
|
||||||
m.RenderDownload(path.Join(ice.USR_LOCAL_WORK, arg[0], ice.BIN_ICE_BIN))
|
|
||||||
} else {
|
} else {
|
||||||
|
m.RenderDownload(path.Join(ice.USR_LOCAL_WORK, arg[0], ice.BIN_ICE_BIN))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if len(arg) == 0 || arg[0] == "" {
|
||||||
|
web.RenderMain(m)
|
||||||
|
return
|
||||||
|
}
|
||||||
if m.Cmd(web.SPACE, arg[0]).Length() == 0 && nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, arg[0])) {
|
if m.Cmd(web.SPACE, arg[0]).Length() == 0 && nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, arg[0])) {
|
||||||
m.Cmd(web.DREAM, cli.START, kit.Dict(mdb.NAME, arg[0]))
|
m.Cmd(web.DREAM, cli.START, kit.Dict(mdb.NAME, arg[0]))
|
||||||
}
|
}
|
||||||
if m.Option(ice.MSG_USERPOD, arg[0]); len(arg) == 1 {
|
if m.Option(ice.MSG_USERPOD, arg[0]); len(arg) == 1 {
|
||||||
m.Cmdy(web.SPACE, arg[0], web.SPACE, ice.MAIN)
|
m.Cmdy(web.SPACE, arg[0], web.SPACE, ice.MAIN)
|
||||||
} else if arg[1] == CMD {
|
} else if kit.IsIn(arg[1], CMD, "c") {
|
||||||
|
if arg[2] == web.CHAT_PORTAL {
|
||||||
|
m.Cmdy(web.SPACE, arg[0], web.SPACE, ice.MAIN)
|
||||||
|
} else {
|
||||||
web.RenderPodCmd(m, arg[0], arg[2], arg[3:])
|
web.RenderPodCmd(m, arg[0], arg[2], arg[3:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ func _autogen_import(m *ice.Message, main string, ctx string, mod string) {
|
|||||||
}
|
}
|
||||||
func _autogen_version(m *ice.Message) string {
|
func _autogen_version(m *ice.Message) string {
|
||||||
if mod := _autogen_mod(m, ice.GO_MOD); !nfs.Exists(m, ".git") {
|
if mod := _autogen_mod(m, ice.GO_MOD); !nfs.Exists(m, ".git") {
|
||||||
m.Cmd(REPOS, INIT, nfs.ORIGIN, strings.Split(kit.MergeURL2(kit.Select(m.Option(ice.MSG_USERWEB), ice.Info.Make.Remote), "/x/"+path.Base(mod)), mdb.QS)[0], mdb.NAME, path.Base(mod), nfs.PATH, nfs.PWD)
|
m.Cmd(REPOS, INIT, nfs.ORIGIN, strings.Split(kit.MergeURL2(kit.Select(m.Option(ice.MSG_USERWEB), ice.Info.Make.Remote), web.X(path.Base(mod))), mdb.QS)[0], mdb.NAME, path.Base(mod), nfs.PATH, nfs.PWD)
|
||||||
defer m.Cmd(REPOS, ADD, kit.Dict(nfs.REPOS, path.Base(mod), nfs.FILE, ice.GO_MOD))
|
defer m.Cmd(REPOS, ADD, kit.Dict(nfs.REPOS, path.Base(mod), nfs.FILE, ice.GO_MOD))
|
||||||
defer m.Cmd(REPOS, ADD, kit.Dict(nfs.REPOS, path.Base(mod), nfs.FILE, nfs.SRC))
|
defer m.Cmd(REPOS, ADD, kit.Dict(nfs.REPOS, path.Base(mod), nfs.FILE, nfs.SRC))
|
||||||
}
|
}
|
||||||
|
@ -58,12 +58,10 @@ func _publish_contexts(m *ice.Message, arg ...string) {
|
|||||||
case nfs.SOURCE, ice.DEV:
|
case nfs.SOURCE, ice.DEV:
|
||||||
m.Options(nfs.SOURCE, ice.Info.Make.Remote)
|
m.Options(nfs.SOURCE, ice.Info.Make.Remote)
|
||||||
case nfs.BINARY, ice.APP:
|
case nfs.BINARY, ice.APP:
|
||||||
|
|
||||||
case "curl", "wget":
|
case "curl", "wget":
|
||||||
case "manual":
|
case "manual":
|
||||||
m.Options(nfs.BINARY, "ice.linux.amd64")
|
m.Options(nfs.BINARY, "ice.linux.amd64")
|
||||||
}
|
}
|
||||||
m.Debug("what %v", m.Option("_template"))
|
|
||||||
template := strings.TrimSpace(nfs.Template(m, kit.Keys(k, SH)))
|
template := strings.TrimSpace(nfs.Template(m, kit.Keys(k, SH)))
|
||||||
if m.Option("format") == "raw" {
|
if m.Option("format") == "raw" {
|
||||||
m.Echo(template)
|
m.Echo(template)
|
||||||
|
@ -165,7 +165,6 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
ice.APP: {Help: "本机", Hand: func(m *ice.Message, arg ...string) {
|
ice.APP: {Help: "本机", Hand: func(m *ice.Message, arg ...string) {
|
||||||
cli.OpenCmds(m, "cd "+kit.Path(""), "vim "+path.Join(arg[0], arg[1])+" +"+arg[2]).ProcessHold()
|
cli.OpenCmds(m, "cd "+kit.Path(""), "vim "+path.Join(arg[0], arg[1])+" +"+arg[2]).ProcessHold()
|
||||||
m.ProcessHold()
|
|
||||||
}},
|
}},
|
||||||
COMPILE: {Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
COMPILE: {Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(nfs.PATH) != "" && nfs.ExistsFile(m, path.Join(m.Option(nfs.PATH), ice.MAKEFILE)) {
|
if m.Option(nfs.PATH) != "" && nfs.ExistsFile(m, path.Join(m.Option(nfs.PATH), ice.MAKEFILE)) {
|
||||||
|
3
info.go
3
info.go
@ -162,7 +162,7 @@ func MergeActions(arg ...Any) Actions {
|
|||||||
for k, v := range cmd.Actions {
|
for k, v := range cmd.Actions {
|
||||||
func(k string) {
|
func(k string) {
|
||||||
if h, ok := list[k]; !ok {
|
if h, ok := list[k]; !ok {
|
||||||
list[k] = &Action{Name: v.Name, Help: v.Help, Hand: func(m *Message, arg ...string) { m.Cmdy(from, k, arg) }}
|
list[k] = &Action{Name: v.Name, Help: v.Help, Icon: v.Icon, Hand: func(m *Message, arg ...string) { m.Cmdy(from, k, arg) }}
|
||||||
} else if h.Hand == nil {
|
} else if h.Hand == nil {
|
||||||
h.Hand = func(m *Message, arg ...string) { m.Cmdy(from, k, arg) }
|
h.Hand = func(m *Message, arg ...string) { m.Cmdy(from, k, arg) }
|
||||||
}
|
}
|
||||||
@ -171,6 +171,7 @@ func MergeActions(arg ...Any) Actions {
|
|||||||
kit.Value(_cmd.Meta, kit.Keys(CTX_TITLE, k), help[1])
|
kit.Value(_cmd.Meta, kit.Keys(CTX_TITLE, k), help[1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
kit.Value(_cmd.Meta, kit.Keys(CTX_ICONS, k), kit.Select(v.Icon, h.Icon))
|
||||||
kit.If(len(v.List) > 0, func() { _cmd.Meta[k] = v.List })
|
kit.If(len(v.List) > 0, func() { _cmd.Meta[k] = v.List })
|
||||||
}(k)
|
}(k)
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
INSTEADOF: {Name: "insteadof remote", Help: "代理", Hand: func(m *ice.Message, arg ...string) {
|
INSTEADOF: {Name: "insteadof remote", Help: "代理", Icon: "bi bi-clouds", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(CONFIGS, func(value ice.Maps) {
|
m.Cmd(CONFIGS, func(value ice.Maps) {
|
||||||
if strings.HasSuffix(value[mdb.NAME], ".insteadof") && strings.HasPrefix(ice.Info.Make.Remote, value[mdb.VALUE]) {
|
if strings.HasSuffix(value[mdb.NAME], ".insteadof") && strings.HasPrefix(ice.Info.Make.Remote, value[mdb.VALUE]) {
|
||||||
_git_cmd(m, CONFIG, "--global", "--unset", value[mdb.NAME])
|
_git_cmd(m, CONFIG, "--global", "--unset", value[mdb.NAME])
|
||||||
@ -502,7 +502,7 @@ func init() {
|
|||||||
mdb.HashRemove(m, m.Option(REPOS))
|
mdb.HashRemove(m, m.Option(REPOS))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
CLONE: {Name: "clone origin* branch name path", Help: "克隆", Hand: func(m *ice.Message, arg ...string) {
|
CLONE: {Name: "clone origin* branch name path", Help: "克隆", Icon: "bi bi-copy", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.OptionDefault(mdb.NAME, path.Base(m.Option(ORIGIN)))
|
m.OptionDefault(mdb.NAME, path.Base(m.Option(ORIGIN)))
|
||||||
m.OptionDefault(nfs.PATH, path.Join(nfs.USR, m.Option(mdb.NAME))+nfs.PS)
|
m.OptionDefault(nfs.PATH, path.Join(nfs.USR, m.Option(mdb.NAME))+nfs.PS)
|
||||||
defer m.Cmdy(nfs.DIR, m.Option(nfs.PATH))
|
defer m.Cmdy(nfs.DIR, m.Option(nfs.PATH))
|
||||||
@ -512,7 +512,7 @@ func init() {
|
|||||||
defer web.ToastProcess(m)()
|
defer web.ToastProcess(m)()
|
||||||
for _, dev := range []string{ice.DEV, ice.SHY} {
|
for _, dev := range []string{ice.DEV, ice.SHY} {
|
||||||
p := m.Option(ORIGIN)
|
p := m.Option(ORIGIN)
|
||||||
kit.If(!kit.HasPrefix(p, nfs.PS, web.HTTP), func() { p = m.Cmdv("web.spide", dev, web.CLIENT_ORIGIN) + "/x/" + p })
|
kit.If(!kit.HasPrefix(p, nfs.PS, web.HTTP), func() { p = m.Cmdv("web.spide", dev, web.CLIENT_ORIGIN) + web.X(p) })
|
||||||
m.Info("clone %s", p)
|
m.Info("clone %s", p)
|
||||||
if _, err := git.PlainClone(m.Option(nfs.PATH), false, &git.CloneOptions{URL: p, Auth: _repos_auth(m, p)}); !m.Warn(err) {
|
if _, err := git.PlainClone(m.Option(nfs.PATH), false, &git.CloneOptions{URL: p, Auth: _repos_auth(m, p)}); !m.Warn(err) {
|
||||||
_repos_insert(m, m.Option(nfs.PATH))
|
_repos_insert(m, m.Option(nfs.PATH))
|
||||||
@ -535,7 +535,7 @@ func init() {
|
|||||||
return repos.Push(&git.PushOptions{RemoteURL: remoteURL, Auth: auth, FollowTags: true})
|
return repos.Push(&git.PushOptions{RemoteURL: remoteURL, Auth: auth, FollowTags: true})
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
STATUS: {Help: "状态", Hand: func(m *ice.Message, arg ...string) {
|
STATUS: {Help: "状态", Icon: "bi bi-app-indicator", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if repos := kit.Select(m.Option(REPOS), arg, 0); repos != "" {
|
if repos := kit.Select(m.Option(REPOS), arg, 0); repos != "" {
|
||||||
_repos_status(m, repos, _repos_open(m, repos))
|
_repos_status(m, repos, _repos_open(m, repos))
|
||||||
} else {
|
} else {
|
||||||
@ -564,7 +564,7 @@ func init() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
ADD: {Hand: func(m *ice.Message, arg ...string) {
|
ADD: {Icon: "bi bi-plus-square", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if work, err := _repos_open(m, m.Option(REPOS)).Worktree(); !m.Warn(err) {
|
if work, err := _repos_open(m, m.Option(REPOS)).Worktree(); !m.Warn(err) {
|
||||||
m.Warn(kit.Lasterr(work.Add(m.Option(nfs.FILE))))
|
m.Warn(kit.Lasterr(work.Add(m.Option(nfs.FILE))))
|
||||||
}
|
}
|
||||||
@ -574,7 +574,7 @@ func init() {
|
|||||||
nfs.Trash(m, _repos_path(m, m.Option(REPOS), m.Option(nfs.FILE)))
|
nfs.Trash(m, _repos_path(m, m.Option(REPOS), m.Option(nfs.FILE)))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
COMMIT: {Name: "commit actions=add,opt,fix message*=some", Help: "提交", Hand: func(m *ice.Message, arg ...string) {
|
COMMIT: {Name: "commit actions=add,opt,fix message*=some", Help: "提交", Icon: "bi bi-check2-square", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if work, err := _repos_open(m, m.Option(REPOS)).Worktree(); !m.Warn(err) {
|
if work, err := _repos_open(m, m.Option(REPOS)).Worktree(); !m.Warn(err) {
|
||||||
opt := &git.CommitOptions{All: true}
|
opt := &git.CommitOptions{All: true}
|
||||||
if cfg, err := config.LoadConfig(config.GlobalScope); err == nil {
|
if cfg, err := config.LoadConfig(config.GlobalScope); err == nil {
|
||||||
@ -607,7 +607,7 @@ func init() {
|
|||||||
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.If(m.Option(REPOS), func(p string) {
|
kit.If(m.Option(REPOS), func(p string) {
|
||||||
p = strings.Split(p, mdb.QS)[0]
|
p = strings.Split(p, mdb.QS)[0]
|
||||||
kit.If(!strings.Contains(p, "://"), func() { p = web.UserHost(m) + "/x/" + p })
|
kit.If(!strings.Contains(p, "://"), func() { p = kit.MergeURL2(web.UserHost(m), web.X(p)) })
|
||||||
kit.If(ice.Info.System == cli.LINUX, func() { p = strings.Replace(p, ice.HTTPS, ice.HTTP, 1) })
|
kit.If(ice.Info.System == cli.LINUX, func() { p = strings.Replace(p, ice.HTTPS, ice.HTTP, 1) })
|
||||||
m.Cmd("", CLONE, ORIGIN, p, nfs.PATH, m.Option(cli.CMD_DIR), ice.Maps{cli.CMD_DIR: ""})
|
m.Cmd("", CLONE, ORIGIN, p, nfs.PATH, m.Option(cli.CMD_DIR), ice.Maps{cli.CMD_DIR: ""})
|
||||||
})
|
})
|
||||||
|
@ -31,7 +31,7 @@ func _service_path(m *ice.Message, p string, arg ...string) string {
|
|||||||
return kit.Path(ice.USR_LOCAL_REPOS, kit.TrimExt(p, GIT), path.Join(arg...))
|
return kit.Path(ice.USR_LOCAL_REPOS, kit.TrimExt(p, GIT), path.Join(arg...))
|
||||||
}
|
}
|
||||||
func _service_link(m *ice.Message, p string, arg ...string) string {
|
func _service_link(m *ice.Message, p string, arg ...string) string {
|
||||||
return kit.MergeURL2(web.UserHost(m), path.Join("/x/", p)+".git")
|
return kit.MergeURL2(web.UserHost(m), web.X(p)+".git")
|
||||||
}
|
}
|
||||||
func _service_param(m *ice.Message, arg ...string) (string, string) {
|
func _service_param(m *ice.Message, arg ...string) (string, string) {
|
||||||
repos, service := arg[0], kit.Select(arg[len(arg)-1], m.Option(SERVICE))
|
repos, service := arg[0], kit.Select(arg[len(arg)-1], m.Option(SERVICE))
|
||||||
@ -107,7 +107,10 @@ const SERVICE = "service"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
web.Index.MergeCommands(ice.Commands{"/x/": {Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
web.Index.MergeCommands(ice.Commands{"/x/": {Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if !m.IsCliUA() {
|
||||||
|
web.RenderCmd(m, "web.code.git.service", arg)
|
||||||
|
return
|
||||||
|
} else if len(arg) == 0 {
|
||||||
return
|
return
|
||||||
} else if arg[0] == ice.LIST {
|
} else if arg[0] == ice.LIST {
|
||||||
m.Cmd(Prefix(SERVICE), func(value ice.Maps) { m.Push(nfs.REPOS, _service_link(m, value[nfs.REPOS])) })
|
m.Cmd(Prefix(SERVICE), func(value ice.Maps) { m.Push(nfs.REPOS, _service_link(m, value[nfs.REPOS])) })
|
||||||
@ -155,14 +158,24 @@ func init() {
|
|||||||
_repos_inner(m, _service_path, arg...)
|
_repos_inner(m, _service_path, arg...)
|
||||||
}},
|
}},
|
||||||
web.DREAM_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
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") })
|
kit.If(arg[0] == REPOS, func() {
|
||||||
|
mdb.HashSelect(m).Sort(REPOS).Cut("repos,version,time")
|
||||||
|
p := m.Cmdv("web.spide", ice.DEV, web.CLIENT_ORIGIN)
|
||||||
|
m.Spawn().SplitIndex(m.Cmdx("web.spide", ice.DEV, web.SPIDE_RAW, http.MethodGet, web.C(web.CODE_GIT_SERVICE))).Table(func(value ice.Maps) {
|
||||||
|
value[nfs.REPOS] = p + web.X(value[nfs.REPOS])
|
||||||
|
m.Push("", value, kit.Split("repos,version,time"))
|
||||||
|
})
|
||||||
|
})
|
||||||
}},
|
}},
|
||||||
}, web.DreamAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,message"), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, web.DreamAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,message"), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||||
m.Push(nfs.SIZE, kit.Split(m.Cmdx(cli.SYSTEM, "du", "-sh", path.Join(ice.USR_LOCAL_REPOS, value[REPOS])))[0])
|
m.Push(nfs.SIZE, kit.Split(m.Cmdx(cli.SYSTEM, "du", "-sh", path.Join(ice.USR_LOCAL_REPOS, value[REPOS])))[0])
|
||||||
m.PushScript(kit.Format("git clone %s", _service_link(m, value[REPOS])))
|
m.PushScript(kit.Format("git clone %s", _service_link(m, value[REPOS])))
|
||||||
}).Sort(REPOS).Cmdy(web.CODE_PUBLISH, ice.CONTEXTS, ice.DEV)
|
}).Sort(REPOS)
|
||||||
|
if !m.IsCliUA() {
|
||||||
|
m.Cmdy(web.CODE_PUBLISH, ice.CONTEXTS, ice.DEV)
|
||||||
|
}
|
||||||
kit.If(mdb.Config(m, aaa.AUTH) == aaa.PRIVATE, func() { m.StatusTimeCount(aaa.AUTH, aaa.PRIVATE) })
|
kit.If(mdb.Config(m, aaa.AUTH) == aaa.PRIVATE, func() { m.StatusTimeCount(aaa.AUTH, aaa.PRIVATE) })
|
||||||
} else if repos := _repos_open(m, arg[0]); len(arg) == 1 {
|
} else if repos := _repos_open(m, arg[0]); len(arg) == 1 {
|
||||||
defer m.PushScript(kit.Format("git clone %s", _service_link(m, arg[0])))
|
defer m.PushScript(kit.Format("git clone %s", _service_link(m, arg[0])))
|
||||||
|
@ -35,11 +35,11 @@ func init() {
|
|||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch m.Option(ctx.ACTION) {
|
switch m.Option(ctx.ACTION) {
|
||||||
case INIT:
|
case INIT:
|
||||||
m.Cmd("web.spide", ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+"/x/"+path.Base(kit.Path(""))) })
|
m.Cmd("web.spide", ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+web.X(path.Base(kit.Path("")))) })
|
||||||
m.Push(arg[0], web.UserHost(m)+"/x/")
|
m.Push(arg[0], kit.MergeURL2(web.UserHost(m), web.X()))
|
||||||
case INSTEADOF:
|
case INSTEADOF:
|
||||||
m.Cmd("web.spide", ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+"/x/") })
|
m.Cmd("web.spide", ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+web.X()) })
|
||||||
m.Push(arg[0], web.UserHost(m)+"/x/")
|
m.Push(arg[0], kit.MergeURL2(web.UserHost(m), web.X()))
|
||||||
default:
|
default:
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case aaa.USERNAME:
|
case aaa.USERNAME:
|
||||||
|
@ -60,7 +60,7 @@ type relay struct {
|
|||||||
ice.Code
|
ice.Code
|
||||||
checkbox string `data:"true"`
|
checkbox string `data:"true"`
|
||||||
short string `data:"machine"`
|
short string `data:"machine"`
|
||||||
field string `data:"time,machine,username,password,host,port,portal,module,version,commit,compile,boot,package,shell,kernel,arch,ncpu,vcpu,mhz,mem,disk,network,listen,socket,proc,vendor"`
|
field string `data:"time,machine,username,password,host,port,portal,module,version,commitTime,compileTime,bootTime,package,shell,kernel,arch,ncpu,vcpu,mhz,mem,disk,network,listen,socket,proc,vendor"`
|
||||||
statsTables string `name:"statsTables" event:"stats.tables"`
|
statsTables string `name:"statsTables" event:"stats.tables"`
|
||||||
create string `name:"create machine* username* password host* port*=22"`
|
create string `name:"create machine* username* password host* port*=22"`
|
||||||
pubkey string `name:"pubkey" help:"公钥" icon:"bi bi-person-vcard"`
|
pubkey string `name:"pubkey" help:"公钥" icon:"bi bi-person-vcard"`
|
||||||
@ -84,7 +84,6 @@ func (s relay) Init(m *ice.Message, arg ...string) {
|
|||||||
NCPU, "处理器", VCPU, "虚拟核", MHZ, "频率",
|
NCPU, "处理器", VCPU, "虚拟核", MHZ, "频率",
|
||||||
MEM, "内存", DISK, "磁盘", NETWORK, "流量",
|
MEM, "内存", DISK, "磁盘", NETWORK, "流量",
|
||||||
LISTEN, "服务", SOCKET, "连接", PROC, "进程",
|
LISTEN, "服务", SOCKET, "连接", PROC, "进程",
|
||||||
nfs.COMMIT, "发布时间", code.COMPILE, "编译时间", "boot", "启动时间",
|
|
||||||
)
|
)
|
||||||
msg := m.Spawn(ice.Maps{ice.MSG_FIELDS: ""})
|
msg := m.Spawn(ice.Maps{ice.MSG_FIELDS: ""})
|
||||||
m.GoSleep3s(func() { s.Hash.List(msg).Table(func(value ice.Maps) { s.xterm(m.Spawn(value)) }) })
|
m.GoSleep3s(func() { s.Hash.List(msg).Table(func(value ice.Maps) { s.xterm(m.Spawn(value)) }) })
|
||||||
@ -139,15 +138,7 @@ func (s relay) Stats(m *ice.Message) {
|
|||||||
return nil
|
return nil
|
||||||
}).ProcessInner()
|
}).ProcessInner()
|
||||||
s.ForEach(m.Spawn(ice.Maps{MACHINE: machine, ice.CMD: s.admins(m, cli.RUNTIME)})).Table(func(value ice.Maps) {
|
s.ForEach(m.Spawn(ice.Maps{MACHINE: machine, ice.CMD: s.admins(m, cli.RUNTIME)})).Table(func(value ice.Maps) {
|
||||||
res := kit.UnMarshal(value[ice.RES])
|
s.Modify(m, kit.Simple(MACHINE, value[MACHINE], kit.Dict(cli.ParseMake(value[ice.RES])))...)
|
||||||
data := kit.Value(res, cli.MAKE)
|
|
||||||
s.Modify(m, kit.Simple(MACHINE, value[MACHINE], kit.Dict(
|
|
||||||
nfs.MODULE, kit.Value(data, nfs.MODULE), nfs.VERSION, kit.Join(kit.TrimArg(kit.Simple(
|
|
||||||
kit.Value(data, nfs.VERSION), kit.Value(data, "forword"), kit.Cut(kit.Format(kit.Value(data, mdb.HASH)), 6),
|
|
||||||
)...), "-"),
|
|
||||||
nfs.COMMIT, kit.Value(data, "when"), code.COMPILE, kit.Value(data, mdb.TIME), "boot", kit.Value(res, "boot.time"),
|
|
||||||
SHELL, kit.Value(res, "conf.SHELL"), KERNEL, kit.Value(res, "host.GOOS"), ARCH, kit.Value(res, "host.GOARCH"),
|
|
||||||
))...)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func (s relay) Dream(m *ice.Message) {
|
func (s relay) Dream(m *ice.Message) {
|
||||||
@ -155,7 +146,7 @@ func (s relay) Dream(m *ice.Message) {
|
|||||||
m.ProcessOpen(web.HostPort(m.Message, m.Option(tcp.HOST), m.Option(web.PORTAL), "", web.DREAM))
|
m.ProcessOpen(web.HostPort(m.Message, m.Option(tcp.HOST), m.Option(web.PORTAL), "", web.DREAM))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fields := "time,machine,host,space,type,status,module,version,commit,compile,boot,link"
|
fields := "time,machine,host,space,type,status,module,version,commitTime,compileTime,bootTime,link"
|
||||||
s.foreach(m, func(msg *ice.Message, cmd []string) {
|
s.foreach(m, func(msg *ice.Message, cmd []string) {
|
||||||
m.Push("", kit.Dict(msg.OptionSimple(fields), mdb.TYPE, web.SERVER, mdb.STATUS, web.ONLINE, web.SPACE, ice.CONTEXTS, web.LINK, web.HostPort(m.Message, msg.Option(tcp.HOST), msg.Option(web.PORTAL))), kit.Split(fields))
|
m.Push("", kit.Dict(msg.OptionSimple(fields), mdb.TYPE, web.SERVER, mdb.STATUS, web.ONLINE, web.SPACE, ice.CONTEXTS, web.LINK, web.HostPort(m.Message, msg.Option(tcp.HOST), msg.Option(web.PORTAL))), kit.Split(fields))
|
||||||
ssh.CombinedOutput(msg.Message, s.admins(m, web.ROUTE), func(res string) {
|
ssh.CombinedOutput(msg.Message, s.admins(m, web.ROUTE), func(res string) {
|
||||||
@ -172,12 +163,18 @@ func (s relay) Dream(m *ice.Message) {
|
|||||||
})
|
})
|
||||||
m.Options(ice.MSG_PROCESS, "")
|
m.Options(ice.MSG_PROCESS, "")
|
||||||
if m.Action(s.Dream, "filter:text"); tcp.IsLocalHost(m.Message, m.Option(ice.MSG_USERIP)) {
|
if m.Action(s.Dream, "filter:text"); tcp.IsLocalHost(m.Message, m.Option(ice.MSG_USERIP)) {
|
||||||
_msg := m.Spawn().SplitIndex(m.Cmdx(cli.SYSTEM, kit.Split(s.admin(m, web.ROUTE))))
|
if _msg := m.Spawn().SplitIndex(m.Cmdx(cli.SYSTEM, kit.Split(s.admin(m, web.ROUTE)))); _msg.Length() > 0 {
|
||||||
m.Copy(_msg.Table(func(value ice.Maps) {
|
m.Copy(_msg.Table(func(value ice.Maps) {
|
||||||
_msg.Push(MACHINE, tcp.LOCALHOST).Push(tcp.HOST, tcp.PublishLocalhost(m.Message, tcp.LOCALHOST))
|
_msg.Push(MACHINE, tcp.LOCALHOST).Push(tcp.HOST, tcp.PublishLocalhost(m.Message, tcp.LOCALHOST))
|
||||||
_msg.Push(web.LINK, kit.Format("%s/chat/pod/%s", web.UserHost(m.Message), value[web.SPACE]))
|
_msg.Push(web.LINK, web.UserHost(m.Message)+web.S(value[web.SPACE]))
|
||||||
}).Cut(fields))
|
}).Cut(fields))
|
||||||
}
|
}
|
||||||
|
if _msg := m.Cmd(cli.SYSTEM, ice.BIN_ICE_BIN, web.ADMIN, cli.RUNTIME); len(_msg.Result()) > 0 {
|
||||||
|
m.Push(MACHINE, tcp.LOCALHOST).Push(tcp.HOST, tcp.PublishLocalhost(m.Message, tcp.LOCALHOST))
|
||||||
|
m.Push("", kit.Dict(cli.ParseMake(_msg.Result())), kit.Split("time,space,module,version,commitTime,compileTime,bootTime"))
|
||||||
|
m.Push(mdb.TYPE, web.SERVER).Push(mdb.STATUS, web.ONLINE).Push(web.LINK, web.UserHost(m.Message))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
func (s relay) ForEach(m *ice.Message, arg ...string) *ice.Message {
|
func (s relay) ForEach(m *ice.Message, arg ...string) *ice.Message {
|
||||||
s.foreach(m, func(msg *ice.Message, cmd []string) {
|
s.foreach(m, func(msg *ice.Message, cmd []string) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ice
|
package ice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -47,8 +48,10 @@ func (m *Message) MergePod(pod string, arg ...Any) string {
|
|||||||
ls := []string{"chat"}
|
ls := []string{"chat"}
|
||||||
kit.If(kit.Keys(m.Option(MSG_USERPOD), pod), func(p string) { ls = append(ls, POD, p) })
|
kit.If(kit.Keys(m.Option(MSG_USERPOD), pod), func(p string) { ls = append(ls, POD, p) })
|
||||||
kit.If(len(ls) == 1, func() { ls = ls[:0] })
|
kit.If(len(ls) == 1, func() { ls = ls[:0] })
|
||||||
|
// ls := []string{}
|
||||||
|
// kit.If(kit.Keys(m.Option(MSG_USERPOD), pod), func(p string) { ls = append(ls, "/s/", p) })
|
||||||
kit.If(m.Option(DEBUG) == TRUE, func() { arg = append([]Any{DEBUG, TRUE}, arg...) })
|
kit.If(m.Option(DEBUG) == TRUE, func() { arg = append([]Any{DEBUG, TRUE}, arg...) })
|
||||||
return kit.MergeURL2(strings.Split(kit.Select("http://localhost:9020", Info.Domain, m.Option(MSG_USERWEB)), QS)[0], PS+kit.Join(ls, PS), arg...)
|
return kit.MergeURL2(strings.Split(kit.Select("http://localhost:9020", Info.Domain, m.Option(MSG_USERWEB)), QS)[0], path.Join(PS, path.Join(ls...)), arg...)
|
||||||
}
|
}
|
||||||
func (m *Message) MergePodCmd(pod, cmd string, arg ...Any) string {
|
func (m *Message) MergePodCmd(pod, cmd string, arg ...Any) string {
|
||||||
ls := []string{"chat"}
|
ls := []string{"chat"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user