mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-02 19:42:51 +08:00
Dock plugin launchers in skins and expose example app settings
This commit is contained in:
1 parent
274bd81dc3
commit
15ca32b7a8
30 files changed
+354
-66
No files matched your search
@@ -221,7 +221,16 @@ components.json 顶层接受 schemaVersion 1、2 或 3 和 components 数组。s
|
||||
}
|
||||
```
|
||||
|
||||
当前可选宿主控件 ID:`home.connection-form`、`home.connection-status`、`home.visitor-count`、`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 已有操作,屏幕采集仍由浏览器或操作系统询问用户。
|
||||
当前可选宿主控件 ID:`home.connection-form`、`home.connection-status`、`home.visitor-count`、`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.plugin-launcher`、`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 已有操作,屏幕采集仍由浏览器或操作系统询问用户。
|
||||
|
||||
从 WebSpeak 0.3.2 起,完整语音布局可以放置宿主小组件 `voice.plugin-launcher`。组件 schema v3 支持 `options.pluginPresentation`,省略时使用 `dialog`。可选 `drawer-below` 在按钮下方展开,或用 `drawer-side` 在侧栏内展开。固定应用排在列表前面,未固定的可用应用仍可搜索。WebSpeak 管理插件授权、可用性与应用窗口,皮肤只声明入口的位置和呈现方式。
|
||||
|
||||
```json
|
||||
{ "widget": "voice.plugin-launcher", "part": "plugin-launcher", "options": { "pluginPresentation": "drawer-side" } }
|
||||
```
|
||||
|
||||
皮肤可用 `voice.plugin-launcher`、`voice.plugin-drawer` 和 `voice.plugin-drawer.app` 调整外观。没有放置此组件的完整语音布局会获得默认应用库入口。可为 `home.social-links` 设置 `options.communityLinks: false`,只保留管理控制台入口。
|
||||
|
||||
|
||||
首页访客统计使用公开宿主控件 `home.visitor-count`:它展示当前访客序号与累计访客数,文本跟随当前界面语言,并在统计数据尚不可用时隐藏;不需声明权限。该控件复用 WebSpeak 日间首页的同一结构与基础样式,皮肤通过包内 CSS 定位,不需要自建统计逻辑。组件节点可用稳定的 `part` 名称(例如 `visitor-stats`)控制位置;内部 `home.visitors`、`home.visitors.orbit`、`home.visitors.icon`、`home.visitors.label`、`home.visitors.divider`、`home.visitors.total` 和 `home.visitors.spark` 是稳定样式部件。控件只能放在 `home` 页面。
|
||||
|
||||
@@ -391,7 +400,7 @@ Wasm 每轮最多读取一次输入并提交一个 UI 输出;首版宿主动
|
||||
| --- | --- |
|
||||
| 通用 | `app`、`app.toast`、`control`、`skin.trigger`、`skin.menu`、`skin.option`、`language.trigger`、`language.menu`、`language.option` |
|
||||
| 首页 | `home`、`home.header`、`home.brand`、`home.header-tools`、`home.gateway-status`、`home.content`、`home.hero`、`home.hero.eyebrow`、`home.hero.title`、`home.hero.description`、`home.features`、`home.feature`、`home.visitors`、`home.visitors.orbit`、`home.visitors.icon`、`home.visitors.label`、`home.visitors.divider`、`home.visitors.total`、`home.visitors.spark`、`home.join-card`、`home.join-card.waveform`、`home.join-card.sonar`、`home.join-title`、`home.join-description`、`home.notice`、`home.form`、`home.server-target`、`home.field-label`、`home.field`、`home.relay-choice`、`home.relay-choice.copy`、`home.server-history`、`home.server-history.group`、`home.server-history.item`、`home.server-history.select`、`home.server-history.favorite-toggle`、`home.favorite-toggle`、`home.identity`、`home.identity-actions`、`home.identity-provider.button`、`home.identity-provider.label`、`home.identity-import.open`、`home.identity-export.button`、`home.identity-import-dialog`、`home.identity-import.header`、`home.identity-import.close`、`home.identity-import.textarea`、`home.identity-import.drop-zone`、`home.identity-import.file-button`、`home.identity-import.error`、`home.identity-import.security`、`home.identity-import.footer`、`home.identity-import.cancel`、`home.identity-import.submit`、`home.server-announcement`、`home.server-announcement.title`、`home.server-announcement.body`、`home.social-links`、`home.connection-status`、`home.connect`、`home.security-note`、`home.footer`、`home.community-dialog` |
|
||||
| 语音工作区 | `voice.shell`、`voice.workspace`、`voice.header`、`voice.header-actions`、`voice.plugin-toolbar`、`voice.breadcrumbs`、`voice.performance`、`voice.performance.panel`、`voice.performance.route`、`voice.performance.metrics`、`voice.performance.status`、`voice.performance.webrtc-stats`、`voice.connection-status`、`voice.audio-status`、`voice.poke`、`voice.scroll`、`voice.content`、`voice.activity`、`voice.activity.artwork`、`voice.activity-heading`、`voice.screen-share-error`、`voice.members`、`voice.members.empty`、`voice.member`、`voice.member.action-trigger`、`voice.member.avatar-wrap`、`voice.member.avatar`、`voice.member.mic-status`、`voice.member.name`、`voice.member.status`、`voice.member.live-indicator`、`voice.member.stop-share`、`voice.member.share-actions`、`voice.member-panel`、`voice.member-panel.heading`、`voice.member-panel.search`、`voice.member-panel.channels`、`voice.channel-group`、`voice.channel-group.heading`、`voice.channel-group.members`、`voice.member-row`、`voice.member-row.avatar`、`voice.member-row.copy`、`voice.member-row.flags`、`voice.member-row.volume`、`voice.whisper-strip`、`voice.audio-dock`、`voice.audio-dock.microphone`、`voice.audio-dock.microphone-panel`、`voice.audio-dock.output`、`voice.audio-dock.output-panel`、`voice.audio-settings`、`voice.audio-settings.device-select`、`voice.audio-settings.device-select-trigger`、`voice.audio-settings.device-select-chevron`、`voice.audio-settings.device-select-menu`、`voice.audio-settings.device-select-option`、`voice.mobile-more`、`voice.mobile-nav` |
|
||||
| 语音工作区 | `voice.shell`、`voice.workspace`、`voice.header`、`voice.header-actions`、`voice.plugin-toolbar`、`voice.plugin-launcher`、`voice.plugin-drawer`、`voice.plugin-drawer.app`、`voice.breadcrumbs`、`voice.performance`、`voice.performance.panel`、`voice.performance.route`、`voice.performance.metrics`、`voice.performance.status`、`voice.performance.webrtc-stats`、`voice.connection-status`、`voice.audio-status`、`voice.poke`、`voice.scroll`、`voice.content`、`voice.activity`、`voice.activity.artwork`、`voice.activity-heading`、`voice.screen-share-error`、`voice.members`、`voice.members.empty`、`voice.member`、`voice.member.action-trigger`、`voice.member.avatar-wrap`、`voice.member.avatar`、`voice.member.mic-status`、`voice.member.name`、`voice.member.status`、`voice.member.live-indicator`、`voice.member.stop-share`、`voice.member.share-actions`、`voice.member-panel`、`voice.member-panel.heading`、`voice.member-panel.search`、`voice.member-panel.channels`、`voice.channel-group`、`voice.channel-group.heading`、`voice.channel-group.members`、`voice.member-row`、`voice.member-row.avatar`、`voice.member-row.copy`、`voice.member-row.flags`、`voice.member-row.volume`、`voice.whisper-strip`、`voice.audio-dock`、`voice.audio-dock.microphone`、`voice.audio-dock.microphone-panel`、`voice.audio-dock.output`、`voice.audio-dock.output-panel`、`voice.audio-settings`、`voice.audio-settings.device-select`、`voice.audio-settings.device-select-trigger`、`voice.audio-settings.device-select-chevron`、`voice.audio-settings.device-select-menu`、`voice.audio-settings.device-select-option`、`voice.mobile-more`、`voice.mobile-nav` |
|
||||
| KOOK 频道树与服务器切换 | `voice.server-switcher`、`voice.server-switcher.trigger`、`voice.server-switcher.menu`、`voice.server-switcher.item`、`voice.server-switcher.icon`、`voice.server-switcher.label`、`voice.server-switcher.current`、`voice.server-switcher.empty`、`voice.channel-tree.list`、`voice.channel-tree.empty`、`voice.channel-tree.node`、`voice.channel-tree.line`、`voice.channel-tree.expander`、`voice.channel-tree.row`、`voice.channel-tree.icon`、`voice.channel-tree.join-hint`、`voice.channel-tree.name`、`voice.channel-tree.count`、`voice.channel-tree.branch`、`voice.channel-tree.member`、`voice.channel-tree.avatar`、`voice.channel-tree.member-name`、`voice.channel-tree.member-muted`、`voice.channel-tree.member-screen-share`、`voice.channel-tree.member-speaking`、`voice.channel-tree.member-away` |
|
||||
| 快速服务器 | `voice.favorite-servers.rail`、`voice.favorite-servers.rail.list`、`voice.favorite-servers.rail.item`、`voice.favorite-servers.server`、`voice.favorite-servers.avatar`、`voice.favorite-servers.tooltip`、`voice.favorite-servers.favorite-toggle`、`voice.favorite-servers.add`、`voice.favorite-servers.strip`、`voice.favorite-servers.strip.item`、`voice.favorite-servers.strip.server`、`voice.favorite-servers.strip.favorite-toggle`、`voice.favorite-servers.strip.add`、`voice.favorite-servers.switch-status`、`voice.favorite-servers.current-toggle`、`voice.favorite-servers.dialog-backdrop`、`voice.favorite-servers.dialog`、`voice.favorite-servers.dialog.header`、`voice.favorite-servers.dialog.close`、`voice.favorite-servers.dialog.form`、`voice.favorite-servers.dialog.field`、`voice.favorite-servers.dialog.input`、`voice.favorite-servers.dialog.target`、`voice.favorite-servers.dialog.hint`、`voice.favorite-servers.dialog.actions`、`voice.favorite-servers.dialog.cancel`、`voice.favorite-servers.dialog.submit` |
|
||||
| 聊天与菜单 | `voice.chat`、`voice.chat.tabs`、`voice.chat.tab`、`voice.chat.heading`、`voice.chat.messages`、`voice.chat.event`、`voice.chat.message`、`voice.chat.message-avatar`、`voice.chat.message-body`、`voice.chat.message-bubble`、`voice.chat.empty`、`voice.chat.composer`、`voice.chat.status`、`voice.context-menu-backdrop`、`voice.context-menu`、`voice.context-menu.header`、`voice.context-menu.move-submenu` |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This example turns the Discord-inspired voice interface into a portable WebSpeak `open-skin` v3 package. Its page structure is declared in `components.json`; its palette and layout are in `skin.css`; localized skin copy lives in `content.json`.
|
||||
|
||||
The independent distribution repository is [Huddle-Up-Forge/webspeak-skin-discord-voice](https://github.com/Huddle-Up-Forge/webspeak-skin-discord-voice). It is the first entry in the [WebSpeak skin store index](https://github.com/Huddle-Up-Forge/webspeak-skins). Administrators can install it from **Skins → Skin store**, then manage availability and the instance default under **Instance skins**. Version 1.0.11 requires WebSpeak 0.2.8 with the current public skin API.
|
||||
The independent distribution repository is [Huddle-Up-Forge/webspeak-skin-discord-voice](https://github.com/Huddle-Up-Forge/webspeak-skin-discord-voice). It is the first entry in the [WebSpeak skin store index](https://github.com/Huddle-Up-Forge/webspeak-skins). Administrators can install it from **Skins → Skin store**, then manage availability and the instance default under **Instance skins**. Version 1.0.12 requires WebSpeak 0.3.2 with the current public skin API.
|
||||
|
||||
The package uses WebSpeak's public TeamSpeak widgets for channel navigation, member cards, chat, audio controls, screen sharing, performance status, server switching and invite links. That keeps connection logic and trusted actions in WebSpeak while the skin controls the visible layout. The Discord visual language and color palette are retained, while host-owned controls keep their supported behavior and accessibility.
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ The owner authorized inspection of the first two voice rooms in the KOOK server.
|
||||
|
||||
## Returning to the workspace
|
||||
|
||||
KAAK 3.1.131 uses the normal connection home on every visit. It no longer opts into persistent workspace entry. The connection-status and explicit reconnect controls remain available inside the voice workspace.
|
||||
KAAK 3.1.132 uses the normal connection home on every visit. It no longer opts into persistent workspace entry. The connection-status and explicit reconnect controls remain available inside the voice workspace.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Binary file not shown.
@@ -263,6 +263,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{"widget":"voice.plugin-launcher","part":"plugin-launcher","options":{"pluginPresentation":"drawer-side"}},
|
||||
{
|
||||
"tag": "div",
|
||||
"className": "dc-sidebar-scroll",
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
"packageType": "open-skin",
|
||||
"id": "community.discord-voice",
|
||||
"name": "Discord Voice",
|
||||
"version": "1.0.11",
|
||||
"version": "1.0.12",
|
||||
"author": "WebSpeak Project",
|
||||
"license": "AGPL-3.0-only",
|
||||
"description": "A Discord-inspired dark voice workspace built with WebSpeak's portable open-skin interface.",
|
||||
"entry": "skin.css",
|
||||
"components": "components.json",
|
||||
"content": "content.json",
|
||||
"minAppVersion": "0.2.8"
|
||||
"minAppVersion": "0.3.2"
|
||||
}
|
||||
@@ -2149,3 +2149,20 @@
|
||||
scroll-behavior: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
[data-ws-plugin-part="discord-workspace.plugin-launcher"] {
|
||||
flex: 0 0 auto;
|
||||
padding: 4px 8px;
|
||||
--skin-plugin-app-accent: #c9cdfc;
|
||||
}
|
||||
[data-ws-plugin-part="discord-workspace.plugin-launcher"] [data-ws-part="voice.plugin-launcher"] > button {
|
||||
color: var(--skin-plugin-app-accent);
|
||||
}
|
||||
[data-ws-plugin-part="discord-workspace.plugin-launcher"] [data-ws-part="voice.plugin-drawer"] {
|
||||
background: #242529;
|
||||
color: #e8e9ed;
|
||||
border-color: #3f4148;
|
||||
}
|
||||
[data-ws-plugin-part="discord-workspace.plugin-launcher"] [data-ws-part="voice.plugin-drawer.app"]:hover {
|
||||
background: #383a44;
|
||||
}
|
||||
Binary file not shown.
@@ -584,7 +584,8 @@
|
||||
},
|
||||
{
|
||||
"widget": "home.social-links",
|
||||
"part": "rail-links"
|
||||
"part": "rail-links",
|
||||
"options": { "communityLinks": false }
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -864,6 +865,7 @@
|
||||
"widget": "voice.server-header",
|
||||
"part": "server-summary"
|
||||
},
|
||||
{"widget":"voice.plugin-launcher","part":"plugin-launcher","options":{"pluginPresentation":"drawer-side"}},
|
||||
{
|
||||
"widget": "voice.server-banner",
|
||||
"part": "server-banner"
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
"packageType": "open-skin",
|
||||
"id": "community.kaak-voice",
|
||||
"name": "KAAK",
|
||||
"version": "3.1.131",
|
||||
"version": "3.1.132",
|
||||
"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.8"
|
||||
"minAppVersion": "0.3.2"
|
||||
}
|
||||
@@ -4715,3 +4715,20 @@
|
||||
height: auto;
|
||||
max-height: calc(100dvh - 32px);
|
||||
}
|
||||
|
||||
[data-ws-plugin-part="kaak-workspace.plugin-launcher"] {
|
||||
flex: 0 0 auto;
|
||||
padding: 4px 8px;
|
||||
--skin-plugin-app-accent: #a8ed50;
|
||||
}
|
||||
[data-ws-plugin-part="kaak-workspace.plugin-launcher"] [data-ws-part="voice.plugin-launcher"] > button {
|
||||
color: var(--skin-plugin-app-accent);
|
||||
}
|
||||
[data-ws-plugin-part="kaak-workspace.plugin-launcher"] [data-ws-part="voice.plugin-drawer"] {
|
||||
background: #24272a;
|
||||
color: #e8e9ed;
|
||||
border-color: #3d4048;
|
||||
}
|
||||
[data-ws-plugin-part="kaak-workspace.plugin-launcher"] [data-ws-part="voice.plugin-drawer.app"]:hover {
|
||||
background: #2b3524;
|
||||
}
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "webspeak-android-gateway",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "webspeak-android-gateway",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"dependencies": {
|
||||
"@honeybbq/teamspeak": "1.0.0-beta.23",
|
||||
"express": "^4.21.2",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "webspeak-android-gateway",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "index.cjs",
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "webspeak-webclient",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "webspeak-webclient",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "^0.10.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "webspeak-webclient",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"private": true,
|
||||
"license": "AGPL-3.0-only",
|
||||
"type": "module",
|
||||
|
||||
@@ -275,6 +275,9 @@ const PUBLIC_PART_IDS = new Set<string>([
|
||||
"voice.header",
|
||||
"voice.header-actions",
|
||||
"voice.plugin-toolbar",
|
||||
"voice.plugin-launcher",
|
||||
"voice.plugin-drawer",
|
||||
"voice.plugin-drawer.app",
|
||||
"voice.member",
|
||||
"voice.member-panel",
|
||||
"voice.member-panel.channels",
|
||||
@@ -366,7 +369,7 @@ const ACTION_PART_IDS = new Set([
|
||||
"voice.favorite-servers.strip.server", "demo.voice-card", "home.identity-import.drop-zone",
|
||||
"voice.channel-group", "voice.member-row", "voice.server-switcher.trigger", "voice.server-switcher.item",
|
||||
"voice.channel-tree.expander", "voice.channel-tree.row", "demo.skin-switcher", "demo.language-switcher",
|
||||
"skin.library", "home.footer.clear", "host.plugins.launcher",
|
||||
"skin.library", "home.footer.clear", "host.plugins.launcher", "voice.plugin-drawer.app",
|
||||
]);
|
||||
const INTERACTIVE_PART_IDS = new Set([
|
||||
"voice.invite.create", "voice.invite.copy",
|
||||
|
||||
@@ -67,6 +67,7 @@ export const SKIN_PLUGIN_HOST_WIDGETS = Object.freeze([
|
||||
"voice.connection-status",
|
||||
"voice.connection-controls",
|
||||
"voice.disconnect-control",
|
||||
"voice.plugin-launcher",
|
||||
] as const);
|
||||
export type SkinPluginHostWidget = typeof SKIN_PLUGIN_HOST_WIDGETS[number];
|
||||
export interface SkinPluginWidgetOptions {
|
||||
@@ -78,6 +79,8 @@ export interface SkinPluginWidgetOptions {
|
||||
memberDragDrop?: boolean;
|
||||
/** Select a supported host presentation for a channel tree. */
|
||||
layout?: "default" | "server-sidebar";
|
||||
pluginPresentation?: "dialog" | "drawer-below" | "drawer-side";
|
||||
communityLinks?: boolean;
|
||||
/** Provider identity used by the generic, UI-only home sign-in entry. */
|
||||
identityProviderId?: string;
|
||||
/** Provider display name used by the generic, UI-only home sign-in entry. */
|
||||
@@ -479,6 +482,7 @@ export function parseSkinPluginDocument(input: unknown): SkinPluginDocument {
|
||||
if (typeof rawNode.widget !== "string" || !HOST_WIDGETS.has(rawNode.widget)) fail("SKIN_PLUGIN_WIDGET_INVALID", "The component requests an unsupported host widget.");
|
||||
if (page === "demo") fail("SKIN_PLUGIN_WIDGET_INVALID", "Host widgets are available only on the home and voice client pages.");
|
||||
if (rawNode.widget === "home.visitor-count" && page !== "home") fail("SKIN_PLUGIN_WIDGET_INVALID", "The visitor count widget is available only on the home page.");
|
||||
if (rawNode.widget === "voice.plugin-launcher" && page !== "voice") fail("SKIN_PLUGIN_WIDGET_INVALID", "The plugin launcher is available only on the voice page.");
|
||||
if (rawNode.options !== undefined && inputSchemaVersion < 3) fail("SKIN_PLUGIN_SCHEMA_UNSUPPORTED", "Host widget options require components schema version 3.");
|
||||
// Preserve existing schema v2 packages; newly authored v3 widgets must declare every
|
||||
// permission needed by the trusted host UI they embed. Screen-share start was already gated.
|
||||
@@ -494,12 +498,21 @@ export function parseSkinPluginDocument(input: unknown): SkinPluginDocument {
|
||||
? new Set(["layout"])
|
||||
: rawNode.widget === "home.identity-provider"
|
||||
? new Set(["identityProviderId", "identityProviderLabel"])
|
||||
: new Set<string>();
|
||||
: rawNode.widget === "voice.plugin-launcher"
|
||||
? new Set(["pluginPresentation"])
|
||||
: rawNode.widget === "home.social-links"
|
||||
? new Set(["communityLinks"])
|
||||
: new Set<string>();
|
||||
if (!isRecord(rawNode.options)
|
||||
|| Object.keys(rawNode.options).some((key) => !supportedOptions.has(key))
|
||||
|| (rawNode.options.screenShare !== undefined && typeof rawNode.options.screenShare !== "boolean")
|
||||
|| (rawNode.options.memberActions !== undefined && typeof rawNode.options.memberActions !== "boolean")
|
||||
|| (rawNode.options.memberDragDrop !== undefined && typeof rawNode.options.memberDragDrop !== "boolean")
|
||||
|| (rawNode.options.communityLinks !== undefined && typeof rawNode.options.communityLinks !== "boolean")
|
||||
|| (rawNode.options.pluginPresentation !== undefined
|
||||
&& rawNode.options.pluginPresentation !== "dialog"
|
||||
&& rawNode.options.pluginPresentation !== "drawer-below"
|
||||
&& rawNode.options.pluginPresentation !== "drawer-side")
|
||||
|| (rawNode.options.layout !== undefined
|
||||
&& rawNode.options.layout !== "default"
|
||||
&& !(rawNode.widget === "voice.channel-tree" && rawNode.options.layout === "server-sidebar"))
|
||||
@@ -517,6 +530,8 @@ export function parseSkinPluginDocument(input: unknown): SkinPluginDocument {
|
||||
...(rawNode.options.memberActions !== undefined ? { memberActions: rawNode.options.memberActions } : {}),
|
||||
...(rawNode.options.memberDragDrop !== undefined ? { memberDragDrop: rawNode.options.memberDragDrop } : {}),
|
||||
...(rawNode.options.layout !== undefined ? { layout: rawNode.options.layout } : {}),
|
||||
...(rawNode.options.pluginPresentation !== undefined ? { pluginPresentation: rawNode.options.pluginPresentation } : {}),
|
||||
...(rawNode.options.communityLinks !== undefined ? { communityLinks: rawNode.options.communityLinks } : {}),
|
||||
...(rawNode.options.identityProviderId !== undefined ? { identityProviderId: rawNode.options.identityProviderId } : {}),
|
||||
...(rawNode.options.identityProviderLabel !== undefined ? { identityProviderLabel: rawNode.options.identityProviderLabel } : {}),
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
def appVersion = project.hasProperty('appVersion') ? project.property('appVersion').toString() : '0.3.1'
|
||||
def appVersionCode = project.hasProperty('appVersionCode') ? project.property('appVersionCode').toString().toInteger() : 301
|
||||
def appVersion = project.hasProperty('appVersion') ? project.property('appVersion').toString() : '0.3.2'
|
||||
def appVersionCode = project.hasProperty('appVersionCode') ? project.property('appVersionCode').toString().toInteger() : 302
|
||||
|
||||
android {
|
||||
namespace = "io.webspeak.client"
|
||||
|
||||
Generated
+2
-2
@@ -25,7 +25,7 @@
|
||||
"vite": "^6.4.3",
|
||||
"vue-tsc": "^2.2.8"
|
||||
},
|
||||
"version": "0.3.1"
|
||||
"version": "0.3.2"
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.27.1",
|
||||
@@ -2952,5 +2952,5 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"version": "0.3.1"
|
||||
"version": "0.3.2"
|
||||
}
|
||||
+1
-1
@@ -27,5 +27,5 @@
|
||||
"vite": "^6.4.3",
|
||||
"vue-tsc": "^2.2.8"
|
||||
},
|
||||
"version": "0.3.1"
|
||||
"version": "0.3.2"
|
||||
}
|
||||
Binary file not shown.
@@ -1,10 +1,24 @@
|
||||
<template>
|
||||
<Teleport v-if="toolbarTarget" :to="toolbarTarget">
|
||||
<div v-if="thirdPartyAllowed && connected && sessionToken" class="ws-plugin-toolbar">
|
||||
<button v-if="!isHostPartHidden('host.plugins.launcher')" ref="launcher" class="header-action ws-plugin-toolbar-trigger" data-ws-part="host.plugins.launcher" type="button" :title="tr('title')" :aria-label="tr('title')" :aria-expanded="visible" @click="toggle">
|
||||
<Teleport :to="toolbarTarget ?? 'body'">
|
||||
<div v-if="thirdPartyAllowed && connected && sessionToken" ref="toolbar" class="ws-plugin-toolbar" :class="{ 'ws-plugin-toolbar-fallback': !toolbarTarget }" data-ws-part="voice.plugin-launcher" :data-presentation="presentation" :data-theme="theme" @keydown.esc="dismissDrawer">
|
||||
<button v-if="!isHostPartHidden('host.plugins.launcher')" ref="launcher" class="header-action ws-plugin-toolbar-trigger" data-ws-part="host.plugins.launcher" type="button" :title="tr('title')" :aria-label="tr('title')" :aria-expanded="presentation === 'dialog' ? visible : drawerOpen" :aria-controls="drawerOpen ? drawerId : undefined" @click="toggle">
|
||||
<svg viewBox="0 0 24 24" data-ws-icon-slot="host.plugins.launcher" aria-hidden="true"><path d="M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z" /></svg>
|
||||
<span v-if="presentation === 'drawer-side'">{{ tr('title') }}</span>
|
||||
</button>
|
||||
<button v-for="entry in pinnedApps" :key="entry.manifest.id" class="header-action ws-plugin-toolbar-shortcut" type="button" :title="entry.manifest.name" :aria-label="entry.manifest.name" :disabled="busy || entry.runtime.state === 'failed'" @click="launch(entry.manifest.id)">{{ entry.manifest.name.slice(0, 1).toUpperCase() }}</button>
|
||||
<section v-if="drawerOpen" :id="drawerId" ref="drawer" class="ws-plugin-drawer" data-ws-part="voice.plugin-drawer" :aria-label="tr('title')">
|
||||
<input ref="drawerSearch" v-model="search" class="ws-plugin-drawer-search" type="search" :placeholder="ui.search" :aria-label="ui.search" />
|
||||
<p v-if="error" role="alert">{{ error }}</p>
|
||||
<p v-else-if="busy && !available.length" role="status">{{ tr('loading') }}</p>
|
||||
<p v-else-if="!filtered.length">{{ available.length ? ui.noResults : tr('empty') }}</p>
|
||||
<ul v-if="filtered.length">
|
||||
<li v-for="entry in filtered" :key="entry.manifest.id">
|
||||
<button type="button" class="ws-plugin-drawer-app" data-ws-part="voice.plugin-drawer.app" :disabled="busy || entry.runtime.state === 'failed'" :title="entry.runtime.error || entry.manifest.name" @click="launch(entry.manifest.id)">
|
||||
<span class="ws-plugin-drawer-mark" aria-hidden="true">{{ entry.manifest.name.slice(0, 1).toUpperCase() }}</span>
|
||||
<span>{{ entry.manifest.name }}</span><span v-if="entry.toolbarPinned" aria-hidden="true">★</span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</Teleport>
|
||||
<Teleport to="body">
|
||||
@@ -19,13 +33,13 @@
|
||||
<button class="ws-plugin-close" type="button" :title="tr('close')" :aria-label="tr('close')" @click="close"><svg viewBox="0 0 24 24"><path d="m6 6 12 12M18 6 6 18" /></svg></button>
|
||||
</div>
|
||||
</header>
|
||||
<nav class="ws-plugin-navigation" :aria-label="tr('title')">
|
||||
<nav v-if="dialogLibrary" class="ws-plugin-navigation" :aria-label="tr('title')">
|
||||
<button type="button" :class="{ active: !appView }" @click="appView = false">{{ ui.workspace }}</button>
|
||||
<button v-if="current" type="button" :class="{ active: appView }" @click="appView = true">{{ current.manifest.name }}</button>
|
||||
<span v-if="current && appView" class="ws-plugin-version">v{{ current.manifest.version }}</span>
|
||||
</nav>
|
||||
<p v-if="error" role="alert" class="ws-plugin-error">{{ error }}</p>
|
||||
<div v-show="!appView" class="ws-plugin-library">
|
||||
<div v-if="dialogLibrary" v-show="!appView" class="ws-plugin-library">
|
||||
<div class="ws-plugin-library-heading"><div><h2>{{ tr('title') }}</h2><span>{{ available.length }} {{ ui.count }}</span></div><button type="button" :disabled="busy" @click="refresh">{{ busy ? tr('loading') : tr('refresh') }}</button></div>
|
||||
<input v-model="search" class="ws-plugin-search" type="search" :placeholder="ui.search" :aria-label="ui.search" />
|
||||
<p v-if="!busy && !filtered.length" class="ws-plugin-empty">{{ available.length ? ui.noResults : tr('empty') }}</p>
|
||||
@@ -47,24 +61,32 @@
|
||||
</Teleport>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue';
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, shallowRef, useId, watch } from 'vue';
|
||||
import { createPluginAppClient, type AvailablePluginApp, type PluginAppClient } from '../services/plugin-app-client.js';
|
||||
import { type PluginAppLaunch, pluginRecord } from '../../../src/shared/plugins.js';
|
||||
import { pluginTranslations, type PluginTextKey } from '../i18n/plugins.js';
|
||||
import { pluginWindowTranslations } from '../i18n/plugin-window.js';
|
||||
import type { SiteLanguage } from '../../../src/site-copy.js';
|
||||
import { thirdPartyAllowed } from '../services/instance-authorization.js';
|
||||
import { isHostPartHidden, pluginLibraryRequests } from '../services/host-chrome.js';
|
||||
const props = defineProps<{ sessionToken: string; gatewayUrl: string; connected: boolean; language: SiteLanguage; toolbarTarget: HTMLElement | null }>();
|
||||
import { isHostPartHidden, isHostPartVisuallyReachable, pluginLibraryRequests } from '../services/host-chrome.js';
|
||||
import type { SkinPluginWidgetOptions } from '../../../src/shared/skin-plugin.js';
|
||||
const props = defineProps<{ sessionToken: string; gatewayUrl: string; connected: boolean; language: SiteLanguage; toolbarTarget: HTMLElement | null; presentation: NonNullable<SkinPluginWidgetOptions['pluginPresentation']> }>();
|
||||
const tr = (key: PluginTextKey) => pluginTranslations[props.language][key];
|
||||
const ui = computed(() => pluginWindowTranslations[props.language]);
|
||||
const windowElement = ref<HTMLElement | null>(null), launcher = ref<HTMLButtonElement | null>(null), frame = ref<HTMLIFrameElement | null>(null);
|
||||
const available = shallowRef<AvailablePluginApp[]>([]), current = shallowRef<PluginAppLaunch | null>(null);
|
||||
const pinnedApps = computed(() => available.value.filter(entry => entry.toolbarPinned));
|
||||
const toolbar = ref<HTMLElement | null>(null);
|
||||
const drawerOpen = ref(false);
|
||||
const drawer = ref<HTMLElement | null>(null);
|
||||
const drawerSearch = ref<HTMLInputElement | null>(null);
|
||||
const drawerId = useId();
|
||||
const dialogLibrary = ref(false);
|
||||
const busy = ref(false), error = ref(''), theme = ref<'light' | 'dark'>('light');
|
||||
const visible = ref(false), maximized = ref(false), appView = ref(false), dragging = ref(false), search = ref('');
|
||||
const position = ref<Record<string, string>>({});
|
||||
const filtered = computed(() => available.value.filter(entry => `${entry.manifest.name} ${entry.manifest.description}`.toLocaleLowerCase().includes(search.value.trim().toLocaleLowerCase())));
|
||||
const filtered = computed(() => available.value
|
||||
.filter(entry => `${entry.manifest.name} ${entry.manifest.description}`.toLocaleLowerCase().includes(search.value.trim().toLocaleLowerCase()))
|
||||
.sort((a, b) => Number(b.toolbarPinned) - Number(a.toolbarPinned)));
|
||||
let epoch = 0, pending: AbortController | undefined, opening: { client: PluginAppClient; key: string } | undefined, observer: MutationObserver | undefined;
|
||||
let drag: { id: number; x: number; y: number; left: number; top: number; handle: HTMLElement; moved: boolean } | undefined;
|
||||
let resizeObserver: ResizeObserver | undefined;
|
||||
@@ -89,31 +111,75 @@ async function refresh() {
|
||||
finally { if (owner === epoch) { busy.value = false; pending = undefined; } }
|
||||
}
|
||||
function toggle() {
|
||||
if (visible.value) { minimize(); return; }
|
||||
detectTheme(); visible.value = true;
|
||||
if (!current.value) { appView.value = false; void refresh(); }
|
||||
if (props.presentation === 'dialog') {
|
||||
if (visible.value && dialogLibrary.value) { minimize(); return; }
|
||||
openLibraryDialog();
|
||||
return;
|
||||
}
|
||||
if (drawerOpen.value) { drawerOpen.value = false; return; }
|
||||
openDrawer();
|
||||
}
|
||||
function openDrawer() {
|
||||
drawerOpen.value = true;
|
||||
detectTheme();
|
||||
visible.value = false;
|
||||
search.value = '';
|
||||
if (!busy.value) void refresh();
|
||||
void nextTick(() => { fitDrawer(); drawerSearch.value?.focus({ preventScroll: true }); });
|
||||
}
|
||||
function openLibraryDialog() {
|
||||
drawerOpen.value = false;
|
||||
detectTheme();
|
||||
dialogLibrary.value = true;
|
||||
visible.value = true;
|
||||
appView.value = false;
|
||||
if (!busy.value) void refresh();
|
||||
void nextTick(() => { fitWindow(); windowElement.value?.focus(); });
|
||||
}
|
||||
function dismissDrawer(event: KeyboardEvent) {
|
||||
if (!drawerOpen.value) return;
|
||||
event.stopPropagation();
|
||||
drawerOpen.value = false;
|
||||
launcher.value?.focus();
|
||||
}
|
||||
function closeDrawerOutside(event: PointerEvent) {
|
||||
if (drawerOpen.value && toolbar.value && !event.composedPath().includes(toolbar.value)) drawerOpen.value = false;
|
||||
}
|
||||
function fitDrawer() {
|
||||
const element = drawer.value;
|
||||
if (!element || props.presentation !== 'drawer-below') return;
|
||||
element.style.translate = '';
|
||||
const box = element.getBoundingClientRect();
|
||||
const delta = Math.max(8 - box.left, Math.min(0, document.documentElement.clientWidth - 8 - box.right));
|
||||
if (delta) element.style.translate = `${delta}px 0`;
|
||||
}
|
||||
function minimize() { endDrag(); visible.value = false; launcher.value?.focus(); }
|
||||
function close() { stop(); error.value = ''; available.value = []; search.value = ''; minimize(); }
|
||||
function close() { drawerOpen.value = false; stop(); error.value = ''; available.value = []; search.value = ''; minimize(); }
|
||||
function stop() {
|
||||
++epoch; pending?.abort(); pending = undefined; const old = opening; opening = undefined; current.value = null; appView.value = false; busy.value = false;
|
||||
if (old) void old.client.cancelOpen(old.key).catch(() => undefined);
|
||||
}
|
||||
async function launch(id: string) {
|
||||
if (!thirdPartyAllowed.value) return;
|
||||
if (!thirdPartyAllowed.value || !props.connected || !props.sessionToken || busy.value) return;
|
||||
if (drawerOpen.value) dialogLibrary.value = false;
|
||||
drawerOpen.value = false;
|
||||
detectTheme(); visible.value = true;
|
||||
if (current.value?.manifest.id === id) { appView.value = true; return; }
|
||||
if (current.value?.manifest.id === id) { appView.value = true; focusAppWindow(); return; }
|
||||
stop(); const owner = ++epoch, controller = new AbortController(), service = client(), key = crypto.randomUUID(); pending = controller; opening = { client: service, key }; busy.value = true; error.value = '';
|
||||
try {
|
||||
const app = await service.open(id, { openId: key, theme: theme.value, language: props.language }, controller.signal);
|
||||
if (owner !== epoch) return;
|
||||
if (new URL(app.url).origin === location.origin) throw new Error('PLUGIN_SEPARATE_ORIGIN_REQUIRED');
|
||||
current.value = app; appView.value = true;
|
||||
focusAppWindow();
|
||||
} catch (e) {
|
||||
if (owner === epoch) { const old = opening; opening = undefined; if (old) void old.client.cancelOpen(old.key).catch(() => undefined); if (!controller.signal.aborted) error.value = `${tr('error')}: ${e instanceof Error ? e.message : ''}`; }
|
||||
} finally { if (owner === epoch) { busy.value = false; pending = undefined; } }
|
||||
}
|
||||
function focusAppWindow() {
|
||||
void nextTick(() => { fitWindow(); windowElement.value?.focus(); });
|
||||
}
|
||||
watch([() => props.toolbarTarget, () => props.presentation], () => { drawerOpen.value = false; });
|
||||
function message(event: MessageEvent) {
|
||||
if (!current.value || event.source !== frame.value?.contentWindow || event.origin !== new URL(current.value.url).origin || !pluginRecord(event.data)) return;
|
||||
if (event.data.type === 'webspeak-app-closed' && event.data.id === current.value.id) { stop(); error.value = tr('context'); }
|
||||
@@ -158,17 +224,20 @@ watch(() => props.language, appearance); watch(theme, appearance);
|
||||
// library reachable when a skin hides the toolbar launcher.
|
||||
watch(pluginLibraryRequests, () => {
|
||||
if (!thirdPartyAllowed.value || !props.connected || !props.sessionToken) return;
|
||||
detectTheme();
|
||||
visible.value = true;
|
||||
appView.value = false;
|
||||
if (!current.value) void refresh();
|
||||
void nextTick(() => { fitWindow(); windowElement.value?.focus(); });
|
||||
if (props.presentation !== 'dialog' && isHostPartVisuallyReachable('host.plugins.launcher')) openDrawer();
|
||||
else openLibraryDialog();
|
||||
});
|
||||
onMounted(() => {
|
||||
document.addEventListener('pointerdown', closeDrawerOutside, true);
|
||||
window.addEventListener('resize', fitDrawer);
|
||||
detectTheme(); window.addEventListener('message', message); window.addEventListener('resize', fitWindow); window.addEventListener('pointermove', moveDrag); window.addEventListener('pointerup', endDrag); window.addEventListener('pointercancel', endDrag); window.addEventListener('blur', endDrag);
|
||||
if (props.connected && thirdPartyAllowed.value) void refresh();
|
||||
observer = new MutationObserver(detectTheme); observer.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter: ['data-ws-skin', 'data-ws-host-skin', 'data-theme'] });
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener('pointerdown', closeDrawerOutside, true);
|
||||
window.removeEventListener('resize', fitDrawer);
|
||||
});
|
||||
onBeforeUnmount(() => { stop(); endDrag(); observer?.disconnect(); resizeObserver?.disconnect(); window.removeEventListener('message', message); window.removeEventListener('resize', fitWindow); window.removeEventListener('pointermove', moveDrag); window.removeEventListener('pointerup', endDrag); window.removeEventListener('pointercancel', endDrag); window.removeEventListener('blur', endDrag); });
|
||||
</script>
|
||||
<style src="../styles/plugin-overlay.css"></style>
|
||||
@@ -72,21 +72,50 @@
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="plugin-config-group" role="group" :aria-label="tr('config')">
|
||||
<div v-if="plugin.manifest.id === fileTransferId" class="plugin-config-group">
|
||||
<label>{{ tr('maxFileSize') }}
|
||||
<input v-model="model.drafts[plugin.manifest.id].publicFields.maxFileMiB" type="number" min="1" max="2048" placeholder="256" />
|
||||
</label>
|
||||
<p>{{ tr('fileTransferIceHelp') }}</p>
|
||||
</div>
|
||||
<div v-else-if="plugin.manifest.id === watchTogetherId" class="plugin-config-group">
|
||||
<label>{{ tr('playbackControl') }}
|
||||
<select v-model="model.drafts[plugin.manifest.id].publicFields.control">
|
||||
<option value="">{{ tr('configDefault') }} · {{ tr('controlEveryone') }}</option>
|
||||
<option value="everyone">{{ tr('controlEveryone') }}</option>
|
||||
<option value="host">{{ tr('controlHost') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<p>{{ tr('watchTogetherConfigHelp') }}</p>
|
||||
</div>
|
||||
<div v-else class="plugin-config-group" role="group" :aria-label="tr('config')">
|
||||
<p>{{ tr('config') }}</p>
|
||||
<PluginConfigValue :labels="valueLabels" :model-value="model.configValue(plugin.manifest.id, 'config')" @update:model-value="model.setConfigValue(plugin.manifest.id, 'config', $event)" />
|
||||
</div>
|
||||
<template v-if="plugin.manifest.server">
|
||||
<p class="plugin-config-help">
|
||||
<template v-if="plugin.manifest.server && plugin.manifest.id !== watchTogetherId">
|
||||
<p v-if="plugin.manifest.id !== fileTransferId" class="plugin-config-help">
|
||||
{{ tr('privateConfigHelp') }}
|
||||
</p>
|
||||
<label>{{ tr('privateConfig') }}
|
||||
<small>{{ tr(plugin.settings.hasServerConfig?'secretSaved':'secretEmpty') }}</small>
|
||||
<small v-if="plugin.manifest.id === fileTransferId">{{ tr('replaceIceHelp') }}</small>
|
||||
<select v-model="model.drafts[plugin.manifest.id].serverConfigAction">
|
||||
<option value="keep">{{ tr('keep') }}</option><option value="replace">{{ tr('replace') }}</option><option value="remove">{{ tr('erase') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<div v-if="model.drafts[plugin.manifest.id].serverConfigAction==='replace'" class="plugin-config-group" role="group" :aria-label="tr('privateConfig')">
|
||||
<div v-if="model.drafts[plugin.manifest.id].serverConfigAction==='replace' && plugin.manifest.id === fileTransferId" class="plugin-config-group">
|
||||
<label class="plugin-trust"><input v-model="model.drafts[plugin.manifest.id].defaultIce" type="checkbox" />{{ tr('defaultIce') }}</label>
|
||||
<template v-if="!model.drafts[plugin.manifest.id].defaultIce">
|
||||
<div v-for="(server, index) in model.drafts[plugin.manifest.id].iceServers" :key="index" class="plugin-config-grid">
|
||||
<label>{{ tr('iceUrls') }}<input v-model="server.urls" type="text" placeholder="turn:turn.example.com:3478" /></label>
|
||||
<label>{{ tr('iceUsername') }}<input v-model="server.username" type="text" autocomplete="off" /></label>
|
||||
<label>{{ tr('iceCredential') }}<input v-model="server.credential" type="password" autocomplete="new-password" /></label>
|
||||
<button type="button" class="plugin-button" @click="model.drafts[plugin.manifest.id].iceServers.splice(index, 1)">{{ tr('remove') }}</button>
|
||||
</div>
|
||||
<button type="button" class="plugin-button" @click="model.drafts[plugin.manifest.id].iceServers.push({urls:'',username:'',credential:''})">{{ tr('addIce') }}</button>
|
||||
</template>
|
||||
</div>
|
||||
<div v-else-if="model.drafts[plugin.manifest.id].serverConfigAction==='replace'" class="plugin-config-group" role="group" :aria-label="tr('privateConfig')">
|
||||
<PluginConfigValue secret :labels="valueLabels" :model-value="model.configValue(plugin.manifest.id, 'serverConfig')" @update:model-value="model.setConfigValue(plugin.manifest.id, 'serverConfig', $event)" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -106,7 +135,7 @@ import Icon from '../Icon.vue';
|
||||
import PluginConfigValue from './PluginConfigValue.vue';
|
||||
import type { SiteLanguage } from '../../../../src/site-copy.js';
|
||||
import { PLUGIN_STORE_REPOSITORY, type InstalledPlugin, type PluginStoreEntry, type PluginManifest } from '../../../../src/shared/plugins.js';
|
||||
import { musicBotId, musicBotPrivateFields, musicBotPublicFields, musicBotRepository, type useAdminPlugins } from '../../composables/useAdminPlugins.js';
|
||||
import { fileTransferId, watchTogetherId, musicBotId, musicBotPrivateFields, musicBotPublicFields, musicBotRepository, type useAdminPlugins } from '../../composables/useAdminPlugins.js';
|
||||
import { pluginTranslations, type PluginTextKey } from '../../i18n/plugins.js';
|
||||
import { pluginStoreTranslations, type PluginStoreTextKey } from '../../i18n/plugin-store.js';
|
||||
const props=defineProps<{model:ReturnType<typeof useAdminPlugins>;language:SiteLanguage}>();
|
||||
@@ -114,6 +143,8 @@ const tr=(key:PluginTextKey)=>pluginTranslations[props.language][key],text=(key:
|
||||
const valueLabels=computed(()=>({type:tr('valueType'),key:tr('fieldKey'),value:tr('fieldValue'),add:tr('addField'),remove:tr('remove')}));
|
||||
function describeError(code:string) {
|
||||
if(code==='TSMB_API_KEY_REQUIRED')return tr('musicBotConfigHelp');
|
||||
if(code==='PLUGIN_FILE_LIMIT_INVALID')return tr('maxFileSize');
|
||||
if(code==='PLUGIN_ICE_URL_INVALID')return tr('iceInvalid');
|
||||
if(code==='PLUGIN_CHECKSUM')return tr('storeChecksum');
|
||||
if(code==='PLUGIN_PACKAGE_MISMATCH')return tr('storeMismatch');
|
||||
return `${tr('error')} (${code})`;
|
||||
@@ -139,7 +170,7 @@ function onToggle(event:Event,id:string){if((event.target as HTMLDetailsElement)
|
||||
.plugin-setup-link,.plugin-installed-meta a{color:var(--admin-accent);display:inline-flex;align-items:center;gap:5px}
|
||||
.plugin-setup-link{margin-bottom:12px;font-size:12px}
|
||||
.plugin-config-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr));column-gap:16px}
|
||||
.plugin-config-grid input{box-sizing:border-box;width:100%;min-width:0;padding:10px 12px;border:1px solid var(--admin-border);border-radius:8px;background:var(--admin-field);color:var(--admin-text);font-size:12px}
|
||||
.plugin-config-grid input,.plugin-config-group input{box-sizing:border-box;width:100%;min-width:0;padding:10px 12px;border:1px solid var(--admin-border);border-radius:8px;background:var(--admin-field);color:var(--admin-text);font-size:12px}
|
||||
.plugin-config-field,.plugin-config-group{font-size:12px;color:var(--admin-muted);min-width:0}
|
||||
.plugin-config-field [role=group],.plugin-config-group{display:grid;gap:8px;margin-bottom:12px}
|
||||
section.page-content.plugin-admin{display:grid;grid-template-columns:minmax(0,1fr);grid-auto-rows:max-content;align-content:start;gap:24px;color:var(--admin-text);min-width:0}
|
||||
|
||||
@@ -41,6 +41,14 @@ export const musicBotPublicFields: readonly ConfigField[] = [
|
||||
{key:'locale',type:'text',placeholder:'auto'},
|
||||
];
|
||||
|
||||
export const fileTransferId = 'community.p2p-file-transfer';
|
||||
export const watchTogetherId = 'community.watch-together';
|
||||
|
||||
const exampleFields: Readonly<Record<string, readonly ConfigField[]>> = {
|
||||
[fileTransferId]: [{key:'maxFileMiB',type:'number',placeholder:'256'}],
|
||||
[watchTogetherId]: [{key:'control',type:'select',choices:['everyone','host'],placeholder:'everyone'}],
|
||||
};
|
||||
|
||||
function makeConfigDraft(fields: readonly ConfigField[], config?: JsonValue): Record<string, string> {
|
||||
return Object.fromEntries(fields.map(({key,type}) => {
|
||||
const value = pluginRecord(config) ? config[key] : undefined;
|
||||
@@ -71,12 +79,12 @@ function readConfigFields(fields: readonly ConfigField[], draft: Record<string,
|
||||
export function useAdminPlugins(api: AdminApi) {
|
||||
const installed=shallowRef<InstalledPlugin[]>([]),catalog=shallowRef<PluginCatalog|null>(null),runtime=shallowRef<PluginRuntimeSettings|null>(null);
|
||||
const origin=ref(''),busy=ref(false),error=ref(''),catalogError=ref(''),requests=createAdminRequests();
|
||||
const drafts=reactive<Record<string,{enabled:boolean;trusted:boolean;toolbarPinned:boolean;scope:'server'|'instance';targets:string;config:string;serverConfigAction:'keep'|'replace'|'remove';serverConfig:string;publicFields:Record<string,string>;privateFields:Record<string,string>}>>({});
|
||||
const drafts=reactive<Record<string,{enabled:boolean;trusted:boolean;toolbarPinned:boolean;scope:'server'|'instance';targets:string;config:string;serverConfigAction:'keep'|'replace'|'remove';serverConfig:string;publicFields:Record<string,string>;privateFields:Record<string,string>;iceServers:{urls:string;username:string;credential:string}[];defaultIce:boolean}>>({});
|
||||
function apply(records:InstalledPlugin[]){
|
||||
installed.value=records;
|
||||
for(const record of records)if(!drafts[record.manifest.id]){
|
||||
const musicBot = record.manifest.id === musicBotId;
|
||||
drafts[record.manifest.id]={enabled:record.settings.enabled,trusted:record.settings.trusted,toolbarPinned:record.settings.toolbarPinned,scope:record.settings.scope,targets:record.settings.targets.join('\n'),config:JSON.stringify(record.settings.config,null,2),serverConfigAction:'keep',serverConfig:'',publicFields:musicBot?makeConfigDraft(musicBotPublicFields,record.settings.config):{},privateFields:musicBot?makeConfigDraft(musicBotPrivateFields):{}};
|
||||
drafts[record.manifest.id]={enabled:record.settings.enabled,trusted:record.settings.trusted,toolbarPinned:record.settings.toolbarPinned,scope:record.settings.scope,targets:record.settings.targets.join('\n'),config:JSON.stringify(record.settings.config,null,2),serverConfigAction:'keep',serverConfig:'',publicFields:makeConfigDraft(musicBot?musicBotPublicFields:exampleFields[record.manifest.id]??[],record.settings.config),privateFields:musicBot?makeConfigDraft(musicBotPrivateFields):{},iceServers:[],defaultIce:true};
|
||||
}
|
||||
for(const id of Object.keys(drafts))if(!records.some(r=>r.manifest.id===id))delete drafts[id];
|
||||
}
|
||||
@@ -111,9 +119,19 @@ export function useAdminPlugins(api: AdminApi) {
|
||||
function save(record:InstalledPlugin){return work(async(signal,current)=>{
|
||||
const draft=drafts[record.manifest.id],captured=JSON.stringify(draft);
|
||||
const musicBot=record.manifest.id===musicBotId;
|
||||
const settings:PluginSettingsInput={enabled:draft.enabled,trusted:draft.trusted,toolbarPinned:draft.toolbarPinned,scope:draft.scope,targets:draft.targets.split(/\r?\n/).map(t=>t.trim()).filter(Boolean),config:musicBot?readConfigFields(musicBotPublicFields,draft.publicFields,record.settings.config):JSON.parse(draft.config),serverConfigAction:draft.serverConfigAction};
|
||||
const fields=musicBot?musicBotPublicFields:exampleFields[record.manifest.id];
|
||||
const settings:PluginSettingsInput={enabled:draft.enabled,trusted:draft.trusted,toolbarPinned:draft.toolbarPinned,scope:draft.scope,targets:draft.targets.split(/\r?\n/).map(t=>t.trim()).filter(Boolean),config:fields?readConfigFields(fields,draft.publicFields,record.settings.config):JSON.parse(draft.config),serverConfigAction:draft.serverConfigAction};
|
||||
if(record.manifest.id===fileTransferId && pluginRecord(settings.config) && typeof settings.config.maxFileMiB==='number'
|
||||
&& (settings.config.maxFileMiB<1 || settings.config.maxFileMiB>2048)) throw new Error('PLUGIN_FILE_LIMIT_INVALID');
|
||||
if(draft.serverConfigAction==='replace'){
|
||||
settings.serverConfig=musicBot?readConfigFields(musicBotPrivateFields,draft.privateFields):JSON.parse(draft.serverConfig);
|
||||
if(record.manifest.id===fileTransferId){
|
||||
settings.serverConfig=draft.defaultIce?{}:{iceServers:draft.iceServers.map(({urls,username,credential})=>({
|
||||
urls:urls.split(/\s+/).filter(Boolean),...(username.trim()?{username:username.trim()}:{}),...(credential?{credential}:{}),
|
||||
}))};
|
||||
if(!draft.defaultIce && draft.iceServers.some(server=>!server.urls.trim() || server.urls.trim().split(/\s+/).some(url=>!/^(stun|stuns|turn|turns):\S+$/i.test(url)))) throw new Error('PLUGIN_ICE_URL_INVALID');
|
||||
}else{
|
||||
settings.serverConfig=musicBot?readConfigFields(musicBotPrivateFields,draft.privateFields):JSON.parse(draft.serverConfig || '{}');
|
||||
}
|
||||
if(musicBot && pluginRecord(settings.serverConfig) && (typeof settings.serverConfig.apiKey !== 'string' || !/^tsmb_[A-Za-z0-9_-]{20,}$/.test(settings.serverConfig.apiKey))) throw new Error('TSMB_API_KEY_REQUIRED');
|
||||
}
|
||||
if(musicBot && draft.enabled && (draft.serverConfigAction==='remove' || (draft.serverConfigAction==='keep' && !record.settings.hasServerConfig))) throw new Error('TSMB_API_KEY_REQUIRED');
|
||||
@@ -128,7 +146,7 @@ export function useAdminPlugins(api: AdminApi) {
|
||||
const result=await api.uploadPlugin(pack,installed.value.find(p=>p.manifest.id===pack.manifest.id)?.revision??null,signal);
|
||||
if(current()){delete drafts[pack.manifest.id];apply([...installed.value.filter(p=>p.manifest.id!==pack.manifest.id),result.plugin]);}
|
||||
});}
|
||||
function cancelRequests(){requests.reset();busy.value=false;for(const draft of Object.values(drafts)){draft.serverConfig='';draft.serverConfigAction='keep';for(const key of Object.keys(draft.privateFields))draft.privateFields[key]='';}}
|
||||
function cancelRequests(){requests.reset();busy.value=false;for(const draft of Object.values(drafts)){draft.serverConfig='';draft.serverConfigAction='keep';draft.iceServers=[];draft.defaultIce=true;for(const key of Object.keys(draft.privateFields))draft.privateFields[key]='';}}
|
||||
function reset(){cancelRequests();installed.value=[];catalog.value=null;runtime.value=null;origin.value='';error.value='';catalogError.value='';for(const id of Object.keys(drafts))delete drafts[id];}
|
||||
return {installed,catalog,runtime,origin,busy,error,catalogError,drafts,load,install,save,restart,saveRuntime,remove,upload,cancelRequests,reset,configValue,setConfigValue,musicBotCollection,setMusicBotCollection};
|
||||
}
|
||||
@@ -44,6 +44,19 @@ const en = {
|
||||
"addField": "Add",
|
||||
"storeChecksum": "Package checksum differs from the catalog. Refresh the store and retry.",
|
||||
"storeMismatch": "The package version, scope, or entry points differ from the catalog.",
|
||||
"maxFileSize": "Maximum file size (MiB, 1–2048; default 256)",
|
||||
"fileTransferIceHelp": "Default STUN works without setup. Add your own TURN service if peers cannot connect directly. WebRTC clients receive the TURN credentials.",
|
||||
"playbackControl": "Playback controls",
|
||||
"controlEveryone": "All viewers",
|
||||
"controlHost": "Room host only",
|
||||
"watchTogetherConfigHelp": "Controls who can play, pause, seek, or change the video. This plugin has no private settings.",
|
||||
"defaultIce": "Use default STUN",
|
||||
"iceUrls": "ICE URLs (separate with spaces)",
|
||||
"iceUsername": "TURN username",
|
||||
"iceCredential": "TURN password",
|
||||
"addIce": "Add STUN or TURN server",
|
||||
"iceInvalid": "Enter a valid STUN or TURN URL for every server.",
|
||||
"replaceIceHelp": "Replacing these settings replaces the whole ICE server list. Add every server you want to keep.",
|
||||
"setupGuide": "Plugin setup guide",
|
||||
"keep": "Keep existing secret configuration",
|
||||
"replace": "Replace secret configuration",
|
||||
@@ -107,6 +120,19 @@ zh:{
|
||||
"addField": "添加",
|
||||
"storeChecksum": "安装包的 SHA‑256 与商店记录不符。请刷新商店后重试。",
|
||||
"storeMismatch": "安装包的版本、作用域或入口与商店记录不一致。",
|
||||
"maxFileSize": "单文件上限(MiB,1–2048,默认 256)",
|
||||
"fileTransferIceHelp": "默认使用 STUN,无需配置。若成员无法直连,可添加自己的 TURN 服务。TURN 凭据会下发给参与传输的浏览器。",
|
||||
"playbackControl": "播放控制权限",
|
||||
"controlEveryone": "所有观看者",
|
||||
"controlHost": "仅房主",
|
||||
"watchTogetherConfigHelp": "决定谁可以播放、暂停、跳转进度或更换视频。此插件没有私密配置。",
|
||||
"defaultIce": "使用默认 STUN",
|
||||
"iceUrls": "ICE 地址(多个用空格分隔)",
|
||||
"iceUsername": "TURN 用户名",
|
||||
"iceCredential": "TURN 密码",
|
||||
"addIce": "添加 STUN 或 TURN 服务器",
|
||||
"iceInvalid": "请为每个服务器填写有效的 STUN 或 TURN 地址。",
|
||||
"replaceIceHelp": "替换会覆盖整个 ICE 服务器列表,请填入全部要保留的服务器。",
|
||||
"setupGuide": "插件配置说明",
|
||||
"keep": "保留现有私密配置",
|
||||
"replace": "替换私密配置",
|
||||
@@ -167,6 +193,19 @@ de:{
|
||||
"addField": "Hinzufügen",
|
||||
"storeChecksum": "Die Paketprüfsumme weicht vom Katalog ab. Aktualisieren Sie den Store.",
|
||||
"storeMismatch": "Version, Geltungsbereich oder Einstiegspunkte weichen vom Katalog ab.",
|
||||
"maxFileSize": "Maximale Dateigröße (MiB, 1–2048; Standard 256)",
|
||||
"fileTransferIceHelp": "Standardmäßig wird STUN verwendet. Bei Verbindungsproblemen kann ein eigener TURN-Dienst helfen. WebRTC-Clients erhalten die TURN-Zugangsdaten.",
|
||||
"playbackControl": "Wiedergabesteuerung",
|
||||
"controlEveryone": "Alle Zuschauer",
|
||||
"controlHost": "Nur der Raum-Host",
|
||||
"watchTogetherConfigHelp": "Legt fest, wer Wiedergabe, Position und Video ändern darf. Das Plugin hat keine privaten Einstellungen.",
|
||||
"defaultIce": "Standard-STUN verwenden",
|
||||
"iceUrls": "ICE-URLs (mit Leerzeichen trennen)",
|
||||
"iceUsername": "TURN-Benutzername",
|
||||
"iceCredential": "TURN-Passwort",
|
||||
"addIce": "STUN- oder TURN-Server hinzufügen",
|
||||
"iceInvalid": "Geben Sie für jeden Server eine gültige STUN- oder TURN-URL ein.",
|
||||
"replaceIceHelp": "Beim Ersetzen wird die gesamte Liste überschrieben. Fügen Sie alle gewünschten Server hinzu.",
|
||||
"setupGuide": "Plugin-Konfigurationsanleitung",
|
||||
"keep": "Vorhandene private Konfiguration behalten",
|
||||
"replace": "Private Konfiguration ersetzen",
|
||||
@@ -227,6 +266,19 @@ ru:{
|
||||
"addField": "Добавить",
|
||||
"storeChecksum": "Контрольная сумма пакета не совпадает с каталогом. Обновите каталог.",
|
||||
"storeMismatch": "Версия, область или точки входа пакета не совпадают с каталогом.",
|
||||
"maxFileSize": "Размер файла (МиБ, 1–2048; по умолчанию 256)",
|
||||
"fileTransferIceHelp": "По умолчанию используется STUN. Если прямое подключение не работает, добавьте свой TURN. Браузеры участников получают данные TURN.",
|
||||
"playbackControl": "Управление воспроизведением",
|
||||
"controlEveryone": "Все зрители",
|
||||
"controlHost": "Только ведущий",
|
||||
"watchTogetherConfigHelp": "Определяет, кто управляет воспроизведением и выбором видео. Приватных настроек нет.",
|
||||
"defaultIce": "Использовать STUN по умолчанию",
|
||||
"iceUrls": "Адреса ICE (через пробел)",
|
||||
"iceUsername": "Имя пользователя TURN",
|
||||
"iceCredential": "Пароль TURN",
|
||||
"addIce": "Добавить сервер STUN или TURN",
|
||||
"iceInvalid": "Укажите корректный адрес STUN или TURN для каждого сервера.",
|
||||
"replaceIceHelp": "Замена перезапишет весь список ICE. Добавьте все нужные серверы.",
|
||||
"setupGuide": "Инструкция по настройке плагина",
|
||||
"keep": "Сохранить текущие приватные настройки",
|
||||
"replace": "Заменить приватные настройки",
|
||||
@@ -287,6 +339,19 @@ ja:{
|
||||
"addField": "追加",
|
||||
"storeChecksum": "パッケージのチェックサムがカタログと一致しません。ストアを更新してください。",
|
||||
"storeMismatch": "パッケージのバージョン、スコープ、またはエントリがカタログと一致しません。",
|
||||
"maxFileSize": "最大ファイルサイズ (MiB、1~2048、既定値 256)",
|
||||
"fileTransferIceHelp": "既定の STUN は設定不要です。直接接続できない場合は TURN を追加してください。TURN 認証情報は参加者のブラウザーに渡ります。",
|
||||
"playbackControl": "再生操作の権限",
|
||||
"controlEveryone": "すべての視聴者",
|
||||
"controlHost": "ルームのホストのみ",
|
||||
"watchTogetherConfigHelp": "再生・一時停止・シーク・動画変更を操作できる人を設定します。秘密設定はありません。",
|
||||
"defaultIce": "既定の STUN を使用",
|
||||
"iceUrls": "ICE URL(空白区切り)",
|
||||
"iceUsername": "TURN ユーザー名",
|
||||
"iceCredential": "TURN パスワード",
|
||||
"addIce": "STUN または TURN サーバーを追加",
|
||||
"iceInvalid": "各サーバーに有効な STUN または TURN URL を入力してください。",
|
||||
"replaceIceHelp": "置換すると ICE サーバーの一覧全体が更新されます。使用するサーバーをすべて追加してください。",
|
||||
"setupGuide": "プラグイン設定ガイド",
|
||||
"keep": "現在の秘密設定を保持",
|
||||
"replace": "秘密設定を置換",
|
||||
|
||||
@@ -46,11 +46,11 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [
|
||||
{
|
||||
id: BUILTIN_KAAK_SKIN_ID,
|
||||
name: "KAAK",
|
||||
version: "3.1.131",
|
||||
version: "3.1.132",
|
||||
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.",
|
||||
minAppVersion: "0.2.8",
|
||||
minAppVersion: "0.3.2",
|
||||
installedAt: 0,
|
||||
builtIn: true,
|
||||
},
|
||||
|
||||
@@ -490,9 +490,9 @@ 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.131");
|
||||
assert.equal(skin.version, "3.1.132");
|
||||
assert.equal(skin.workspace, undefined);
|
||||
assert.equal(skin.minAppVersion, "0.2.8");
|
||||
assert.equal(skin.minAppVersion, "0.3.2");
|
||||
assert.equal(BUILTIN_SKIN_CATALOG.find((entry) => entry.id === skin.id)?.version, skin.version);
|
||||
assert.equal(skin.schemaVersion, 3);
|
||||
const baseMessages = skin.contentData?.locales["zh-CN"]?.messages ?? {};
|
||||
@@ -507,6 +507,8 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
|
||||
const voice = skin.pluginData?.components.find((component) => component.page === "voice");
|
||||
assert.ok(voice?.permissions.includes("voice.connect"));
|
||||
assert.match(JSON.stringify(voice?.root), /"widget":"voice.connection-status"/);
|
||||
assert.match(JSON.stringify(voice?.root), /"widget":"voice.plugin-launcher".*?"pluginPresentation":"drawer-side"/);
|
||||
assert.match(JSON.stringify(voice?.root), /"widget":"home.social-links".*?"communityLinks":false/);
|
||||
assert.deepEqual(skin.pluginData?.components.map((component) => [component.id, component.mode]), [
|
||||
["kaak-home", "surface"],
|
||||
["kaak-workspace", "surface"],
|
||||
@@ -949,6 +951,7 @@ test("the Discord Voice package imports portable home and voice surfaces", async
|
||||
const file = new File([archive], "discord-voice.wskin", { type: "application/octet-stream" });
|
||||
const skin = await importSkinPack(file);
|
||||
assert.equal(skin.id, "community.discord-voice");
|
||||
assert.equal(skin.minAppVersion, "0.3.2");
|
||||
assert.equal(skin.packageType, "open-skin");
|
||||
assert.equal(skin.schemaVersion, 3);
|
||||
assert.deepEqual(skin.pluginData?.components.map(({ id, page, mode }) => [id, page, mode]), [
|
||||
@@ -963,6 +966,7 @@ test("the Discord Voice package imports portable home and voice surfaces", async
|
||||
assert.ok(voice?.permissions.includes("audio.microphone.control"));
|
||||
assert.ok(voice?.permissions.includes("voice.screenShare.control"));
|
||||
assert.equal(voice?.actions["copy-invite-link"]?.type, "session.copyInviteLink");
|
||||
assert.match(JSON.stringify(voice?.root), /"widget":"voice.plugin-launcher".*?"pluginPresentation":"drawer-side"/);
|
||||
assert.equal(skin.runtimePlugins?.plugins.length ?? 0, 0, "the open skin contains no executable plugin code");
|
||||
const baseMessageKeys = Object.keys(skin.contentData?.locales.en?.messages ?? {}).sort();
|
||||
for (const locale of ["zh-CN", "de", "ru", "ja"]) {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.ws-plugin-overlay button:focus-visible,.ws-plugin-search:focus-visible{outline:2px solid var(--po-accent);outline-offset:3px}
|
||||
.ws-plugin-overlay svg{display:block;width:19px;height:19px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
|
||||
.webspeak-plugin-toolbar-host{display:flex;align-items:center;flex:none;min-width:0;max-width:min(38vw,240px)}
|
||||
.ws-plugin-toolbar{display:flex;align-items:center;gap:4px;max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:none}
|
||||
.ws-plugin-toolbar{display:flex;align-items:center;gap:4px;max-width:100%;overflow:visible}
|
||||
.ws-plugin-toolbar::-webkit-scrollbar{display:none}
|
||||
.ws-plugin-toolbar .ws-plugin-toolbar-trigger,.ws-plugin-toolbar .ws-plugin-toolbar-shortcut{display:inline-flex;align-items:center;justify-content:center;flex:none;width:34px;height:34px;padding:7px;border-radius:10px;cursor:pointer}
|
||||
.ws-plugin-toolbar .ws-plugin-toolbar-trigger svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
|
||||
@@ -50,3 +50,20 @@
|
||||
.ws-plugin-browser iframe{display:block;flex:1;width:100%;height:100%;min-height:0;border:0;border-radius:0;background:var(--po-surface)}
|
||||
.ws-plugin-drag-shield{position:absolute;inset:62px 0 0;z-index:1;cursor:grabbing}
|
||||
@media(max-width:600px){.ws-plugin-window{left:8px!important;top:8px!important;transform:none!important;width:calc(100vw - 16px)!important;height:calc(100dvh - 92px);min-width:0;resize:none;border-radius:13px}.ws-plugin-titlebar{padding-left:12px;gap:8px}.ws-plugin-window-title small{display:none}.ws-plugin-library{padding:18px}.webspeak-plugin-toolbar-host{max-width:30vw}.ws-plugin-toolbar .ws-plugin-toolbar-shortcut{width:30px;height:30px}.ws-plugin-library-heading h2{font-size:21px}.ws-plugin-entry{padding:16px}.ws-plugin-navigation{padding-inline:10px}}
|
||||
|
||||
.ws-plugin-toolbar{position:relative;display:flex;align-items:center;min-width:0}
|
||||
.ws-plugin-toolbar-fallback{position:fixed;z-index:1001;right:16px;bottom:calc(16px + env(safe-area-inset-bottom));padding:4px;border-radius:12px;background:var(--ws-panel,#fff);box-shadow:0 4px 20px #0003;color:#233049}
|
||||
.ws-plugin-toolbar[data-presentation="drawer-side"]{display:grid;width:100%;gap:4px;color:inherit}
|
||||
.ws-plugin-toolbar[data-presentation="drawer-side"] .ws-plugin-toolbar-trigger{justify-content:flex-start;width:100%;gap:8px;padding:7px 10px;color:inherit;background:transparent;border:1px solid transparent;font:inherit}
|
||||
.ws-plugin-drawer{position:absolute;top:calc(100% + 8px);right:0;z-index:60;width:min(280px,calc(100vw - 32px));max-height:min(380px,60dvh);overflow:auto;overscroll-behavior:contain;padding:8px;color:var(--plugin-drawer-text,#233049);background:var(--plugin-drawer-bg,#fff);border:1px solid var(--plugin-drawer-border,#dae1ef);border-radius:12px;box-shadow:0 12px 32px #17223430;text-align:left;font:13px/1.4 system-ui,sans-serif}
|
||||
.ws-plugin-toolbar[data-theme="dark"] .ws-plugin-drawer{--plugin-drawer-text:#edf2ff;--plugin-drawer-bg:#202736;--plugin-drawer-border:#364158;--plugin-drawer-hover:#303a49}
|
||||
.ws-plugin-toolbar[data-presentation="drawer-side"] .ws-plugin-drawer{position:static;width:auto;max-height: min(250px,32dvh);box-shadow:none}
|
||||
.ws-plugin-drawer-search{box-sizing:border-box;width:100%;padding:6px 9px;border:1px solid var(--plugin-drawer-border,#dae1ef);border-radius:7px;background:transparent;color:inherit;font:inherit}
|
||||
.ws-plugin-drawer ul{display:grid;gap:2px;margin:6px 0 0;padding:0;list-style:none}
|
||||
.ws-plugin-drawer p{margin:8px 2px}
|
||||
.ws-plugin-drawer-app{display:grid;grid-template-columns:24px minmax(0,1fr) auto;align-items:center;width:100%;gap:8px;border:0;border-radius:7px;padding:5px;color:inherit;background:transparent;font:inherit;text-align:left;cursor:pointer}
|
||||
.ws-plugin-drawer-app span:nth-child(2){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.ws-plugin-drawer-app:hover,.ws-plugin-drawer-app:focus-visible{background:var(--plugin-drawer-hover,#eef1f8)}
|
||||
.ws-plugin-drawer-app:disabled{opacity:.55;cursor:default}
|
||||
.ws-plugin-drawer-mark{display:grid;place-items:center;height:24px;border:1px solid var(--plugin-drawer-border,#dae1ef);border-radius:6px}
|
||||
.ws-plugin-window .ws-plugin-error:last-of-type{overflow-wrap:anywhere}
|
||||
@@ -3007,7 +3007,7 @@
|
||||
:deep(.section-counter) {
|
||||
display: none;
|
||||
}
|
||||
.workspace-actions .header-action:first-child {
|
||||
.workspace-actions > .header-action:first-child {
|
||||
display: none;
|
||||
}
|
||||
.dock-icon {
|
||||
|
||||
@@ -874,7 +874,7 @@
|
||||
<div class="ws-skin-mount-slot" data-ws-skin-mount="voice.workspace.overlay"></div>
|
||||
</div>
|
||||
|
||||
<PluginPanel :session-token="pluginSession" :gateway-url="pluginVoiceSocket?.url ?? ''" :connected="voiceState.connected" :language="language" :toolbar-target="pluginToolbarTarget" />
|
||||
<PluginPanel :session-token="pluginSession" :gateway-url="pluginVoiceSocket?.url ?? ''" :connected="voiceState.connected" :language="language" :toolbar-target="skinPluginToolbar?.element ?? pluginToolbarTarget" :presentation="skinPluginToolbar?.presentation ?? (OFFICIAL_SKIN_IDS.has(activeSkinId) ? 'drawer-below' : 'dialog')" />
|
||||
<HostChrome :language="language" :connected="voiceState.connected" :plugin-library-available="voiceState.connected && Boolean(pluginSession)" />
|
||||
<IdentityImportDialog
|
||||
v-if="identityImportOpen"
|
||||
@@ -970,7 +970,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { observeMobileViewport } from "../services/mobile-viewport.js";
|
||||
import { computed, h, onMounted, onUnmounted, reactive, ref, shallowRef, watch } from "vue";
|
||||
import { computed, h, nextTick, onMounted, onUnmounted, reactive, ref, shallowRef, watch } from "vue";
|
||||
import Icon from "../components/Icon.vue";
|
||||
import VoiceConnectionStatus from "../components/web-client/VoiceConnectionStatus.vue";
|
||||
import { useVoiceWorkspace } from "../composables/useVoiceWorkspace.js";
|
||||
@@ -1011,6 +1011,7 @@ import { useWebClientChannels, type TreeChannel } from "../composables/useWebCli
|
||||
import { useWebClientConnection } from "../composables/useWebClientConnection.js";
|
||||
import { useWebClientMembers } from "../composables/useWebClientMembers.js";
|
||||
import PluginPanel from "../components/PluginPanel.vue";
|
||||
import { OFFICIAL_SKIN_IDS } from "../services/instance-authorization.js";
|
||||
import HostChrome from "../components/HostChrome.vue";
|
||||
import InstanceAuthorization from '../components/InstanceAuthorization.vue';
|
||||
import WorkspaceInviteDialog from "../components/web-client/WorkspaceInviteDialog.vue";
|
||||
@@ -1176,6 +1177,7 @@ const skinPluginDocument = computed<SkinPluginDocument>(() => {
|
||||
return loadSkinPluginAuthoringDocument(skin.id, skin.version) ?? skin.pluginData ?? emptySkinPluginDocument;
|
||||
});
|
||||
const pluginToolbarTarget = ref<HTMLElement | null>(null);
|
||||
const skinPluginToolbar = shallowRef<{ element: HTMLElement; presentation: NonNullable<SkinPluginWidgetOptions["pluginPresentation"]> } | null>(null);
|
||||
const skinPluginSurfaceActive = ref(false);
|
||||
const skinRuntimePluginSurfaceActive = ref(false);
|
||||
watch(activeSkin, () => {
|
||||
@@ -1832,11 +1834,11 @@ const skinPluginWidgets = {
|
||||
h("h2", { "data-ws-part": "home.server-announcement.title" }, t("serverAnnouncement")),
|
||||
h("p", { "data-ws-part": "home.server-announcement.body" }, localizedWelcomeText.value),
|
||||
]),
|
||||
"home.social-links": () => h("nav", {
|
||||
"home.social-links": (options?: SkinPluginWidgetOptions) => h("nav", {
|
||||
"data-ws-part": "home.social-links",
|
||||
"aria-label": t("communityLinks"),
|
||||
}, [
|
||||
h("a", {
|
||||
...(options?.communityLinks === false ? [] : [h("a", {
|
||||
href: githubRepositoryUrl,
|
||||
target: "_blank",
|
||||
rel: "noreferrer",
|
||||
@@ -1849,7 +1851,7 @@ const skinPluginWidgets = {
|
||||
rel: "noreferrer",
|
||||
title: t("qqGroup"),
|
||||
"aria-label": t("qqGroup"),
|
||||
}, [h(Icon, { name: "qq", size: 20 })]),
|
||||
}, [h(Icon, { name: "qq", size: 20 })])]),
|
||||
h("a", {
|
||||
href: "/admin",
|
||||
title: t("adminConsole"),
|
||||
@@ -1930,6 +1932,24 @@ const skinPluginWidgets = {
|
||||
menuLabel: t("languageMenu"),
|
||||
onChange: persistLanguage,
|
||||
}),
|
||||
"voice.plugin-launcher": (options?: SkinPluginWidgetOptions) => h("div", {
|
||||
ref: (element) => {
|
||||
if (element instanceof HTMLElement) {
|
||||
const presentation = options?.pluginPresentation ?? "dialog";
|
||||
if (skinPluginToolbar.value?.element !== element || skinPluginToolbar.value.presentation !== presentation) {
|
||||
skinPluginToolbar.value = { element, presentation };
|
||||
}
|
||||
} else if (skinPluginToolbar.value && !skinPluginToolbar.value.element.isConnected) {
|
||||
skinPluginToolbar.value = null;
|
||||
} else if (skinPluginToolbar.value) {
|
||||
const previous = skinPluginToolbar.value.element;
|
||||
void nextTick(() => {
|
||||
if (skinPluginToolbar.value?.element === previous && !previous.isConnected) skinPluginToolbar.value = null;
|
||||
});
|
||||
}
|
||||
},
|
||||
class: "webspeak-plugin-toolbar-skin-slot",
|
||||
}),
|
||||
"voice.channel-panel": () => h(ChannelMemberPanel, {
|
||||
query: memberQuery.value,
|
||||
"onUpdate:query": (value: string) => { memberQuery.value = value; },
|
||||
|
||||
Reference in new issue
Block a user