feat(skins): add persistent voice workspace API and align KAAK

This commit is contained in:
illusia committed 2026-10-24 13:30:50 +08:00
1 parent 0af3236c30
commit 452e6f09ca
24 files changed
+451 -21

No files matched your search

+10
View File
@@ -74,6 +74,16 @@ v3 保留安全的标准元素和属性白名单;组件可通过完整页面 s
仓库地址限定为 `https://github.com/owner/repository`。索引最多 50 项;索引最大 128 KiB,单个 `skin.json` 最大 16 KiB,归档最大 20 MiB,下载有超时限制。商店不执行皮肤构建脚本,也不从仓库加载未打入归档的资源。
### 工作区接口 v1(WebSpeak 0.2.8 当前运行时)
v3/v4 开放皮肤可在 `manifest.json` 中声明 `"workspace": { "apiVersion": 1, "mode": "persistent" }`。未声明时保留原先的首页流程。该通用接口不识别皮肤 ID,也不授予额外网络或存储权限;皮肤包本身不能读写此偏好。旧运行时不认识该字段或权限时会拒绝导入,不能仅凭应用版本号认定支持;使用它的包需要 `minAppVersion: "0.2.8"` 及工作区接口 v1。
首次使用仍显示连接表单;只有成功连接才记录 `hasConnected`。旧的成功连接历史会迁移为已使用状态,只有昵称或失败尝试不算。启用此策略的皮肤在主动断开或刷新回访后仍进入工作区,但不会自动连接、采集麦克风或切换服务器。普通回访可由宿主恢复最近目标;显式邀请、目标或频道链接优先。切换到未声明策略的皮肤恢复其原有流程,清除本地数据会重置此记录。
可信控件 `voice.connection-status` 需要 `session.status.read` 与 `voice.connect`,显示本地化的连接/失败状态、可编辑昵称与重连按钮;忙碌时禁用重复提交,服务器密码和新增服务器对话框仍由宿主管理。公开部件为 `voice.connection-status`、`voice.connection-status.message`、`voice.connection-status.nickname`、`voice.connection-status.nickname.input`、`voice.connection-status.reconnect`。皮肤负责这些部件的位置、响应式布局和外观。
声明式动作 `voice.connect` 使用同名权限且不接受参数;它只在明确可信点击后连接宿主当前选定的目标,不能携带地址、密码、身份材料、邀请令牌或自动执行。服务器配置和身份未就绪、正在连接/重连、已经连接或对话框尚待处理时,宿主拒绝重复发起。它和既有的 `quickServers.switch`、服务器栏加号共用宿主连接流程;异步读取浏览器已保存密码不会被误判为连接失败。
## 包结构
`.wskin` 是标准 ZIP 容器,推荐把下列文件直接放在 ZIP 根目录:
+6
View File
@@ -28,6 +28,12 @@ The existing WebSpeak noise-suppression switch is available in the audio setting
The owner authorized inspection of the first two voice rooms in the KOOK server. Both rooms were entered and viewed; the microphone remained off and no message was sent. The in-room view confirmed a single large participant tile in the center, a separate right-side panel for the active voice channel's text chat, a narrow server rail, grouped voice channels, and a compact voice-control dock near the lower left. The chat was empty, so no message contents were recorded. Server/room identifiers and member names were not recorded.
## Returning to the workspace
KAAK 3.1.125 requires WebSpeak 0.2.8 with workspace API v1. Its manifest opts into the generic persistent workspace policy: first-time visitors keep the connection home until a successful voice connection; returning visitors and disconnected users retain the workspace and server rail. Restoring the workspace never starts a connection or captures the microphone. The host restores the recent target only for ordinary visits, preserving explicit invitation and target links. Clearing browser data resets this history.
The permission-gated `voice.connection-status` host widget provides the connection state, nickname and explicit reconnect button beside server navigation at desktop and narrow widths. Open-mode server switching and adding servers reuse the host connection flow, including saved-password lookup and trusted password prompts; fixed mode retains its restrictions. All KAAK layout and styling remain in the package.
## Components and permissions
The connection page and voice workspace are full-page declarative surfaces in [components.json](./kaak-voice/components.json). The voice surface requests only the capabilities it uses: visible server shortcuts, channel and member data, cached profile-avatar display inside the trusted member-card widget, channel joining, channel chat, voice status, microphone/output controls, whisper controls, disconnect, and screen-share status/read/control. Its member-card widget explicitly enables share status and watch actions; the KAAK dock uses the host's screen-share control. When a screen-share peer is active, the performance panel shows browser-side video codec and transport metrics. The host renders trusted connection, language, skin, and audio controls. KAAK keeps the shared-screen player inside the central voice-stage column with an explicit responsive height, so the player cannot collapse when the host applies its inline video sizing; member cards scroll in the remaining area. The full source image remains visible with black letterboxing. Server and channel password prompts use the compact dark KAAK dialog style while retaining WebSpeak's trusted password, error, cancel, and retry behavior. It rechecks permissions and connection state when each action runs; approval is local to this skin version and can be revoked from the host access control.
Binary file not shown.
+7 -1
View File
@@ -395,6 +395,7 @@
"audio.microphone.control",
"audio.output.control",
"audio.settings.open",
"voice.connect",
"voice.disconnect",
"voice.screenShare.status.read",
"voice.screenShare.read",
@@ -501,7 +502,8 @@
"attributes": {
"type": "button",
"aria-current": "{{server.current}}",
"aria-label": "切换到 {{server.label}}"
"aria-label": "{{server.switchTitle}}",
"title": "{{server.switchTitle}}"
},
"events": {
"click": "switch-server"
@@ -862,6 +864,10 @@
"widget": "voice.server-banner",
"part": "server-banner"
},
{
"widget": "voice.connection-status",
"part": "connection-status"
},
{
"tag": "nav",
"part": "channel-list",
+6 -2
View File
@@ -3,12 +3,16 @@
"packageType": "open-skin",
"id": "community.kaak-voice",
"name": "KAAK",
"version": "3.1.122",
"version": "3.1.125",
"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.",
"entry": "skin.css",
"components": "components.json",
"content": "content.json",
"minAppVersion": "0.2.7"
"minAppVersion": "0.2.8",
"workspace": {
"apiVersion": 1,
"mode": "persistent"
}
}
+72
View File
@@ -4567,3 +4567,75 @@
inset-inline-start: 70px;
}
}
/* Workspace API v1: reconnect stays beside server navigation on every width. */
[data-ws-plugin-part="kaak-workspace.connection-status"] {
flex: 0 0 auto;
min-width: 0;
margin: 10px 8px;
}
[data-ws-plugin-part="kaak-workspace.connection-status"]:not(:has([data-ws-part="voice.connection-status"])) { display: none; }
[data-ws-plugin-part="kaak-workspace.connection-status"] [data-ws-part="voice.connection-status"] {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 12px;
width: 100%;
min-width: 0;
margin: 0;
padding: 16px;
border: 1px solid var(--skin-kaak-border);
border-radius: 12px;
color: var(--skin-kaak-text);
background: var(--skin-kaak-raised);
box-shadow: none;
font-family: var(--skin-kaak-font);
}
[data-ws-plugin-part="kaak-workspace.connection-status"] [data-ws-part="voice.connection-status.message"] {
flex: 0 0 auto;
margin: 0;
color: var(--skin-kaak-muted);
font-size: 13px;
line-height: 1.5;
overflow-wrap: anywhere;
}
[data-ws-plugin-part="kaak-workspace.connection-status"] [data-ws-state="failed"] [data-ws-part="voice.connection-status.message"] { color: #ffaaaa; }
[data-ws-plugin-part="kaak-workspace.connection-status"] [data-ws-part="voice.connection-status.nickname"] {
display: grid;
gap: 6px;
min-width: 0;
width: 100%;
color: var(--skin-kaak-muted);
font-size: 12px;
}
[data-ws-plugin-part="kaak-workspace.connection-status"] input {
width: 100%;
min-width: 0;
min-height: 44px;
padding: 9px 10px;
border: 1px solid #4b4e55;
border-radius: 7px;
color: var(--skin-kaak-text);
background: var(--skin-kaak-panel);
font: inherit;
font-size: 14px;
}
[data-ws-plugin-part="kaak-workspace.connection-status"] button {
justify-content: center;
min-width: 0;
min-height: 44px;
padding: 10px 12px;
border-radius: 7px;
color: #152000;
background: var(--skin-kaak-accent);
font: inherit;
font-weight: 700;
white-space: normal;
overflow-wrap: anywhere;
}
[data-ws-plugin-part="kaak-workspace.connection-status"] button:hover:not(:disabled) { background: var(--skin-kaak-accent-hover); }
[data-ws-plugin-part="kaak-workspace.connection-status"] input:focus-visible,
[data-ws-plugin-part="kaak-workspace.connection-status"] button:focus-visible { outline: 2px solid #a8ed50; outline-offset: 3px; }
@media (max-width: 820px) {
[data-ws-plugin-part="kaak-workspace.connection-status"] { margin: 10px 4px; }
}