1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-02-27 22:02:19 +08:00
parent 0f5d9e6c8a
commit 7f7a042951
9 changed files with 66 additions and 26 deletions

View File

@ -152,9 +152,10 @@ func init() {
}
}},
}, mdb.HashAction(mdb.SHORT, mdb.TEXT, mdb.FIELD, "time,hash,size,type,name,text,file"), ice.RenderAction(ice.RENDER_DOWNLOAD)), Hand: func(m *ice.Message, arg ...string) {
if mdb.HashSelect(m, arg...); len(arg) == 0 || m.R != nil && m.R.Method == http.MethodGet {
m.Option(ice.MSG_ACTION, "")
} else if m.Length() == 0 {
if mdb.HashSelect(m, arg...); len(arg) == 0 {
return
}
if m.Length() == 0 {
return
} else if m.Append(nfs.FILE) == "" {
m.PushScript(mdb.TEXT, m.Append(mdb.TEXT))

View File

@ -418,7 +418,7 @@ func init() {
case WORKER:
m.PushButton(cli.RUNTIME, tcp.SEND, OPEN)
default:
m.PushButton(cli.RUNTIME, OPEN)
m.PushButton(cli.RUNTIME, DREAM, OPEN)
}
}},
STATS_TABLES: {Hand: func(m *ice.Message, arg ...string) {
@ -432,7 +432,7 @@ func init() {
}},
}, StatsAction(), DreamAction(), DreamTablesAction(), mdb.ImportantHashAction(
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icons,repos,binary,template,restart",
html.BUTTON, kit.JoinWord(PORTAL, DESKTOP, ADMIN, WORD, STATUS, VIMER, COMPILE, XTERM, DREAM),
html.BUTTON, kit.JoinWord(PORTAL, DESKTOP, ADMIN, MESSAGE, WORD, STATUS, VIMER, COMPILE, XTERM, DREAM),
ctx.TOOLS, kit.Simple(SPIDE, STORE, MATRIX, ROUTE),
)), Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 {

View File

@ -29,9 +29,9 @@ func _matrix_list(m *ice.Message, domain, icon, typ string, fields ...string) (s
m.PushRecord(value, fields...).PushButton(button...)
switch typ {
case MYSELF:
button = []ice.Any{PORTAL, WORD, STATUS, VIMER, COMPILE, cli.RUNTIME, XTERM, DESKTOP, ADMIN, OPEN}
button = []ice.Any{PORTAL, WORD, STATUS, VIMER, COMPILE, cli.RUNTIME, MESSAGE, XTERM, DESKTOP, ADMIN, OPEN}
case SERVER:
button = []ice.Any{PORTAL, DESKTOP, ADMIN, OPEN, UPGRADE, cli.RUNTIME, WORD, STATUS, VIMER, XTERM}
button = []ice.Any{PORTAL, DESKTOP, ADMIN, OPEN, UPGRADE, cli.RUNTIME, MESSAGE, WORD, STATUS, VIMER, XTERM}
default:
button = []ice.Any{PORTAL, DESKTOP, ADMIN, OPEN, XTERM, cli.RUNTIME, WORD, STATUS, VIMER}
}

View File

@ -184,6 +184,7 @@ const (
WIKI_WORD = "web.wiki.word"
WIKI_PORTAL = "web.wiki.portal"
CHAT_OAUTH_CLIENT = "web.chat.oauth.client"
CHAT_MESSAGE = "web.chat.message"
CHAT_HEADER = "web.chat.header"
CHAT_IFRAME = "web.chat.iframe"
CHAT_FAVOR = "web.chat.favor"

View File

@ -233,6 +233,14 @@ func _space_send(m *ice.Message, name string, arg ...string) (h string) {
}
}
}) {
if target[0] == ice.OPS {
if ice.Info.NodeType == SERVER {
if name == ice.OPS {
m.Cmdy(arg)
return
}
}
}
kit.If(m.IsDebug(), func() {
m.WarnNotFound(kit.IndexOf([]string{ice.OPS, ice.DEV}, target[0]) == -1, SPACE, name)
})

View File

@ -24,6 +24,7 @@ func init() {
DeskAppend(m, "Photos.png", web.WIKI_FEEL)
DeskAppend(m, "Grapher.png", web.WIKI_DRAW)
DeskAppend(m, "Calendar.png", web.TEAM_PLAN)
DeskAppend(m, "Messages.png", web.CHAT_MESSAGE)
}
if m.Cmd(DOCK).Length() == 0 {
DockAppend(m, "Finder.png", Prefix(FINDER))

View File

@ -1,18 +1,20 @@
body.light fieldset.web.chat.message>div.output { background-color:white; }
body.light fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list { background-color:#e3e3e2; }
body.light fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item:not(.plug).myself div.content { background-color:#94ec69; }
fieldset.web.chat.message>div.output>div.project>div.title { padding:var(--button-padding); display:flex; justify-content:space-between; position:sticky; top:0; z-index:2; }
fieldset.web.chat.message>div.output>div.project>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.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.item.text.filter>i { left:var(--input-padding); }
fieldset.web.chat.message>div.output>div.project>div.item { height:58px; padding: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 img { height:var(--header-height); width:var(--header-height); display:block; float:left; }
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 { padding:0 var(--input-padding); width:calc(100% - var(--header-height)); float:left; }
fieldset.web.chat.message>div.output>div.project>div.item div.container { padding:0 var(--input-padding); width:calc(100% - var(--header-height) - 2*var(--input-padding)); 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.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 { 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 { 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 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.list>div.item { padding:var(--input-padding); min-height:fit-content; display:flex; }
@ -24,13 +26,21 @@ 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 div.container>span.from { color:var(--disable-fg-color); font-size:var(--status-font-size); padding:0 var(--input-padding); }
fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.myself div.container>span.from { float:right; }
fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.myself 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 { 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 { display:flex; align-items:center; border-radius:var(--plugin-radius); min-height:var(--header-height); width:fit-content; }
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.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);
}
fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item>div.container>div.content {
display:flex; align-items:center; border-radius:var(--plugin-radius);
min-height:var(--header-height); width:fit-content; }
fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.plug { height:fit-content; }
fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.plug div.content { padding:0; }
fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.myself { flex-direction:row-reverse; }
fieldset.web.chat.message>div.output>div.layout>div.display { height:120px; overflow:hidden; }
fieldset.web.chat.message>div.output>div.layout>div.display div.toolkit { height:var(--action-height); display:flex; }
fieldset.web.chat.message>div.output>div.layout>div.display div.toolkit { background-color:var(--plugin-bg-color); height:var(--action-height); display:flex; align-items:center; }
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)); }

View File

@ -19,7 +19,7 @@ func init() {
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
messageCreate(m, web.DREAM, "usr/icons/Launchpad.png")
messageCreate(m, cli.SYSTEM, "usr/icons/System Settings.png")
messageInsert(m, cli.SYSTEM, mdb.TYPE, "plug", ctx.INDEX, cli.RUNTIME)
messageInsert(m, cli.SYSTEM, mdb.TYPE, "text", mdb.NAME, cli.RUNTIME, mdb.TEXT, m.Cmdx(cli.RUNTIME), ctx.DISPLAY, "/plugin/story/json.js")
}},
mdb.CREATE: {Name: "create type*=tech,void zone* icons* target"},
mdb.INSERT: {Hand: func(m *ice.Message, arg ...string) {
@ -33,10 +33,12 @@ func init() {
mdb.HashSelectUpdate(m, m.Option(ice.FROM_SPACE), func(value ice.Map) { kit.Value(value, mdb.TIME, m.Time()) })
}},
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
messageInsert(m, web.DREAM, mdb.TYPE, "plug", ctx.INDEX, IFRAME, ctx.ARGS, web.S(m.Option(mdb.NAME)))
if ice.Info.Important {
messageInsert(m, web.DREAM, mdb.TYPE, "plug", ctx.INDEX, IFRAME, ctx.ARGS, web.S(m.Option(mdb.NAME)))
}
}},
}, web.DreamAction(), mdb.ZoneAction(
mdb.SHORT, mdb.ZONE, mdb.FIELD, "time,hash,type,zone,icons,target", mdb.FIELDS, "time,id,avatar,usernick,username,type,name,text,space,index,args",
}, web.DreamAction(), web.DreamTablesAction(), mdb.ZoneAction(
mdb.SHORT, mdb.ZONE, mdb.FIELD, "time,hash,type,zone,icons,title,count,target", mdb.FIELDS, "time,id,avatar,usernick,username,type,name,text,space,index,args,style,display",
)), Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 {
mdb.ZoneSelect(m.Display("").Spawn(), arg...).Table(func(value ice.Maps) {

View File

@ -12,8 +12,8 @@ Volcanos(chat.ONIMPORT, {
msg.Table(function(value) {
var _target = can.page.Append(can, can.ui.project, [{view: html.ITEM, list: [
{img: can.misc.Resource(can, value.icons||"usr/icons/Messages.png")}, {view: html.CONTAINER, list: [
{view: wiki.TITLE, list: [{text: value.zone||"[未命名]"}, {text: [can.base.TimeTrim(value.time), "", mdb.TIME]}]},
{view: wiki.CONTENT, list: [{text: value.text||"[未知消息]"}]},
{view: wiki.TITLE, list: [{text: value.title||value.zone||"[未命名]"}, {text: [can.base.TimeTrim(value.time), "", mdb.TIME]}]},
{view: wiki.CONTENT, list: [{text: value.target||"[未知消息]"}]},
]},
], onclick: function(event) { can.isCmdMode() && can.misc.SearchHash(can, value.zone), can.onimport._switch(can, false)
can.db.zone = value, can.db.hash = value.hash, can.onmotion.select(can, can.ui.project, html.DIV_ITEM, _target)
@ -58,7 +58,7 @@ Volcanos(chat.ONIMPORT, {
]}])
}), can.onappend._status(can, msg.Option(ice.MSG_STATUS)), can.onimport.layout(can)
if (can.Status(mdb.TOTAL) > can.db.zone.id) { can.onimport._request(can) }
can.onmotion.delay(can, function() { can.ui.message && (can.ui.message.scrollTop += 10000) })
can.onmotion.delay(can, function() { can.ui.message && (can.ui.message.scrollTop += 10000) }, 300)
},
_request: function(can) {
can.run(can.request(event, {"cache.begin": parseInt(can.db.zone.id||0)+1, "cache.limit": 10}), [can.db.hash], function(msg) {
@ -82,6 +82,14 @@ Volcanos(chat.ONIMPORT, {
can.ui.title && can.page.style(can, can.ui.message, html.HEIGHT, can.ui.content.offsetHeight-can.ui.title.offsetHeight)
},
}, [""])
Volcanos(chat.ONEXPORT, {
plugHeight: function(can, value) { var height = can.base.Min(can.ui.content.offsetHeight-240, 240)
return can.base.Max(html.STORY_HEIGHT, height, height/(can.base.isIn(value.index, html.IFRAME)? 1: 2))
},
plugWidth: function(can, value) {
return can.ui.content.offsetWidth-(can.user.isMobile? 60: 180)
},
})
Volcanos(chat.ONDETAIL, {
"bi bi-mic": function(event, can) {},
"bi bi-card-image": function(event, can) {
@ -101,13 +109,22 @@ Volcanos(chat.ONDETAIL, {
})
Volcanos(chat.ONFIGURE, {
image: function(can, value) { return {view: wiki.CONTENT, list: [{img: can.misc.Resource(can, value.text)}]} },
text: function(can, value) { return {view: wiki.CONTENT, list: [{text: value.text||"[未知消息]"}]} },
plug: function(can, value) { var height = can.base.Min(can.ui.content.offsetHeight-210, 240)
var height = can.base.Max(html.PLUG_HEIGHT, height, height/(can.base.isIn(value.index, html.IFRAME)? 1: 2)), width = can.ui.content.offsetWidth-(can.user.isMobile? 60: 180)
return {view: wiki.CONTENT, style: {height: height, width: width}, _init: function(target) { value.type = chat.STORY
text: function(can, value) {
return {view: wiki.CONTENT, list: [{text: value.text||"[未知消息]"}], _init: function(target) {
if (value.display) { var msg = can.request(); msg.Echo(value.text), can.onmotion.clear(can, target)
var height = can.onexport.plugHeight(can, value), width = can.onexport.plugWidth(can, value)
can.onappend.plugin(can, {title: value.name, index: "can._plugin", height: height, display: value.display, msg: msg}, function(sub) {
delete(sub._legend.onclick)
}, target)
}
}}
},
plug: function(can, value) {
var height = can.onexport.plugHeight(can, value), width = can.onexport.plugWidth(can, value)
return {view: wiki.CONTENT, style: {height: height+2, width: width}, _init: function(target) { value.type = chat.STORY
can.onappend.plugin(can, value, function(sub) {
sub.onexport.output = function() { sub.onimport.size(sub, height, width)
can.page.style(can, target, html.HEIGHT, sub._target.offsetHeight, html.WIDTH, sub._target.offsetWidth)
can.page.style(can, target, html.HEIGHT, sub._target.offsetHeight+2, html.WIDTH, sub._target.offsetWidth)
}
}, target)
}}