diff --git a/docs/OPEN_SKIN_SYSTEM_SPEC.zh-CN.md b/docs/OPEN_SKIN_SYSTEM_SPEC.zh-CN.md index 17c2347..987acc2 100644 --- a/docs/OPEN_SKIN_SYSTEM_SPEC.zh-CN.md +++ b/docs/OPEN_SKIN_SYSTEM_SPEC.zh-CN.md @@ -70,6 +70,7 @@ v4 当前运行路径已不使用 v3 固定标签/属性/状态/动作表来构 当前宿主动作如下: +- session.copyInviteLink 需要 session.invite.copy,只复制当前公开服务器与频道的邀请链接;宿主会排除连接凭据。 - voice.joinChannel 需要 session.channel.join,只能请求加入当前页面公开可见的 TeamSpeak 频道,仍经过宿主和原有密码、权限流程。 - favorites.switch 需要 favorites.switch,只能让宿主按不透明令牌选择本机已有收藏并走原连接流程。 - quickServers.switch 需要 servers.quickList.switch,只能让宿主按不透明令牌选择本机已有收藏或最近连接并走原连接流程。 diff --git a/docs/SKIN_DEVELOPMENT.md b/docs/SKIN_DEVELOPMENT.md index 2191283..634d087 100644 --- a/docs/SKIN_DEVELOPMENT.md +++ b/docs/SKIN_DEVELOPMENT.md @@ -164,7 +164,7 @@ components.json 顶层接受 schemaVersion 1、2 或 3 和 components 数组。s 当前可选宿主控件 ID:`home.connection-form`、`home.connection-status`、`home.server-announcement`、`home.social-links`、`home.identity-provider`、`app.skin-switcher`、`app.language-switcher`、`voice.channel-panel`、`voice.member-cards`、`voice.chat-panel`、`voice.audio-controls`、`voice.screen-share-player`、`voice.screen-share-start`、`voice.whisper-controls`、`voice.performance-panel`、`voice.connection-controls`、`voice.disconnect-control`、`voice.server-header`、`voice.server-banner`、`voice.server-switcher`、`voice.channel-tree`。未知控件和同页重复控件会被拒绝;每个控件的状态和业务动作仍由 WebSpeak 内部处理。`home.identity-provider` 是通用身份提供方入口,需用 `options.identityProviderId` 和 `options.identityProviderLabel` 指定稳定提供方标识与显示名;宿主会把点击转交给应用代码的 `registerIdentityProviderAdapter` 分发接口,皮肤只能发起请求、不能注册适配器。当前没有 MyTS 适配器,所以 MyTS 入口仍提示开发中;这不代表已经实现登录认证。schema v3 会检查受保护控件所需权限:音频控件需 `audio.status.read`、`audio.microphone.control` 和 `audio.output.control`;聊天需 `chat.channel.read` 与 `chat.channel.send`;成员卡片始终需 `session.members.read` 和 `session.memberAvatars.read`;schema v3 可为成员卡片设置 `options.memberActions: true`,在非本人卡片上显示可信宿主成员操作入口(包含现有个人音量控件);也可为 `voice.channel-tree` 设置该选项,在非本人频道树成员行上启用右键菜单;菜单仍由 WebSpeak 宿主处理,皮肤不获得额外动作或数据接口。频道树还可单独设置 `options.memberDragDrop: true`,将非本人成员拖到另一频道行时复用 WebSpeak 现有移动成员操作;悬停和拖入高亮由皮肤样式控制,此选项默认关闭且只适用于频道树。成员卡片或性能卡片可设置 `options.screenShare: false`,同时隐藏共享 UI/指标并免除成员卡片所需的屏幕共享权限;默认成员共享操作仍需屏幕共享读取/控制权限;头像只在可信宿主控件内显示,不暴露给皮肤代码;屏幕共享播放器需 `voice.screenShare.read` 与 `voice.screenShare.control`;悄悄话控件需对应状态读取和控制权限;断开/连接控件需 `voice.disconnect`。既有 v2 包维持旧校验行为,`voice.screen-share-start` 仍像此前一样要求 `voice.screenShare.control`。该控件仅能放在语音页;宿主按钮在可信点击处理器内直接启动屏幕采集,避免异步 Wasm 回调丢失浏览器瞬时用户激活。自定义 UI 可以完全用普通声明式节点搭建,不需要采用这些控件。只显示收藏时可用 `favorites.items` 和 `favorites.switch`;若要将收藏与最近连接放在同一自定义栏,可用 `servers.quickList` 数据与 `quickServers.switch` 动作。服务器目标始终使用本机生成的不透明令牌,不把地址、密码或身份材料交给组件。频道行也可把 `voice.joinChannel` 绑定到双击事件,切房继续走 TeamSpeak 原有权限和密码流程。v3 还提供经独立权限保护的麦克风/扬声器、输出音量、噪声抑制、伴奏、离开状态、悄悄话、断开连接和屏幕共享动作;噪声抑制使用 `audio.toggleNoiseSuppression` 与 `audio.microphone.control`,伴奏使用 `audio.toggleAccompaniment` 与 `audio.output.control`。它们只调用 WebSpeak 已有操作,屏幕采集仍由浏览器或操作系统询问用户。 -可信语音导航控件包括 `voice.channel-tree`、`voice.server-switcher` 和 `voice.server-header`。频道树要求 `session.channels.read`、`session.members.read`、`session.memberAvatars.read` 与 `session.channel.join`;头像只由宿主读取并在频道树中绘制。它可选 `layout: "server-sidebar"` 展示频道成员并让频道行与成员行分别控制折叠;未指定时保留默认呈现。独立服务器切换器要求 `servers.quickList.read` 与 `servers.quickList.switch`。服务器头部还要求 `session.status.read`,并在同一可信部件中组合服务器身份、状态、频道搜索和快速切换。两种入口都只接收不透明本地标识,点击后复用 WebSpeak 当前连接流程。语音状态投影中的 `serverLabel` 会在看起来像 IP、域名或连接目标时省略,避免把地址显示为服务器名称。 +可信语音导航控件包括 `voice.channel-tree`、`voice.server-switcher` 和 `voice.server-header`。频道树要求 `session.channels.read`、`session.members.read`、`session.memberAvatars.read` 与 `session.channel.join`;头像只由宿主读取并在频道树中绘制。它可选 `layout: "server-sidebar"` 展示频道成员并让频道行与成员行分别控制折叠;未指定时保留默认呈现。独立服务器切换器要求 `servers.quickList.read` 与 `servers.quickList.switch`。服务器头部还要求 `session.status.read`,并在同一可信部件中组合服务器身份、状态、频道搜索和快速切换。两种入口都只接收不透明本地标识,点击后复用 WebSpeak 当前连接流程。v3 还可用 `session.invite.copy` 授权 `session.copyInviteLink`,让宿主复制当前公开服务器与频道的邀请链接并排除连接凭据。语音状态投影中的 `serverLabel` 会在看起来像 IP、域名或连接目标时省略,避免把地址显示为服务器名称。 示例包见 [KAAK voice 示例](./examples/KAAK-VOICE.md),其 components.json 使用完整首页与语音工作区 surface,展示收藏服务器、频道树、在线成员、聊天和可信语音控制的组合;[Open Voice Surface](./examples/OPEN-VOICE-SURFACE.md) 保留为通用格式验证脚手架。KAAK 的语音视觉参考来自用户授权进入的前两个语音房间;只记录布局,不保留服务器/房间标识、成员名或聊天内容。当前数据权限和宿主动作以[开放皮肤规格](./OPEN_SKIN_SYSTEM_SPEC.zh-CN.md)中的清单为准。组件按本地用户授权后才渲染;权限对每个皮肤版本、页面和组件分别保存,可在宿主权限入口撤销。页面替换时,宿主会额外显示“返回标准界面”和“恢复内置皮肤”入口;拒绝授权或离开 surface 后,普通页面可立即恢复。 diff --git a/docs/examples/kaak-voice.wskin b/docs/examples/kaak-voice.wskin index 7682423..ddb8afc 100644 Binary files a/docs/examples/kaak-voice.wskin and b/docs/examples/kaak-voice.wskin differ diff --git a/docs/examples/kaak-voice/components.json b/docs/examples/kaak-voice/components.json index 3396dbe..3c2d2c0 100644 --- a/docs/examples/kaak-voice/components.json +++ b/docs/examples/kaak-voice/components.json @@ -364,6 +364,7 @@ "permissions": [ "ui.surface.replace", "session.status.read", + "session.invite.copy", "session.channels.read", "session.members.read", "session.memberAvatars.read", @@ -392,6 +393,10 @@ "type": "voice.disconnect", "args": {} }, + "copy-invite-link": { + "type": "session.copyInviteLink", + "args": {} + }, "stop-screen-share": { "type": "voice.stopScreenShare", "args": {} @@ -703,6 +708,23 @@ } ] }, + { + "tag": "button", + "part": "mobile-room-invite-copy", + "attributes": { + "type": "button", + "role": "menuitem", + "aria-label": "复制邀请链接 / Copy invite link" + }, + "events": { + "click": "copy-invite-link" + }, + "children": [ + { + "text": "复制邀请链接 / Copy invite link" + } + ] + }, { "tag": "button", "part": "mobile-room-menu-close", @@ -1106,6 +1128,50 @@ } ] }, + { + "tag": "button", + "part": "voice-stage-invite", + "className": "voice-stage-invite", + "attributes": { + "type": "button", + "aria-label": "复制邀请链接 / Copy invite link", + "title": "复制邀请链接 / Copy invite link" + }, + "events": { + "click": "copy-invite-link" + }, + "children": [ + { + "tag": "svg", + "className": "voice-stage-action-icon", + "attributes": { + "width": 18, + "height": 18, + "viewbox": "0 0 24 24", + "fill": "none", + "stroke": "currentColor", + "stroke-width": 1.8, + "stroke-linecap": "round", + "stroke-linejoin": "round", + "aria-hidden": "true" + }, + "children": [ + { + "tag": "path", + "attributes": { + "d": "M10 13a5 5 0 0 0 7.07 0l2-2a5 5 0 0 0-7.07-7.07l-1.15 1.15" + } + }, + { + "tag": "path", + "attributes": { + "d": "M14 11a5 5 0 0 0-7.07 0l-2 2a5 5 0 0 0 7.07 7.07l1.15-1.15" + } + } + ] + } + ] + }, { "tag": "button", "part": "chat-panel-expand", @@ -1123,7 +1189,7 @@ }, "children": [ { - "text": "聊天" + "text": "#" } ] } @@ -1283,7 +1349,7 @@ { "tag": "path", "attributes": { - "d": "M19.4 15a1.7 1.7 0 0 0 .34 1.88l.06.06-1.7 2.94-.08-.02a1.7 1.7 0 0 0-1.74.45l-.06.06h-3.4l-.03-.08a1.7 1.7 0 0 0-1.35-1.14l-.08-.01-1.7-2.95.05-.06a1.7 1.7 0 0 0 0-1.96l-.05-.07 1.7-2.94.08.02a1.7 1.7 0 0 0 1.74-.45l.06-.06h3.4l.03.08a1.7 1.7 0 0 0 1.35 1.14l.08.01 1.7 2.95-.05.06Z" + "d": "M10 2h4l1 3 2 1 3-1 2 4-2 2v2l2 2-2 4-3-1-2 1-1 3h-4l-1-3-2-1-3 1-2-4 2-2v-2l-2-2 2-4 3 1 2-1z" } } ] diff --git a/docs/examples/kaak-voice/manifest.json b/docs/examples/kaak-voice/manifest.json index e44f0fe..7a9c98f 100644 --- a/docs/examples/kaak-voice/manifest.json +++ b/docs/examples/kaak-voice/manifest.json @@ -3,7 +3,7 @@ "packageType": "open-skin", "id": "community.kaak-voice", "name": "KAAK", - "version": "3.1.107", + "version": "3.1.108", "author": "WebSpeak Project", "license": "AGPL-3.0-only", "description": "A KOOK-inspired WebSpeak skin with a split-screen connection home, searchable server header, TeamSpeak banner, nested channel members, unified chat with local history, and a compact audio dock.", diff --git a/docs/examples/kaak-voice/skin.css b/docs/examples/kaak-voice/skin.css index bb11cfe..9f92ae3 100644 --- a/docs/examples/kaak-voice/skin.css +++ b/docs/examples/kaak-voice/skin.css @@ -1569,6 +1569,36 @@ [data-ws-plugin-part="kaak-workspace.chat-panel-chevron"] { display: block; } +[data-ws-plugin-part="kaak-workspace.voice-stage-invite"] { + display: grid; + flex: 0 0 34px; + place-items: center; + width: 34px; + height: 34px; + padding: 0; + border: 1px solid var(--skin-kaak-border); + border-radius: 9px; + color: var(--skin-kaak-muted); + background: var(--skin-kaak-raised); + cursor: pointer; + transition: color .16s ease, background-color .16s ease, border-color .16s ease; +} + +[data-ws-plugin-part="kaak-workspace.voice-stage-invite"] .voice-stage-action-icon { + display: block; + flex: 0 0 18px; + width: 18px; + height: 18px; + aspect-ratio: 1 / 1; +} + +[data-ws-plugin-part="kaak-workspace.voice-stage-invite"]:hover, +[data-ws-plugin-part="kaak-workspace.voice-stage-invite"]:focus-visible { + color: var(--skin-kaak-text); + border-color: #5a7e35; + background: #33363b; +} + [data-ws-plugin-part="kaak-workspace.chat-panel-expand"] { display: grid; flex: 0 0 36px; @@ -2283,8 +2313,10 @@ } [data-ws-plugin-part="kaak-workspace.desktop-room-controls"] .desktop-room-control-icon { display: block; flex: 0 0 auto; width: 18px; height: 18px; } [data-ws-plugin-part="kaak-workspace.desktop-room-settings"] { + display: flex; grid-column: 1; grid-row: 2; + align-items: center; justify-content: flex-start; gap: 8px; width: auto; @@ -2293,9 +2325,21 @@ color: #b5c6d8; font-size: 12px; font-weight: 500; + line-height: 1; } -[data-ws-plugin-part="kaak-workspace.desktop-room-settings"] .desktop-room-control-icon { width: 15px; height: 15px; } -[data-ws-plugin-part="kaak-workspace.desktop-room-settings"] .desktop-room-control-label { white-space: nowrap; } +[data-ws-plugin-part="kaak-workspace.desktop-room-settings"] .desktop-room-control-icon { + display: block; + flex: 0 0 15px; + width: 15px; + min-width: 15px; + height: 15px; + min-height: 15px; + aspect-ratio: 1 / 1; + overflow: visible; + transform: none; + vertical-align: middle; +} +[data-ws-plugin-part="kaak-workspace.desktop-room-settings"] .desktop-room-control-label { display: block; line-height: 16px; white-space: nowrap; } [data-ws-plugin-part="kaak-workspace.desktop-room-noise-suppression"] { grid-column: 2; grid-row: 2; color: #fff; background: #6cbf00; } [data-ws-plugin-part="kaak-workspace.desktop-room-microphone"] { grid-column: 3; grid-row: 2; } [data-ws-plugin-part="kaak-workspace.desktop-room-output"] { grid-column: 4; grid-row: 2; } @@ -3632,7 +3676,7 @@ [data-ws-plugin-part="kaak-workspace.voice-stage-heading"] { flex: 0 0 48px; gap: 7px; margin: 0 -10px 8px; padding: 0 10px; } [data-ws-plugin-part="kaak-workspace.voice-stage-title"] { flex: 1 1 auto; font-size: 16px; } [data-ws-plugin-part="kaak-workspace.voice-stage-member-count"] { flex: 0 0 auto; } - [data-ws-plugin-part="kaak-workspace.chat-panel-expand"] { flex: 0 0 52px; width: 52px; height: 34px; margin-left: 0; border-radius: 10px; font-size: 13px; } + [data-ws-plugin-part="kaak-workspace.chat-panel-expand"] { flex: 0 0 36px; width: 36px; height: 36px; margin-left: 0; border-radius: 9px; font-size: 22px; } [data-ws-plugin-part="kaak-workspace.screen-share-player"] { flex: 0 0 auto; width: 100%; max-width: 100%; margin: 0 0 10px; } [data-ws-plugin-part="kaak-workspace.screen-share-player"] .screen-share-player-stage { height: min(28dvh, 230px); min-height: 126px; max-height: 230px; } diff --git a/src/shared/skin-plugin.test.ts b/src/shared/skin-plugin.test.ts index 38b528d..265fea9 100644 --- a/src/shared/skin-plugin.test.ts +++ b/src/shared/skin-plugin.test.ts @@ -168,6 +168,25 @@ test("chat panel visibility is host-controlled and its toggle requires chat acce errorCode(() => parseSkinPluginDocument(document), "SKIN_PLUGIN_PERMISSION_MISSING"); }); +test("copying a session invite link is an explicit permission-gated host action", () => { + const document = validDocument(); + document.schemaVersion = 3; + document.components[0].actions = { + invite: { type: "session.copyInviteLink", args: {} }, + }; + document.components[0].root = { + tag: "button", + events: { click: "invite" }, + }; + + errorCode(() => parseSkinPluginDocument(document), "SKIN_PLUGIN_PERMISSION_MISSING"); + + document.components[0].permissions = ["session.invite.copy"]; + const parsed = parseSkinPluginDocument(document).components[0]; + assert.equal(parsed.actions.invite.type, "session.copyInviteLink"); + assert.equal(Object.keys(parsed.actions.invite.args).length, 0); +}); + test("host widget references stay allowlisted and cannot be used on the demo page", () => { const unknownWidget = validDocument(); unknownWidget.schemaVersion = 2; diff --git a/src/shared/skin-plugin.ts b/src/shared/skin-plugin.ts index ce92fc7..f6c8d34 100644 --- a/src/shared/skin-plugin.ts +++ b/src/shared/skin-plugin.ts @@ -14,7 +14,8 @@ export const SKIN_PLUGIN_RENDER_NODE_LIMIT = 8192; export const SKIN_PLUGIN_PERMISSIONS = Object.freeze({ "ui.surface.replace": Object.freeze({ policyVersion: 1, description: "Replace the built-in public page with a custom skin surface; the host recovery controls remain available." }), "ui.input.read": Object.freeze({ policyVersion: 1, description: "Read values entered or autofilled in this plugin's own input fields. Never enter passwords or other secrets." }), - "session.status.read": Object.freeze({ policyVersion: 1, description: "Read the current connection and channel summary." }), + "session.status.read": Object.freeze({ policyVersion: 1, description: "Read the current connection and channel summary." }), + "session.invite.copy": Object.freeze({ policyVersion: 1, description: "Copy a WebSpeak invite link for the current public server and channel; credentials are excluded." }), "session.channels.read": Object.freeze({ policyVersion: 1, description: "Read the public TeamSpeak channel tree; the demo page uses synthetic sample data." }), "session.members.read": Object.freeze({ policyVersion: 1, description: "Read visible member names, initials derived from those names, and speaking states; the demo page uses synthetic sample data." }), "session.memberAvatars.read": Object.freeze({ policyVersion: 1, description: "Display cached TeamSpeak profile pictures for visible members inside trusted host member-card or channel-tree widgets. Images are not exposed to skin markup or plugin runtimes." }), @@ -117,6 +118,7 @@ export type SkinPluginEvent = | "pointerenter" | "pointerleave" | "dragstart" | "dragover" | "drop"; export type SkinPluginAction = | "ui.setState" | "ui.toggleState" + | "session.copyInviteLink" | "voice.joinChannel" | "favorites.switch" | "quickServers.switch" | "chat.sendMessage" | "chat.togglePanel" | "voice.toggleMicrophone" | "voice.toggleOutputMute" | "voice.setOutputVolume" | "audio.openSettings" | "audio.toggleNoiseSuppression" | "audio.toggleAccompaniment" @@ -200,19 +202,20 @@ const V3_EVENTS = new Set([ ]); const PASSIVE_EVENTS = new Set(["focus", "blur", "pointerenter", "pointerleave", "dragstart", "dragover"]); const ACTIONS = new Set([ - "ui.setState", "ui.toggleState", "voice.joinChannel", "favorites.switch", "quickServers.switch", "chat.sendMessage", "chat.togglePanel", + "ui.setState", "ui.toggleState", "session.copyInviteLink", "voice.joinChannel", "favorites.switch", "quickServers.switch", "chat.sendMessage", "chat.togglePanel", "voice.toggleMicrophone", "voice.toggleOutputMute", "voice.setOutputVolume", "audio.openSettings", "audio.toggleNoiseSuppression", "audio.toggleAccompaniment", "voice.disconnect", "voice.setAway", "voice.setWhisperActive", "voice.startScreenShare", "voice.stopScreenShare", "voice.joinScreenShare", "voice.leaveScreenShare", ]); const V3_ACTIONS = new Set([ - "ui.toggleState", "chat.togglePanel", "voice.toggleMicrophone", "voice.toggleOutputMute", "voice.setOutputVolume", "audio.openSettings", "audio.toggleNoiseSuppression", "audio.toggleAccompaniment", "voice.disconnect", "voice.setAway", + "ui.toggleState", "session.copyInviteLink", "chat.togglePanel", "voice.toggleMicrophone", "voice.toggleOutputMute", "voice.setOutputVolume", "audio.openSettings", "audio.toggleNoiseSuppression", "audio.toggleAccompaniment", "voice.disconnect", "voice.setAway", "voice.setWhisperActive", "voice.startScreenShare", "voice.stopScreenShare", "voice.joinScreenShare", "voice.leaveScreenShare", ]); const PERMISSIONS = new Set(Object.keys(SKIN_PLUGIN_PERMISSIONS)); const HOST_WIDGETS = new Set(SKIN_PLUGIN_HOST_WIDGETS); -const ACTION_ARGS: Record> = { - "ui.setState": new Set(["key", "value"]), +const ACTION_ARGS: Record> = { + "ui.setState": new Set(["key", "value"]), "ui.toggleState": new Set(["key", "resetKey"]), + "session.copyInviteLink": new Set([]), "voice.joinChannel": new Set(["channelId"]), "favorites.switch": new Set(["favoriteId"]), "quickServers.switch": new Set(["quickServerId"]), @@ -232,9 +235,10 @@ const ACTION_ARGS: Record> = { "voice.joinScreenShare": new Set(["streamId"]), "voice.leaveScreenShare": new Set([]), }; -const ACTION_PERMISSION: Record = { - "ui.setState": null, - "ui.toggleState": null, +const ACTION_PERMISSION: Record = { + "ui.setState": null, + "ui.toggleState": null, + "session.copyInviteLink": "session.invite.copy", "voice.joinChannel": "session.channel.join", "favorites.switch": "favorites.switch", "quickServers.switch": "servers.quickList.switch", diff --git a/web/public/skins/kaak-voice.wskin b/web/public/skins/kaak-voice.wskin index 7682423..ddb8afc 100644 Binary files a/web/public/skins/kaak-voice.wskin and b/web/public/skins/kaak-voice.wskin differ diff --git a/web/src/services/skin-catalog.ts b/web/src/services/skin-catalog.ts index 0d60635..62de80b 100644 --- a/web/src/services/skin-catalog.ts +++ b/web/src/services/skin-catalog.ts @@ -46,7 +46,7 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [ { id: BUILTIN_KAAK_SKIN_ID, name: "KAAK", - version: "3.1.107", + version: "3.1.108", author: "WebSpeak Project", license: "AGPL-3.0-only", description: "A KOOK-inspired WebSpeak skin with a split-screen connection home, searchable server header, TeamSpeak banner, nested channel members, unified chat with local history, and a compact audio dock.", diff --git a/web/src/services/skin-pack.test.ts b/web/src/services/skin-pack.test.ts index d0fd38a..1c22cc6 100644 --- a/web/src/services/skin-pack.test.ts +++ b/web/src/services/skin-pack.test.ts @@ -486,7 +486,7 @@ test("the distributable KAAK package provides full home and voice surfaces", asy const file = new File([archive], "kaak-voice.wskin", { type: "application/octet-stream" }); const skin = await importSkinPack(file); assert.equal(skin.id, "community.kaak-voice"); - assert.equal(skin.version, "3.1.107"); + assert.equal(skin.version, "3.1.108"); assert.equal(BUILTIN_SKIN_CATALOG.find((entry) => entry.id === skin.id)?.version, skin.version); assert.equal(skin.schemaVersion, 3); const home = skin.pluginData?.components.find((component) => component.page === "home"); @@ -508,6 +508,8 @@ test("the distributable KAAK package provides full home and voice surfaces", asy assert.ok(voice?.permissions.includes("servers.quickList.read")); assert.ok(voice?.permissions.includes("servers.quickList.switch")); assert.ok(voice?.permissions.includes("session.status.read")); + assert.ok(voice?.permissions.includes("session.invite.copy")); + assert.equal(voice?.actions["copy-invite-link"]?.type, "session.copyInviteLink"); assert.ok(voice?.permissions.includes("session.channels.read")); assert.ok(voice?.permissions.includes("session.members.read")); assert.ok(voice?.permissions.includes("session.memberAvatars.read")); @@ -567,6 +569,8 @@ test("the distributable KAAK package provides full home and voice surfaces", asy const desktopRoomControls = findPart(voice?.root, "desktop-room-controls"); assert.equal(desktopRoomControls?.attributes?.role, "toolbar"); assert.equal(findPart(desktopRoomControls, "desktop-room-settings")?.events?.click, "open-audio-settings"); + const audioSettingsIcon = findPart(desktopRoomControls, "desktop-room-settings")?.children?.find((child) => child.tag === "svg"); + assert.match(String(audioSettingsIcon?.children?.[1]?.attributes?.d ?? ""), /^M10 2h4/, "the settings gear uses a centered, complete outline"); assert.equal(findPart(desktopRoomControls, "desktop-room-noise-suppression")?.events?.click, "toggle-noise-suppression"); assert.equal(findPart(desktopRoomControls, "desktop-room-microphone")?.events?.click, "toggle-microphone"); assert.equal(findPart(desktopRoomControls, "desktop-room-output")?.events?.click, "toggle-output-mute"); @@ -595,11 +599,15 @@ test("the distributable KAAK package provides full home and voice surfaces", asy assert.deepEqual(chatExpand?.when, { path: "chat.status.panelOpen", equals: false }); assert.equal(chatExpand?.events?.click, "toggle-chat-panel"); assert.equal(chatExpand?.attributes?.["aria-expanded"], "{{chat.status.panelOpen}}"); - assert.equal(chatExpand?.children?.[0]?.text, "聊天"); + assert.equal(chatExpand?.children?.[0]?.text, "#"); + const voiceStageInvite = findPart(voice?.root, "voice-stage-invite"); + assert.equal(voiceStageInvite?.events?.click, "copy-invite-link"); + assert.equal(voiceStageInvite?.attributes?.["aria-label"], "复制邀请链接 / Copy invite link"); assert.equal(findPart(voice?.root, "chat-panel")?.widget, "voice.chat-panel"); assert.deepEqual(findPart(voice?.root, "chat-panel")?.when, { path: "chat.status.panelOpen", equals: true }); assert.equal(voice?.root.attributes?.["data-chat-open"], "{{chat.status.panelOpen}}"); assert.equal(findPart(voice?.root, "whisper-controls"), undefined, "the KAAK surface does not add a duplicate whisper button"); + assert.equal(findPart(voice?.root, "mobile-room-invite-copy")?.events?.click, "copy-invite-link"); assert.equal(voice?.actions["whisper-on"], undefined); assert.equal(voice?.actions["whisper-off"], undefined); assert.equal(voice?.permissions.includes("voice.whisper.control"), false); @@ -790,7 +798,9 @@ test("the distributable KAAK package provides full home and voice surfaces", asy assert.match(skin.css, /kaak-workspace\.identity-name\"\]\s*\{\s*display: none;/); assert.match(skin.css, /@media \(max-width: 820px\)[\s\S]*?grid-template-columns: 86px minmax\(0, 1fr\);[\s\S]*?grid-template-columns: 86px minmax\(0, 1fr\);/); assert.match(skin.css, /@media \(max-height: 620px\)[\s\S]*?server-rail[\s\S]*?padding-bottom: 76px;/); - assert.match(skin.css, /voice-grid[\s\S]*?grid-template-columns: repeat\(auto-fit/); + assert.match(skin.css, /voice-grid[\s\S]*?grid-template-columns: repeat\(auto-fit/); + assert.match(skin.css, /kaak-workspace\.desktop-room-settings"\]\s*\{[\s\S]*?display: flex;[\s\S]*?align-items: center;/, "the settings gear and label share a centered control row"); + assert.match(skin.css, /kaak-workspace\.voice-stage-invite"\]\s*\{[\s\S]*?width: 34px;[\s\S]*?height: 34px;/, "the invite action is an icon-only header control"); assert.match(skin.css, /voice-card[\s\S]*?aspect-ratio: 1\.82;/); assert.match(skin.css, /\.voice-card\s*\{[\s\S]*?transition: border-color \.18s ease, background-color \.18s ease, box-shadow \.18s ease;/); assert.match(skin.css, /voice-card[\s\S]*?max-width: 480px;/); diff --git a/web/src/views/WebClient.vue b/web/src/views/WebClient.vue index 8e7f301..3f07244 100644 --- a/web/src/views/WebClient.vue +++ b/web/src/views/WebClient.vue @@ -1741,6 +1741,7 @@ const skinPluginActions = { if (!text || text.length > 1000 || text.includes("\u0000")) return; void sendTextMessage(text, currentChannel.value.id); }, + "session.copyInviteLink": () => doShare(), "chat.togglePanel": () => chat.togglePanel(), "voice.toggleMicrophone": () => { if (voiceState.connected) toggleMicrophone(); }, "voice.toggleOutputMute": () => { if (voiceState.connected) toggleOutputMute(); },