diff --git a/base/ctx/command.go b/base/ctx/command.go index 400b7313..12745589 100644 --- a/base/ctx/command.go +++ b/base/ctx/command.go @@ -75,6 +75,13 @@ func init() { m.Echo(`%s %s %s;" f`+lex.NL, value[mdb.NAME], value[nfs.FILE], value[nfs.LINE]) }).Cmd(nfs.SAVE, nfs.TAGS, m.Result()) }}, + mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { + if len(arg) > 0 && arg[0] != "" { + m.Cmdy(arg).Search(arg[0], func(key string, cmd *ice.Command) { + m.Cut(kit.Format(kit.Value(cmd.List, kit.Format("%d.name", len(arg)-1)))) + }) + } + }}, }, CmdAction(), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) { if len(arg) == 0 { m.Cmdy("", mdb.SEARCH, COMMAND, ice.OptionFields(INDEX)).StatusTimeCount() diff --git a/base/web/space.go b/base/web/space.go index 8a1c3426..f2eb8d4c 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -80,14 +80,14 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) { break } msg := m.Spawn(b) + if safe { // 下行命令 + msg.OptionDefault(ice.MSG_USERROLE, aaa.UserRole(msg, msg.Option(ice.MSG_USERNAME))) + } else { // 上行请求 + msg.Option(ice.MSG_USERROLE, aaa.VOID) + } source, target := kit.Simple(msg.Optionv(ice.MSG_SOURCE), name), kit.Simple(msg.Optionv(ice.MSG_TARGET)) msg.Log(tcp.RECV, "%v->%v %v %v", source, target, msg.Detailv(), msg.FormatsMeta(nil)) if next := msg.Option(ice.MSG_TARGET); next == "" || len(target) == 0 { - if safe { // 下行命令 - msg.Option(ice.MSG_USERROLE, aaa.UserRole(msg, msg.Option(ice.MSG_USERNAME))) - } else { // 上行请求 - msg.Option(ice.MSG_USERROLE, aaa.VOID) - } m.Go(func() { _space_exec(msg, source, target, c) }, strings.Join(kit.Simple(SPACE, name, msg.Detailv()), lex.SP)) } else { done := false @@ -140,6 +140,7 @@ func _space_send(m *ice.Message, name string, arg ...string) (h string) { h = mdb.HashCreate(m.Spawn(), mdb.TYPE, tcp.SEND, mdb.NAME, kit.Keys(name, m.Target().ID()), mdb.TEXT, kit.Join(arg, lex.SP), kit.Dict(mdb.TARGET, done)) if target := kit.Split(name, nfs.PT, nfs.PT); mdb.HashSelectDetail(m, target[0], func(value ice.Map) { if c, ok := value[mdb.TARGET].(*websocket.Conn); !m.Warn(!ok, ice.ErrNotValid, mdb.TARGET) { + kit.For([]string{ice.MSG_USERROLE}, func(k string) { m.Optionv(k, m.Optionv(k)) }) kit.For(m.Optionv(ice.MSG_OPTS), func(k string) { m.Optionv(k, m.Optionv(k)) }) _space_echo(m.Set(ice.MSG_DETAIL, arg...), []string{h}, target, c) } diff --git a/core/chat/macos/applications.go b/core/chat/macos/applications.go index d1d3aad1..302d83cd 100644 --- a/core/chat/macos/applications.go +++ b/core/chat/macos/applications.go @@ -33,7 +33,24 @@ func init() { AppInstall(m, "", web.CODE_GIT_STATUS, mdb.ICON, "usr/icons/git.jpg") }}, code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { AppInstall(m, arg[0], arg[1], arg[2:]...) }}, - }, CmdHashAction("index,args"))}, + mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { + switch arg[0] { + case web.SPACE: + m.Cmdy(web.SPACE).CutTo(mdb.NAME, arg[0]) + case ctx.INDEX: + m.Cmdy(web.Space(m, m.Option(web.SPACE)), ctx.COMMAND) + case ctx.ARGS: + m.Cmdy(web.Space(m, m.Option(web.SPACE)), ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX)) + case mdb.ICON: + if m.Option(ctx.INDEX) != "" { + m.Cmd(web.Space(m, m.Option(web.SPACE)), m.Option(ctx.INDEX), mdb.INPUTS, arg[0]).Table(func(value ice.Maps) { + m.Push(arg[0], value[arg[0]]+"?pod="+kit.Keys(m.Option(ice.MSG_USERPOD), m.Option(web.SPACE))) + }) + } + m.Cmd(nfs.DIR, USR_ICONS, func(value ice.Maps) { m.Push(arg[0], value[nfs.PATH]) }) + } + }}, mdb.CREATE: {Name: "create space index args name icon"}, + }, CmdHashAction("space,index,args"))}, }) } func install(m *ice.Message, cmd, name, index string, arg ...string) { diff --git a/core/chat/macos/desktop.css b/core/chat/macos/desktop.css index a8dea722..d6ea2a8c 100644 --- a/core/chat/macos/desktop.css +++ b/core/chat/macos/desktop.css @@ -32,6 +32,8 @@ fieldset.macos.desktop>div.output>div.desktop>fieldset>div.item.button { border- fieldset.macos.desktop>div.output>div.desktop>fieldset>legend { background-color:unset; padding-right:10px; margin:10px 0; } fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>*:not(.textarea) { margin:10px 0px 10px 10px; } fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.icon { margin-left:0; margin-top:10px; margin-bottom:8px; } +fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item.button>span.icon { font-size:26px; line-height:28px; } + fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item.icons { margin-left:0; } fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item:last-child { margin-right:20px; } fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item:last-child { margin-right:80px; } diff --git a/core/chat/macos/finder.go b/core/chat/macos/finder.go index 743f1248..b8fcda97 100644 --- a/core/chat/macos/finder.go +++ b/core/chat/macos/finder.go @@ -8,7 +8,10 @@ import ( const FINDER = "finder" func init() { - Index.MergeCommands(ice.Commands{FINDER: {Name: "finder list", Actions: CmdHashAction(mdb.NAME)}}) + Index.MergeCommands(ice.Commands{FINDER: {Name: "finder list insert", Actions: ice.MergeActions(ice.Actions{ + mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(APPLICATIONS, mdb.INPUTS, arg) }}, + mdb.INSERT: {Name: "insert space index* args name* icon*", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(APPLICATIONS, mdb.CREATE, arg) }}, + }, CmdHashAction(mdb.NAME))}}) } func FinderAppend(m *ice.Message, name, index string, arg ...string) { diff --git a/core/chat/macos/macos.go b/core/chat/macos/macos.go index f12bd538..97f54790 100644 --- a/core/chat/macos/macos.go +++ b/core/chat/macos/macos.go @@ -36,5 +36,5 @@ func CmdHashAction(arg ...string) ice.Actions { mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) { mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(ctx.FileURI(file)) }}, - }, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,name,icon,text,index,args", arg, 1), kit.Slice(arg, 2))) + }, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,name,icon,text,space,index,args", arg, 1), kit.Slice(arg, 2))) } diff --git a/core/chat/river.go b/core/chat/river.go index 68d497dd..0051d04e 100644 --- a/core/chat/river.go +++ b/core/chat/river.go @@ -49,15 +49,11 @@ func init() { case nfs.TEMPLATE: m.Cmdy(TEMPLATE).CutTo(RIVER, arg[0]) case web.SPACE: - m.Cmd(web.SPACE, func(value ice.Maps) { - kit.If(kit.IsIn(value[mdb.TYPE], web.WORKER), func() { m.Push(arg[0], value[mdb.NAME]) }) - }) + m.Cmdy(web.SPACE).CutTo(mdb.NAME, arg[0]) case ctx.INDEX: - if m.Option(web.SPACE) == "" { - m.Cmdy(ctx.COMMAND) - } else { - m.Cmdy(web.SPACE, m.Option(web.SPACE), ctx.COMMAND) - } + m.Cmdy(web.Space(m, m.Option(web.SPACE)), ctx.COMMAND) + case ctx.ARGS: + m.Cmdy(web.Space(m, m.Option(web.SPACE)), ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX)) default: mdb.HashInputs(m, arg) }