From 6154aa93aa515091dd336bb15e61202991fd8fb1 Mon Sep 17 00:00:00 2001 From: shy Date: Sun, 7 Apr 2024 15:33:13 +0800 Subject: [PATCH] add some --- base/web/dream.go | 5 +++-- base/web/matrix.go | 6 ++++-- base/web/serve.go | 11 +++++------ base/web/space.go | 4 ++++ core/chat/message.css | 16 ++++++++++++---- core/chat/message.go | 19 ++++++++++--------- core/chat/message.js | 8 ++++---- 7 files changed, 42 insertions(+), 27 deletions(-) diff --git a/base/web/dream.go b/base/web/dream.go index 612d138a..2ce5a462 100644 --- a/base/web/dream.go +++ b/base/web/dream.go @@ -526,8 +526,9 @@ func DreamTablesAction(arg ...string) ice.Actions { } func DreamAction() ice.Actions { return gdb.EventsAction( - DREAM_INPUTS, DREAM_CREATE, DREAM_REMOVE, DREAM_TRASH, DREAM_OPEN, DREAM_CLOSE, SPACE_LOGIN, SERVE_START, - OPS_DREAM_CREATE, OPS_DREAM_REMOVE, + DREAM_INPUTS, DREAM_CREATE, DREAM_REMOVE, DREAM_TRASH, DREAM_OPEN, DREAM_CLOSE, + OPS_ORIGIN_OPEN, OPS_SERVER_OPEN, OPS_DREAM_CREATE, OPS_DREAM_REMOVE, + SERVE_START, SPACE_LOGIN, ) } func DreamWhiteHandle(m *ice.Message, arg ...string) { diff --git a/base/web/matrix.go b/base/web/matrix.go index bd5c6f8b..13aa8a6a 100644 --- a/base/web/matrix.go +++ b/base/web/matrix.go @@ -113,8 +113,10 @@ func init() { m.OptionDefault(nfs.BINARY, UserHost(m)+S(m.Option(mdb.NAME))) } _matrix_dream(m, mdb.CREATE, kit.Simple(m.OptionSimple(mdb.ICONS, nfs.REPOS, nfs.BINARY))...) - m.Cmd(SPACE, kit.Keys(m.Option(DOMAIN), m.Option(mdb.NAME)), MESSAGE, mdb.CREATE, mdb.TYPE, aaa.TECH, mdb.ICONS, nfs.USR_ICONS_VOLCANOS, TARGET, kit.Keys(nfs.FROM, m.Option(mdb.NAME))) - m.Cmd(SPACE, m.Option(mdb.NAME), MESSAGE, mdb.CREATE, mdb.TYPE, aaa.TECH, mdb.ICONS, nfs.USR_ICONS_ICEBERGS, TARGET, kit.Keys(ice.OPS, m.Option(DOMAIN), m.Option(mdb.NAME))) + m.Cmd(SPACE, kit.Keys(m.Option(DOMAIN), m.Option(mdb.NAME)), MESSAGE, mdb.CREATE, + mdb.TYPE, ORIGIN, mdb.ICONS, m.Option(mdb.ICONS), TARGET, kit.Keys(nfs.FROM, m.Option(mdb.NAME))) + m.Cmd(SPACE, m.Option(mdb.NAME), MESSAGE, mdb.CREATE, + mdb.TYPE, SERVER, mdb.ICONS, m.Option(mdb.ICONS), TARGET, kit.Keys(ice.OPS, m.Option(DOMAIN), m.Option(mdb.NAME))) StreamPushRefreshConfirm(m, m.Trans("refresh for new space ", "刷新列表查看新空间 ")+kit.Keys(m.Option(DOMAIN), m.Option(mdb.NAME))) }}, }, ctx.ConfAction( diff --git a/base/web/serve.go b/base/web/serve.go index c84649fa..83a45445 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -207,11 +207,10 @@ const ( BODY = "body" HOME = "home" - OPS_SERVER_OPEN = "ops.server.open" - SERVE_START = "serve.start" - PROXY_CONF = "proxyConf" - PROXY_PATH = "usr/local/daemon/10000/" - PROXY_CMDS = "./sbin/nginx" + SERVE_START = "serve.start" + PROXY_CONF = "proxyConf" + PROXY_PATH = "usr/local/daemon/10000/" + PROXY_CMDS = "./sbin/nginx" ) const SERVE = "serve" @@ -225,7 +224,7 @@ func init() { mdb.Config(m, ice.MAIN, C(m.Option(ctx.INDEX))) } }}, - mdb.ICONS: {Hand: func(m *ice.Message, arg ...string) { + mdb.ICONS: {Hand: func(m *ice.Message, arg ...string) { mdb.Config(m, mdb.ICONS, arg[0]) }}, tcp.HOST: {Help: "公网", Hand: func(m *ice.Message, arg ...string) { m.Echo(kit.Formats(PublicIP(m))) }}, diff --git a/base/web/space.go b/base/web/space.go index 163f10f5..c29eb81e 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -185,6 +185,7 @@ func _space_exec(m *ice.Message, name string, source, target []string, c *websoc } mdb.HashModify(m, mdb.HASH, name, ParseUA(m), m.OptionSimple(mdb.ICONS, mdb.TIME, nfs.MODULE, nfs.VERSION, AGENT, cli.SYSTEM)) m.Push(mdb.LINK, m.MergePod(kit.Select("", source, -1))) + SpaceEvent(m, OPS_ORIGIN_OPEN, name, kit.Simple(mdb.NAME, name, m.OptionSimple(mdb.ICONS, mdb.TIME, nfs.MODULE, nfs.VERSION, AGENT, cli.SYSTEM))...) default: if m.IsErr() { return @@ -267,6 +268,9 @@ const ( AGENT = "agent" ) const ( + OPS_ORIGIN_OPEN = "ops.origin.open" + OPS_SERVER_OPEN = "ops.server.open" + SPACE_LOGIN = "space.login" SPACE_LOGIN_CLOSE = "space.login.close" SPACE_GRANT = "space.grant" diff --git a/core/chat/message.css b/core/chat/message.css index 086ad707..e9488a16 100644 --- a/core/chat/message.css +++ b/core/chat/message.css @@ -5,18 +5,24 @@ fieldset.web.chat.message>div.output>div.project>div.title { background-color:va fieldset.web.chat.message>div.output>div.project>div.title i:hover { background-color:var(--hover-bg-color); cursor:pointer; } fieldset.web.chat.message>div.output>div.project>div.title span:hover { background-color:var(--hover-bg-color); cursor:pointer; } fieldset.web.chat.message>div.output>div.project>div.title span { padding:0 var(--input-padding); } -fieldset.web.chat.message>div.output>div.project>div.item.text.filter>i { left:var(--input-padding); } fieldset.web.chat.message>div.output>div.project>div.item:not(.filter) { height:58px; padding:var(--input-padding); } -fieldset.web.chat.message>div.output>div.project>div.item.select { border-right:unset; } +fieldset.web.chat.message>div.output>div.project>div.item.text.filter>i { left:var(--input-padding); } +fieldset.web.chat.message>div.output>div.project>div.item.origin { border-left:var(--box-danger3); } +fieldset.web.chat.message>div.output>div.project>div.item.server { border-left:var(--box-notice3); } +fieldset.web.chat.message>div.output>div.project>div.item.origin.select { border-right:var(--box-danger3); } +fieldset.web.chat.message>div.output>div.project>div.item.server.select { border-right:var(--box-notice3); } +fieldset.web.chat.message>div.output>div.project>div.item.select { border-right:var(--box-border3); } +fieldset.web.chat.message>div.output>div.project>div.item { border-left:var(--box-border3); cursor:pointer; } fieldset.web.chat.message>div.output>div.project>div.item img { height:var(--header-height); width:var(--header-height); display:block; float:left; } -body.mobile fieldset.web.chat.message>div.output>div.project { border-right:none; } fieldset.web.chat.message>div.output>div.project>div.item span.time { color:var(--disable-fg-color); font-size:var(--status-font-size); } fieldset.web.chat.message>div.output>div.project>div.item div.container { width:calc(100% - var(--header-height)); float:left; } fieldset.web.chat.message>div.output>div.project>div.item div.title { display:flex; justify-content:space-between; } +fieldset.web.chat.message>div.output>div.project>div.item div.content { display:flex; justify-content:space-between; } fieldset.web.chat.message>div.output>div.project>div.item div.title>span:first-child { margin-right:var(--input-margin); overflow:hidden; flex-shrink:1; } fieldset.web.chat.message>div.output>div.project>div.item div.content { color:var(--disable-fg-color); font-size:var(--status-font-size); } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content { overflow:hidden; } -fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.title { background-color:var(--plugin-bg-color); padding:var(--button-padding); display:flex; justify-content:space-between; position:sticky; top:0; z-index:2; } +fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.title img { height:26px; } +fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.title { background-color:var(--plugin-bg-color); padding:var(--button-padding); display:flex; justify-content:space-between; align-items:center; position:sticky; top:0; z-index:2; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.title i:hover { background-color:var(--hover-bg-color); cursor:pointer; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.title span:hover { background-color:var(--hover-bg-color); cursor:pointer; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.title span { padding:0 var(--input-padding); } @@ -31,6 +37,7 @@ fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list> fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.send div.container { display:flex; flex-direction:column; align-items:flex-end; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.text div.content { white-space:pre; padding:var(--input-padding) var(--button-padding); } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item>div.container>div.content fieldset.story>form.option>div.item.text input { width:var(--form-width); } +fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item>div.container>div.content fieldset.story>form.option>div.icon.delete { display:none; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.plug>div.container>div.content fieldset.story>div.action>div.item.chat.icons { display:none; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.plug>div.container>div.content { box-shadow:var(--box-shadow); } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.plug>div.container>div.content:hover { box-shadow:var(--notice-box-shadow); } @@ -43,3 +50,4 @@ fieldset.web.chat.message>div.output>div.layout>div.display div.toolkit { backgr fieldset.web.chat.message>div.output>div.layout>div.display div.toolkit i { padding:var(--input-padding); } fieldset.web.chat.message>div.output>div.layout>div.display div.toolkit i:hover { background-color:var(--hover-bg-color); } fieldset.web.chat.message>div.output>div.layout>div.display textarea { height:calc(100% - var(--action-height)); } +body.mobile fieldset.web.chat.message>div.output>div.project { border-right:none; } diff --git a/core/chat/message.go b/core/chat/message.go index 81854b4d..767aea8b 100644 --- a/core/chat/message.go +++ b/core/chat/message.go @@ -32,7 +32,7 @@ func init() { if m.OptionDefault(mdb.ZONE, m.Option(web.TARGET)) == "" { m.Option(mdb.ZONE, kit.Hashs(mdb.UNIQ)) } - mdb.ZoneCreate(m, kit.Simple(arg, web.TARGET, m.Option(web.TARGET), mdb.ZONE, m.Option(mdb.ZONE))) + mdb.ZoneCreate(m, kit.Simple(m.OptionSimple(mdb.ICONS), arg, m.OptionSimple(web.TARGET, mdb.ZONE))) }}, mdb.INSERT: {Hand: func(m *ice.Message, arg ...string) { mdb.ZoneInsert(m, kit.Simple(arg[0], tcp.DIRECT, tcp.SEND, arg[1:], aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.AVATAR, m.Option(ice.MSG_AVATAR))) @@ -47,15 +47,13 @@ func init() { m.Cmd("", mdb.INSERT, m.Option(ice.FROM_SPACE), arg, tcp.DIRECT, tcp.RECV) mdb.HashSelectUpdate(m, m.Option(ice.FROM_SPACE), func(value ice.Map) { kit.Value(value, web.TARGET, m.Option(ice.FROM_SPACE)) }) }}, - cli.CLEAR: {Hand: func(m *ice.Message, arg ...string) {}}, - web.OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.MergePod(m.Option(web.TARGET))) }}, + cli.CLEAR: {Hand: func(m *ice.Message, arg ...string) {}}, + web.OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.MergePod(m.Option(web.TARGET))) }}, + web.OPS_ORIGIN_OPEN: {Hand: func(m *ice.Message, arg ...string) { messageCreateSpace(m, web.ORIGIN, "") }}, + web.OPS_SERVER_OPEN: {Hand: func(m *ice.Message, arg ...string) { messageCreateSpace(m, web.SERVER, "") }}, + web.OPS_DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) { messageCreateSpace(m, web.WORKER, "") }}, web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) { - if !m.IsCliUA() { - MessageInsertPlug(m, web.DREAM, "", "", web.DREAM, m.Option(mdb.NAME)) - } - }}, - web.OPS_DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) { - m.Cmd("", mdb.CREATE, mdb.TYPE, aaa.TECH, web.TARGET, kit.Keys(kit.Select("", ice.OPS, m.IsWorker()), m.Option(mdb.NAME))) + MessageInsertPlug(m, web.DREAM, "", "", web.DREAM, m.Option(mdb.NAME)) }}, web.DREAM_REMOVE: {Hand: func(m *ice.Message, arg ...string) { MessageInsertPlug(m, web.DREAM, "", "", web.DREAM, m.Option(mdb.NAME)) @@ -114,6 +112,9 @@ func init() { }}, }) } +func messageCreateSpace(m *ice.Message, kind, name string) { + m.Cmd("", mdb.CREATE, mdb.TYPE, kind, web.TARGET, kit.Keys(kit.Select("", ice.OPS, m.IsWorker()), kit.Select(m.Option(mdb.NAME), name))) +} func MessageCreate(m *ice.Message, zone, icons string) { if _, ok := m.CmdMap(MESSAGE, mdb.ZONE)[zone]; !ok { m.Cmd(MESSAGE, mdb.CREATE, mdb.TYPE, aaa.TECH, mdb.ICONS, icons, mdb.ZONE, zone) diff --git a/core/chat/message.js b/core/chat/message.js index 7fbf0559..af17cfc4 100644 --- a/core/chat/message.js +++ b/core/chat/message.js @@ -10,10 +10,10 @@ Volcanos(chat.ONIMPORT, { {icon: "bi bi-plus-lg", onclick: function(event) { can.Update(event, [ctx.ACTION, mdb.CREATE]) }}, ]}], can.ui.project.firstChild, can.ui.project) msg.Table(function(value) { - var _target = can.page.Append(can, can.ui.project, [{view: html.ITEM, list: [ + var _target = can.page.Append(can, can.ui.project, [{view: [[html.ITEM, value.type]], list: [ {img: can.misc.Resource(can, value.icons||"usr/icons/Messages.png")}, {view: html.CONTAINER, list: [ - {view: wiki.TITLE, list: [{text: value.title||can.base.trimPrefix(value.zone, "ops.")||"[未命名]"}, {text: [can.base.TimeTrim(value.time), "", mdb.TIME]}]}, - {view: wiki.CONTENT, list: [{text: value.target||"[未知消息]"}]}, + {view: wiki.TITLE, list: [{text: can.base.trimPrefix(value.title||value.zone, "ops.")||"[未命名]"}]}, + {view: wiki.CONTENT, list: [{text: can.base.trimPrefix(value.target, "ops.")||"[未知消息]"}, {text: [can.base.TimeTrim(value.time), "", mdb.TIME]}]}, ]}, ], onclick: function(event) { can.isCmdMode() && can.misc.SearchHash(can, value.zone), can.onimport._switch(can, false) can.sup.db.current = value.zone @@ -38,7 +38,7 @@ Volcanos(chat.ONIMPORT, { _content: function(can, msg) { can.ui.title = can.page.Appends(can, can.ui.content, [{view: wiki.TITLE, list: [ {icon: "bi bi-chevron-left", onclick: function() { can.onimport._switch(can, true) }}, - {text: can.db.zone.title||can.base.trimPrefix(can.db.zone.zone, "ops.")}, + {text: can.base.trimPrefix(can.db.zone.title||can.db.zone.zone, "ops.")}, {icon: "bi bi-three-dots", onclick: function() { can.onmotion.toggle(can, can.ui.profile), can.onimport.layout(can) }}, ]}])._target can.ui.message = can.page.Append(can, can.ui.content, [{view: html.LIST}])._target, can.onimport._message(can, msg)