Compare commits

...
4 Commits
42 changed files with 670 additions and 89 deletions

No files matched your search

+4 -3
View File
@@ -77,11 +77,12 @@ Ein plattformübergreifender Musikbot für TeamSpeak 3/6 mit Netease Cloud Music
## Contributors · 贡献者
感谢通过 PR 改进 WebSpeak 的贡献者。以下按 GitHub 的合并记录列出。
感谢上游 SDK 作者及通过 PR 改进 WebSpeak 的贡献者。以下列出上游基础项目、已合并的 PR,以及已移植为独立皮肤包的原始贡献。
- [LainHE](https://github.com/LainHE) — [PR #2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/2) 改进浏览器端报错翻译;[PR #8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/8) 修正缩放、浮动布局和首页脚注。
- [HoneyBBQ](https://github.com/HoneyBBQ) — 上游 [teamspeak-js(`@honeybbq/teamspeak`)](https://github.com/HoneyBBQ/teamspeak-js) SDK 的作者,为 WebSpeak 提供底层 TeamSpeak 协议客户端能力。
- [LainHE](https://github.com/LainHE) — [已合并 PR #2、#8、#28、#31–#35、#37、#38、#40](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ALainHE),涉及浏览器报错翻译、缩放与首页布局、屏幕共享码率与观看者头像、中继目标校验与异常重连、可信代理校验、连接失败传递、音频故障报告及 WebRTC 失败时的资源清理。
- [TimmySheep](https://github.com/TimmySheep) — [已合并 PR #13、#15–#24](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ATimmySheep),涉及 TS6 既有屏幕共享发现、屏幕比例、移动端语音/常亮/皮肤菜单、身份频道选项、PWA/主题、聊天历史、成员音频状态和麦克风权限等改进。
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) 支持通过 TeamSpeak 注册昵称连接,并在设置、收藏和邀请中保留昵称目标。
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) 支持 TeamSpeak 注册昵称连接并保留昵称目标;[PR #51](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/51) 改进 KAAK 首次连接后的工作区保留与重连;[PR #27](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/27) 和 [PR #52](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/52) 提供 Discord 皮肤的原始设计与实现(提交署名 **yumi**),后由 WebSpeak 项目移植为[独立分发的 `.wskin` 皮肤](https://github.com/Huddle-Up-Forge/webspeak-skin-discord-voice)。
## 许可证 · License · Lizenz · Лицензия · ライセンス
+6 -4
View File
@@ -351,9 +351,11 @@ Für den Bau von `@discordjs/opus` werden Python, Make und eine C/C++-Toolchain
| Daten | Docker verwendet `webspeak-data`; Release-Pakete und Quellcode verwenden `data/`. Vor Updates sichern. |
| Sitzungslimit | Eine Instanz akzeptiert bis zu 100 aktive Browser-Sitzungen. |
## Kürzlich zusammengeführte Beiträge
## Mitwirkende und Beiträge
- Die Liste folgt den GitHub-Merge-Einträgen.
- [LainHE](https://github.com/LainHE) — [PR #2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/2) verbesserte Browser-Fehlermeldungen; [PR #8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/8) korrigierte Skalierung, schwebendes Layout und Fußzeile der Startseite.
Diese Liste würdigt den Autor des zugrunde liegenden SDKs, Beiträge aus zusammengeführten GitHub-PRs sowie ursprüngliche Arbeiten, die in eigenständig verteilte Skin-Pakete übernommen wurden.
- [HoneyBBQ](https://github.com/HoneyBBQ) — Autor des [teamspeak-js-SDKs (`@honeybbq/teamspeak`)](https://github.com/HoneyBBQ/teamspeak-js), das den von WebSpeak verwendeten TeamSpeak-Protokollclient bereitstellt.
- [LainHE](https://github.com/LainHE) — [zusammengeführte PRs #2, #8, #28, #31–#35, #37, #38 und #40](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ALainHE): Browser-Fehlerübersetzungen, Skalierung und Startseitenlayout, Bildschirmfreigabe-Bitrate und Zuschaueravatare, Relay-Zielprüfung und Wiederverbindung, vertrauenswürdige Proxys, Weitergabe von Verbindungsfehlern, Audio-Fehlermeldungen und Ressourcenfreigabe bei WebRTC-Fehlern.
- [TimmySheep](https://github.com/TimmySheep) — [zusammengeführte PRs #13 und #15–#24](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ATimmySheep) zu vorhandenen TS6-Freigaben, Seitenverhältnis, mobiler Sprache/Bildschirm-Wachhalten/Skin-Menü, Kanaloptionen der Identität, PWA/Design, Chatverlauf, Mitglieder-Audiozuständen und Mikrofonberechtigungen.
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) ermöglichte Verbindungen über registrierte TeamSpeak-Nicknames und bewahrte Nickname-Ziele in Einstellungen, Favoriten und Einladungen.
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) ermöglichte Verbindungen über registrierte TeamSpeak-Nicknames und bewahrte Nickname-Ziele; [PR #51](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/51) verbesserte das Beibehalten des KAAK-Arbeitsbereichs und die Wiederverbindung nach der ersten Verbindung. [PR #27](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/27) und [PR #52](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/52) lieferten das ursprüngliche Design und die Implementierung des Discord-Skins (Commit-Autor **yumi**), die das WebSpeak-Projekt in einen [eigenständig verteilten `.wskin`-Skin](https://github.com/Huddle-Up-Forge/webspeak-skin-discord-voice) überführte.
+6 -4
View File
@@ -361,9 +361,11 @@ Building `@discordjs/opus` requires Python, Make, and a C/C++ toolchain.
| Data | Docker data is in `webspeak-data`; release packages and source installs use `data/`. Back up before upgrades. |
| Session limit | One instance accepts up to 100 active browser sessions. |
## Recent contributors
## Contributors and contributions
- Listed from GitHub's merge records; the version summaries above describe only changes included in each release.
- [LainHE](https://github.com/LainHE) — [PR #2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/2) improved browser error translations; [PR #8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/8) fixed scaling, floating layout, and the homepage footer.
This list acknowledges the upstream SDK author, contributions through merged GitHub PRs, and original work adapted into independently distributed skin packages.
- [HoneyBBQ](https://github.com/HoneyBBQ) — Author of the upstream [teamspeak-js (`@honeybbq/teamspeak`)](https://github.com/HoneyBBQ/teamspeak-js) SDK, which provides the TeamSpeak protocol client used by WebSpeak.
- [LainHE](https://github.com/LainHE) — [merged PRs #2, #8, #28, #31–#35, #37, #38 and #40](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ALainHE), covering browser error translations, scaling and home layout, screen-share bitrate and viewer avatars, relay target validation and recovery, trusted proxy handling, connection-failure propagation, audio fault reporting, and WebRTC failure cleanup.
- [TimmySheep](https://github.com/TimmySheep) — [merged PRs #13 and #15–#24](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ATimmySheep), covering existing TS6 share discovery, share aspect ratio, mobile voice/wake/skin-menu behavior, identity channel options, PWA/theme work, chat history, member audio states, and microphone permission.
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) added connections through registered TeamSpeak nicknames and preserved nickname targets in settings, favorites, and invitations.
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) added registered TeamSpeak nickname connections and preserved nickname targets; [PR #51](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/51) improved KAAK workspace retention and reconnection after the first connection. [PR #27](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/27) and [PR #52](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/52) supplied the original Discord skin design and implementation (commit author **yumi**), later adapted by the WebSpeak project into an [independently distributed `.wskin` skin](https://github.com/Huddle-Up-Forge/webspeak-skin-discord-voice).
+6 -4
View File
@@ -233,9 +233,11 @@ Docker 起動を簡略化し、15秒の接続タイムアウトと継続的な
WebSpeak は [GNU Affero General Public License v3.0 only](../LICENSE) の下で公開されています。
## 最近マージされた貢献
## 貢献者と主な貢献
- GitHub のマージ記録に基づく一覧です。上のバージョン概要には、各リリースに実際に含まれる変更のみを記載しています。
- [LainHE](https://github.com/LainHE) — [PR #2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/2) でブラウザのエラー翻訳を改善し、[PR #8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/8) で拡大縮小、フローティングレイアウト、ホームのフッターを修正。
上流 SDK の作者、マージ済みの GitHub PR、および独立配布のスキンパッケージへ移植された原作の貢献を記載しています。
- [HoneyBBQ](https://github.com/HoneyBBQ) — 上流 SDK [teamspeak-js(`@honeybbq/teamspeak`)](https://github.com/HoneyBBQ/teamspeak-js) の作者。WebSpeak の TeamSpeak プロトコル通信を支えるクライアントライブラリを提供。
- [LainHE](https://github.com/LainHE) — [マージ済み PR #2、#8、#28、#31–#35、#37、#38、#40](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ALainHE)。ブラウザのエラー翻訳、拡大縮小とホームのレイアウト、画面共有のビットレートと視聴者アバター、中継先の検証と再接続、信頼済みプロキシの扱い、接続失敗の通知、音声エラー報告、WebRTC 失敗時のリソース解放を改善。
- [TimmySheep](https://github.com/TimmySheep) — [マージ済み PR #13、#15–#24](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ATimmySheep)。既存 TS6 共有の検出、画面比率、モバイル音声・画面点灯・スキンメニュー、ID のチャンネル設定、PWA/テーマ、チャット履歴、メンバー音声状態、マイク権限などに貢献。
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) で TeamSpeak の登録済みニックネームによる接続に対応し、設定・お気に入り・招待リンクにニックネームの接続先を保持。
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) で TeamSpeak の登録済みニックネーム接続と接続先の保持に対応し、[PR #51](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/51) で初回接続後の KAAK ワークスペース保持と再接続を改善。[PR #27](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/27) と [PR #52](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/52) では Discord スキンの原作デザインと実装を提供(コミット名義 **yumi**)。その後、WebSpeak プロジェクトが[独立配布の `.wskin` スキン](https://github.com/Huddle-Up-Forge/webspeak-skin-discord-voice)へ移植。
+6 -4
View File
@@ -235,9 +235,11 @@ npm start
WebSpeak распространяется по [GNU Affero General Public License v3.0 only](../LICENSE).
## Недавно объединённые вклады
## Участники и вклад в проект
- Список составлен по записям о слиянии на GitHub; сводки выше описывают только изменения, вошедшие в соответствующий релиз.
- [LainHE](https://github.com/LainHE) — [PR #2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/2) улучшил переводы ошибок браузера; [PR #8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/8) исправил масштабирование, плавающую компоновку и нижний колонтитул главной страницы.
Список отмечает автора SDK, используемого в основе проекта, вклад через объединённые PR на GitHub и исходные работы, перенесённые в отдельно распространяемые пакеты скинов.
- [HoneyBBQ](https://github.com/HoneyBBQ) — Автор SDK [teamspeak-js (`@honeybbq/teamspeak`)](https://github.com/HoneyBBQ/teamspeak-js), который предоставляет используемый WebSpeak клиент протокола TeamSpeak.
- [LainHE](https://github.com/LainHE) — [объединённые PR #2, #8, #28, #31–#35, #37, #38 и #40](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ALainHE): переводы ошибок браузера, масштабирование и компоновка главной страницы, битрейт трансляции и аватары зрителей, проверка целей и восстановление ретранслятора, доверенные прокси, передача ошибок подключения, сообщения об ошибках аудио и освобождение ресурсов при сбоях WebRTC.
- [TimmySheep](https://github.com/TimmySheep) — [объединённые PR #13 и #15–#24](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ATimmySheep): обнаружение активных трансляций TS6, пропорции экрана, мобильное аудио/подсветка экрана/меню скинов, канал в настройках идентичности, PWA/темы, история чата, состояние аудио участников и разрешение микрофона.
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) добавил подключение по зарегистрированным именам TeamSpeak и сохранение имени цели в настройках, избранном и приглашениях.
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) добавил подключение по зарегистрированным именам TeamSpeak с сохранением имени цели; [PR #51](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/51) улучшил сохранение рабочего пространства KAAK и повторное подключение после первого соединения. [PR #27](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/27) и [PR #52](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/52) содержали исходный дизайн и реализацию скина Discord (автор коммитов **yumi**), которые проект WebSpeak перенёс в [отдельно распространяемый скин `.wskin`](https://github.com/Huddle-Up-Forge/webspeak-skin-discord-voice).
+6 -4
View File
@@ -365,9 +365,11 @@ npm start
| 数据 | Docker 数据在 `webspeak-data` volume;发布包和源码运行数据在 `data/`。升级前建议备份。 |
| 会话上限 | 单实例最多允许 100 个活动网页会话。 |
## 近期合并贡献者
## 贡献者与贡献来源
- 以下依据 GitHub 合并记录列出。
- [LainHE](https://github.com/LainHE) — [PR #2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/2) 改进浏览器端报错翻译;[PR #8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/8) 修正缩放、浮动布局和首页脚注。
以下列出上游 SDK 作者、已合并的 GitHub PR,以及已移植为独立皮肤包的原始贡献。
- [HoneyBBQ](https://github.com/HoneyBBQ) — 上游 [teamspeak-js(`@honeybbq/teamspeak`)](https://github.com/HoneyBBQ/teamspeak-js) SDK 的作者,为 WebSpeak 提供底层 TeamSpeak 协议客户端能力。
- [LainHE](https://github.com/LainHE) — [已合并 PR #2、#8、#28、#31–#35、#37、#38、#40](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ALainHE),涉及浏览器报错翻译、缩放与首页布局、屏幕共享码率与观看者头像、中继目标校验与异常重连、可信代理校验、连接失败传递、音频故障报告及 WebRTC 失败时的资源清理。
- [TimmySheep](https://github.com/TimmySheep) — [已合并 PR #13、#15–#24](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pulls?q=is%3Apr+is%3Amerged+author%3ATimmySheep),涉及 TS6 既有屏幕共享发现、屏幕比例、移动端语音/常亮/皮肤菜单、身份频道选项、PWA/主题、聊天历史、成员音频状态和麦克风权限等改进。
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) 支持通过 TeamSpeak 注册昵称连接,并在设置、收藏和邀请中保留昵称目标。
- [yichen11818](https://github.com/yichen11818) — [PR #25](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/25) 支持 TeamSpeak 注册昵称连接并保留昵称目标;[PR #51](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/51) 改进 KAAK 首次连接后的工作区保留与重连;[PR #27](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/27) 和 [PR #52](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/52) 提供 Discord 皮肤的原始设计与实现(提交署名 **yumi**),后由 WebSpeak 项目移植为[独立分发的 `.wskin` 皮肤](https://github.com/Huddle-Up-Forge/webspeak-skin-discord-voice)。
+4
View File
@@ -189,6 +189,10 @@ components.json 顶层接受 schemaVersion 1、2 或 3 和 components 数组。s
申请 `session.channels.read` 的 `session.channels` 列表还提供 `memberCount`、两位数显示用的 `memberCountLabel`、`maxClients` 和 `maxClientsLimited`。后两个字段仅在 TeamSpeak 返回有效上限数据时出现;`maxClientsLimited: false` 表示频道不限人数。它们与频道树一起属于公开只读数据,不会授予服务器写入能力。
频道显示接口增补(0.2.8):同一权限下新增 `displayName`、`isSpacer`、`spacerAlignment` 与 `spacerStyle`,声明式 v3 和 Wasm v4 均可读取。`name` 始终保留服务器原名,`displayName` 仅对永久、顶层且名称以 `[spacer…]`、`[lspacer…]`、`[cspacer…]`、`[rspacer…]` 或 `[*spacer…]` 开头的频道移除前缀(大小写不敏感,省略或自定义标识均可)。分隔栏的 `spacerAlignment` 为 `left`、`center`、`right` 或 `repeat`;`spacerStyle` 为 `text`、`solid`、`dashed`、`dotted`、`dash-dot` 或 `dash-dot-dot`,五种线型对应 `___`、`---`、`...`、`-.-`、`-..`。普通频道的 `displayName` 等于 `name`、`isSpacer: false`、两个格式字段为空字符串。旧运行时可能不含新增字段;兼容包应回退到 `name`,不能只凭相同的 0.2.8 版本号推断字段存在。分隔栏仍为真实 TS 频道,不增加加入限制,不隐藏其中的成员或子频道;管理编辑继续使用原名。
宿主 `voice.channel-tree` 与 `voice.channel-panel` 自动使用上述显示规则;分隔栏隐藏普通频道图标和人数,不显示空成员提示。新增稳定部件 `voice.channel-spacer`,提供 `data-alignment` 与 `data-spacer-style` 属性;频道树行 `voice.channel-tree.row` 和成员面板标题 `voice.channel-group.heading` 在分隔栏上提供 `data-spacer="true"`。颜色和字体继承皮肤,文字及重复填充在可用宽度内裁剪,空文本保留分隔间距。皮肤无需新增权限或修改传输逻辑。
```json
{
"schemaVersion": 2,
+1 -1
View File
@@ -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.5 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.11 requires WebSpeak 0.2.8 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.
Binary file not shown.
+24 -4
View File
@@ -23,7 +23,7 @@
"tag": "div",
"className": "brand-lockup",
"children": [
{ "tag": "span", "className": "brand-mark", "children": [{ "text": "W" }] },
{ "tag": "span", "className": "dc-brand-mark", "children": [{ "text": "W" }] },
{
"tag": "div",
"children": [
@@ -121,7 +121,7 @@
}
]
},
{ "tag": "div", "className": "visitor-count", "children": [{ "widget": "home.visitor-count", "part": "visitor-count" }] },
{ "tag": "div", "className": "dc-visitor-slot", "children": [{ "widget": "home.visitor-count", "part": "visitor-count" }] },
{ "tag": "div", "className": "announcement-wrap", "children": [{ "widget": "home.server-announcement", "part": "announcement" }] }
]
},
@@ -195,6 +195,7 @@
"copy-invite-link": { "type": "session.copyInviteLink", "args": {} },
"stop-screen-share": { "type": "voice.stopScreenShare", "args": {} },
"toggle-accompaniment": { "type": "audio.toggleAccompaniment", "args": {} },
"open-audio-settings": { "type": "audio.openSettings", "args": {} },
"toggle-chat": { "type": "ui.toggleState", "args": { "key": "chatopen" } }
},
"state": { "chatopen": true },
@@ -299,7 +300,26 @@
{ "tag": "span", "className": "dc-user-avatar", "children": [{ "tag": "i", "children": [{ "text": "{{session.status.userName}}" }] }] },
{ "tag": "span", "className": "dc-user-text", "children": [{ "tag": "strong", "children": [{ "text": "{{session.status.userName}}" }] }, { "tag": "small", "children": [{ "text": "{{skin.messages.online}}" }] }] }
] },
{ "tag": "div", "className": "dc-user-actions", "children": [{ "widget": "voice.audio-controls", "part": "audio-controls" }] }
{ "tag": "div", "className": "dc-user-actions", "children": [
{ "widget": "voice.audio-controls", "part": "audio-controls" },
{
"tag": "button",
"part": "mobile-audio-settings",
"className": "dc-mobile-audio-settings",
"attributes": { "type": "button", "aria-label": "{{skin.messages.audioSettings}}", "title": "{{skin.messages.audioSettings}}" },
"events": { "click": "open-audio-settings" },
"children": [{
"tag": "svg",
"attributes": { "width": 20, "height": 20, "viewbox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "stroke-width": 1.8, "stroke-linecap": "round", "aria-hidden": "true" },
"children": [
{ "tag": "path", "attributes": { "d": "M4 6h4m4 0h8M4 12h8m4 0h4M4 18h2m4 0h10" } },
{ "tag": "circle", "attributes": { "cx": 10, "cy": 6, "r": 2 } },
{ "tag": "circle", "attributes": { "cx": 14, "cy": 12, "r": 2 } },
{ "tag": "circle", "attributes": { "cx": 8, "cy": 18, "r": 2 } }
]
}]
}
] }
]
}
]
@@ -421,7 +441,7 @@
}
]
},
{ "widget": "voice.chat-panel", "part": "chat" }
{ "widget": "voice.chat-panel", "part": "chat", "className": "dc-chat-body" }
]
}
]
+5
View File
@@ -29,6 +29,7 @@
"voiceChannels": "VOICE CHANNELS",
"voiceConnected": "VOICE CONNECTED",
"online": "Online",
"audioSettings": "Audio settings",
"toggleChat": "Toggle channel chat",
"invitePeople": "Invite people",
"closeChat": "Close chat",
@@ -65,6 +66,7 @@
"voiceChannels": "语音频道",
"voiceConnected": "语音已连接",
"online": "在线",
"audioSettings": "音频设置",
"toggleChat": "打开或关闭频道聊天",
"invitePeople": "邀请成员",
"closeChat": "关闭聊天",
@@ -101,6 +103,7 @@
"voiceChannels": "SPRACHKANÄLE",
"voiceConnected": "SPRACHE VERBUNDEN",
"online": "Online",
"audioSettings": "Audioeinstellungen",
"toggleChat": "Kanalchat umschalten",
"invitePeople": "Mitglieder einladen",
"closeChat": "Chat schließen",
@@ -137,6 +140,7 @@
"voiceChannels": "ГОЛОСОВЫЕ КАНАЛЫ",
"voiceConnected": "ГОЛОС ПОДКЛЮЧЁН",
"online": "В сети",
"audioSettings": "Настройки звука",
"toggleChat": "Показать или скрыть чат канала",
"invitePeople": "Пригласить участников",
"closeChat": "Закрыть чат",
@@ -173,6 +177,7 @@
"voiceChannels": "ボイスチャンネル",
"voiceConnected": "ボイス接続中",
"online": "オンライン",
"audioSettings": "音声設定",
"toggleChat": "チャンネルチャットの表示切替",
"invitePeople": "メンバーを招待",
"closeChat": "チャットを閉じる",
+1 -1
View File
@@ -3,7 +3,7 @@
"packageType": "open-skin",
"id": "community.discord-voice",
"name": "Discord Voice",
"version": "1.0.5",
"version": "1.0.11",
"author": "WebSpeak Project",
"license": "AGPL-3.0-only",
"description": "A Discord-inspired dark voice workspace built with WebSpeak's portable open-skin interface.",
+169 -17
View File
@@ -29,6 +29,7 @@
--skin-discord-text-header: #f2f3f5;
--skin-discord-text-normal: #dbdee1;
--skin-discord-text-muted: #949ba4;
--skin-discord-text-secondary: #b5bac1;
--skin-discord-text-subtle: #80848e;
--skin-discord-text-link: #00a8fc;
--skin-discord-border-subtle: #1f2023;
@@ -200,10 +201,19 @@
color: var(--skin-discord-text-header);
}
:root .brand-mark {
:root .dc-brand-mark {
display: grid;
flex: 0 0 40px;
width: 40px;
height: 40px;
place-items: center;
color: #fff;
background: var(--skin-discord-blurple);
border-radius: 12px;
box-shadow: 0 4px 16px rgba(88, 101, 242, 0.35);
font-size: 22px;
font-weight: 800;
line-height: 1;
}
:root .eyebrow {
@@ -223,6 +233,9 @@
}
:root .promise-item {
display: flex;
align-items: flex-start;
gap: 10px;
background: #2b2d31;
border: 1px solid #1f2023;
border-radius: 8px;
@@ -238,17 +251,31 @@
transform: translateY(-2px);
}
:root .promise-item > span:last-child { min-width: 0; }
:root .promise-item b {
display: block;
color: var(--skin-discord-text-header);
font-size: 13px;
line-height: 1.4;
}
:root .promise-item small {
display: block;
margin-top: 3px;
color: var(--skin-discord-text-muted);
font-size: 11px;
line-height: 1.5;
}
:root .promise-icon {
display: grid;
flex: 0 0 28px;
width: 28px;
height: 28px;
place-items: center;
font-size: 11px;
font-weight: 700;
line-height: 1;
background: #1e1f22;
color: var(--skin-discord-blurple);
border-radius: 8px;
@@ -264,13 +291,41 @@
color: var(--skin-discord-yellow);
}
:root .visitor-count {
:root .dc-visitor-slot {
max-width: 100%;
margin-top: 30px;
}
:root .dc-visitor-slot [data-ws-part="home.visitors"] {
margin: 0;
background: #2b2d31;
border: 1px solid #1f2023;
color: var(--skin-discord-text-muted);
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
:root .dc-visitor-slot [data-ws-part="home.visitors.label"],
:root .dc-visitor-slot [data-ws-part="home.visitors.total"] {
overflow: visible;
white-space: normal;
overflow-wrap: anywhere;
}
@media (max-width: 1050px) {
:root .dc-visitor-slot [data-ws-part="home.visitors"] {
display: inline-grid;
grid-template-columns: 27px minmax(0, 1fr) auto;
column-gap: 10px;
row-gap: 3px;
border-radius: 18px;
}
:root .dc-visitor-slot [data-ws-part="home.visitors.icon"] { grid-column: 1; grid-row: 1 / span 2; }
:root .dc-visitor-slot [data-ws-part="home.visitors.label"] { grid-column: 2; grid-row: 1; }
:root .dc-visitor-slot [data-ws-part="home.visitors.total"] { grid-column: 2; grid-row: 2; }
:root .dc-visitor-slot [data-ws-part="home.visitors.divider"] { display: none; }
:root .dc-visitor-slot [data-ws-part="home.visitors.spark"] { grid-column: 3; grid-row: 1 / span 2; }
}
:root .join-copy h1 {
color: var(--skin-discord-text-header);
font-weight: 800;
@@ -505,7 +560,7 @@
========================================================================== */
:root .discord-app-shell {
display: grid !important;
grid-template-columns: 72px 240px minmax(0, 1fr) 360px !important;
grid-template-columns: 72px 240px minmax(0, 1fr) !important;
grid-template-rows: minmax(0, 1fr) !important;
grid-template-areas: none !important;
gap: 0 !important;
@@ -518,8 +573,8 @@
color: var(--skin-discord-text-normal);
}
:root .discord-app-shell:has([data-ws-part="skin.voice.discord-workspace.part-chat-toggle"][aria-expanded="false"]) {
grid-template-columns: 72px 240px minmax(0, 1fr) !important;
:root .discord-app-shell:has(.dc-chat) {
grid-template-columns: 72px 240px minmax(0, 1fr) 360px !important;
}
:root .discord-app-shell button {
@@ -1042,7 +1097,7 @@
}
:root .dc-performance [data-ws-part="voice.performance"] small {
:root .dc-performance [data-ws-part="voice.performance"] > button small {
display: none;
}
@@ -1211,6 +1266,7 @@
:root .dc-user-avatar { display: none; }
:root .dc-user-actions { width: 100%; }
:root .dc-user-actions > * { width: 100%; }
:root .dc-user-actions > .dc-mobile-audio-settings { display: none; }
:root .dc-user-bar [data-ws-part="voice.audio-dock"] {
position: static;
inset: auto;
@@ -1614,6 +1670,14 @@
font-weight: 600;
}
:root .dc-chat-body {
display: flex;
flex: 1 1 0;
flex-direction: column;
min-width: 0;
min-height: 0;
}
:root .dc-chat [data-ws-part="voice.chat"] {
display: flex;
flex: 1 1 auto;
@@ -1831,8 +1895,18 @@
:root .join-card [data-ws-part="home.field"] input,
:root .join-card [data-ws-part="home.field"] select,
:root .join-card [data-ws-part="home.field"] textarea {
color:var(--skin-discord-text-normal); background:var(--skin-discord-bg-input);
border:1px solid var(--skin-discord-border-input); border-radius:6px;
width:100%; min-width:0;
color:var(--skin-discord-text-normal); background:transparent;
border:0; border-radius:0;
}
:root .join-card [data-ws-part="home.field"] input:focus-visible,
:root .join-card [data-ws-part="home.field"] select:focus-visible,
:root .join-card [data-ws-part="home.field"] textarea:focus-visible {
outline: none;
}
:root .join-card [data-ws-part="home.field"]:focus-within {
border-color: var(--skin-discord-blurple);
box-shadow: 0 0 0 2px rgb(88 101 242 / 24%);
}
:root .join-card [data-ws-part="home.field-label"] { color:var(--skin-discord-text-muted); }
:root .join-card [data-ws-part="home.connect"] {
@@ -1862,9 +1936,13 @@
}
:root .dc-rail-item:has(.dc-rail-server[aria-pressed="true"]) .dc-rail-pill { height:40px; }
:root .dc-rail-fav { pointer-events:none; }
:root [data-ws-part="voice.favorite-servers.add"] {
:root .dc-rail > button {
display:grid; place-items:center; width:48px; height:48px; color:var(--skin-discord-green);
background:var(--skin-discord-bg-chat); border:0; border-radius:50%;
min-width:48px; min-height:48px; flex:0 0 auto; padding:0;
background:var(--skin-discord-bg-chat); border:0; border-radius:50%; font-size:28px; cursor:pointer;
}
:root .dc-rail > button:hover {
color:#fff; background:var(--skin-discord-green); border-radius:16px;
}
:root .dc-sidebar [data-ws-part="voice.channel-tree.list"] { margin:0; padding:0; list-style:none; }
:root .dc-sidebar [data-ws-part="voice.channel-tree.node"] { list-style:none; }
@@ -1909,11 +1987,75 @@
}
:root [data-ws-part="voice.screen-player.stage"] { background:#000; }
:root [data-ws-part="voice.screen-player.video"] { object-fit:contain; background:#000; }
:root .discord-app-shell:has([data-ws-part="skin.voice.discord-workspace.part-chat-toggle"][aria-expanded="false"]) {
grid-template-columns:72px 240px minmax(0,1fr) !important;
/* Trusted dialogs keep their behavior; the package themes their public parts. */
:root [data-ws-part="voice.performance.panel"] [data-ws-part="voice.performance.route"],
:root [data-ws-part="voice.performance.metrics"] > article,
:root [data-ws-part="voice.performance.webrtc-stats"] > div {
color:var(--skin-discord-text-normal);
background:var(--skin-discord-bg-chat);
border-color:var(--skin-discord-border-subtle);
}
:root [data-ws-part="voice.performance.panel"] strong { color:var(--skin-discord-text-header); }
:root [data-ws-part="voice.performance.panel"] :is(small, span),
:root [data-ws-part="voice.performance.status"] { color:var(--skin-discord-text-secondary); }
:root [data-ws-part="voice.performance.metrics"] strong { color:#a3aaff; }
:root [data-ws-part="voice.performance.panel"] button {
color:var(--skin-discord-text-normal); background:var(--skin-discord-bg-input); border-color:var(--skin-discord-border-subtle);
}
:root [data-ws-part="voice.performance.webrtc-stats"] { border-color:var(--skin-discord-border-subtle); }
:root [data-ws-part="voice.audio-settings"],
:root [data-ws-part="voice.screen-share-settings"] {
color:var(--skin-discord-text-normal); background:var(--skin-discord-bg-sidebar);
border-color:var(--skin-discord-border-subtle); box-shadow:0 16px 48px rgba(0,0,0,.55);
}
:root [data-ws-part="voice.audio-settings"] div {
background:transparent; border-color:var(--skin-discord-border-subtle);
}
:root [data-ws-part="voice.audio-settings"] label:has(input[type="checkbox"]) {
background:var(--skin-discord-bg-input); border-color:var(--skin-discord-border-subtle);
}
:root [data-ws-part="voice.audio-settings"] :is(header, footer),
:root [data-ws-part="voice.screen-share-settings.actions"] { border-color:var(--skin-discord-border-subtle); }
:root [data-ws-part="voice.audio-settings"] :is(h2, h3, strong, label),
:root [data-ws-part="voice.screen-share-settings.heading"] h2 {
color:var(--skin-discord-text-header);
}
:root [data-ws-part="voice.audio-settings"] :is(small, p, span),
:root [data-ws-part="voice.screen-share-settings.heading"] p,
:root [data-ws-part="voice.screen-share-settings.fields"] label > span,
:root [data-ws-part="voice.screen-share-settings.note"] {
color:var(--skin-discord-text-secondary);
}
:root [data-ws-part="voice.audio-settings"] :is(button, select),
:root [data-ws-part="voice.screen-share-settings"] :is(button, select) {
color:var(--skin-discord-text-normal); background:var(--skin-discord-bg-input);
border-color:var(--skin-discord-border-input);
}
:root [data-ws-part="voice.audio-settings"] [data-ws-part="voice.audio-settings.device-select-menu"] {
color:var(--skin-discord-text-normal); background:var(--skin-discord-bg-floating);
border-color:var(--skin-discord-border-input);
}
:root [data-ws-part="voice.audio-settings.device-select-option"]:is(:hover, [aria-selected="true"]) {
color:#fff; background:var(--skin-discord-blurple);
}
:root [data-ws-part="voice.audio-settings"] button[aria-pressed="false"] { color:var(--skin-discord-red); }
:root [data-ws-part="voice.audio-settings"] input { accent-color:var(--skin-discord-blurple); }
:root [data-ws-part="voice.audio-settings"] footer { background:var(--skin-discord-bg-user-bar); }
:root [data-ws-part="voice.audio-settings"] footer button,
:root [data-ws-part="voice.screen-share-settings.actions"] button:last-child {
color:#fff; background:var(--skin-discord-blurple); border-color:var(--skin-discord-blurple);
}
:root [data-ws-part="voice.audio-settings"] :is(button, input, select):focus-visible,
:root [data-ws-part="voice.screen-share-settings"] :is(button, select):focus-visible,
:root [data-ws-part="voice.performance.panel"] button:focus-visible {
outline:2px solid #a3aaff; outline-offset:2px;
}
@media (max-width: 1050px) {
:root .discord-app-shell:has([data-ws-part="skin.voice.discord-workspace.part-chat-toggle"][aria-expanded="false"]) {
:root .discord-app-shell,
:root .discord-app-shell:has(.dc-chat) {
grid-template-columns:64px 210px minmax(0,1fr) !important;
}
:root .dc-chat {
@@ -1961,7 +2103,7 @@
overflow-x:hidden;
overflow-y:auto;
}
:root .discord-app-shell:has([data-ws-part="skin.voice.discord-workspace.part-chat-toggle"][aria-expanded="false"]) {
:root .discord-app-shell:has(.dc-chat) {
grid-template-columns:minmax(0,1fr) !important;
}
:root .dc-rail {
@@ -1983,8 +2125,18 @@
}
:root .dc-user-actions [role="toolbar"] > button[aria-pressed="false"] { color:var(--skin-discord-red); }
:root .dc-user-actions [role="toolbar"] > button > span { display:none; }
:root .dc-user-actions { gap:8px; }
:root .dc-user-actions > :not(.dc-mobile-audio-settings) { flex:1 1 auto; min-width:0; width:auto; }
:root .dc-user-actions > .dc-mobile-audio-settings {
display:inline-grid; place-items:center; flex:0 0 44px; width:44px; height:44px; padding:0;
color:var(--skin-discord-text-normal); background:var(--skin-discord-bg-input); border:0; border-radius:8px; cursor:pointer;
}
:root .dc-user-actions > .dc-mobile-audio-settings:hover { background:var(--skin-discord-bg-active); }
:root .dc-stage { grid-column:1 !important; grid-row:3 !important; min-height:500px; }
:root .dc-chat { position:fixed; inset:0; z-index:90; width:100%; }
:root .dc-performance [data-ws-part="voice.performance.panel"] {
left:12px; right:12px; bottom:12px; width:calc(100vw - 24px); max-height:calc(100dvh - 24px);
}
:root .join-header { align-items:flex-start; flex-direction:column; }
:root .join-header-tools { width:100%; justify-content:flex-end; }
:root .join-content { grid-template-columns:minmax(0,1fr); gap:20px; }
@@ -1992,8 +2144,8 @@
@media (prefers-reduced-motion: reduce) {
:root *, :root *::before, :root *::after {
animation: none;
transition: none;
scroll-behavior: auto;
animation: none !important;
transition: none !important;
scroll-behavior: auto !important;
}
}
+76 -2
View File
@@ -32,6 +32,8 @@ async function fixture(t: TestContext, family: "ts3" | "ts6" = "ts6") {
const clients: QueryClient[] = [];
const clientOptions: QueryClientOptions[] = [];
let httpStatus = 200;
let httpCommand: string | undefined;
let jsonErrors = false;
let reply: (command: string, params: Record<string, string>) => Reply | Promise<Reply> = command => {
switch (command) {
case "version": return ok([{ version: family === "ts3" ? "3.13.7" : "6.0.0-beta13" }]);
@@ -54,8 +56,8 @@ async function fixture(t: TestContext, family: "ts3" | "ts6" = "ts6") {
calls.push({ path, command, params, key: String(req.headers["x-api-key"]) });
const answer = await reply(command, params);
res.setHeader("content-type", "application/json");
res.statusCode = httpStatus;
res.end(httpStatus === 200 ? JSON.stringify(answer) : "Access denied");
res.statusCode = httpCommand === undefined || httpCommand === command ? httpStatus : 200;
res.end(res.statusCode === 200 || jsonErrors ? JSON.stringify(answer) : "Access denied");
});
await new Promise<void>(resolve => server.listen(0, "127.0.0.1", resolve));
const address = server.address(); assert.ok(address && typeof address !== "string");
@@ -75,6 +77,8 @@ async function fixture(t: TestContext, family: "ts3" | "ts6" = "ts6") {
return { service, database, master, settings, calls, policy, logs, clientOptions,
action: (operation: unknown) => service.action({ operation, configurationRevision: service.settings().configurationRevision }),
set httpStatus(value: number) { httpStatus = value; },
set httpCommand(value: string) { httpCommand = value; },
set jsonErrors(value: boolean) { jsonErrors = value; },
get reply() { return reply; }, set reply(value) { reply = value; } };
}
@@ -136,6 +140,7 @@ test("limited list permissions preserve the rest of the overview and error detai
f.reply = (command, params) => ["servergrouplist", "banlist"].includes(command) ? denied() : original(command, params);
const result = await f.service.overview();
assert.equal(result.groupsAvailable, false); assert.equal(result.bansAvailable, false);
assert.equal(result.groupsErrorCode, "TS_ADMIN_PERMISSION_DENIED"); assert.equal(result.bansErrorCode, "TS_ADMIN_PERMISSION_DENIED");
assert.equal(result.channels.length, 1); assert.equal(result.clients.length, 1);
f.reply = (command, params) => command === "serverinfo" ? denied() : original(command, params);
await assert.rejects(f.service.overview(), hasCode("TS_ADMIN_PERMISSION_DENIED"));
@@ -143,6 +148,75 @@ test("limited list permissions preserve the rest of the overview and error detai
assert.ok(!JSON.stringify(f.logs).includes(f.settings.apiKey));
});
test("Query connections never appear in member lists or channel and server member counts", async t => {
const f = await fixture(t), original = f.reply;
f.reply = (command, params) => {
if (command === "clientlist") return ok([member, { ...member, clid: "99", client_type: "1", client_nickname: "serveradmin" }]);
if (command === "channellist") return ok([{ ...channel, total_clients: "2" }, { ...channel, cid: "2", channel_name: "Empty" }]);
return original(command, params);
};
const result = await f.service.overview();
assert.equal(result.clientCount, 1); assert.deepEqual(result.clients.map(entry => entry.id), [42]);
assert.deepEqual(result.channels.map(entry => entry.totalClients), [1, 0]);
f.reply = (command, params) => command === "clientlist" ? ok([{ ...member, clid: "99", client_type: "1" }]) : original(command, params);
const empty = await f.service.overview();
assert.equal(empty.clientCount, 0); assert.deepEqual(empty.clients, []); assert.equal(empty.channels[0].totalClients, 0);
});
for (const [code, expected] of [[524, "TS_ADMIN_RATE_LIMITED"], [2568, "TS_ADMIN_PERMISSION_DENIED"], [1538, "TS_ADMIN_READ_FAILED"]] as const) {
test(`optional list error ${code} retains its cause rather than inventing a permission failure`, async t => {
const f = await fixture(t), original = f.reply;
f.reply = (command, params) => command === "servergrouplist" ? { body: [], status: { code, message: "private-error-detail" } } : original(command, params);
const result = await f.service.overview();
assert.equal(result.groupsAvailable, false); assert.equal(result.groupsErrorCode, expected);
assert.equal(result.bansAvailable, true); assert.equal(result.bansErrorCode, null);
assert.equal(result.clients.length, 1); assert.ok(!JSON.stringify(result).includes("private-error-detail"));
});
}
for (const state of ["disconnected", "reused-id"] as const) test(`a successful UID ban with ${state} does not kick another connection or report partial failure`, async t => {
const f = await fixture(t), original = f.reply;
let banned = false;
f.reply = (command, params) => {
if (command === "banadd") banned = true;
if (command === "clientlist" && banned) return ok(state === "disconnected" ? [] : [{ ...member, client_unique_identifier: "replacement-identity=" }]);
return original(command, params);
};
assert.deepEqual(await f.action({ action: "client.ban", clientId: 42, clientUid: uid, reason: "UID only", durationSeconds: 120 }), { ok: true });
assert.equal(f.calls.filter(call => call.command === "banadd").length, 1);
assert.ok(!f.calls.some(call => call.command === "clientkick"));
assert.ok(!f.database.recentAudit(50).some(entry => entry.event === "TS_ADMIN_ACTION_PARTIAL"));
});
test("a banned client leaving between the fresh identity check and kick is successful", async t => {
const f = await fixture(t), original = f.reply;
f.reply = (command, params) => command === "clientkick" ? { body: [], status: { code: 512, message: "invalid clientID" } } : original(command, params);
assert.deepEqual(await f.action({ action: "client.ban", clientId: 42, clientUid: uid, reason: "UID only", durationSeconds: 120 }), { ok: true });
assert.equal(f.calls.filter(call => call.command === "clientkick").length, 1);
});
for (const [status, expected] of [[429, "TS_ADMIN_RATE_LIMITED"], [408, "TS_ADMIN_TIMEOUT"], [504, "TS_ADMIN_TIMEOUT"]] as const) test(`HTTP ${status} has a specific safe Query failure`, async t => {
const f = await fixture(t);
f.httpStatus = status;
await assert.rejects(f.service.overview(), hasCode(expected));
});
for (const [status, expected] of [[429, "TS_ADMIN_RATE_LIMITED"], [503, "TS_ADMIN_READ_FAILED"]] as const) test(`HTTP ${status} cannot become a successful list through a JSON status.code=0 body`, async t => {
const f = await fixture(t);
f.httpStatus = status; f.httpCommand = "servergrouplist"; f.jsonErrors = true;
const result = await f.service.overview();
assert.equal(result.groupsAvailable, false); assert.equal(result.groupsErrorCode, expected);
assert.equal(result.bansAvailable, true); assert.equal(result.clientCount, 1);
});
test("HTTP errors carrying genuine TS permission errors keep the SDK error classification", async t => {
const f = await fixture(t), original = f.reply;
f.httpStatus = 403; f.httpCommand = "servergrouplist"; f.jsonErrors = true;
f.reply = (command, params) => command === "servergrouplist" ? denied() : original(command, params);
const result = await f.service.overview();
assert.equal(result.groupsErrorCode, "TS_ADMIN_PERMISSION_DENIED");
});
test("administrator actions use typed SDK commands, escaping and UID-only bans", async t => {
const f = await fixture(t);
const actions: TsAdminAction[] = [
+32 -9
View File
@@ -4,7 +4,7 @@ import {
addBan, addClientToServerGroup, asBanID, asChannelID, asClientID, asServerGroupID,
createChannel, deleteBan, deleteChannel, editChannel, editServer, getServerInfo, kickClient,
listBans, listChannels, listClients, listServerGroups, moveClient, Reason,
removeClientFromServerGroup, ServerError, type CommandOptions,
removeClientFromServerGroup, ServerError, ErrorCode, CommandTimeoutError, type CommandOptions,
} from "@honeybbq/teamspeak";
import { QueryClient, WebQueryHttpError, type QueryClientOptions } from "@honeybbq/teamspeak/query";
import type { Logger } from "../logger.js";
@@ -81,23 +81,31 @@ export class TsAdminService {
]);
const [groups, bans] = await Promise.allSettled([listServerGroups(client, options), listBans(client, options)]);
assertCurrent();
this.database.addAudit("TS_ADMIN_OVERVIEW_READ", { channels: channels.length, clients: clients.length });
const voiceClients = clients.filter(entry => entry.type === 0);
const channelMembers = new Map<string, number>();
for (const entry of voiceClients) {
const id = String(entry.channelID);
channelMembers.set(id, (channelMembers.get(id) ?? 0) + 1);
}
this.database.addAudit("TS_ADMIN_OVERVIEW_READ", { channels: channels.length, clients: voiceClients.length });
return {
configurationRevision: this.configuration(),
serverName: server.virtualserver_name ?? "", serverVersion: client.serverVersion, serverFamily: client.serverFamily,
welcomeMessage: server.virtualserver_welcomemessage ?? "", maxClients: numeric(server.virtualserver_maxclients),
uptimeSeconds: numeric(server.virtualserver_uptime), channelCount: channels.length, clientCount: clients.length,
uptimeSeconds: numeric(server.virtualserver_uptime), channelCount: channels.length, clientCount: voiceClients.length,
channels: channels.map(channel => ({ id: String(channel.id), parentID: String(channel.parentID), name: channel.name,
description: channel.description, totalClients: channel.totalClients ?? 0, hasPassword: channel.hasPassword })),
clients: clients.map(entry => ({ id: Number(entry.id), uid: entry.uid, nickname: entry.nickname, channelID: String(entry.channelID),
description: channel.description, totalClients: channelMembers.get(String(channel.id)) ?? 0, hasPassword: channel.hasPassword })),
clients: voiceClients.map(entry => ({ id: Number(entry.id), uid: entry.uid, nickname: entry.nickname, channelID: String(entry.channelID),
serverGroups: entry.serverGroups.map(String), away: entry.isAway, inputMuted: entry.isInputMuted ?? false, outputMuted: entry.isOutputMuted ?? false })),
groups: groups.status === "fulfilled" ? groups.value.filter(group => group.type === 1).map(group => ({ id: String(group.id), name: group.name })) : [],
bans: bans.status === "fulfilled" ? bans.value.map(ban => ({ id: String(ban.id), name: ban.name || ban.lastNickname,
uid: ban.uid, reason: ban.reason, durationSeconds: ban.durationMs / 1000, createdAt: ban.createdAt?.toISOString() ?? null })) : [],
groupsAvailable: groups.status === "fulfilled", bansAvailable: bans.status === "fulfilled",
groupsErrorCode: groups.status === "fulfilled" ? null : classifyError(groups.reason, "TS_ADMIN_READ_FAILED"),
bansErrorCode: bans.status === "fulfilled" ? null : classifyError(bans.reason, "TS_ADMIN_READ_FAILED"),
observedAt: new Date().toISOString(),
};
});
}, undefined, "TS_ADMIN_READ_FAILED");
}
/** Serialize writes, then revalidate live client identities immediately before changing them. */
@@ -136,7 +144,19 @@ export class TsAdminService {
} else {
// Banning the gateway's IP would disconnect unrelated WebSpeak users.
await addBan(client, { uid: current.uid, reason: action.reason, durationMs: action.durationSeconds * 1000 }, options);
try { assertCurrent(); await kickClient(client, current.id, Reason.KickServer, { ...options, reasonMessage: action.reason }); }
try {
assertCurrent();
// TS may disconnect the banned identity itself. Never kick a replacement that reused its ID.
const remaining = (await listClients(client, { ...options, uid: true })).find(entry => entry.id === current.id);
assertCurrent();
if (remaining?.uid === current.uid && remaining.type === 0) {
try { await kickClient(client, current.id, Reason.KickServer, { ...options, reasonMessage: action.reason }); }
catch (error) {
// The same client can leave between the fresh list and the kick.
if (!(error instanceof ServerError && error.code === ErrorCode.ClientInvalidID)) throw error;
}
}
}
catch { this.database.addAudit("TS_ADMIN_ACTION_PARTIAL", { action: action.action }); fail("TS_ADMIN_PARTIAL_SUCCESS"); }
}
}
@@ -155,7 +175,7 @@ export class TsAdminService {
return createHash("sha256").update(JSON.stringify([this.policy(), this.database.getTsAdminSettings()])).digest("hex");
}
private async withClient<T>(run: (client: QueryClient, options: CommandOptions, assertCurrent: () => void) => Promise<T>, expected?: string): Promise<T> {
private async withClient<T>(run: (client: QueryClient, options: CommandOptions, assertCurrent: () => void) => Promise<T>, expected?: string, failureCode = "TS_ADMIN_OPERATION_FAILED"): Promise<T> {
this.assertFixed();
if (expected !== undefined && this.configuration() !== expected) fail("TS_ADMIN_CONFIG_CHANGED");
const settings = this.database.getTsAdminSettings();
@@ -196,7 +216,7 @@ export class TsAdminService {
return await run(client, { signal, timeoutMs: 8_000 }, assertCurrent);
} catch (error) {
if (error instanceof AdminInputError) throw error;
const code = classifyError(error, connected ? "TS_ADMIN_OPERATION_FAILED" : "TS_ADMIN_CONNECTION_FAILED");
const code = classifyError(error, connected ? failureCode : "TS_ADMIN_CONNECTION_FAILED");
this.logger.warn({ code, transport: settings.transport }, "TeamSpeak administrator request failed");
return fail(code);
} finally {
@@ -267,6 +287,9 @@ function classifyError(error: unknown, fallback: string): string {
seen.add(error);
if (error.message === "TS_ADMIN_HOST_KEY_MISMATCH") return error.message;
if (error instanceof WebQueryHttpError && [401, 403].includes(error.status)) return "TS_ADMIN_AUTH_FAILED";
if (error instanceof WebQueryHttpError && error.status === 429) return "TS_ADMIN_RATE_LIMITED";
if (error instanceof CommandTimeoutError || ["TimeoutError", "AbortError"].includes(error.name)
|| error instanceof WebQueryHttpError && [408, 504].includes(error.status)) return "TS_ADMIN_TIMEOUT";
if (error instanceof ServerError) {
if ([2568, 2569, 2570, 5120].includes(error.code)) return "TS_ADMIN_PERMISSION_DENIED";
if ([520, 5122, 5124].includes(error.code)) return "TS_ADMIN_AUTH_FAILED";
+15 -3
View File
@@ -1,5 +1,6 @@
import { request as httpRequest } from "node:http";
import { request as httpsRequest } from "node:https";
import { WebQueryHttpError } from "@honeybbq/teamspeak/query";
/** Keep the SDK's WebQuery protocol, but bound HTTP requests to this admin operation.
* Node's global fetch blocks WebQuery's default port 10080. */
@@ -18,9 +19,20 @@ export function webQueryFetch(lifetime: AbortSignal): typeof fetch {
chunks.push(chunk);
});
res.on("error", reject);
res.on("end", () => resolve(new Response(Buffer.concat(chunks), {
status: res.statusCode ?? 502, statusText: res.statusMessage ?? "",
})));
res.on("end", () => {
const body = Buffer.concat(chunks), status = res.statusCode ?? 502;
if (status < 200 || status >= 300) {
// SDK beta.19 accepts status.code=0 even on HTTP failures. Keep genuine TS errors,
// but never turn a proxy's failed HTTP response into a successful empty result.
let tsError = false;
try {
const code: unknown = JSON.parse(body.toString("utf8"))?.status?.code;
tsError = typeof code === "number" && Number.isSafeInteger(code) && code > 0;
} catch { /* HTTP status is authoritative when no TS error is present. */ }
if (!tsError) { reject(new WebQueryHttpError(status, res.statusMessage ?? "")); return; }
}
resolve(new Response(body, { status, statusText: res.statusMessage ?? "" }));
});
});
req.on("error", reject);
req.end(init.body as string);
+14
View File
@@ -9,6 +9,20 @@ const directory = (): TSDirectorySnapshot => ({
clients: [{ id: 2, channelID: 1n, nickname: "Member", uid: "uid-2", type: 0, serverGroups: [], away: true, inputMuted: true }],
});
test("permanent channel flags survive the gateway wire, without guessing omitted flags", () => {
const source = directory();
source.channels[0] = { ...source.channels[0], name: "[cspacer0]Section", isPermanent: true };
source.channels[1] = { ...source.channels[1], isPermanent: false };
const channels = mapChannelTree(source);
const message = parseServerMessage(JSON.parse(JSON.stringify({ type: "channelList", channels })));
assert.ok(message?.type === "channelList");
assert.equal(message.channels[0].name, "[cspacer0]Section");
assert.equal(message.channels[0].isPermanent, true);
assert.equal(message.channels[1].isPermanent, false);
assert.equal(Object.hasOwn(mapChannelTree(directory())[0], "isPermanent"), false);
assert.equal(parseServerMessage({ type: "channelList", channels: [{ ...channels[0], isPermanent: "true" }] }), null);
});
test("self restoration uses the connected channel before a snapshot or requested channel", () => {
const source = directory();
const result = normalizeDirectorySnapshot(source, 2, 18446744073709551615n, "Self", "Lobby");
+1
View File
@@ -12,6 +12,7 @@ export function mapChannelTree(snapshot: TSDirectorySnapshot, avatarCache = new
? { maxClients: channel.maxClients, maxClientsLimited: channel.maxClientsLimited }
: {}),
...(typeof channel.passwordProtected === "boolean" ? { passwordProtected: channel.passwordProtected } : {}),
...(typeof channel.isPermanent === "boolean" ? { isPermanent: channel.isPermanent } : {}),
members: snapshot.clients
.filter((client) => client.channelID === channel.id)
.map((client) => {
+5 -3
View File
@@ -10,7 +10,7 @@ const identity = generateIdentitySync(8);
const uid = "AAAAAAAAAAAAAAAAAAAAAAAAAAA=";
function channel(id = 1): Channel {
return { id: asChannelID(BigInt(id)), parentID: asChannelID(0n), order: asChannelID(0n), name: "Lobby",
description: "", hasPassword: true, maxClients: 12, isMaxClientsUnlimited: false } as Channel;
description: "", hasPassword: true, isPermanent: true, maxClients: 12, isMaxClientsUnlimited: false } as Channel;
}
function member(id = 1): ClientEntry {
return { id: asClientID(id), nickname: `Member ${id}`, uid: asUID(uid), channelID: asChannelID(1n), type: 0,
@@ -43,7 +43,7 @@ function fixture() {
test("ordinary-client directories and avatar metadata use the live view without list permissions", async () => {
const { sdk, native } = fixture();
assert.deepEqual(await sdk.listDirectoryChannels(), [{ id: 1n, parentID: 0n, order: 0n, name: "Lobby", description: "",
passwordProtected: true, maxClients: 12, maxClientsLimited: true }]);
passwordProtected: true, isPermanent: true, maxClients: 12, maxClientsLimited: true }]);
assert.deepEqual(await sdk.listDirectoryClients(), [{ id: 1, nickname: "Member 1", uid, channelID: 1n, type: 0,
serverGroups: [], away: true, awayMessage: "Away", inputMuted: true, outputMuted: false, channelCommander: true }]);
assert.deepEqual(await sdk.getClientAvatarMetadata(1), { uid, cacheKey: "avatar-hash", path: `/${avatarFileName(uid)}` });
@@ -62,11 +62,13 @@ test("live-view snapshots include channel edits and remove clients that went out
assert.equal(snapshots.length, 1, "an unchanged revision does not duplicate the directory");
assert.equal(snapshots[0]?.complete, true);
native.view.clients.clear();
native.view.channels.set(asChannelID(1n), { ...channel(), name: "Renamed", hasPassword: false, maxClients: 20 });
native.view.channels.set(asChannelID(1n), { ...channel(), name: "Renamed", hasPassword: false, isPermanent: false, maxClients: 20 });
native.view.revision++;
native.emit("viewChanged");
assert.equal(snapshots.at(-1)?.channels[0]?.name, "Renamed");
assert.equal(snapshots.at(-1)?.channels[0]?.passwordProtected, false);
assert.equal(snapshots[0]?.channels[0]?.isPermanent, true);
assert.equal(snapshots.at(-1)?.channels[0]?.isPermanent, false);
assert.equal(snapshots.at(-1)?.channels[0]?.maxClients, 20);
assert.deepEqual(snapshots.at(-1)?.clients, []);
assert.equal(snapshots[0]?.clients.length, 1, "earlier snapshots stay independent");
+2
View File
@@ -48,6 +48,7 @@ export interface DirectoryChannelInfo {
name: string;
description: string;
passwordProtected?: boolean;
isPermanent?: boolean;
maxClients?: number;
maxClientsLimited?: boolean;
}
@@ -315,6 +316,7 @@ function toDirectoryChannel(channel: Channel): DirectoryChannelInfo {
name: channel.name,
description: channel.description,
passwordProtected: channel.hasPassword,
...(typeof channel.isPermanent === "boolean" ? { isPermanent: channel.isPermanent } : {}),
...(Number.isInteger(channel.maxClients) && channel.maxClients >= 0 && channel.maxClients <= 65_535
&& typeof channel.isMaxClientsUnlimited === "boolean"
? { maxClients: channel.maxClients, maxClientsLimited: !channel.isMaxClientsUnlimited }
+1
View File
@@ -87,6 +87,7 @@ const tsAdminOverview = object({
channels: array(object({ id: text, parentID: text, name: text, description: text, totalClients: number, hasPassword: boolean })),
clients: array(object({ id: number, uid: text, nickname: text, channelID: text, serverGroups: array(text), away: boolean, inputMuted: boolean, outputMuted: boolean })),
groups: array(object({ id: text, name: text })), groupsAvailable: boolean, bansAvailable: boolean,
groupsErrorCode: optional(nullable(text)), bansErrorCode: optional(nullable(text)),
bans: array(object({ id: text, name: text, uid: text, reason: text, durationSeconds: number, createdAt: nullable(text) })),
observedAt: text,
});
+25
View File
@@ -0,0 +1,25 @@
import type { ChannelInfo } from "./voice-models.js";
export interface ChannelSpacer {
text: string;
alignment: "left" | "center" | "right" | "repeat";
style: "text" | "solid" | "dashed" | "dotted" | "dash-dot" | "dash-dot-dot";
}
const LINE_STYLES: Readonly<Record<string, ChannelSpacer["style"]>> = {
"___": "solid", "---": "dashed", "...": "dotted", "-.-": "dash-dot", "-..": "dash-dot-dot",
};
/** Spacers are a presentation convention for permanent, root-level TS channels. */
export function getChannelSpacer(channel: Pick<ChannelInfo, "name" | "parentID" | "isPermanent">): ChannelSpacer | null {
if (channel.parentID !== "0" || channel.isPermanent !== true) return null;
const match = /^\[([clr*]?)spacer[^\]\r\n]*\]([\s\S]*)$/i.exec(channel.name);
if (!match) return null;
const text = match[2];
const alignment = ({ c: "center", r: "right", "*": "repeat" } as const)[match[1].toLowerCase() as "c" | "r" | "*"] ?? "left";
return { text, alignment, style: Object.hasOwn(LINE_STYLES, text) ? LINE_STYLES[text] : "text" };
}
export function channelDisplayName(channel: Pick<ChannelInfo, "name" | "parentID" | "isPermanent">): string {
return getChannelSpacer(channel)?.text ?? channel.name;
}
+1
View File
@@ -73,6 +73,7 @@ function channel(value: unknown): value is ChannelInfo {
&& optional(value.maxClients, maximum => finite(maximum) && Number.isInteger(maximum) && maximum >= 0 && maximum <= 65_535)
&& optional(value.maxClientsLimited, boolean)
&& optional(value.passwordProtected, boolean)
&& optional(value.isPermanent, boolean)
&& (value.maxClients === undefined) === (value.maxClientsLimited === undefined)
&& optional(value.members, members => arrayOf(members, member));
}
+1
View File
@@ -192,6 +192,7 @@ const PUBLIC_PART_IDS = new Set<string>([
"voice.breadcrumbs",
"voice.channel-group",
"voice.channel-group.heading",
"voice.channel-spacer",
"voice.channel-group.members",
"voice.channel-tree.avatar",
"voice.channel-tree.branch",
+1 -1
View File
@@ -276,7 +276,7 @@ const COLLECTION_PERMISSION: Record<string, SkinPluginPermission> = {
"screenShare.streams": "voice.screenShare.read",
};
const COLLECTION_FIELDS: Record<string, ReadonlySet<string>> = {
"session.channels": new Set(["id", "name", "parentId", "depth", "memberCount", "memberCountLabel", "maxClients", "maxClientsLimited", "current"]),
"session.channels": new Set(["id", "name", "displayName", "isSpacer", "spacerAlignment", "spacerStyle", "parentId", "depth", "memberCount", "memberCountLabel", "maxClients", "maxClientsLimited", "current"]),
"session.members": new Set(["id", "name", "avatarInitial", "channelId", "status", "speaking", "self", "screenSharing", "screenShareStreamId"]),
"favorites.items": new Set(["id", "label", "current", "kind"]),
"servers.quickList": new Set(["id", "label", "monogram", "icon", "tone", "current", "switchRestricted", "switchTitle", "kind", "favorite"]),
@@ -5,6 +5,15 @@ import {
SKIN_RUNTIME_PLUGIN_CONTEXT_LIMIT_BYTES,
} from "./skin-runtime-plugin-context.js";
test("channel spacer metadata is available to custom skins only with channel read permission", () => {
const item = { id: "4", name: "[cspacer0]Section", displayName: "Section", isSpacer: true, spacerAlignment: "center", spacerStyle: "text", secret: "hidden" };
const context = { session: { channels: [item] } };
assert.deepEqual(JSON.parse(JSON.stringify(projectSkinRuntimePluginContext([], context))), {});
assert.deepEqual(JSON.parse(JSON.stringify(projectSkinRuntimePluginContext(["session.channels.read"], context))), {
session: { channels: [{ id: "4", name: item.name, displayName: "Section", isSpacer: true, spacerAlignment: "center", spacerStyle: "text" }] },
});
});
test("runtime context exposes only fields covered by declared read permissions", () => {
const projected = projectSkinRuntimePluginContext(["session.channels.read"], {
session: {
+5 -2
View File
@@ -26,7 +26,7 @@ interface CollectionProjection {
}
const COLLECTIONS: readonly CollectionProjection[] = Object.freeze([
{ path: ["session", "channels"], permission: "session.channels.read", fields: new Set(["id", "name", "parentId", "depth", "memberCount", "memberCountLabel", "maxClients", "maxClientsLimited", "current"]), maxItems: 128 },
{ path: ["session", "channels"], permission: "session.channels.read", fields: new Set(["id", "name", "displayName", "isSpacer", "spacerAlignment", "spacerStyle", "parentId", "depth", "memberCount", "memberCountLabel", "maxClients", "maxClientsLimited", "current"]), maxItems: 128 },
{
path: ["session", "members"],
permission: "session.members.read",
@@ -54,7 +54,7 @@ const CONTEXTS: readonly ContextProjection[] = Object.freeze([
{ path: ["screenShare", "status"], permission: "voice.screenShare.status.read", fields: new Set(["active", "starting", "viewing"]) },
]);
const BOOLEAN_FIELDS = new Set(["connected", "connecting", "current", "favorite", "speaking", "self", "screenSharing", "audio", "microphoneMuted", "outputMuted", "noiseSuppressionEnabled", "accompanimentActive", "active", "starting", "viewing", "maxClientsLimited", "panelOpen"]);
const BOOLEAN_FIELDS = new Set(["connected", "connecting", "current", "favorite", "speaking", "self", "screenSharing", "audio", "microphoneMuted", "outputMuted", "noiseSuppressionEnabled", "accompanimentActive", "active", "starting", "viewing", "maxClientsLimited", "panelOpen", "isSpacer"]);
const NUMBER_FIELDS = new Set(["depth", "memberCount", "targetCount", "ownerClientId", "viewerCount", "maxClients"]);
const TEXT_LIMITS: Readonly<Record<string, number>> = Object.freeze({
id: 128,
@@ -63,6 +63,9 @@ const TEXT_LIMITS: Readonly<Record<string, number>> = Object.freeze({
channelId: 128,
parentId: 128,
name: 160,
displayName: 160,
spacerAlignment: 8,
spacerStyle: 12,
label: 160,
channelName: 160,
userName: 160,
+2
View File
@@ -25,6 +25,8 @@ export interface ChannelInfo {
maxClientsLimited?: boolean;
/** TeamSpeak's public channel flag; absent when the connected server omits it. */
passwordProtected?: boolean;
/** Required to recognize TeamSpeak's permanent, root-level spacer channels. */
isPermanent?: boolean;
members?: ChannelMember[];
}
+5 -4
View File
@@ -5,6 +5,7 @@
<div v-if="!settings.fixedMode" class="alert info admin-fixed-notice"><Icon name="info" :size="18"/><div><p>{{ tr('tsAdminFixedOnly') }}</p><RouterLink to="/admin/server">{{ tr('adminInstanceSettings') }}</RouterLink></div></div>
<template v-else>
<div v-if="noticeMessage" class="alert success" role="status">{{ noticeMessage }}</div>
<div v-if="refreshWarning" class="alert info" role="status">{{ refreshWarning }}</div>
<article v-if="!settings.enabled && !loading" class="operation-card admin-ts-setup">
<Icon name="server" :size="26"/><div><h3>{{ tr('adminTsSetupTitle') }}</h3><p>{{ tr('adminTsSetupLead') }}</p></div>
<button class="secondary-button" type="button" @click="configureConnection">{{ tr('adminTsConfigure') }}</button>
@@ -63,7 +64,7 @@
<template v-if="editor.action === 'channel.create'">
<label><span>{{ tr('tsAdminParent') }}</span><select v-model="editor.parentId"><option value="0">{{ tr('tsAdminRoot') }}</option><option v-for="channel in overview?.channels" :key="channel.id" :value="channel.id">{{ channel.name }}</option></select></label>
<label class="ts-admin-wide"><span>{{ tr('tsAdminDescription') }}</span><textarea v-model="editor.description" maxlength="8192" rows="3"></textarea></label>
<label><span>{{ tr('tsAdminPassword') }}</span><input v-model="editor.password" type="password" autocomplete="new-password" maxlength="512" /></label><label class="choice"><input v-model="editor.permanent" type="checkbox" /><span>{{ tr('tsAdminPermanent') }}</span></label>
<label><span>{{ tr('tsAdminChannelPassword') }}</span><input v-model="editor.password" type="password" autocomplete="new-password" maxlength="512" /></label><label class="choice"><input v-model="editor.permanent" type="checkbox" /><span>{{ tr('tsAdminPermanent') }}</span></label>
</template>
<label v-if="editor.action === 'client.move'"><span>{{ tr('tsAdminChannel') }}</span><select v-model="editor.channelId" required><option v-for="channel in overview?.channels" :key="channel.id" :value="channel.id">{{ channel.name }}</option></select></label>
<template v-if="editor.action === 'client.group'"><label><span>{{ tr('tsAdminGroup') }}</span><select v-model="editor.groupId" required><option v-for="group in overview?.groups" :key="group.id" :value="group.id">{{ group.name }} (#{{ group.id }})</option></select></label><label class="choice"><input v-model="editor.remove" type="checkbox" /><span>{{ tr('tsAdminRemoveGroup') }}</span></label></template>
@@ -87,12 +88,12 @@
<tr v-if="!overview.channels.length"><td colspan="4">{{ tr('tsAdminNoChannels') }}</td></tr></tbody></table></div></section>
</div>
<div v-show="activeSection === 'clients'" data-admin-section="clients" class="admin-ts-section">
<p v-if="!overview.groupsAvailable" class="field-help">{{ tr('tsAdminGroup') }}: {{ tr('tsAdminRestricted') }}</p>
<p v-if="!overview.groupsAvailable" class="field-help">{{ tr('tsAdminGroup') }}: {{ listErrorText(overview.groupsErrorCode) }}</p>
<section class="operation-card"><header><h3>{{ tr('tsAdminClients') }}</h3><strong>{{ overview.clients.length }}</strong></header><div class="table-wrap" role="region" tabindex="0" :aria-label="tr('tsAdminClients')"><table><thead><tr><th>{{ tr('nickname') }}</th><th>{{ tr('tsAdminChannel') }}</th><th>{{ tr('tsAdminGroup') }}</th><th>{{ tr('tsAdminTitle') }}</th></tr></thead><tbody>
<tr v-for="client in overview.clients" :key="client.id"><td><strong>{{ client.nickname }}</strong><small>#{{ client.id }}</small></td><td>{{ channelNames.get(client.channelID) || client.channelID }}</td><td>{{ client.serverGroups.map(id => groupNames.get(id) || id).join(', ') || '—' }}</td><td><div class="ts-admin-row-actions"><button type="button" :disabled="settingsDirty || loading || saving || acting || !client.uid" @click="beginAction('client.move', client)">{{ tr('tsAdminMove') }}</button><button type="button" :disabled="settingsDirty || loading || saving || acting || !client.uid || !overview.groupsAvailable" @click="beginAction('client.group', client)">{{ tr('tsAdminGroupAction') }}</button><button class="danger" type="button" :disabled="settingsDirty || loading || saving || acting || !client.uid" @click="beginAction('client.kick', client)">{{ tr('tsAdminKick') }}</button><button class="danger" type="button" :disabled="settingsDirty || loading || saving || acting || !client.uid" @click="beginAction('client.ban', client)">{{ tr('tsAdminBan') }}</button></div></td></tr>
<tr v-if="!overview.clients.length"><td colspan="4">{{ tr('tsAdminNoClients') }}</td></tr></tbody></table></div></section>
</div>
<div v-show="activeSection === 'bans'" data-admin-section="bans" class="admin-ts-section"><section class="operation-card"><header><h3>{{ tr('tsAdminBans') }}</h3><strong>{{ overview.bans.length }}</strong></header><p v-if="!overview.bansAvailable" class="field-help">{{ tr('tsAdminRestricted') }}</p><div v-else class="table-wrap"><table><thead><tr><th>{{ tr('nickname') }} / UID</th><th>{{ tr('tsAdminReason') }}</th><th>{{ tr('tsAdminBanDuration') }}</th><th>{{ tr('tsAdminTitle') }}</th></tr></thead><tbody><tr v-for="ban in overview.bans" :key="ban.id"><td>{{ ban.name || ban.uid || `#${ban.id}` }}</td><td>{{ ban.reason || '—' }}</td><td>{{ ban.durationSeconds }}</td><td><button type="button" class="secondary-button" :disabled="settingsDirty || loading || saving || acting" @click="beginAction('ban.delete', ban)">{{ tr('remove') }}</button></td></tr><tr v-if="!overview.bans.length"><td colspan="4">{{ tr('tsAdminNoBans') }}</td></tr></tbody></table></div></section></div>
<div v-show="activeSection === 'bans'" data-admin-section="bans" class="admin-ts-section"><section class="operation-card"><header><h3>{{ tr('tsAdminBans') }}</h3><strong>{{ overview.bans.length }}</strong></header><p v-if="!overview.bansAvailable" class="field-help">{{ listErrorText(overview.bansErrorCode) }}</p><div v-else class="table-wrap"><table><thead><tr><th>{{ tr('nickname') }} / UID</th><th>{{ tr('tsAdminReason') }}</th><th>{{ tr('tsAdminBanDuration') }}</th><th>{{ tr('tsAdminTitle') }}</th></tr></thead><tbody><tr v-for="ban in overview.bans" :key="ban.id"><td>{{ ban.name || ban.uid || `#${ban.id}` }}</td><td>{{ ban.reason || '—' }}</td><td>{{ ban.durationSeconds }}</td><td><button type="button" class="secondary-button" :disabled="settingsDirty || loading || saving || acting" @click="beginAction('ban.delete', ban)">{{ tr('remove') }}</button></td></tr><tr v-if="!overview.bans.length"><td colspan="4">{{ tr('tsAdminNoBans') }}</td></tr></tbody></table></div></section></div>
</template>
</article>
</template>
@@ -109,7 +110,7 @@ import type { AdminTranslationKey } from '../../i18n/admin.js';
import Icon from '../Icon.vue';
const props = defineProps<{ model: ReturnType<typeof useAdminTsAdmin>; i18n: Pick<ReturnType<typeof useAdminI18n>, 'tr' | 'formatDate'>; targetAddress: string; targetPort: string }>();
const {tr, formatDate} = props.i18n;
const {settings, form, editor, overview, settingsDirty, noticeMessage, loading, saving, connecting, acting, saveSettings, connectAndRefresh, beginAction, closeAction, runAction} = props.model;
const {settings, form, editor, overview, settingsDirty, noticeMessage, refreshWarning, listErrorText, loading, saving, connecting, acting, saveSettings, connectAndRefresh, beginAction, closeAction, runAction} = props.model;
const connectionOpen = ref(false);
const connectionPanel = ref<HTMLDetailsElement | null>(null);
async function configureConnection() {
@@ -60,16 +60,19 @@
<button
class="member-channel-heading"
data-ws-part="voice.channel-group.heading"
:data-spacer="getChannelSpacer(channelItem) ? 'true' : undefined"
:data-ws-state="channelItem.id === currentChannelId ? 'current' : 'idle'"
:title="t('switchChannel')"
@click="emit('selectChannel', channelItem)"
>
<Icon
v-if="!getChannelSpacer(channelItem)"
:name="channelItem.passwordProtected ? 'lock' : 'speaker'"
:size="16"
/>
<span>{{ channelItem.name }}</span>
<small>{{ channelItem.members.length }}</small>
<ChannelSpacer v-if="getChannelSpacer(channelItem)" :spacer="getChannelSpacer(channelItem)!" />
<span v-else>{{ channelItem.name }}</span>
<small v-if="!getChannelSpacer(channelItem)">{{ channelItem.members.length }}</small>
</button>
<div
v-if="channelItem.members.length"
@@ -170,7 +173,7 @@
</div>
</div>
<div
v-else
v-else-if="!getChannelSpacer(channelItem)"
class="channel-no-members"
>{{ t("noMembersInChannel") }}</div
>
@@ -188,6 +191,8 @@
<script setup lang="ts">
import type { CSSProperties } from "vue";
import Icon from "../Icon.vue";
import ChannelSpacer from "./ChannelSpacer.vue";
import { getChannelSpacer } from "../../../../src/shared/channel-spacer.js";
import { memberPresenceKey } from "../../services/member-presence.js";
import type { TreeChannel } from "../../composables/useWebClientChannels.js";
import type { useWebClientMembers } from "../../composables/useWebClientMembers.js";
@@ -0,0 +1,60 @@
<template>
<span
class="ws-channel-spacer"
data-ws-part="voice.channel-spacer"
:data-alignment="spacer.alignment"
:data-spacer-style="spacer.style"
:aria-label="spacer.text || undefined"
><span :aria-hidden="spacer.alignment === 'repeat' || spacer.style !== 'text' ? 'true' : undefined">{{ displayText }}</span></span>
</template>
<script setup lang="ts">
import { computed } from "vue";
import type { ChannelSpacer } from "../../../../src/shared/channel-spacer.js";
const props = defineProps<{ spacer: ChannelSpacer }>();
const displayText = computed(() => {
if (props.spacer.style !== "text") return "";
const text = props.spacer.text;
// Clip a bounded run in CSS rather than measuring DOM or growing with viewport width.
return props.spacer.alignment === "repeat" && text
? text.repeat(Math.max(1, Math.floor(1024 / text.length)))
: text;
});
</script>
<style scoped>
.ws-channel-spacer {
display: block;
flex: 1 1 0;
min-width: 0;
width: 100%;
min-height: 1.3em;
overflow: hidden;
color: inherit;
font: inherit;
line-height: 1.3;
text-align: left;
}
.ws-channel-spacer > span { white-space: pre; }
.ws-channel-spacer[data-alignment="center"] { text-align: center; }
.ws-channel-spacer[data-alignment="right"] { text-align: right; }
.ws-channel-spacer:where(:not([data-spacer-style="text"]))::before {
content: "";
display: block;
margin-block: .6em;
border-top: 1px solid currentColor;
opacity: .55;
}
.ws-channel-spacer[data-spacer-style="dashed"]::before { border-top-style: dashed; }
.ws-channel-spacer[data-spacer-style="dotted"]::before { border-top-style: dotted; }
.ws-channel-spacer[data-spacer-style="dash-dot"]::before,
.ws-channel-spacer[data-spacer-style="dash-dot-dot"]::before {
height: 1px;
border: 0;
background: repeating-linear-gradient(to right, currentColor 0 6px, transparent 6px 9px, currentColor 9px 11px, transparent 11px 14px);
}
.ws-channel-spacer[data-spacer-style="dash-dot-dot"]::before {
background: repeating-linear-gradient(to right, currentColor 0 6px, transparent 6px 9px, currentColor 9px 11px, transparent 11px 14px, currentColor 14px 16px, transparent 16px 19px);
}
</style>
@@ -16,7 +16,7 @@
type="button"
class="ws-voice-channel-expander"
data-ws-part="voice.channel-tree.expander"
:aria-label="`${expanded ? '收起' : '展开'} ${node.channel.name} / ${expanded ? 'Collapse' : 'Expand'} channel`"
:aria-label="`${expanded ? '收起' : '展开'} ${displayName} / ${expanded ? 'Collapse' : 'Expand'} channel`"
:aria-expanded="expanded"
@click.stop="emit('toggle', node.channel.id)"
><Icon :name="expanded ? 'chevron-down' : 'chevron-right'" :size="13" /></button>
@@ -24,8 +24,9 @@
type="button"
class="ws-voice-channel-row"
data-ws-part="voice.channel-tree.row"
:data-spacer="spacer ? 'true' : undefined"
:data-drag-over="memberDragDrop && dragOverChannelId === node.channel.id ? 'true' : undefined"
:title="`双击或按 Enter 加入 ${node.channel.name} / Double-click or press Enter to join${node.channel.passwordProtected ? ' · 需要频道密码 / Channel password required' : ''}`"
:title="`双击或按 Enter 加入 ${displayName} / Double-click or press Enter to join${node.channel.passwordProtected ? ' · 需要频道密码 / Channel password required' : ''}`"
:data-password-protected="node.channel.passwordProtected ? 'true' : undefined"
@click="emit('select', node.channel.id)"
@dblclick.stop.prevent="join"
@@ -35,15 +36,17 @@
@drop="handleChannelDrop($event)"
>
<Icon
v-if="!spacer"
class="ws-voice-channel-type"
data-ws-part="voice.channel-tree.icon"
:name="node.channel.passwordProtected ? 'lock' : 'speaker'"
:data-password-protected="node.channel.passwordProtected ? 'true' : 'false'"
:size="14"
/>
<span class="ws-voice-channel-name" data-ws-part="voice.channel-tree.name">{{ node.channel.name }}</span>
<span v-if="selected && !current" class="ws-voice-channel-join-hint" data-ws-part="voice.channel-tree.join-hint">双击加入</span>
<span class="ws-voice-channel-count" data-ws-part="voice.channel-tree.count">
<ChannelSpacer v-if="spacer" :spacer="spacer" />
<span v-else class="ws-voice-channel-name" data-ws-part="voice.channel-tree.name">{{ node.channel.name }}</span>
<span v-if="!spacer && selected && !current" class="ws-voice-channel-join-hint" data-ws-part="voice.channel-tree.join-hint">双击加入</span>
<span v-if="!spacer" class="ws-voice-channel-count" data-ws-part="voice.channel-tree.count">
{{ memberCount }}<template v-if="node.channel.maxClientsLimited && typeof node.channel.maxClients === 'number'">/{{ node.channel.maxClients }}</template>
</span>
</button>
@@ -230,6 +233,8 @@
<script setup lang="ts">
import { computed, type CSSProperties } from "vue";
import Icon from "../Icon.vue";
import ChannelSpacer from "./ChannelSpacer.vue";
import { channelDisplayName, getChannelSpacer } from "../../../../src/shared/channel-spacer.js";
import type { ChannelMember } from "../../composables/useVoiceWebSocket.js";
import type { TreeChannel } from "../../composables/useWebClientChannels.js";
import type { VoiceChannelTreeNode } from "../../services/voice-channel-tree.js";
@@ -267,6 +272,8 @@ const emit = defineEmits<{
}>();
const expanded = computed(() => props.expandedIds.has(props.node.channel.id));
const spacer = computed(() => getChannelSpacer(props.node.channel));
const displayName = computed(() => channelDisplayName(props.node.channel));
const hasChildren = computed(() => props.node.children.length > 0);
const hasContents = computed(() => hasChildren.value || props.node.channel.members.length > 0);
const isExpandable = computed(() => props.layout === "server-sidebar" ? hasChildren.value : hasContents.value);
+1
View File
@@ -50,6 +50,7 @@ const errorLabels: Record<string, AdminTranslationKey> = {
TS_ADMIN_PERMISSION_DENIED: "tsAdminPermissionError", TS_ADMIN_AUTH_FAILED: "tsAdminAuthError", TS_ADMIN_OPERATION_FAILED: "tsAdminActionError",
TS_ADMIN_CLIENT_CHANGED: "tsAdminClientChanged", TS_ADMIN_CONFIG_CHANGED: "tsAdminConfigChanged", TS_ADMIN_PARTIAL_SUCCESS: "tsAdminPartialError",
TS_ADMIN_RATE_LIMITED: "tsAdminRateError", TS_ADMIN_TLS_FAILED: "tsAdminTlsError",
TS_ADMIN_READ_FAILED: "tsAdminReadError", TS_ADMIN_TIMEOUT: "tsAdminTimeoutError",
};
const connectionErrors: Record<string, AdminTranslationKey> = {
PASSWORD_REQUIRED: "serverPasswordRequiredError", SERVER_PASSWORD_REQUIRED: "serverPasswordRequiredError",
+17 -7
View File
@@ -25,6 +25,7 @@ export function useAdminTsAdmin(options: Options) {
const settings = reactive(emptySettings()), form = reactive(emptyForm()), editor = reactive(emptyEditor());
const overview = ref<Awaited<ReturnType<AdminApi["tsAdminOverview"]>> | null>(null);
const noticeMessage = ref("");
const refreshWarning = ref("");
const loading = ref(false), saving = ref(false), connecting = ref(false), acting = ref(false);
const settingsDirty = computed(() => form.enabled !== settings.enabled || form.transport !== settings.transport
|| form.queryHost !== settings.queryHost || form.webQueryUrl !== settings.webQueryUrl
@@ -40,6 +41,7 @@ export function useAdminTsAdmin(options: Options) {
function cancelRequests() {
requests.reset(); loading.value = false; saving.value = false; connecting.value = false; acting.value = false;
Object.assign(editor, emptyEditor());
refreshWarning.value = "";
}
function reset() {
cancelRequests(); Object.assign(settings, emptySettings()); Object.assign(form, emptyForm()); overview.value = null; noticeMessage.value = "";
@@ -51,6 +53,7 @@ export function useAdminTsAdmin(options: Options) {
function mergeSettings(value: Awaited<ReturnType<AdminApi["tsAdminSettings"]>>, baseline: Form) {
if (settings.configurationRevision && settings.configurationRevision !== value.configurationRevision) {
requests.cancel("overview"); connecting.value = false; overview.value = null; Object.assign(editor, emptyEditor());
refreshWarning.value = "";
}
Object.assign(settings, value);
const next: Form = { enabled: value.enabled, transport: value.transport, queryHost: value.queryHost, webQueryUrl: value.webQueryUrl,
@@ -77,7 +80,7 @@ export function useAdminTsAdmin(options: Options) {
if (saving.value || acting.value) return;
requests.cancel("overview"); connecting.value = false;
const request = requests.begin("settings"), baseline = { ...form };
saving.value = true; loading.value = false; options.errorMessage.value = ""; noticeMessage.value = "";
saving.value = true; loading.value = false; options.errorMessage.value = ""; noticeMessage.value = ""; refreshWarning.value = "";
try {
const saved = await options.api.saveTsAdminSettings({ ...baseline, queryPort: Number(baseline.queryPort),
password: baseline.passwordAction === "replace" ? baseline.password : undefined,
@@ -89,12 +92,19 @@ export function useAdminTsAdmin(options: Options) {
} catch (error) { if (request.isCurrent()) report(error); }
finally { if (request.isCurrent()) saving.value = false; request.finish(); }
}
async function connectAndRefresh() {
function listErrorText(code?: string | null) { return options.errorText(code || "TS_ADMIN_READ_FAILED"); }
async function connectAndRefresh() { await readOverview(false); }
async function readOverview(afterAction: boolean) {
if (loading.value || connecting.value || saving.value || acting.value || settingsDirty.value || !settings.enabled || !settings.fixedMode) return;
const request = requests.begin("overview");
connecting.value = true; options.errorMessage.value = "";
connecting.value = true; options.errorMessage.value = ""; refreshWarning.value = "";
try { const value = await options.api.tsAdminOverview(request.signal); if (request.isCurrent()) overview.value = value; }
catch (error) { if (request.isCurrent()) report(error); }
catch (error) {
if (request.isCurrent() && !isAdminRequestCancelled(error)) {
if (afterAction) refreshWarning.value = options.tr("tsAdminRefreshError", { error: listErrorText((error as { code?: string }).code) });
else report(error);
}
}
finally { if (request.isCurrent()) connecting.value = false; request.finish(); }
}
function beginAction(action: TsAdminAction["action"], target?: { id: number | string; uid?: string; nickname?: string; name?: string; channelID?: string }) {
@@ -125,17 +135,17 @@ export function useAdminTsAdmin(options: Options) {
if (acting.value || saving.value || loading.value || settingsDirty.value || !settings.enabled || !settings.fixedMode || !editor.action || !overview.value) return;
requests.cancel("overview"); connecting.value = false;
const request = requests.begin("action"), body = { operation: actionPayload(), configurationRevision: overview.value.configurationRevision };
acting.value = true; options.errorMessage.value = ""; noticeMessage.value = "";
acting.value = true; options.errorMessage.value = ""; noticeMessage.value = ""; refreshWarning.value = "";
try {
await options.api.tsAdminAction(body, request.signal);
if (!request.isCurrent()) return;
Object.assign(editor, emptyEditor()); noticeMessage.value = options.tr("tsAdminActionSaved"); overview.value = null;
// A failed refresh must never retry the write or report that it did not happen.
acting.value = false;
await connectAndRefresh();
await readOverview(true);
} catch (error) { if (request.isCurrent()) report(error); }
finally { if (request.isCurrent()) acting.value = false; request.finish(); }
}
return { settings, form, editor, overview, settingsDirty, noticeMessage, loading, saving, connecting, acting,
return { settings, form, editor, overview, settingsDirty, noticeMessage, refreshWarning, listErrorText, loading, saving, connecting, acting,
loadSettings, saveSettings, connectAndRefresh, beginAction, closeAction, runAction, cancelRequests, reset };
}
+2 -1
View File
@@ -1,5 +1,6 @@
import { computed, watch, type Ref } from "vue";
import type { ChannelInfo, ChannelMember } from "./useVoiceWebSocket.js";
import { channelDisplayName } from "../../../src/shared/channel-spacer.js";
export interface TreeChannel extends ChannelInfo {
depth: number;
@@ -108,7 +109,7 @@ export function useWebClientChannels({
if (fromSelf) return fromSelf;
return channelTree.value.find((item) => item.name === channelName.value) ?? channelTree.value[0];
});
const currentChannelName = computed(() => (currentChannel.value?.name ?? channelName.value) || t("voiceLobby"));
const currentChannelName = computed(() => (currentChannel.value ? channelDisplayName(currentChannel.value) : channelName.value) || t("voiceLobby"));
const currentChannelDescription = computed(() => currentChannel.value?.description ?? "");
const currentMembers = computed<ChannelMember[]>(() => {
const source = currentChannel.value ? currentChannel.value.members : members;
+20
View File
@@ -17,6 +17,10 @@ const zh = {
tsAdminRemoveKey: "移除 API Key",
tsAdminKeepKey: "保留 API Key",
tsAdminActionSaved: "TeamSpeak 操作已完成。",
tsAdminRefreshError: "操作已完成,但状态刷新失败。{{error}} 请手动刷新,勿重复执行操作。",
tsAdminReadError: "无法读取 TeamSpeak 状态,请检查管理连接后手动刷新。",
tsAdminTimeoutError: "TeamSpeak 请求超时,请检查连接并稍后重试。",
tsAdminChannelPassword: "频道密码",
tsAdminServerSettings: "服务器设置",
tsAdminWelcome: "欢迎消息",
tsAdminSlots: "最大在线人数",
@@ -78,6 +82,10 @@ const en = {
tsAdminRemoveKey: "Remove API key",
tsAdminKeepKey: "Keep API key",
tsAdminActionSaved: "TeamSpeak operation completed.",
tsAdminRefreshError: "The operation completed, but refreshing the state failed. {{error}} Refresh manually; do not repeat the operation.",
tsAdminReadError: "Could not read TeamSpeak state. Check the management connection and refresh manually.",
tsAdminTimeoutError: "The TeamSpeak request timed out. Check the connection and try again later.",
tsAdminChannelPassword: "Channel password",
tsAdminServerSettings: "Server settings",
tsAdminWelcome: "Welcome message",
tsAdminSlots: "Maximum clients",
@@ -139,6 +147,10 @@ const de = {
tsAdminRemoveKey: "API-Schlüssel entfernen",
tsAdminKeepKey: "API-Schlüssel behalten",
tsAdminActionSaved: "TeamSpeak-Aktion abgeschlossen.",
tsAdminRefreshError: "Die Aktion wurde ausgeführt, aber der Status konnte nicht aktualisiert werden. {{error}} Aktualisieren Sie manuell, ohne die Aktion zu wiederholen.",
tsAdminReadError: "Der TeamSpeak-Status konnte nicht gelesen werden. Prüfen Sie die Verwaltungsverbindung und aktualisieren Sie manuell.",
tsAdminTimeoutError: "Zeitüberschreitung bei der TeamSpeak-Anfrage. Prüfen Sie die Verbindung und versuchen Sie es später erneut.",
tsAdminChannelPassword: "Kanalpasswort",
tsAdminServerSettings: "Servereinstellungen",
tsAdminWelcome: "Willkommensnachricht",
tsAdminSlots: "Maximale Clientzahl",
@@ -200,6 +212,10 @@ const ru = {
tsAdminRemoveKey: "Удалить API-ключ",
tsAdminKeepKey: "Сохранить API-ключ",
tsAdminActionSaved: "Операция TeamSpeak выполнена.",
tsAdminRefreshError: "Операция выполнена, но обновить состояние не удалось. {{error}} Обновите вручную, не повторяя операцию.",
tsAdminReadError: "Не удалось получить состояние TeamSpeak. Проверьте подключение управления и обновите вручную.",
tsAdminTimeoutError: "Время ожидания запроса TeamSpeak истекло. Проверьте соединение и повторите позже.",
tsAdminChannelPassword: "Пароль канала",
tsAdminServerSettings: "Настройки сервера",
tsAdminWelcome: "Приветствие",
tsAdminSlots: "Максимум клиентов",
@@ -261,6 +277,10 @@ const ja = {
tsAdminRemoveKey: "API キーを削除",
tsAdminKeepKey: "API キーを維持",
tsAdminActionSaved: "TeamSpeak の操作が完了しました。",
tsAdminRefreshError: "操作は完了しましたが、状態の更新に失敗しました。{{error}} 操作を繰り返さず、手動で更新してください。",
tsAdminReadError: "TeamSpeak の状態を取得できませんでした。管理接続を確認し、手動で更新してください。",
tsAdminTimeoutError: "TeamSpeak のリクエストがタイムアウトしました。接続を確認し、後で再試行してください。",
tsAdminChannelPassword: "チャンネルパスワード",
tsAdminServerSettings: "サーバー設定",
tsAdminWelcome: "ウェルカムメッセージ",
tsAdminSlots: "最大接続数",
@@ -27,6 +27,19 @@ function surfaceDocument(): SkinPluginDocument {
};
}
test("declarative skins can read channel spacer presentation without new permissions", () => {
const document = {
schemaVersion: 3,
components: [{ id: "channel-labels", name: "Channel labels", page: "voice", accessibleName: "Channel labels", permissions: ["session.channels.read"], actions: {},
root: { tag: "div", repeat: { path: "session.channels", as: "channel" }, children: [
{ tag: "span", children: [{ text: "{{channel.displayName}} {{channel.spacerAlignment}} {{channel.spacerStyle}}" }], when: { path: "channel.isSpacer", equals: true } },
] },
}],
};
assert.doesNotThrow(() => parseSkinPluginDocument(document));
assert.throws(() => parseSkinPluginDocument({ ...document, components: [{ ...document.components[0], permissions: [] }] }));
});
test("page replacement stays disabled until local approval and returns to the host after revocation", () => {
const storage = new Map<string, string>();
const previousStorage = Object.getOwnPropertyDescriptor(globalThis, "localStorage");
@@ -5,6 +5,34 @@ import type { ChannelMember } from "../composables/useVoiceWebSocket.js";
import { useWebClientMembers } from "../composables/useWebClientMembers.js";
import { buildVoiceChannelTree, filterVoiceChannelTree } from "./voice-channel-tree.js";
import { memberPresenceKey } from "./member-presence.js";
import { channelDisplayName, getChannelSpacer } from "../../../src/shared/channel-spacer.js";
test("TeamSpeak spacers require a leading marker on a permanent root channel", () => {
const channel = { name: "[cspacer0]🏔 后山 🏔", parentID: "0", isPermanent: true };
assert.deepEqual(getChannelSpacer(channel), { text: "🏔 后山 🏔", alignment: "center", style: "text" });
assert.equal(channelDisplayName(channel), "🏔 后山 🏔");
for (const ordinary of [
{ ...channel, isPermanent: false }, { ...channel, isPermanent: undefined }, { ...channel, parentID: "1" },
{ ...channel, name: "prefix [cspacer0]Title" }, { ...channel, name: "[cspacer0Title" },
{ ...channel, name: "[xspacer0]Title" }, { ...channel, name: "General" },
]) {
assert.equal(getChannelSpacer(ordinary), null);
assert.equal(channelDisplayName(ordinary), ordinary.name);
}
});
test("spacer display supports blank labels, arbitrary IDs, case, alignment and standard line patterns", () => {
const base = { parentID: "0", isPermanent: true };
for (const [name, alignment, text] of [
["[spacer]", "left", ""], ["[CSPACER0]", "center", ""],
["[lspacerstaff]Staff", "left", "Staff"], ["[rspacer42]Right", "right", "Right"],
["[*spacer0]★·", "repeat", "★·"], ["[cspacer1]A]B", "center", "A]B"],
["[cspacer]__proto__", "center", "__proto__"],
]) assert.deepEqual(getChannelSpacer({ ...base, name }), { text, alignment, style: "text" });
for (const [text, style] of [["___", "solid"], ["---", "dashed"], ["...", "dotted"], ["-.-", "dash-dot"], ["-..", "dash-dot-dot"]]) {
assert.deepEqual(getChannelSpacer({ ...base, name: `[*spacer0]${text}` }), { text, alignment: "repeat", style });
}
});
test("channel search keeps matching nested channels and only their ancestors", () => {
const tree = buildVoiceChannelTree([
+1 -1
View File
@@ -144,7 +144,7 @@ const skinPluginContext = computed(() => ({
skin: { locale: language.value, messages: skinMessages.value },
session: {
status: { connected: true, connecting: false, channelId: selectedChannel.value.id, channelName: selectedChannel.value.name, userName: "illusia" },
channels: channels.map((channel, depth) => ({ id: channel.id, name: channel.name, parentId: "", depth, memberCount: channel.members.length, current: channel.id === selectedChannel.value.id })),
channels: channels.map((channel, depth) => ({ id: channel.id, name: channel.name, displayName: channel.name, isSpacer: false, spacerAlignment: "", spacerStyle: "", parentId: "", depth, memberCount: channel.members.length, current: channel.id === selectedChannel.value.id })),
members: selectedChannel.value.members.map((member) => ({
id: member.id,
name: member.name,
+6
View File
@@ -972,6 +972,7 @@ import SkinLoadRecoveryNotice from "../components/SkinLoadRecoveryNotice.vue";
import VoiceMemberCards from "../components/web-client/VoiceMemberCards.vue";
import VoicePerformancePanel from "../components/web-client/VoicePerformancePanel.vue";
import VoiceChannelTree from "../components/web-client/VoiceChannelTree.vue";
import { channelDisplayName, getChannelSpacer } from "../../../src/shared/channel-spacer.js";
import VoiceServerSwitcher from "../components/web-client/VoiceServerSwitcher.vue";
import VoiceServerHeader from "../components/web-client/VoiceServerHeader.vue";
import VoiceServerBanner from "../components/web-client/VoiceServerBanner.vue";
@@ -1649,9 +1650,14 @@ const skinPluginContext = computed(() => ({
},
channels: channelTree.value.map((item) => {
const members = skinPluginMembers.value.filter((member) => member.channelId === item.id);
const spacer = getChannelSpacer(item);
return {
id: item.id,
name: item.name,
displayName: channelDisplayName(item),
isSpacer: Boolean(spacer),
spacerAlignment: spacer?.alignment ?? "",
spacerStyle: spacer?.style ?? "",
parentId: item.parentID,
depth: item.depth,
memberCount: item.members.length,
+29 -1
View File
@@ -539,8 +539,12 @@ test("TS mutations send the selected UID once and a failed refresh never retries
const pending = model.runAction(); await model.runAction();
response.resolve(json({ ok: true })); await pending;
assert.equal(writes, 1); assert.equal(model.acting, false); assert.equal(model.editor.action, "");
assert.ok(model.noticeMessage); assert.ok(state.errorMessage);
assert.ok(model.noticeMessage); assert.equal(state.errorMessage, "");
assert.ok(model.refreshWarning.includes("操作已完成")); assert.ok(model.refreshWarning.includes("勿重复执行"));
assert.equal(model.overview, null);
handler = path => Promise.resolve(json(defaults(path)));
await model.connectAndRefresh();
assert.equal(model.refreshWarning, ""); assert.ok(model.overview);
});
test("leaving TS management discards a late response and logout clears saved credential drafts", async () => {
@@ -569,6 +573,11 @@ test("TS administration actually renders transport forms, operations and all fiv
assert.ok(html.includes("WebQuery")); assert.ok(html.includes("https://query.example"));
assert.ok(html.includes("Selected user")); assert.ok(html.includes("Lobby"));
assert.ok(!html.includes("undefined"));
readable.beginAction("channel.create");
const creating = await renderToString(createSSRApp(Component, { model, i18n: state.i18n, targetAddress: "voice.example", targetPort: "9987" }));
assert.ok(creating.includes(state.i18n.tr("tsAdminChannelPassword")));
assert.ok(!creating.includes(`<span>${state.i18n.tr("tsAdminPassword")}</span><input type="password" autocomplete="new-password" maxlength="512"`));
readable.closeAction();
}
readable.form.transport = "ssh";
let html = await renderToString(createSSRApp(Component, { model, i18n: state.i18n, targetAddress: "voice.example", targetPort: "9987" }));
@@ -580,6 +589,25 @@ test("TS administration actually renders transport forms, operations and all fiv
assert.ok(html.includes('class="operation-card ts-admin-editor"')); assert.ok(html.includes("Selected user"));
});
test("TS list warnings distinguish rate limits, permissions, timeouts and other read failures in every language", async () => {
const { createSSRApp } = await import("vue");
const { renderToString } = await import("vue/server-renderer");
const { default: Component } = await vite.ssrLoadModule("/src/components/admin/AdminTsAdmin.vue");
await mount("/admin/ts-admin");
const model = reactive(state.adminTsAdmin);
await model.connectAndRefresh();
for (const code of ["TS_ADMIN_RATE_LIMITED", "TS_ADMIN_PERMISSION_DENIED", "TS_ADMIN_TIMEOUT", "TS_ADMIN_READ_FAILED"]) {
model.overview.groupsAvailable = false; model.overview.bansAvailable = false;
model.overview.groupsErrorCode = code; model.overview.bansErrorCode = code;
for (const language of ["zh", "en", "de", "ru", "ja"]) {
state.language = language;
const html = await renderToString(createSSRApp(Component, { model: state.adminTsAdmin, i18n: state.i18n, targetAddress: "voice.example", targetPort: "9987" }));
assert.equal(html.split(state.i18n.errorText(code)).length - 1, 2);
assert.ok(!html.includes(state.i18n.tr("tsAdminRestricted")));
}
}
});
test("WebSpeak routes work in open and fixed modes without any TS management request", async () => {
for (const accessMode of ["open", "fixed"]) {
+40 -1
View File
@@ -6,15 +6,54 @@ import vue from "@vitejs/plugin-vue";
import { createServer } from "vite";
import { createRenderer, createSSRApp, nextTick, shallowRef, markRaw } from "vue";
import { renderToString } from "@vue/server-renderer";
let vite, useWebClientScreenShare, VoiceMemberCards, VoiceChannelTree;
let vite, useWebClientScreenShare, VoiceMemberCards, VoiceChannelTree, ChannelMemberPanel;
const renderer = createRenderer({ createComment: text => ({ text }), createText: text => ({ text }), createElement: () => ({}), insert() {}, remove() {}, setText() {}, setElementText() {}, patchProp() {}, parentNode: () => null, nextSibling: () => null });
before(async () => {
vite = await createServer({ configFile: false, plugins: [vue()], root: fileURLToPath(new URL("../", import.meta.url)), server: { middlewareMode: true, hmr: false, ws: false, watch: null }, optimizeDeps: { noDiscovery: true, include: [] }, appType: "custom" });
({ useWebClientScreenShare } = await vite.ssrLoadModule("/src/composables/useWebClientScreenShare.ts"));
({ default: VoiceMemberCards } = await vite.ssrLoadModule("/src/components/web-client/VoiceMemberCards.vue"));
({ default: VoiceChannelTree } = await vite.ssrLoadModule("/src/components/web-client/VoiceChannelTree.vue"));
({ default: ChannelMemberPanel } = await vite.ssrLoadModule("/src/components/web-client/ChannelMemberPanel.vue"));
});
after(async () => { await vite?.close(); });
test("both tree layouts render spacer labels without channel icons/counts, and preserve children and members", async () => {
const channels = [
{ id: "1", parentID: "0", depth: 0, name: "[cspacer0]🏔 后山 🏔", isPermanent: true, members: [{ id: 7, nickname: "Visible member" }] },
{ id: "2", parentID: "1", depth: 1, name: "[cspacer1]Nested ordinary", isPermanent: true, members: [] },
{ id: "3", parentID: "0", depth: 0, name: "[*spacer3]★", isPermanent: true, members: [] },
{ id: "4", parentID: "0", depth: 0, name: "[cspacer4]", isPermanent: true, members: [] },
{ id: "5", parentID: "0", depth: 0, name: "[cspacer5]<img src=x onerror=alert(1)>", isPermanent: true, members: [] },
];
for (const layout of ["default", "server-sidebar"]) {
const html = await renderToString(createSSRApp(VoiceChannelTree, {
channels, layout, avatarStyle: () => ({}), avatarInitial: name => name[0], isSpeaking: () => false, t: key => key,
}));
assert.equal((html.match(/data-ws-part="voice.channel-spacer"/g) ?? []).length, 4);
assert.equal((html.match(/data-ws-part="voice.channel-tree.icon"/g) ?? []).length, 1);
assert.equal((html.match(/data-ws-part="voice.channel-tree.count"/g) ?? []).length, 1);
assert.match(html, /Visible member/);
assert.match(html, /\[cspacer1\]Nested ordinary/);
assert.doesNotMatch(html, /\[cspacer0\]|\[\*spacer3\]|\[cspacer4\]|<img/);
assert.match(html, /&lt;img/);
}
});
test("the standard member panel uses the same spacer display and hides only empty spacer hints", async () => {
const html = await renderToString(createSSRApp(ChannelMemberPanel, {
model: { memberDisplayName: member => member.nickname, isSpeaking: () => false }, query: "",
filteredMemberChannels: [
{ id: "1", parentID: "0", depth: 0, name: "[rspacer0]右侧标题", isPermanent: true, members: [] },
{ id: "2", parentID: "0", depth: 0, name: "Ordinary", members: [] },
],
mobileVisible: true, isMobileViewport: false, volumes: {}, avatarStyle: () => ({}), avatarInitial: name => name[0], rangeStyle: () => ({}), t: key => key,
}));
assert.match(html, /data-alignment="right"/);
assert.match(html, /右侧标题/);
assert.doesNotMatch(html, /\[rspacer0\]/);
assert.equal((html.match(/noMembersInChannel/g) ?? []).length, 1);
});
function mount(t, initialStream = null, memberAvatar = () => "") {
const listeners = new Set(), starts = [], storage = new Map(); let exits = 0, ui;
class Element {}