diff --git a/base/web/dream.go b/base/web/dream.go index f51d4704..2dfee5a3 100644 --- a/base/web/dream.go +++ b/base/web/dream.go @@ -323,7 +323,7 @@ func init() { kit.If(m.Option(mdb.NAME) == "", func() { m.Sleep3s().Cmdy(ROUTE, cli.BUILD).ProcessInner() }) }}, PUBLISH: {Name: "publish name", Help: "发布", Icon: "bi bi-send-check", Hand: func(m *ice.Message, arg ...string) { - m.Option(ice.MSG_TITLE, kit.Keys(m.CommandKey(), m.ActionKey())) + m.Option(ice.MSG_TITLE, kit.Keys(m.Option(ice.MSG_USERPOD), m.CommandKey(), m.ActionKey())) defer ToastProcess(m)() list := []string{cli.LINUX, cli.DARWIN, cli.WINDOWS} msg := m.Spawn(ice.Maps{ice.MSG_DAEMON: ""}) diff --git a/base/web/matrix.go b/base/web/matrix.go index 44765104..045404fe 100644 --- a/base/web/matrix.go +++ b/base/web/matrix.go @@ -73,6 +73,9 @@ func init() { 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.STOP: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, "") }}, + COMPILE: {Hand: func(m *ice.Message, arg ...string) { + m.Cmdy(Space(m, kit.Keys(m.Option(DOMAIN), m.Option(mdb.NAME))), COMPILE, cli.AMD64, cli.LINUX, ice.SRC_MAIN_GO).ProcessHold() + }}, UPGRADE: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(Space(m, kit.Keys(m.Option(DOMAIN), m.Option(mdb.NAME))), UPGRADE).Sleep3s() }}, diff --git a/base/web/option.go b/base/web/option.go index 1ef20052..3e22f2ed 100644 --- a/base/web/option.go +++ b/base/web/option.go @@ -81,9 +81,8 @@ func PushNotice(m *ice.Message, arg ...ice.Any) { return } opts := ice.Map{ice.MSG_OPTION: []string{}, ice.MSG_OPTS: []string{}} - kit.For([]string{ice.MSG_TITLE, ctx.DISPLAY, ctx.STYLE, cli.DELAY, ice.MSG_STATUS, ice.LOG_DEBUG, ice.LOG_TRACEID}, func(key string) { - opts[ice.MSG_OPTION] = kit.Simple(opts[ice.MSG_OPTION], key) - opts[key] = m.Option(key) + kit.For([]string{ctx.DISPLAY, ctx.STYLE, cli.DELAY, ice.MSG_TITLE, ice.MSG_STATUS, ice.LOG_DEBUG, ice.LOG_TRACEID}, func(key string) { + opts[ice.MSG_OPTION], opts[key] = kit.Simple(opts[ice.MSG_OPTION], key), m.Option(key) }) m.Cmd(SPACE, m.Option(ice.MSG_DAEMON), arg, opts) } @@ -102,7 +101,7 @@ func PushStream(m *ice.Message) *ice.Message { func init() { ice.Info.PushStream = PushStream } func init() { ice.Info.PushNotice = PushNotice } -func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title [duration [progress]]] +func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title [duration [progress [hash]]]] if len(arg) > 1 { switch val := arg[1].(type) { case string: @@ -112,7 +111,7 @@ func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title } } kit.If(len(arg) == 0, func() { arg = append(arg, m.PrefixKey()) }) - kit.If(len(arg) > 0, func() { arg[0] = kit.Select(m.PrefixKey(), arg[0]) }) + kit.If(len(arg) > 0 && arg[0] == "", func() { arg[0] = kit.Keys(m.Option(ice.MSG_USERPOD), ctx.ShortCmd(m.PrefixKey())) }) PushNoticeToast(m, text, arg) return m } @@ -133,16 +132,17 @@ func ToastFailure(m *ice.Message, arg ...ice.Any) { Toast(m, toastContent(m, ice.FAILURE, arg...), "", m.OptionDefault(ice.TOAST_DURATION, cli.TIME_3s)).Sleep(m.OptionDefault(ice.TOAST_DURATION, cli.TIME_3s)) } func ToastProcess(m *ice.Message, arg ...ice.Any) func(...ice.Any) { - Toast(m, toastContent(m, ice.PROCESS, arg...), "", cli.TIME_30s) - return func(arg ...ice.Any) { Toast(m, toastContent(m, ice.SUCCESS, arg...), "", "1s") } + h := kit.HashsUniq() + Toast(m, toastContent(m, ice.PROCESS, arg...), "", "-1", "", h) + return func(arg ...ice.Any) { Toast(m, toastContent(m, ice.SUCCESS, arg...), "", cli.TIME_1s, "", h) } } func GoToast(m *ice.Message, title string, cb func(toast func(name string, count, total int)) []string) *ice.Message { - _total := 0 - icon := Icons[ice.PROCESS] + h := kit.HashsUniq() + icon, _total := Icons[ice.PROCESS], 0 toast := func(name string, count, total int) { kit.If(total == 0, func() { total = 1 }) - Toast(m, kit.Format("%s %s %s", icon, kit.JoinWord(kit.Select(kit.Select("", m.ActionKey(), m.ActionKey() != ice.LIST), title, m.Option(ice.MSG_TITLE)), name), strings.ReplaceAll(kit.FmtSize(count, total), "B", "")), - "", m.OptionDefault(ice.TOAST_DURATION, cli.TIME_30s), count*100/total) + Toast(m, kit.Format("%s %s %s", icon, kit.JoinWord(m.ActionKey(), name), strings.ReplaceAll(kit.FmtSize(count, total), "B", "")), + kit.Select(title, m.Option(ice.MSG_TITLE)), m.OptionDefault(ice.TOAST_DURATION, "-1"), count*100/total, h) _total = total } if list := cb(toast); len(list) > 0 { diff --git a/base/web/space.go b/base/web/space.go index 3d4a89dc..6ed94bb4 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -325,6 +325,7 @@ func init() { }) m.Sort("", kit.Simple(aaa.LOGIN, WEIXIN, PORTAL, WORKER, SERVER, MASTER)) } else { + m.OptionDefault(ice.MSG_USERPOD, arg[0]) _space_send(m, arg[0], kit.Simple(kit.Split(arg[1]), arg[2:])...) } }}, diff --git a/core/chat/macos/desktop.css b/core/chat/macos/desktop.css index 3469ec81..719a497e 100644 --- a/core/chat/macos/desktop.css +++ b/core/chat/macos/desktop.css @@ -11,7 +11,7 @@ fieldset.macos.desktop>div.output>fieldset.macos.menu div.menu { display:flex; a fieldset.macos.desktop>div.output>fieldset.macos.menu div.menu.title { font-style:italic; margin-left:10px; } fieldset.macos.desktop>div.output>fieldset.macos.menu div.item.time { margin-right:10px; } fieldset.macos.desktop>div.output>fieldset.macos.menu>div.output { overflow:hidden; } -fieldset.macos.desktop>div.output>fieldset.macos.dock { border:var(--box-border); border-radius:var(--plugin-radius); position:absolute; bottom:var(--input-margin); transition:margin-left 0.3s; } +fieldset.macos.desktop>div.output>fieldset.macos.dock { border:var(--box-border); border-radius:var(--plugin-radius); position:absolute; bottom:var(--input-margin); transition:margin-left 0.3s; z-index:11; } fieldset.macos.desktop>div.output>fieldset.macos.searchs { position:absolute; 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; } @@ -74,7 +74,7 @@ fieldset.macos.dock>div.output>div.item { text-align:center; align-self:baseline fieldset.macos.dock>div.output>div.item img { object-fit:contain; min-height:var(--desktop-icon-size); width:var(--desktop-icon-size); transition:width 0.3s; } fieldset.macos.dock>div.output>div.item>div.name { display:none; } fieldset.macos.finder>div.output div.content>div.item { text-align:center; float:left; } -fieldset.macos.finder>div.output div.content>div.item img { object-fit:contain; height:var(--desktop-icon-size); width:var(--desktop-icon-size); } +fieldset.macos.finder>div.output div.content>div.item img { object-fit:contain; width:var(--desktop-icon-size); } fieldset.macos.finder>div.output div.content>div.item div.name { font-size:var(--code-font-size); text-align:center; } body.dark fieldset.macos.desktop>div.output>fieldset.macos { background-color:#08234ad1; } body.dark fieldset.macos.desktop>div.output>div.desktop fieldset table.content tbody tr:nth-child(odd):not(:hover) { background-color:#282B2F; } diff --git a/core/chat/script.js b/core/chat/script.js index 3754f4b7..e68733a9 100644 --- a/core/chat/script.js +++ b/core/chat/script.js @@ -10,19 +10,24 @@ Volcanos(chat.ONIMPORT, { Volcanos(chat.ONACTION, { record: function(event, can, msg) { can.misc.sessionStorage(can, SCRIPT_ZONE, msg.Option(mdb.ZONE)), can.user.toastSuccess(can, msg.Option(mdb.ZONE)), can.Update(event) }, stop: function(event, can, msg) { can.misc.sessionStorage(can, SCRIPT_ZONE, ""), can.Update(event) }, - play: function(event, can) { var begin = new Date().getTime(); can.core.Next(can._msg.Table(), function(value, next, index, list) { + play: function(event, can) { var begin = new Date().getTime(); can.core.Next(can._msg.Table(), function(value, next, index, list, data) { + var ls = can.core.Split(value.style||""); data = data||{}, data.list = data.list||[]; var fork + if (ls && ls.length > 0 && ls[0] == "fork") { data.done = parseInt(ls[1])+1, fork = {skip: parseInt(ls[1])} } + if (data.skip > 0) { return next({skip: data.skip-1}) } + if (data.done === 0) { return } if (data.done > 0) { data.done -= 1 } data.list.push(value) can.Status(cli.STEP, index), can.Status(cli.COST, can.base.Duration(new Date().getTime()-begin)) can.user.toastProcess(can, `${can.core.Keys(value.space, value.index)} ${value.play} ${index}/${can._msg.Length()}`, "", index*100/list.length) var tr = can.page.Select(can, can._output, html.TR)[1]; can.onmotion.select(can, tr.parentNode, html.TR, index) - value.status == mdb.DISABLE? next(): can.onaction.preview({}, can, can.request({}, value), next) + value.status == mdb.DISABLE? next(data): can.onaction.preview({}, can, can.request({}, value), next, data) + if (fork) { next(fork) } }, function(list) { can.Status(cli.STEP, list.length), can.Status(cli.COST, can.base.Duration(new Date().getTime()-begin)), can.user.toastSuccess(can) }) }, - preview: function(event, can, msg, next) { + preview: function(event, can, msg, next, data) { can.onappend.plugin(can, {space: msg.Option(web.SPACE), index: msg.Option(ctx.INDEX), style: msg.Option(ctx.STYLE)}, function(sub) { var done = false function action(skip) { sub.Update(sub.request({}, {_handle: ice.TRUE}), [ctx.ACTION, msg.Option(cli.PLAY)], function(msg) { - sub.onimport._process(sub, msg) || msg.Length() == 0 && msg.Result() == "" || can.onappend._output(sub, msg), next && next() + sub.onimport._process(sub, msg) || msg.Length() == 0 && msg.Result() == "" || can.onappend._output(sub, msg), next && next(data) }) } if (msg.Option(ctx.STYLE) == "async") { - done = true, sub.Update(sub.request({}, {_handle: ice.TRUE}), [ctx.ACTION, msg.Option(cli.PLAY)]), next && next() + done = true, sub.Update(sub.request({}, {_handle: ice.TRUE}), [ctx.ACTION, msg.Option(cli.PLAY)]), next && next(data) } else { can.onmotion.delay(can, function() { if (done || sub._auto) { return } done = true, action() }, 300) } diff --git a/core/code/compile.go b/core/code/compile.go index 81220d06..b2892ab3 100644 --- a/core/code/compile.go +++ b/core/code/compile.go @@ -111,8 +111,8 @@ func init() { }}, web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }}, }, ctx.ConfAction(cli.ENV, kit.Dict(GOPRIVATE, "shylinux.com,github.com", GOPROXY, "https://goproxy.cn,direct", CGO_ENABLED, "0"))), Hand: func(m *ice.Message, arg ...string) { - defer web.ToastProcess(m)() main, file, goos, arch := _compile_target(m, arg...) + defer web.ToastProcess(m, file)(file) env := kit.Simple(cli.PATH, cli.BinPath(), cli.HOME, kit.Select(kit.Path(""), kit.Env(cli.HOME)), mdb.Configv(m, cli.ENV), m.Optionv(cli.ENV), cli.GOOS, goos, cli.GOARCH, arch) kit.If(runtime.GOOS == cli.WINDOWS, func() { env = append(env, GOPATH, kit.HomePath(GO), GOCACHE, kit.HomePath("go/go-build")) }) m.Options(cli.CMD_ENV, env).Cmd(AUTOGEN, VERSION) diff --git a/logs.go b/logs.go index fdd35bd5..b4f63077 100644 --- a/logs.go +++ b/logs.go @@ -271,6 +271,18 @@ func (m *Message) FormatStack(s, n int) string { switch ls := kit.Split(name, PT, PT); kit.Select("", ls, 0) { case "reflect", "runtime", "http": default: + if kit.HasPrefix(name, + "icebergs.(*Context)._action", + "icebergs.(*Context)._command", + "icebergs.(*Message)._command", + "icebergs.(*Message).Cmd", + "icebergs.(*Message).CmdHand", + "icebergs.(*Message).Search", + "icebergs.(*Message).TryCatch", + "icebergs.(*Message).Go", + ) { + break + } list = append(list, kit.Format("%s:%d\t%s", file, frame.Line, name)) } if len(list) >= n || !more { diff --git a/misc/git/repos.go b/misc/git/repos.go index 098bf5fd..dc5c31cf 100644 --- a/misc/git/repos.go +++ b/misc/git/repos.go @@ -458,7 +458,7 @@ func init() { } }}, REMOTE: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) { - repos := _repos_open(m, kit.Select(path.Base(kit.Path("")), kit.Select(m.Option(REPOS), arg, 0))) + repos := _repos_open(m, kit.Select(path.Base(kit.Path("")), arg, 0)) if _remote, err := repos.Remote(ORIGIN); err == nil { m.Push(REMOTE, kit.Select("", _remote.Config().URLs, 0)) } diff --git a/misc/ssh/relay/relay.go b/misc/ssh/relay/relay.go index 386c2518..c45aea0d 100644 --- a/misc/ssh/relay/relay.go +++ b/misc/ssh/relay/relay.go @@ -109,7 +109,6 @@ func (s relay) Inputs(m *ice.Message, arg ...string) { } } func (s relay) Stats(m *ice.Message) { - m.Option(ice.MSG_TITLE, kit.Keys(m.CommandKey(), m.ActionKey())) cmds := []string{"go", `go version`, "git", `git version`, PACKAGE, `if yum -h &>/dev/null; then echo yum; elif apk version &>/dev/null; then echo apk; elif opkg -v &>/dev/null; then echo opkg; elif apt -h &>/dev/null; then echo apt; fi`, SHELL, `echo $SHELL`, KERNEL, `uname -s`, ARCH, `uname -m`, @@ -319,7 +318,7 @@ func (s relay) Install(m *ice.Message, arg ...string) { s.Modify(m, kit.Simple(m.OptionSimple(MACHINE, web.DREAM))...) } func (s relay) Upgrade(m *ice.Message, arg ...string) { - m.Option(ice.MSG_TITLE, kit.Keys(m.CommandKey(), m.ActionKey())) + m.Option(ice.MSG_TITLE, kit.Keys(m.Option(ice.MSG_USERPOD), m.CommandKey(), m.ActionKey())) if len(arg) == 0 && (m.Option(MACHINE) == "" || strings.Contains(m.Option(MACHINE), ",")) { s.foreach(m, func(msg *ice.Message, cmd []string) { if msg.Option("go") == "" { @@ -334,7 +333,7 @@ func (s relay) Upgrade(m *ice.Message, arg ...string) { } } func (s relay) Version(m *ice.Message, arg ...string) { - m.Option(ice.MSG_TITLE, kit.Keys(m.CommandKey(), m.ActionKey())) + m.Option(ice.MSG_TITLE, kit.Keys(m.Option(ice.MSG_USERPOD), m.CommandKey(), m.ActionKey())) s.foreach(m, func(msg *ice.Message, cmd []string) { if msg.Option("go") == "" { return