Tree metadata (groups, icons, banners), viewer lifecycle fixes, deafen/loopback evidence, docs
No files matched your search
@@ -0,0 +1,15 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 0.1.0 — unreleased
|
||||||
|
|
||||||
|
- Electron desktop shell (contextIsolation, sandbox, strict CSP, allowlisted IPC, `app://` protocol).
|
||||||
|
- First-run nickname with persistent P-256 identity, visible UID, rename without UID change,
|
||||||
|
identity export/import and restore-on-first-run through native dialogs.
|
||||||
|
- Connect to TeamSpeak 6 servers, channel tree, joining (incl. password channels), private/channel/server chat.
|
||||||
|
- Voice: AudioWorklet capture (48 kHz mono, 20 ms i16 frames) and bounded playback ring, push-to-talk,
|
||||||
|
open mic, mute, deafen, device selection, voice volume.
|
||||||
|
- TS6 screenshare viewing over P2P WebRTC with ICE buffering, realign/reconnect offers, filters,
|
||||||
|
cancellation, negotiated codec/decoder statistics, stream volume, output device, fullscreen.
|
||||||
|
- Server metadata in the tree: group name labels per `name_mode`, custom group icons, channel icons
|
||||||
|
and banners, country codes, recording flag.
|
||||||
|
- Packaging script with native-core architecture checks, ELF 16 KiB page checker, Gitea CI workflow.
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# TeamsPeach ↔ TeamSpeak 6 server features
|
||||||
|
|
||||||
|
Status: **proven** = exercised against the real server 10.10.10.160 (TS6 6.0.0-beta13.1) with the real
|
||||||
|
UI, evidence path given; **implemented** = code + unit/loopback tests, no live proof yet;
|
||||||
|
**blocked** = not available, reason given. Windows x64 only unless stated.
|
||||||
|
|
||||||
|
| Feature | Status | Evidence / reason |
|
||||||
|
|---|---|---|
|
||||||
|
| First-run nickname, P-256 identity, public UID, restart persistence, rename keeps UID | proven | `docs/evidence/runtime/2026-10-24-identity/` |
|
||||||
|
| Connect / disconnect (address, server password) | proven | identity run `04-connected.png` |
|
||||||
|
| Channel tree, join channel, password channels (inline prompt) | proven (join), implemented (password) | probe joined `cs`; no password test performed |
|
||||||
|
| Voice TX/RX (Opus via core), talking indicators, mute, deafen RX+TX block/restore, PTT, open mic | proven | `docs/evidence/runtime/2026-10-24-voice-chat/` (synthetic capture device, real path after it) |
|
||||||
|
| Private chat | proven | voice-chat run `15/16-*.png` |
|
||||||
|
| Channel chat | proven error path | server denies guests: TS 2568, permission 224, shown in UI |
|
||||||
|
| Server chat | implemented | not exercised live |
|
||||||
|
| Mic/output device selection | implemented; output routing proven in loopback | `2026-10-24-loopback-browser-pipeline/` |
|
||||||
|
| TS6 screenshare viewing (P2P): discovery, join, answer, ICE buffering, stop | proven | `2026-10-24-ts6-stream-view/`: AV1 2560×1440 ~59 fps, 2298 frames, D3D11 decoder |
|
||||||
|
| Realign / reconnect offer renegotiation | implemented | unit tests + loopback (2 offers/2 answers); no realign seen live |
|
||||||
|
| Stream audio | implemented | live stream advertised `audio=0`; loopback 139 inbound audio packets |
|
||||||
|
| SFU streams | blocked | P2P only; `notifysfuaccessinfo` → "не поддерживается" |
|
||||||
|
| Sending own screenshare | blocked | not implemented |
|
||||||
|
| Server/channel group labels (`name_mode`), custom group icons, country | proven | `2026-10-24-tree-metadata/`: labels «куколд», «бля ща», 6 custom icons, RU |
|
||||||
|
| Built-in group icons (id < 1000) | partial | server has no file; neutral named badge |
|
||||||
|
| Channel icons and banners | proven | tree-metadata run: 11/11 icons, 11/11 banners |
|
||||||
|
| Host banner | implemented in core | not rendered in UI yet |
|
||||||
|
| Avatars (server file) | implemented | no client on this server has `client_flag_avatar` |
|
||||||
|
| Avatars (myTeamSpeak URL) | blocked (pending core field) | core adding `myts_avatar_url(s)`; main allowlists only server-announced http(s) URLs |
|
||||||
|
| Nickname colours | blocked | source not found in official UI bundle |
|
||||||
|
| Poke | not implemented | core supports target `poke` |
|
||||||
|
| Identity export/import | implemented | CLI path by core; UI export via native dialog not exercised in automation |
|
||||||
|
| Hardware video decode policy / OpenH264 toggle | blocked | Chromium engine exposes no per-codec backend choice; decoder is reported live |
|
||||||
|
| Linux x64 / arm64 packages | in CI | Gitea run #1 started; results pending; Asahi hardware not reachable |
|
||||||
|
| macOS, Windows ARM64 | blocked | no build hosts |
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
# TeamsPeach
|
||||||
|
|
||||||
|
Настольный клиент для серверов **TeamSpeak 6** без учётной записи myTeamSpeak: голос, чат, дерево
|
||||||
|
каналов с группами/иконками/баннерами сервера и **просмотр трансляций экрана TS6**.
|
||||||
|
Интерфейс — Electron (обычные JS-модули, HTML/CSS), протокол — нативное ядро на Rust
|
||||||
|
(`core/`, ReSpeak tsclientlib) через приватный stdio (контракт: [`docs/bridge.md`](docs/bridge.md)).
|
||||||
|
|
||||||
|
Подробная карта возможностей и доказательств: [`FEATURE_COMPATIBILITY.md`](FEATURE_COMPATIBILITY.md).
|
||||||
|
|
||||||
|
## Запуск для разработки (Windows / Linux)
|
||||||
|
|
||||||
|
```
|
||||||
|
npm ci
|
||||||
|
cargo build --release --locked --manifest-path core/Cargo.toml # нужен Rust ≥ 1.89, CMake, C-компилятор
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
Electron ищет ядро в `core/target/release` и `core/target/debug` (берётся более свежий файл).
|
||||||
|
На Windows cargo установлен rustup'ом без изменения PATH — запускайте `%USERPROFILE%\.cargo\bin\cargo.exe`
|
||||||
|
или откройте «Developer PowerShell for VS». При нехватке памяти линковки используйте `-j 2`.
|
||||||
|
|
||||||
|
Отдельный профиль (не трогает основной): `TEAMSPEACH_PROFILE_DIR=<абсолютный путь> npm start`.
|
||||||
|
|
||||||
|
## Сборка пакетов
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run dist:win-x64 # NSIS + zip
|
||||||
|
npm run dist:linux-x64 # AppImage + tar.gz
|
||||||
|
npm run dist:linux-arm64 # AppImage + tar.gz (ядро aarch64 собирается отдельно)
|
||||||
|
```
|
||||||
|
|
||||||
|
`scripts/dist.mjs` **отказывается** собирать пакет без ядра нужной ОС/архитектуры (проверка
|
||||||
|
заголовка PE/ELF/Mach-O), кладёт `THIRD_PARTY_NOTICES.md` ядра в `resources/licenses/` и проверяет,
|
||||||
|
что ядро действительно попало в пакет. Для Asahi (страницы 16 КиБ) есть
|
||||||
|
`node scripts/elf-pagesize.mjs <файл|папка>` — проверка выравнивания PT_LOAD, glibc и зависимостей.
|
||||||
|
|
||||||
|
CI: `.gitea/workflows/ci.yml` (Gitea Actions, контейнеры на Linux x64): тесты, сборка ядра,
|
||||||
|
офлайн-проверка идентичности через stdio, Electron-смоук под Xvfb, кросс-сборка ядра aarch64 с
|
||||||
|
проверкой 16 КиБ и запуском под `qemu-aarch64` (эмуляция, не железо Apple).
|
||||||
|
|
||||||
|
## Использование
|
||||||
|
|
||||||
|
1. Первый запуск: один раз ввести никнейм — создаётся криптографическая идентичность (P-256),
|
||||||
|
публичный UID виден в «Настройки → Профиль». Никнейм меняется без смены UID.
|
||||||
|
2. Ввести адрес сервера (и пароль, если нужен) → «Подключиться».
|
||||||
|
3. Клик по каналу — переход (для каналов с паролем откроется поле ввода).
|
||||||
|
4. Голос: «Нажми и говори» (по умолчанию F8 или кнопка в шапке) либо «Открытый микрофон»;
|
||||||
|
кнопки микрофона и звука внизу слева видны серверу.
|
||||||
|
5. Трансляции: у стримящего участника появится кнопка «Смотреть». Громкость, отключение звука,
|
||||||
|
полный экран, «Прекратить просмотр» — на панели под видео. В строке статуса — реально
|
||||||
|
согласованный кодек, разрешение и частота кадров.
|
||||||
|
|
||||||
|
## Резервная копия идентичности
|
||||||
|
|
||||||
|
«Настройки → Профиль → Экспортировать…» сохраняет файл в формате TeamSpeak (`.ini`) через системный
|
||||||
|
диалог. **Файл содержит закрытый ключ** — храните как пароль. Восстановление: «Импортировать…»
|
||||||
|
(после отключения от сервера; текущая идентичность заменяется только после подтверждения) или
|
||||||
|
кнопка «Восстановить из резервной копии…» на экране первого запуска. Ядро никогда не создаёт новую
|
||||||
|
идентичность поверх повреждённой.
|
||||||
|
|
||||||
|
Данные: `%APPDATA%\TeamsPeach` (Windows), `~/.config/TeamsPeach` (Linux): `core/identity.json`,
|
||||||
|
`core/profile.json`, `prefs.json`, `logs/`.
|
||||||
|
|
||||||
|
## Ограничения (честно)
|
||||||
|
|
||||||
|
- Трансляции только P2P (как у официального клиента по умолчанию). SFU-трансляции сервер
|
||||||
|
обозначает уведомлением — TeamsPeach пишет «не поддерживается». TURN нет: нужен прямой путь
|
||||||
|
до компьютера стримера (STUN `turn.teamspeak.com`, как у официального клиента).
|
||||||
|
- Показ своего экрана (отправка трансляции) не реализован.
|
||||||
|
- Клавиша PTT работает только когда окно активно (глобальные клавиши на Wayland недоступны).
|
||||||
|
- Голос только Opus; каналы Speex/CELT помечаются как непригодные для передачи.
|
||||||
|
- Ник-цвета и аватары myTeamSpeak пока не отображаются (источник цвета не найден; аватары
|
||||||
|
ожидают поле ядра). Иконки встроенных групп TeamSpeak (id < 1000) показываются нейтральным значком
|
||||||
|
с названием группы — у сервера нет этих файлов.
|
||||||
|
- Управление «Cisco OpenH264» и выбор аппаратных бэкендов из TS6 в движке Chromium недоступны;
|
||||||
|
декодирование выбирает Chromium (на Windows подтверждён аппаратный D3D11 для AV1).
|
||||||
|
- Сборки macOS и Windows ARM64 не выпускаются: нет сборочных машин. Linux ARM64 собирается
|
||||||
|
кроссом; запуск на Asahi M1 Pro не проверен — машина недоступна по SSH.
|
||||||
|
- Пакеты не подписаны: Windows SmartScreen и macOS Gatekeeper будут предупреждать.
|
||||||
|
|
||||||
|
## Продукт и дизайн
|
||||||
|
|
||||||
|
Рабочий инструмент: привычная раскладка голосового чата (сервер и дерево слева, канал/чат справа),
|
||||||
|
системные шрифты, светлая/тёмная тема по настройке ОС, единственный акцент — персиковый; зелёный —
|
||||||
|
только «говорит». Всё содержимое сервера выводится как текст (`textContent`), изображения — только
|
||||||
|
байты, проверенные по сигнатуре. Renderer изолирован (contextIsolation, sandbox, строгая CSP,
|
||||||
|
список разрешённых команд в main); пути к файлам выбирает только main через системные диалоги.
|
||||||
|
|
||||||
|
## Проверки
|
||||||
|
|
||||||
|
- `npm test` — модульные тесты (валидация IPC, сессия просмотра, каталог трансляций).
|
||||||
|
- `node scripts/core-smoke.mjs <ядро>` — офлайн-инварианты идентичности.
|
||||||
|
- `node scripts/smoke-ui.mjs`, `smoke-voice.mjs`, `probe-stream.mjs`, `loopback-stream.mjs`,
|
||||||
|
`smoke-tree.mjs` — реальный UI; результаты прогонов лежат в `docs/evidence/runtime/`.
|
||||||
@@ -122,6 +122,15 @@ const COMMANDS = {
|
|||||||
stream_join: shape({ stream_id: streamId, client_id: posInt, message: optional(str(0, 200)) }),
|
stream_join: shape({ stream_id: streamId, client_id: posInt, message: optional(str(0, 200)) }),
|
||||||
stream_signal: shape({ stream_id: streamId, client_id: posInt, json: signalJson }),
|
stream_signal: shape({ stream_id: streamId, client_id: posInt, json: signalJson }),
|
||||||
stream_leave: shape({ stream_id: streamId, client_id: posInt }),
|
stream_leave: shape({ stream_id: streamId, client_id: posInt }),
|
||||||
|
fetch_icon: shape({
|
||||||
|
icon_id: (v, k) => {
|
||||||
|
if (!Number.isSafeInteger(v) || v <= 0 || v > 0xffffffff) throw new ValidationError(`${k}: ожидался идентификатор иконки`);
|
||||||
|
return v;
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
fetch_avatar: shape({ client_id: posInt }),
|
||||||
|
fetch_banner: shape({ channel_id: posInt }),
|
||||||
|
fetch_server_banner: shape({}),
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Returns sanitized args or throws ValidationError. */
|
/** Returns sanitized args or throws ValidationError. */
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const CSP = [
|
|||||||
"default-src 'none'",
|
"default-src 'none'",
|
||||||
"script-src 'self'",
|
"script-src 'self'",
|
||||||
"style-src 'self'",
|
"style-src 'self'",
|
||||||
"img-src 'self' data:",
|
"img-src 'self' data: blob:",
|
||||||
"media-src 'self' blob: mediastream:",
|
"media-src 'self' blob: mediastream:",
|
||||||
"font-src 'self'",
|
"font-src 'self'",
|
||||||
"connect-src 'none'",
|
"connect-src 'none'",
|
||||||
@@ -127,6 +127,13 @@ function onCoreEvent(evt) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (evt.event === 'state' && typeof evt.state === 'string') connectionState = evt.state;
|
if (evt.event === 'state' && typeof evt.state === 'string') connectionState = evt.state;
|
||||||
|
if (evt.event === 'state' && evt.state === 'disconnected') externalMedia.clear();
|
||||||
|
if (evt.event === 'snapshot' && Array.isArray(evt.clients)) {
|
||||||
|
for (const c of evt.clients) {
|
||||||
|
if (typeof c.myts_avatar_url === 'string') allowExternalMedia(c.myts_avatar_url);
|
||||||
|
if (Array.isArray(c.myts_avatar_urls)) for (const v of c.myts_avatar_urls) allowExternalMedia(v && v.url);
|
||||||
|
}
|
||||||
|
}
|
||||||
sendToRenderer('core:event', evt);
|
sendToRenderer('core:event', evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,6 +178,71 @@ function appendLog(file, text) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- external images announced by the server (http/https only) ----------
|
||||||
|
|
||||||
|
const EXTERNAL_MEDIA_LIMIT = 4 * 1024 * 1024;
|
||||||
|
const externalMedia = new Set();
|
||||||
|
let mediaSession = null;
|
||||||
|
|
||||||
|
/** Only URLs the core reported from server data may be fetched; the renderer cannot add its own. */
|
||||||
|
function allowExternalMedia(url) {
|
||||||
|
if (typeof url !== 'string' || url.length > 2048) return;
|
||||||
|
try {
|
||||||
|
const u = new URL(url);
|
||||||
|
if (u.protocol !== 'https:' && u.protocol !== 'http:') return;
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (externalMedia.size >= 512) externalMedia.clear();
|
||||||
|
externalMedia.add(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sniffImage(b) {
|
||||||
|
if (b.length >= 8 && b.readUInt32BE(0) === 0x89504e47) return 'image/png';
|
||||||
|
if (b.length >= 3 && b[0] === 0xff && b[1] === 0xd8 && b[2] === 0xff) return 'image/jpeg';
|
||||||
|
if (b.length >= 6 && b.toString('latin1', 0, 4) === 'GIF8') return 'image/gif';
|
||||||
|
if (b.length >= 12 && b.toString('latin1', 0, 4) === 'RIFF' && b.toString('latin1', 8, 12) === 'WEBP') return 'image/webp';
|
||||||
|
if (b.length >= 4 && b.readUInt32BE(0) === 0x00000100) return 'image/x-icon';
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchExternalMedia(url) {
|
||||||
|
if (typeof url !== 'string' || !externalMedia.has(url)) {
|
||||||
|
return { ok: false, error: { code: 'forbidden', message: 'Адрес не был объявлен сервером' } };
|
||||||
|
}
|
||||||
|
if (!mediaSession) mediaSession = session.fromPartition('teamspeach-media', { cache: true });
|
||||||
|
const controller = new AbortController();
|
||||||
|
const timer = setTimeout(() => controller.abort(), 15000);
|
||||||
|
try {
|
||||||
|
const res = await mediaSession.fetch(url, { signal: controller.signal, headers: { Accept: 'image/*' } });
|
||||||
|
const finalProtocol = new URL(res.url || url).protocol;
|
||||||
|
if (finalProtocol !== 'https:' && finalProtocol !== 'http:') throw new Error('redirect to a non-http scheme');
|
||||||
|
if (!res.ok) return { ok: false, error: { code: 'http_error', message: `HTTP ${res.status}` } };
|
||||||
|
const reader = res.body.getReader();
|
||||||
|
const chunks = [];
|
||||||
|
let size = 0;
|
||||||
|
for (;;) {
|
||||||
|
const { done, value } = await reader.read();
|
||||||
|
if (done) break;
|
||||||
|
size += value.byteLength;
|
||||||
|
if (size > EXTERNAL_MEDIA_LIMIT) {
|
||||||
|
controller.abort();
|
||||||
|
return { ok: false, error: { code: 'media_too_large', message: 'Изображение больше 4 МиБ' } };
|
||||||
|
}
|
||||||
|
chunks.push(Buffer.from(value));
|
||||||
|
}
|
||||||
|
const bytes = Buffer.concat(chunks);
|
||||||
|
// Servers mislabel images (e.g. text/plain); trust only the bytes.
|
||||||
|
const mime = sniffImage(bytes);
|
||||||
|
if (!mime) return { ok: false, error: { code: 'media_unsupported', message: 'Не изображение' } };
|
||||||
|
return { ok: true, result: { mime, bytes: bytes.length, data: bytes.toString('base64') } };
|
||||||
|
} catch (err) {
|
||||||
|
return { ok: false, error: { code: 'io', message: err.name === 'AbortError' ? 'Истекло время загрузки' : err.message } };
|
||||||
|
} finally {
|
||||||
|
clearTimeout(timer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---------- identity backup (main-only, native dialogs) ----------
|
// ---------- identity backup (main-only, native dialogs) ----------
|
||||||
|
|
||||||
async function exportIdentity() {
|
async function exportIdentity() {
|
||||||
@@ -331,7 +403,9 @@ function registerIpc() {
|
|||||||
}
|
}
|
||||||
if (!core) return { ok: false, error: { code: 'core_unavailable', message: 'Ядро не запущено' } };
|
if (!core) return { ok: false, error: { code: 'core_unavailable', message: 'Ядро не запущено' } };
|
||||||
const hasArgs = Object.keys(clean).length > 0;
|
const hasArgs = Object.keys(clean).length > 0;
|
||||||
return core.request(cmd, hasArgs ? clean : undefined);
|
const response = await core.request(cmd, hasArgs ? clean : undefined);
|
||||||
|
if (!response.ok && response.error.code === 'external_media' && response.error.detail) allowExternalMedia(response.error.detail.url);
|
||||||
|
return response;
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('core:audio-frame', (event, frame) => {
|
ipcMain.on('core:audio-frame', (event, frame) => {
|
||||||
@@ -382,6 +456,8 @@ function registerIpc() {
|
|||||||
ipcMain.handle('identity:export', (event) => (trustedSender(event) ? exportIdentity() : { ok: false }));
|
ipcMain.handle('identity:export', (event) => (trustedSender(event) ? exportIdentity() : { ok: false }));
|
||||||
ipcMain.handle('identity:import', (event) => (trustedSender(event) ? importIdentity() : { ok: false }));
|
ipcMain.handle('identity:import', (event) => (trustedSender(event) ? importIdentity() : { ok: false }));
|
||||||
|
|
||||||
|
ipcMain.handle('media:external', (event, url) => (trustedSender(event) ? fetchExternalMedia(url) : { ok: false }));
|
||||||
|
|
||||||
ipcMain.handle('clipboard:write', (event, text) => {
|
ipcMain.handle('clipboard:write', (event, text) => {
|
||||||
if (!trustedSender(event) || typeof text !== 'string' || text.length > 4096) return false;
|
if (!trustedSender(event) || typeof text !== 'string' || text.length > 4096) return false;
|
||||||
clipboard.writeText(text);
|
clipboard.writeText(text);
|
||||||
|
|||||||
@@ -26,5 +26,6 @@ contextBridge.exposeInMainWorld('teamspeach', {
|
|||||||
importIdentity: () => ipcRenderer.invoke('identity:import'),
|
importIdentity: () => ipcRenderer.invoke('identity:import'),
|
||||||
copyText: (text) => ipcRenderer.invoke('clipboard:write', text),
|
copyText: (text) => ipcRenderer.invoke('clipboard:write', text),
|
||||||
openLogs: () => ipcRenderer.invoke('app:open-logs'),
|
openLogs: () => ipcRenderer.invoke('app:open-logs'),
|
||||||
|
fetchExternalMedia: (url) => ipcRenderer.invoke('media:external', url),
|
||||||
log: (level, message) => ipcRenderer.send('app:log', level, String(message)),
|
log: (level, message) => ipcRenderer.send('app:log', level, String(message)),
|
||||||
});
|
});
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="ru">
|
<html lang="ru">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; media-src 'self' blob: mediastream:; font-src 'self'; connect-src 'none'; worker-src 'self'; base-uri 'none'; form-action 'none'; frame-src 'none'; object-src 'none'">
|
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data: blob:; media-src 'self' blob: mediastream:; font-src 'self'; connect-src 'none'; worker-src 'self'; base-uri 'none'; form-action 'none'; frame-src 'none'; object-src 'none'">
|
||||||
<meta name="color-scheme" content="light dark">
|
<meta name="color-scheme" content="light dark">
|
||||||
<title>TeamsPeach</title>
|
<title>TeamsPeach</title>
|
||||||
<link rel="stylesheet" href="styles/app.css">
|
<link rel="stylesheet" href="styles/app.css">
|
||||||
@@ -30,6 +30,8 @@
|
|||||||
<symbol id="i-moon" viewBox="0 0 24 24"><path d="M19.5 14.6A7.8 7.8 0 1 1 9.4 4.5a6.2 6.2 0 0 0 10.1 10.1z"/></symbol>
|
<symbol id="i-moon" viewBox="0 0 24 24"><path d="M19.5 14.6A7.8 7.8 0 1 1 9.4 4.5a6.2 6.2 0 0 0 10.1 10.1z"/></symbol>
|
||||||
<symbol id="i-message" viewBox="0 0 24 24"><path d="M4.5 5.5h15v10.5h-9.5l-5.5 4z"/></symbol>
|
<symbol id="i-message" viewBox="0 0 24 24"><path d="M4.5 5.5h15v10.5h-9.5l-5.5 4z"/></symbol>
|
||||||
<symbol id="i-peach" viewBox="0 0 24 24"><path class="peach-body" d="M12 7.2c-4.6-1.6-8 1.6-8 6 0 4.6 3.6 8.3 8 8.3s8-3.7 8-8.3c0-4.4-3.4-7.6-8-6z"/><path class="peach-crease" d="M12 7.6c-1.8 2.6-2 8.6 0 13.6"/><path class="peach-leaf" d="M12.2 6.8c.2-2.6 2-4.2 5-4.3-.3 2.7-2.1 4.2-5 4.3z"/></symbol>
|
<symbol id="i-peach" viewBox="0 0 24 24"><path class="peach-body" d="M12 7.2c-4.6-1.6-8 1.6-8 6 0 4.6 3.6 8.3 8 8.3s8-3.7 8-8.3c0-4.4-3.4-7.6-8-6z"/><path class="peach-crease" d="M12 7.6c-1.8 2.6-2 8.6 0 13.6"/><path class="peach-leaf" d="M12.2 6.8c.2-2.6 2-4.2 5-4.3-.3 2.7-2.1 4.2-5 4.3z"/></symbol>
|
||||||
|
<symbol id="i-shield" viewBox="0 0 24 24"><path d="M12 3.5l7 2.6v5.4c0 4.3-2.9 7.6-7 9-4.1-1.4-7-4.7-7-9V6.1z"/></symbol>
|
||||||
|
<symbol id="i-record" viewBox="0 0 24 24"><circle cx="12" cy="12" r="6.5"/><circle cx="12" cy="12" r="2.5"/></symbol>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<div id="boot" class="boot" role="status">
|
<div id="boot" class="boot" role="status">
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
// Server images (group/channel icons, channel banners, host banner, avatars) as blob: URLs.
|
||||||
|
// Bytes come from the core's file transfer (or main's allowlisted http(s) fetch); MIME is sniffed
|
||||||
|
// upstream and re-checked here. Failures are cached as null so a missing file is not refetched.
|
||||||
|
import { tp, call, log } from './core.js';
|
||||||
|
|
||||||
|
const ALLOWED = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/x-icon', 'image/svg+xml']);
|
||||||
|
const cache = new Map();
|
||||||
|
|
||||||
|
function toUrl(result) {
|
||||||
|
if (!result || !ALLOWED.has(result.mime) || typeof result.data !== 'string') return null;
|
||||||
|
const bin = atob(result.data);
|
||||||
|
const bytes = new Uint8Array(bin.length);
|
||||||
|
for (let i = 0; i < bin.length; i += 1) bytes[i] = bin.charCodeAt(i);
|
||||||
|
return URL.createObjectURL(new Blob([bytes], { type: result.mime }));
|
||||||
|
}
|
||||||
|
|
||||||
|
function cached(key, load) {
|
||||||
|
if (!cache.has(key)) {
|
||||||
|
cache.set(key, load().then(toUrl).catch((err) => {
|
||||||
|
if (err.code !== 'not_found') log('info', `media ${key.split(':')[0]} unavailable: ${err.code ?? err.message}`);
|
||||||
|
return null;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
return cache.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function viaCore(cmd, args) {
|
||||||
|
try {
|
||||||
|
return await call(cmd, args);
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code === 'external_media' && err.detail && typeof err.detail.url === 'string') {
|
||||||
|
const r = await tp.fetchExternalMedia(err.detail.url);
|
||||||
|
if (r && r.ok) return r.result;
|
||||||
|
const e = new Error(r?.error?.message ?? 'external fetch failed');
|
||||||
|
e.code = r?.error?.code ?? 'io';
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Built-in TeamSpeak group icons (< 1000) have no file on the server. */
|
||||||
|
export function isBuiltinIcon(id) {
|
||||||
|
return Number.isInteger(id) && id > 0 && id < 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function iconUrl(iconId) {
|
||||||
|
if (!iconId || isBuiltinIcon(iconId)) return Promise.resolve(null);
|
||||||
|
return cached(`icon:${iconId}`, () => call('fetch_icon', { icon_id: iconId }));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function channelBannerUrl(channel) {
|
||||||
|
if (!channel.banner_url) return Promise.resolve(null);
|
||||||
|
return cached(`banner:${channel.id}:${channel.banner_url}`, () => viaCore('fetch_banner', { channel_id: channel.id }));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function serverBannerUrl(server) {
|
||||||
|
if (!server?.hostbanner_gfx_url) return Promise.resolve(null);
|
||||||
|
return cached(`hostbanner:${server.hostbanner_gfx_url}`, () => viaCore('fetch_server_banner'));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function avatarUrl(client) {
|
||||||
|
if (client.avatar_hash) return cached(`avatar:${client.uid}:${client.avatar_hash}`, () => call('fetch_avatar', { client_id: client.id }));
|
||||||
|
const myts = mytsAvatar(client);
|
||||||
|
if (myts) {
|
||||||
|
return cached(`myts:${myts}`, async () => {
|
||||||
|
const r = await tp.fetchExternalMedia(myts);
|
||||||
|
if (r && r.ok) return r.result;
|
||||||
|
const e = new Error(r?.error?.message ?? 'external fetch failed');
|
||||||
|
e.code = r?.error?.code ?? 'io';
|
||||||
|
throw e;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Promise.resolve(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function mytsAvatar(client) {
|
||||||
|
if (typeof client.myts_avatar_url === 'string') return client.myts_avatar_url;
|
||||||
|
if (Array.isArray(client.myts_avatar_urls) && client.myts_avatar_urls.length) {
|
||||||
|
const sorted = [...client.myts_avatar_urls].filter((v) => v && typeof v.url === 'string').sort((a, b) => (a.size ?? 0) - (b.size ?? 0));
|
||||||
|
return (sorted.find((v) => (v.size ?? 0) >= 64) ?? sorted.at(-1))?.url ?? null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Forget everything (new server or disconnect) and release blob URLs. */
|
||||||
|
export function clearMedia() {
|
||||||
|
for (const p of cache.values()) p.then((url) => url && URL.revokeObjectURL(url));
|
||||||
|
cache.clear();
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
// Channel tree with members (TeamSpeak order), talking state, mute flags and stream badges.
|
// Channel tree with members (TeamSpeak order): talking state, mute flags, server-configured group
|
||||||
|
// labels and icons, channel icons/banners, avatars and stream badges — all from real server data.
|
||||||
import { $, h, icon, reconcile, setText } from './dom.js';
|
import { $, h, icon, reconcile, setText } from './dom.js';
|
||||||
import { S, isConnected } from './state.js';
|
import { S, isConnected } from './state.js';
|
||||||
import { call } from './core.js';
|
import { call } from './core.js';
|
||||||
import { errorText, parseSpacer, pluralMembers } from './text.js';
|
import { errorText, parseSpacer, pluralMembers } from './text.js';
|
||||||
import { toast } from './toast.js';
|
import { toast } from './toast.js';
|
||||||
|
import { iconUrl, isBuiltinIcon, channelBannerUrl, avatarUrl } from './media.js';
|
||||||
|
|
||||||
let hooks = { openPrivate: () => {}, openSettings: () => {}, toggleWatch: () => {}, streamOf: () => null, watchingId: () => null };
|
let hooks = { openPrivate: () => {}, openSettings: () => {}, toggleWatch: () => {}, streamOf: () => null, watchingId: () => null };
|
||||||
let pendingPasswordCid = null;
|
let pendingPasswordCid = null;
|
||||||
@@ -92,7 +94,14 @@ function updateRow(el, item) {
|
|||||||
// ---------- channels ----------
|
// ---------- channels ----------
|
||||||
|
|
||||||
function createChannelRow() {
|
function createChannelRow() {
|
||||||
const btn = h('button', { class: 'row-btn', type: 'button' }, icon('channel'), h('span', { class: 'row-label' }), h('span', { class: 'channel-meta' }));
|
const btn = h(
|
||||||
|
'button',
|
||||||
|
{ class: 'row-btn', type: 'button' },
|
||||||
|
icon('channel'),
|
||||||
|
h('span', { class: 'row-label' }),
|
||||||
|
h('span', { class: 'channel-icon', 'aria-hidden': 'true' }),
|
||||||
|
h('span', { class: 'channel-meta' }),
|
||||||
|
);
|
||||||
const li = h('li', { class: 'tree-row channel-row' }, btn);
|
const li = h('li', { class: 'tree-row channel-row' }, btn);
|
||||||
btn.addEventListener('click', () => joinChannel(Number(li.dataset.cid)));
|
btn.addEventListener('click', () => joinChannel(Number(li.dataset.cid)));
|
||||||
return li;
|
return li;
|
||||||
@@ -104,7 +113,7 @@ function updateChannelRow(li, ch, count) {
|
|||||||
const current = ch.id === S.snap.own_channel_id;
|
const current = ch.id === S.snap.own_channel_id;
|
||||||
li.dataset.current = String(current);
|
li.dataset.current = String(current);
|
||||||
const btn = li.firstElementChild;
|
const btn = li.firstElementChild;
|
||||||
const [ic, label, meta] = btn.children;
|
const [ic, label, chIcon, meta] = btn.children;
|
||||||
ic.firstElementChild.setAttribute('href', ch.has_password ? '#i-lock' : '#i-channel');
|
ic.firstElementChild.setAttribute('href', ch.has_password ? '#i-lock' : '#i-channel');
|
||||||
setText(label, ch.name);
|
setText(label, ch.name);
|
||||||
const max = ch.max_clients;
|
const max = ch.max_clients;
|
||||||
@@ -117,6 +126,27 @@ function updateChannelRow(li, ch, count) {
|
|||||||
btn.title = ch.topic ? ch.topic : current ? 'Вы в этом канале' : 'Перейти в канал';
|
btn.title = ch.topic ? ch.topic : current ? 'Вы в этом канале' : 'Перейти в канал';
|
||||||
if (current) btn.setAttribute('aria-current', 'location');
|
if (current) btn.setAttribute('aria-current', 'location');
|
||||||
else btn.removeAttribute('aria-current');
|
else btn.removeAttribute('aria-current');
|
||||||
|
|
||||||
|
// Channel icon and banner are the server's own files; nothing is drawn when the server has none.
|
||||||
|
const iconKey = String(ch.icon_id ?? '');
|
||||||
|
if (chIcon.dataset.sig !== iconKey) {
|
||||||
|
chIcon.dataset.sig = iconKey;
|
||||||
|
chIcon.replaceChildren();
|
||||||
|
iconUrl(ch.icon_id).then((url) => {
|
||||||
|
if (url && chIcon.dataset.sig === iconKey) chIcon.appendChild(h('img', { src: url, alt: '', draggable: 'false' }));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const bannerKey = ch.banner_url ?? '';
|
||||||
|
if (btn.dataset.banner !== bannerKey) {
|
||||||
|
btn.dataset.banner = bannerKey;
|
||||||
|
li.classList.remove('has-banner');
|
||||||
|
btn.style.removeProperty('--banner');
|
||||||
|
channelBannerUrl(ch).then((url) => {
|
||||||
|
if (!url || btn.dataset.banner !== bannerKey) return;
|
||||||
|
btn.style.setProperty('--banner', `url("${url}")`);
|
||||||
|
li.classList.add('has-banner');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function joinChannel(cid) {
|
async function joinChannel(cid) {
|
||||||
@@ -170,10 +200,13 @@ function createMemberRow() {
|
|||||||
const btn = h(
|
const btn = h(
|
||||||
'button',
|
'button',
|
||||||
{ class: 'row-btn', type: 'button' },
|
{ class: 'row-btn', type: 'button' },
|
||||||
h('span', { class: 'status-dot', 'aria-hidden': 'true' }),
|
h('span', { class: 'avatar', 'aria-hidden': 'true' }, h('span', { class: 'status-dot' })),
|
||||||
|
h('span', { class: 'group-label', hidden: true }),
|
||||||
h('span', { class: 'row-label' }),
|
h('span', { class: 'row-label' }),
|
||||||
|
h('span', { class: 'group-label', hidden: true }),
|
||||||
h('span', { class: 'member-tag' }),
|
h('span', { class: 'member-tag' }),
|
||||||
h('span', { class: 'member-flags' }),
|
h('span', { class: 'member-flags' }),
|
||||||
|
h('span', { class: 'member-badges' }),
|
||||||
);
|
);
|
||||||
const li = h('li', { class: 'tree-row member-row' }, btn);
|
const li = h('li', { class: 'tree-row member-row' }, btn);
|
||||||
btn.addEventListener('click', () => {
|
btn.addEventListener('click', () => {
|
||||||
@@ -184,6 +217,14 @@ function createMemberRow() {
|
|||||||
return li;
|
return li;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A client's server groups (catalog order) plus its channel group, resolved from the snapshot. */
|
||||||
|
function groupsOf(cl) {
|
||||||
|
const ids = new Set(cl.server_groups ?? []);
|
||||||
|
const server = (S.snap.server_groups ?? []).filter((g) => ids.has(g.id));
|
||||||
|
const channel = (S.snap.channel_groups ?? []).find((g) => g.id === cl.channel_group_id) ?? null;
|
||||||
|
return { server, channel };
|
||||||
|
}
|
||||||
|
|
||||||
function updateMemberRow(li, cl, depth) {
|
function updateMemberRow(li, cl, depth) {
|
||||||
li.dataset.clid = String(cl.id);
|
li.dataset.clid = String(cl.id);
|
||||||
li.style.setProperty('--depth', String(depth));
|
li.style.setProperty('--depth', String(depth));
|
||||||
@@ -191,10 +232,20 @@ function updateMemberRow(li, cl, depth) {
|
|||||||
const talking = cl.is_self ? S.audio.transmitting : S.talking.has(cl.id);
|
const talking = cl.is_self ? S.audio.transmitting : S.talking.has(cl.id);
|
||||||
li.dataset.talking = String(talking);
|
li.dataset.talking = String(talking);
|
||||||
const btn = li.firstElementChild;
|
const btn = li.firstElementChild;
|
||||||
const [, label, tag, flags] = btn.children;
|
const [avatar, before, label, after, tag, flags, badges] = btn.children;
|
||||||
setText(label, cl.nickname);
|
setText(label, cl.nickname);
|
||||||
setText(tag, cl.is_self ? 'вы' : '');
|
setText(tag, cl.is_self ? 'вы' : '');
|
||||||
|
|
||||||
|
// Group names appear next to the nickname exactly where each group's name_mode puts them.
|
||||||
|
const { server: groups, channel: cgroup } = groupsOf(cl);
|
||||||
|
const named = cgroup ? [...groups, cgroup] : groups;
|
||||||
|
const beforeText = named.filter((g) => g.name_mode === 'before').map((g) => g.name).join(' · ');
|
||||||
|
const afterText = named.filter((g) => g.name_mode === 'after').map((g) => g.name).join(' · ');
|
||||||
|
setText(before, beforeText);
|
||||||
|
before.hidden = !beforeText;
|
||||||
|
setText(after, afterText);
|
||||||
|
after.hidden = !afterText;
|
||||||
|
|
||||||
const flagIcons = [];
|
const flagIcons = [];
|
||||||
const states = [];
|
const states = [];
|
||||||
if (cl.output_muted) {
|
if (cl.output_muted) {
|
||||||
@@ -210,19 +261,45 @@ function updateMemberRow(li, cl, depth) {
|
|||||||
}
|
}
|
||||||
if (cl.away) {
|
if (cl.away) {
|
||||||
flagIcons.push(['moon', '', cl.away_message ? `Отошёл: ${cl.away_message}` : 'Отошёл']);
|
flagIcons.push(['moon', '', cl.away_message ? `Отошёл: ${cl.away_message}` : 'Отошёл']);
|
||||||
states.push('отошёл');
|
states.push(cl.away_message ? `отошёл: ${cl.away_message}` : 'отошёл');
|
||||||
}
|
}
|
||||||
const flagKey = flagIcons.map((f) => f[0] + f[1]).join('|');
|
if (cl.is_recording) {
|
||||||
|
flagIcons.push(['record', 'flag-rec', 'Записывает разговор']);
|
||||||
|
states.push('записывает');
|
||||||
|
}
|
||||||
|
const flagKey = flagIcons.map((f) => f.join(':')).join('|');
|
||||||
if (flags.dataset.sig !== flagKey) {
|
if (flags.dataset.sig !== flagKey) {
|
||||||
flags.dataset.sig = flagKey;
|
flags.dataset.sig = flagKey;
|
||||||
flags.replaceChildren(...flagIcons.map(([name, cls, title]) => {
|
flags.replaceChildren(...flagIcons.map(([name, cls, title]) => h('span', { title }, icon(name, cls))));
|
||||||
const wrap = h('span', { title }, icon(name, cls));
|
|
||||||
return wrap;
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Group icons: custom files from the server; built-in ids have no file, shown as a neutral named badge.
|
||||||
|
const iconGroups = named.filter((g) => g.icon_id);
|
||||||
|
const badgeKey = `${iconGroups.map((g) => `${g.id}:${g.icon_id}`).join(',')}|${cl.country ?? ''}`;
|
||||||
|
if (badges.dataset.sig !== badgeKey) {
|
||||||
|
badges.dataset.sig = badgeKey;
|
||||||
|
badges.replaceChildren(
|
||||||
|
...iconGroups.map((g) => groupBadge(g)),
|
||||||
|
...(cl.country ? [h('span', { class: 'country', title: `Страна: ${cl.country}`, text: cl.country })] : []),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const avatarKey = `${cl.avatar_hash ?? ''}|${cl.myts_avatar_url ?? ''}|${JSON.stringify(cl.myts_avatar_urls ?? null)}`;
|
||||||
|
if (avatar.dataset.sig !== avatarKey) {
|
||||||
|
avatar.dataset.sig = avatarKey;
|
||||||
|
avatar.querySelector('img')?.remove();
|
||||||
|
avatar.classList.remove('has-image');
|
||||||
|
avatarUrl(cl).then((url) => {
|
||||||
|
if (!url || avatar.dataset.sig !== avatarKey) return;
|
||||||
|
avatar.prepend(h('img', { src: url, alt: '', draggable: 'false' }));
|
||||||
|
avatar.classList.add('has-image');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (talking) states.unshift('говорит');
|
if (talking) states.unshift('говорит');
|
||||||
btn.setAttribute('aria-label', `${cl.nickname}${cl.is_self ? ' (вы)' : ''}${states.length ? `, ${states.join(', ')}` : ''}${cl.is_self ? '. Открыть настройки профиля' : '. Написать личное сообщение'}`);
|
const groupNames = groups.map((g) => g.name);
|
||||||
btn.title = cl.is_self ? 'Настройки профиля' : 'Написать личное сообщение';
|
btn.setAttribute('aria-label', `${cl.nickname}${cl.is_self ? ' (вы)' : ''}${groupNames.length ? `, группы: ${groupNames.join(', ')}` : ''}${states.length ? `, ${states.join(', ')}` : ''}${cl.is_self ? '. Открыть настройки профиля' : '. Написать личное сообщение'}`);
|
||||||
|
btn.title = [cl.description ? `Описание: ${cl.description}` : '', groupNames.length ? `Группы: ${groupNames.join(', ')}` : '', cl.is_self ? 'Настройки профиля' : 'Написать личное сообщение'].filter(Boolean).join('\n');
|
||||||
|
|
||||||
const stream = hooks.streamOf(cl.id);
|
const stream = hooks.streamOf(cl.id);
|
||||||
let watch = li.querySelector('.watch-btn');
|
let watch = li.querySelector('.watch-btn');
|
||||||
@@ -245,6 +322,18 @@ function updateMemberRow(li, cl, depth) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function groupBadge(group) {
|
||||||
|
const el = h('span', { class: 'group-icon', title: group.name, role: 'img', 'aria-label': group.name });
|
||||||
|
if (isBuiltinIcon(group.icon_id)) {
|
||||||
|
el.appendChild(icon('shield'));
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
iconUrl(group.icon_id).then((url) => {
|
||||||
|
el.appendChild(url ? h('img', { src: url, alt: '', draggable: 'false' }) : icon('shield'));
|
||||||
|
});
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
|
||||||
/** Cheap talking update without a full reconcile. */
|
/** Cheap talking update without a full reconcile. */
|
||||||
export function updateTalking(clientId) {
|
export function updateTalking(clientId) {
|
||||||
const li = document.querySelector(`#tree [data-key="u:${clientId}"]`);
|
const li = document.querySelector(`#tree [data-key="u:${clientId}"]`);
|
||||||
|
|||||||
@@ -607,3 +607,30 @@ input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width
|
|||||||
@media (max-width: 1000px) {
|
@media (max-width: 1000px) {
|
||||||
.transmit-hint { display: none; }
|
.transmit-hint { display: none; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------- server-provided tree media ---------- */
|
||||||
|
.avatar { position: relative; width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; }
|
||||||
|
.avatar img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
|
||||||
|
.avatar.has-image .status-dot { position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; background: var(--sidebar); }
|
||||||
|
[data-talking="true"] > .row-btn .avatar.has-image img { box-shadow: 0 0 0 2px var(--talk); }
|
||||||
|
.member-row .row-btn { padding-left: calc(18px + var(--indent)); }
|
||||||
|
.group-label { flex: none; max-width: 40%; padding: 0 6px; border-radius: 4px; background: var(--sunken); color: var(--text-2); font-size: 11.5px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
.member-row .row-label { flex: 0 1 auto; }
|
||||||
|
.member-tag { margin-right: auto; }
|
||||||
|
.member-badges { display: inline-flex; align-items: center; gap: 3px; flex: none; }
|
||||||
|
.group-icon { display: inline-grid; place-items: center; width: 16px; height: 16px; color: var(--text-3); }
|
||||||
|
.group-icon img { width: 16px; height: 16px; object-fit: contain; }
|
||||||
|
.group-icon .icon { width: 14px; height: 14px; }
|
||||||
|
.country { padding: 0 4px; border: 1px solid var(--border-strong); border-radius: 3px; font-size: 10.5px; line-height: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
|
||||||
|
.member-flags .flag-rec { color: var(--danger); }
|
||||||
|
.channel-icon { display: inline-grid; place-items: center; flex: none; }
|
||||||
|
.channel-icon img { width: 16px; height: 16px; object-fit: contain; }
|
||||||
|
.channel-row.has-banner .row-btn {
|
||||||
|
min-height: 36px;
|
||||||
|
background-image: linear-gradient(90deg, var(--sidebar) 30%, color-mix(in srgb, var(--sidebar) 55%, transparent) 100%), var(--banner);
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
.channel-row.has-banner[data-current="true"] .row-btn {
|
||||||
|
background-image: linear-gradient(90deg, var(--accent-soft) 30%, color-mix(in srgb, var(--accent-soft) 55%, transparent) 100%), var(--banner);
|
||||||
|
}
|
||||||
@@ -102,7 +102,9 @@ fn print_cli_result(result: Result<String, ErrorObj>) -> ExitCode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn export(data_dir: &Path, out: &Path) -> Result<String, ErrorObj> {
|
fn export(data_dir: &Path, out: &Path) -> Result<String, ErrorObj> {
|
||||||
// identity.json is immutable after creation, so export does not need the lock.
|
// Unlocked read-only access is safe: identity.json/profile.json are only ever replaced by
|
||||||
|
// atomic rename (key-offset upgrade, rename, import --replace), so a concurrent reader sees
|
||||||
|
// one complete version, and load_identity verifies it.
|
||||||
let (ini, uid) = Store::new(data_dir).export_ts_ini().map_err(session::store_error)?;
|
let (ini, uid) = Store::new(data_dir).export_ts_ini().map_err(session::store_error)?;
|
||||||
secure_fs::write_atomic(out, ini.as_bytes(), true)
|
secure_fs::write_atomic(out, ini.as_bytes(), true)
|
||||||
.map_err(|e| ErrorObj::new(protocol::ErrorCode::Io, format!("writing {}: {e}", out.display())))?;
|
.map_err(|e| ErrorObj::new(protocol::ErrorCode::Io, format!("writing {}: {e}", out.display())))?;
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ use crate::protocol::{ErrorCode, ErrorObj};
|
|||||||
pub const MAX_IN_FLIGHT: usize = 3;
|
pub const MAX_IN_FLIGHT: usize = 3;
|
||||||
/// Whole download (request to last byte) deadline.
|
/// Whole download (request to last byte) deadline.
|
||||||
pub const DEADLINE: Duration = Duration::from_secs(20);
|
pub const DEADLINE: Duration = Duration::from_secs(20);
|
||||||
/// Icon ids below this are the client-bundled standard icons (100, 200, 300, 500, 600);
|
/// Icon ids of TeamSpeak's default group icons, which clients ship and servers do not store.
|
||||||
/// the server has no file for them (live: `ftinitdownload` → error 2054 FileInvalidPath).
|
/// Exactly the ids the test server's default groups use and for which `ftinitdownload` was
|
||||||
pub const FIRST_UPLOADED_ICON_ID: u32 = 1000;
|
/// verified live to fail with error 2054 `FileInvalidPath`; other ids are always asked for.
|
||||||
|
pub const BUILTIN_ICON_IDS: [u32; 5] = [100, 200, 300, 500, 600];
|
||||||
const MAX_CHANNEL_PATH: usize = 512;
|
const MAX_CHANNEL_PATH: usize = 512;
|
||||||
|
|
||||||
/// Which server file a fetch refers to. Only these fixed schemes are ever requested.
|
/// Which server file a fetch refers to. Only these fixed schemes are ever requested.
|
||||||
|
|||||||
@@ -643,7 +643,17 @@ impl Session {
|
|||||||
.get(&ClientId(client_id))
|
.get(&ClientId(client_id))
|
||||||
.ok_or_else(|| ErrorObj::new(ErrorCode::NotFound, format!("client {client_id} is not visible")))?;
|
.ok_or_else(|| ErrorObj::new(ErrorCode::NotFound, format!("client {client_id} is not visible")))?;
|
||||||
if client.avatar_hash.is_empty() {
|
if client.avatar_hash.is_empty() {
|
||||||
return Err(ErrorObj::new(ErrorCode::NotFound, format!("client {client_id} has no avatar")));
|
// TeamSpeak 6 / myTeamSpeak avatars are public https URLs, not server files.
|
||||||
|
let urls = c.extras.client_myts_avatars(client_id);
|
||||||
|
if urls.is_empty() {
|
||||||
|
return Err(ErrorObj::new(ErrorCode::NotFound, format!("client {client_id} has no avatar")));
|
||||||
|
}
|
||||||
|
let urls: Vec<Value> = urls.iter().map(|(variant, url)| json!({ "variant": variant, "url": url })).collect();
|
||||||
|
return Err(ErrorObj::new(
|
||||||
|
ErrorCode::ExternalMedia,
|
||||||
|
"avatar is a myTeamSpeak web URL; fetch it outside the core (sniff the bytes)",
|
||||||
|
)
|
||||||
|
.with_detail(json!({ "urls": urls })));
|
||||||
}
|
}
|
||||||
let uid = client
|
let uid = client
|
||||||
.uid
|
.uid
|
||||||
@@ -654,7 +664,7 @@ impl Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn fetch_icon(&mut self, id: &str, icon_id: u32) -> Result<Option<Value>, ErrorObj> {
|
async fn fetch_icon(&mut self, id: &str, icon_id: u32) -> Result<Option<Value>, ErrorObj> {
|
||||||
if icon_id < media::FIRST_UPLOADED_ICON_ID {
|
if media::BUILTIN_ICON_IDS.contains(&icon_id) {
|
||||||
return Err(ErrorObj::new(
|
return Err(ErrorObj::new(
|
||||||
ErrorCode::NotFound,
|
ErrorCode::NotFound,
|
||||||
format!("icon {icon_id} is a built-in TeamSpeak icon; the server has no file for it"),
|
format!("icon {icon_id} is a built-in TeamSpeak icon; the server has no file for it"),
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ impl ChannelExtra {
|
|||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct ClientExtra {
|
struct ClientExtra {
|
||||||
is_streaming: Option<bool>,
|
is_streaming: Option<bool>,
|
||||||
|
/// `client_myteamspeak_avatar` parsed into `(variant, https URL)` pairs.
|
||||||
|
myts_avatars: Vec<(u32, String)>,
|
||||||
|
/// Raw value when it was non-empty but no pair could be parsed.
|
||||||
|
myts_avatar_unparsed: Option<String>,
|
||||||
|
has_myts: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClientExtra {
|
impl ClientExtra {
|
||||||
@@ -50,12 +55,44 @@ impl ClientExtra {
|
|||||||
if let Some(v) = item.get("client_is_streaming") {
|
if let Some(v) = item.get("client_is_streaming") {
|
||||||
self.is_streaming = Some(v == "1");
|
self.is_streaming = Some(v == "1");
|
||||||
}
|
}
|
||||||
|
if let Some(v) = item.get("client_myteamspeak_avatar") {
|
||||||
|
self.myts_avatars = parse_myts_avatar(v);
|
||||||
|
self.myts_avatar_unparsed = (self.myts_avatars.is_empty() && !v.is_empty()).then(|| v.clone());
|
||||||
|
}
|
||||||
|
if let Some(v) = item.get("client_myteamspeak_id") {
|
||||||
|
self.has_myts = Some(!v.is_empty());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MAX_AVATAR_URL: usize = 2048;
|
||||||
|
|
||||||
|
/// Parse `client_myteamspeak_avatar`. Observed live (TS6 6.0.0-beta13.1):
|
||||||
|
/// `2,https://storage.googleapis.com/ts-sys-myts-avatars/<uuid>/<n>` — `<uint>,<url>`. Several
|
||||||
|
/// pairs are accepted separated by `;` or `|` (separator not observed yet). Only `https://` URLs
|
||||||
|
/// without whitespace/control characters are kept.
|
||||||
|
pub fn parse_myts_avatar(raw: &str) -> Vec<(u32, String)> {
|
||||||
|
raw.split([';', '|'])
|
||||||
|
.filter_map(|seg| {
|
||||||
|
let (variant, url) = seg.trim().split_once(',')?;
|
||||||
|
let variant = variant.trim().parse::<u32>().ok()?;
|
||||||
|
let url = url.trim();
|
||||||
|
let ok = url.len() <= MAX_AVATAR_URL
|
||||||
|
&& url.get(..8).is_some_and(|p| p.eq_ignore_ascii_case("https://"))
|
||||||
|
&& !url.chars().any(|c| c.is_whitespace() || c.is_control());
|
||||||
|
ok.then(|| (variant, url.to_owned()))
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
fn non_empty(s: &str) -> Option<String> { (!s.is_empty()).then(|| s.to_owned()) }
|
fn non_empty(s: &str) -> Option<String> { (!s.is_empty()).then(|| s.to_owned()) }
|
||||||
|
|
||||||
impl RawExtras {
|
impl RawExtras {
|
||||||
|
/// myTeamSpeak avatar URLs of a client (`(variant, url)`), empty if none.
|
||||||
|
pub fn client_myts_avatars(&self, client_id: u16) -> &[(u32, String)] {
|
||||||
|
self.clients.get(&client_id).map_or(&[], |e| e.myts_avatars.as_slice())
|
||||||
|
}
|
||||||
|
|
||||||
/// Raw banner URL of a channel as sent by the server.
|
/// Raw banner URL of a channel as sent by the server.
|
||||||
pub fn channel_banner(&self, channel_id: u64) -> Option<&str> {
|
pub fn channel_banner(&self, channel_id: u64) -> Option<&str> {
|
||||||
self.channels.get(&channel_id).and_then(|e| e.banner_url.as_deref())
|
self.channels.get(&channel_id).and_then(|e| e.banner_url.as_deref())
|
||||||
@@ -88,15 +125,6 @@ impl RawExtras {
|
|||||||
}
|
}
|
||||||
"notifycliententerview" => {
|
"notifycliententerview" => {
|
||||||
for (clid, item) in clids() {
|
for (clid, item) in clids() {
|
||||||
// TEMP-INVESTIGATION (remove): which avatar/identity fields does TS6 send?
|
|
||||||
tracing::info!(
|
|
||||||
clid,
|
|
||||||
keys = ?item.keys().collect::<Vec<_>>(),
|
|
||||||
flag_avatar_len = item.get("client_flag_avatar").map(|s| s.len()),
|
|
||||||
myts_avatar = ?item.get("client_myteamspeak_avatar"),
|
|
||||||
myts_id_len = item.get("client_myteamspeak_id").map(|s| s.len()),
|
|
||||||
"TEMP enterview"
|
|
||||||
);
|
|
||||||
let mut e = ClientExtra::default();
|
let mut e = ClientExtra::default();
|
||||||
e.merge(item);
|
e.merge(item);
|
||||||
self.clients.insert(clid, e);
|
self.clients.insert(clid, e);
|
||||||
@@ -200,6 +228,7 @@ fn channel_json(c: &Channel, depth: usize, extras: &RawExtras) -> Value {
|
|||||||
fn client_json(c: &Client, own: u16, extras: &RawExtras) -> Value {
|
fn client_json(c: &Client, own: u16, extras: &RawExtras) -> Value {
|
||||||
let mut groups: Vec<u64> = c.server_groups.iter().map(|g| g.0).collect();
|
let mut groups: Vec<u64> = c.server_groups.iter().map(|g| g.0).collect();
|
||||||
groups.sort_unstable();
|
groups.sort_unstable();
|
||||||
|
let extra = extras.clients.get(&c.id.0);
|
||||||
json!({
|
json!({
|
||||||
"id": c.id.0,
|
"id": c.id.0,
|
||||||
"uid": uid_string(&c.uid),
|
"uid": uid_string(&c.uid),
|
||||||
@@ -218,13 +247,17 @@ fn client_json(c: &Client, own: u16, extras: &RawExtras) -> Value {
|
|||||||
"is_channel_commander": c.is_channel_commander,
|
"is_channel_commander": c.is_channel_commander,
|
||||||
"is_priority_speaker": c.is_priority_speaker,
|
"is_priority_speaker": c.is_priority_speaker,
|
||||||
"is_recording": c.is_recording,
|
"is_recording": c.is_recording,
|
||||||
"is_streaming": extras.clients.get(&c.id.0).and_then(|e| e.is_streaming),
|
"is_streaming": extra.and_then(|e| e.is_streaming),
|
||||||
"description": non_empty(&c.description),
|
"description": non_empty(&c.description),
|
||||||
"country": non_empty(&c.country_code),
|
"country": non_empty(&c.country_code),
|
||||||
"server_groups": groups,
|
"server_groups": groups,
|
||||||
"channel_group_id": c.channel_group.0,
|
"channel_group_id": c.channel_group.0,
|
||||||
"channel_group_inherited_from": c.inherited_channel_group_from_channel.0,
|
"channel_group_inherited_from": c.inherited_channel_group_from_channel.0,
|
||||||
"avatar_hash": non_empty(&c.avatar_hash),
|
"avatar_hash": non_empty(&c.avatar_hash),
|
||||||
|
"has_myts": extra.and_then(|e| e.has_myts),
|
||||||
|
"myts_avatars": extra.map_or_else(Vec::new, |e| e.myts_avatars.iter()
|
||||||
|
.map(|(variant, url)| json!({ "variant": variant, "url": url })).collect::<Vec<_>>()),
|
||||||
|
"myts_avatar_unparsed": extra.and_then(|e| e.myts_avatar_unparsed.clone()),
|
||||||
"icon_id": icon(c.icon),
|
"icon_id": icon(c.icon),
|
||||||
"badges": non_empty(&c.badges),
|
"badges": non_empty(&c.badges),
|
||||||
})
|
})
|
||||||
@@ -355,7 +388,8 @@ mod tests {
|
|||||||
assert_eq!(x.channels[&20].banner_url, None);
|
assert_eq!(x.channels[&20].banner_url, None);
|
||||||
assert_eq!(x.channels[&20].banner_mode.as_deref(), Some("2"), "mode untouched by partial edit");
|
assert_eq!(x.channels[&20].banner_mode.as_deref(), Some("2"), "mode untouched by partial edit");
|
||||||
let unrelated = rawcmd::parse(br"notifychanneledited cid=20 reasonid=10 channel_name=x").unwrap();
|
let unrelated = rawcmd::parse(br"notifychanneledited cid=20 reasonid=10 channel_name=x").unwrap();
|
||||||
assert!(!x.apply(&unrelated));
|
x.apply(&unrelated);
|
||||||
|
assert_eq!(x.channels[&20].banner_mode.as_deref(), Some("2"), "edit without banner keys keeps banner");
|
||||||
|
|
||||||
let enter = rawcmd::parse(br"notifycliententerview clid=16 client_is_streaming=1|clid=6 client_is_streaming=0").unwrap();
|
let enter = rawcmd::parse(br"notifycliententerview clid=16 client_is_streaming=1|clid=6 client_is_streaming=0").unwrap();
|
||||||
assert!(x.apply(&enter));
|
assert!(x.apply(&enter));
|
||||||
@@ -365,4 +399,51 @@ mod tests {
|
|||||||
x.apply(&upd);
|
x.apply(&upd);
|
||||||
assert_eq!(x.clients[&16].is_streaming, Some(false));
|
assert_eq!(x.clients[&16].is_streaming, Some(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn recycled_client_id_does_not_inherit_values() {
|
||||||
|
let mut x = RawExtras::default();
|
||||||
|
let a = rawcmd::parse(
|
||||||
|
br"notifycliententerview clid=16 client_is_streaming=1 client_myteamspeak_id=abc client_myteamspeak_avatar=2,https:\/\/h.example\/a\/1",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
x.apply(&a);
|
||||||
|
assert_eq!(x.client_myts_avatars(16), &[(2, "https://h.example/a/1".to_owned())]);
|
||||||
|
// Explicit clearing by the server.
|
||||||
|
x.apply(&rawcmd::parse(br"notifyclientupdated clid=16 client_myteamspeak_avatar").unwrap());
|
||||||
|
assert!(x.client_myts_avatars(16).is_empty());
|
||||||
|
assert_eq!(x.clients[&16].is_streaming, Some(true), "update without the key keeps it");
|
||||||
|
// Leave, then a different client gets the same id without those fields.
|
||||||
|
assert!(x.apply(&rawcmd::parse(br"notifyclientleftview clid=16 reasonid=8 cfid=1 ctid=0").unwrap()));
|
||||||
|
assert!(!x.clients.contains_key(&16));
|
||||||
|
x.apply(&rawcmd::parse(br"notifycliententerview clid=16 client_nickname=other").unwrap());
|
||||||
|
assert_eq!(x.clients[&16].is_streaming, None);
|
||||||
|
assert_eq!(x.clients[&16].has_myts, None);
|
||||||
|
// Enter-view replaces: a re-entering id with fields gets exactly the new ones.
|
||||||
|
x.apply(&rawcmd::parse(br"notifycliententerview clid=16 client_is_streaming=0 client_myteamspeak_id").unwrap());
|
||||||
|
assert_eq!(x.clients[&16].is_streaming, Some(false));
|
||||||
|
assert_eq!(x.clients[&16].has_myts, Some(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn recycled_or_deleted_channel_id_does_not_inherit_banner() {
|
||||||
|
let mut x = RawExtras::default();
|
||||||
|
x.apply(&rawcmd::parse(br"channellist cid=5 channel_banner_gfx_url=ts3image:\/\/h?channel=5&filename=a channel_banner_mode=2").unwrap());
|
||||||
|
assert!(x.apply(&rawcmd::parse(br"notifychanneldeleted cid=5 invokerid=1").unwrap()));
|
||||||
|
assert_eq!(x.channel_banner(5), None);
|
||||||
|
x.apply(&rawcmd::parse(br"channellist cid=5 channel_banner_gfx_url=ts3image:\/\/h?channel=5&filename=b").unwrap());
|
||||||
|
x.apply(&rawcmd::parse(br"notifychannelcreated cid=5 channel_name=new").unwrap());
|
||||||
|
assert_eq!(x.channel_banner(5), None, "created channel replaces the old entry");
|
||||||
|
assert_eq!(x.channels[&5].banner_mode, None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn myts_avatar_parsing() {
|
||||||
|
let live = "2,https://storage.googleapis.com/ts-sys-myts-avatars/7806f4c4-ee78-4588-af6c-fb3b7f7ebe10/697775641";
|
||||||
|
assert_eq!(parse_myts_avatar(live), vec![(2, live[2..].to_owned())]);
|
||||||
|
assert_eq!(parse_myts_avatar("1,https://a.example/x;2,https://a.example/y").len(), 2);
|
||||||
|
for bad in ["", "2", "x,https://a/b", "2,http://a/b", "2,javascript:alert(1)", "2,https://a/b c"] {
|
||||||
|
assert!(parse_myts_avatar(bad).is_empty(), "{bad}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,8 @@ struct Core {
|
|||||||
child: Child,
|
child: Child,
|
||||||
stdin: ChildStdin,
|
stdin: ChildStdin,
|
||||||
lines: mpsc::Receiver<Value>,
|
lines: mpsc::Receiver<Value>,
|
||||||
|
/// Every stdout line, for secret-leak checks.
|
||||||
|
transcript: std::sync::Arc<std::sync::Mutex<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Core {
|
impl Core {
|
||||||
@@ -43,16 +45,19 @@ impl Core {
|
|||||||
let stdin = child.stdin.take().unwrap();
|
let stdin = child.stdin.take().unwrap();
|
||||||
let stdout = child.stdout.take().unwrap();
|
let stdout = child.stdout.take().unwrap();
|
||||||
let (tx, lines) = mpsc::channel();
|
let (tx, lines) = mpsc::channel();
|
||||||
|
let transcript = std::sync::Arc::new(std::sync::Mutex::new(String::new()));
|
||||||
|
let t = transcript.clone();
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
for line in BufReader::new(stdout).lines() {
|
for line in BufReader::new(stdout).lines() {
|
||||||
let line = line.unwrap();
|
let line = line.unwrap();
|
||||||
|
t.lock().unwrap().push_str(&line);
|
||||||
let v: Value = serde_json::from_str(&line).unwrap_or_else(|e| panic!("stdout is not JSON ({e}): {line}"));
|
let v: Value = serde_json::from_str(&line).unwrap_or_else(|e| panic!("stdout is not JSON ({e}): {line}"));
|
||||||
if tx.send(v).is_err() {
|
if tx.send(v).is_err() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let mut core = Self { child, stdin, lines };
|
let mut core = Self { child, stdin, lines, transcript };
|
||||||
let ready = core.next();
|
let ready = core.next();
|
||||||
assert_eq!(ready["event"], "ready");
|
assert_eq!(ready["event"], "ready");
|
||||||
assert_eq!(ready["protocol"], 1);
|
assert_eq!(ready["protocol"], 1);
|
||||||
@@ -111,7 +116,12 @@ fn identity_lifecycle_over_stdio() {
|
|||||||
assert_eq!(r["result"]["nickname"], "TeamsPeach-Smoke");
|
assert_eq!(r["result"]["nickname"], "TeamsPeach-Smoke");
|
||||||
assert!(r["result"]["security_level"].as_u64().unwrap() >= 8);
|
assert!(r["result"]["security_level"].as_u64().unwrap() >= 8);
|
||||||
assert!(events.iter().any(|e| e["event"] == "profile" && e["uid"] == uid.as_str()));
|
assert!(events.iter().any(|e| e["event"] == "profile" && e["uid"] == uid.as_str()));
|
||||||
assert!(r.to_string().find("private").is_none(), "private key material leaked: {r}");
|
// The private key (as stored, i.e. what any accidental serialization would print) must never
|
||||||
|
// appear on stdout.
|
||||||
|
let stored: Value = serde_json::from_slice(&std::fs::read(dir.0.join("identity.json")).unwrap()).unwrap();
|
||||||
|
let private_key = stored["private_key"].as_str().unwrap().to_owned();
|
||||||
|
assert!(private_key.len() > 40);
|
||||||
|
assert!(!core.transcript.lock().unwrap().contains(&private_key), "private key leaked to stdout");
|
||||||
|
|
||||||
let (r, _) = core.request("4", "profile_create", json!({ "nickname": "Other" }));
|
let (r, _) = core.request("4", "profile_create", json!({ "nickname": "Other" }));
|
||||||
assert_eq!(r["error"]["code"], "profile_exists");
|
assert_eq!(r["error"]["code"], "profile_exists");
|
||||||
@@ -143,6 +153,7 @@ fn identity_lifecycle_over_stdio() {
|
|||||||
core.send(json!({ "cmd": "audio_end" }));
|
core.send(json!({ "cmd": "audio_end" }));
|
||||||
let (r, _) = core.request("9", "set_audio", json!({ "input_muted": true }));
|
let (r, _) = core.request("9", "set_audio", json!({ "input_muted": true }));
|
||||||
assert_eq!(r["result"], json!({ "input_muted": true, "output_muted": false, "transmitting": false }));
|
assert_eq!(r["result"], json!({ "input_muted": true, "output_muted": false, "transmitting": false }));
|
||||||
|
assert!(!core.transcript.lock().unwrap().contains(&private_key), "private key leaked to stdout");
|
||||||
core.shutdown();
|
core.shutdown();
|
||||||
|
|
||||||
// Restart: same UID, renamed nickname persisted.
|
// Restart: same UID, renamed nickname persisted.
|
||||||
@@ -150,6 +161,7 @@ fn identity_lifecycle_over_stdio() {
|
|||||||
let (r, _) = core.request("1", "profile_get", json!({}));
|
let (r, _) = core.request("1", "profile_get", json!({}));
|
||||||
assert_eq!(r["result"]["uid"], uid.as_str());
|
assert_eq!(r["result"]["uid"], uid.as_str());
|
||||||
assert_eq!(r["result"]["nickname"], "Renamed Smoke");
|
assert_eq!(r["result"]["nickname"], "Renamed Smoke");
|
||||||
|
assert!(!core.transcript.lock().unwrap().contains(&private_key), "private key leaked to stdout");
|
||||||
core.shutdown();
|
core.shutdown();
|
||||||
|
|
||||||
// Export (allowed while a core runs) and import into a fresh data dir.
|
// Export (allowed while a core runs) and import into a fresh data dir.
|
||||||
@@ -158,6 +170,14 @@ fn identity_lifecycle_over_stdio() {
|
|||||||
let (code, v) = cli(&["identity".as_ref(), "export".as_ref(), "--data-dir".as_ref(), dir.0.as_os_str(), "--out".as_ref(), export_file.as_os_str()]);
|
let (code, v) = cli(&["identity".as_ref(), "export".as_ref(), "--data-dir".as_ref(), dir.0.as_os_str(), "--out".as_ref(), export_file.as_os_str()]);
|
||||||
assert_eq!(code, 0, "{v}");
|
assert_eq!(code, 0, "{v}");
|
||||||
assert_eq!(v["uid"], uid.as_str());
|
assert_eq!(v["uid"], uid.as_str());
|
||||||
|
assert!(!v.to_string().contains(&private_key));
|
||||||
|
// The export carries the key (obfuscated TeamSpeak form); it must not reach stdout either.
|
||||||
|
let ini = std::fs::read_to_string(&export_file).unwrap();
|
||||||
|
let exported = ini.lines().find_map(|l| l.strip_prefix("identity=\"")).unwrap().trim_end_matches('"');
|
||||||
|
let exported_key = exported.split_once('V').unwrap().1.to_owned();
|
||||||
|
assert!(!v.to_string().contains(&exported_key));
|
||||||
|
assert!(!running.transcript.lock().unwrap().contains(&exported_key));
|
||||||
|
assert!(!running.transcript.lock().unwrap().contains(&private_key));
|
||||||
running.shutdown();
|
running.shutdown();
|
||||||
|
|
||||||
let other = TempDir::new("import");
|
let other = TempDir::new("import");
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Forge and CI metadata (non-secret, 2026-10-24)
|
||||||
|
|
||||||
|
- Forge: <https://git.eeee.moe>, Gitea **1.27.3** (`/api/v1/version`; `/api/forgejo/v1/version` → 404, so not Forgejo).
|
||||||
|
- API user of the provided organization token: `omar`, not instance admin. Token scopes reported by the server:
|
||||||
|
`write:activitypub, write:misc, write:notification, write:organization, write:package, write:issue,
|
||||||
|
write:repository, write:user` (no `read:admin`, so instance-level runners cannot be listed).
|
||||||
|
The token itself is not stored in this repository, in git config, in remotes or in workflows.
|
||||||
|
- Organization `TeamsPeach` (id 17, visibility public) had no repositories.
|
||||||
|
- Repository created: **`TeamsPeach/client`**, **private**, default branch `main`, actions and releases enabled.
|
||||||
|
URL: <https://git.eeee.moe/TeamsPeach/client>
|
||||||
|
- Runners visible through the API before the first push: organization 0, user 0, repository 0.
|
||||||
|
- First push of `main` (commit `7287fdb`): workflow `ci` run #1 created jobs `linux-x64` and
|
||||||
|
`linux-arm64-cross`; both were picked up (status `running`) within 20 s, i.e. an instance-level runner
|
||||||
|
accepts `runs-on: ubuntu-latest` with job containers. Results are recorded only from the finished run.
|
||||||
|
- No Windows, macOS or Linux ARM64 runner is known to the repository. Windows x64 is built on the
|
||||||
|
developer PC; macOS and Windows ARM64 have no build host.
|
||||||
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"startedAt": "2026-10-24T00:20:07.132Z",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"name": "switch while pending",
|
||||||
|
"state": "live",
|
||||||
|
"framesDecoded": 82,
|
||||||
|
"offersApplied": 2,
|
||||||
|
"answersSent": 2,
|
||||||
|
"inboundAudioPackets": 139,
|
||||||
|
"tracksOnElement": 2,
|
||||||
|
"errors": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "default sink",
|
||||||
|
"sinkId": "",
|
||||||
|
"sinkError": "",
|
||||||
|
"errors": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "selected sink",
|
||||||
|
"device": "Fake Audio Output 1",
|
||||||
|
"elementSinkMatches": true,
|
||||||
|
"sinkError": "",
|
||||||
|
"errors": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "restart with selected sink",
|
||||||
|
"sinkId": true,
|
||||||
|
"sinkError": "",
|
||||||
|
"framesDecoded": 38,
|
||||||
|
"inboundAudioPackets": 67,
|
||||||
|
"errors": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "final",
|
||||||
|
"errors": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"console": [],
|
||||||
|
"ok": true,
|
||||||
|
"note": "Loopback inside Chromium: validates the browser media pipeline only, not TS6 interoperability."
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 149 KiB |
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"name": "tree metadata rendered",
|
||||||
|
"channels": 11,
|
||||||
|
"channelIcons": 11,
|
||||||
|
"banners": 11,
|
||||||
|
"groupLabels": [
|
||||||
|
"куколд",
|
||||||
|
"бля ща"
|
||||||
|
],
|
||||||
|
"groupIconImages": 6,
|
||||||
|
"builtinBadges": 2,
|
||||||
|
"avatars": 0,
|
||||||
|
"countries": [
|
||||||
|
"RU"
|
||||||
|
],
|
||||||
|
"errorToasts": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"console": [],
|
||||||
|
"ok": true
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 45 KiB |
@@ -1,34 +1,34 @@
|
|||||||
{
|
{
|
||||||
"startedAt": "2026-10-24T00:16:08.472Z",
|
"startedAt": "2026-10-24T00:32:40.465Z",
|
||||||
"server": "10.10.10.160:9987",
|
"server": "10.10.10.160:9987",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"name": "profiles created",
|
"name": "profiles created",
|
||||||
"at": "2026-10-24T00:16:11.212Z",
|
"at": "2026-10-24T00:32:42.781Z",
|
||||||
"a": {
|
"a": {
|
||||||
"uid": "RpuYw2vd6KW2pndcNgbtWrjHvGE=",
|
"uid": "g4BovFvUtn3VLm4xBXo7NQYyB5M=",
|
||||||
"nickname": "PeachVoiceA"
|
"nickname": "PeachVoiceA"
|
||||||
},
|
},
|
||||||
"b": {
|
"b": {
|
||||||
"uid": "h+bYvyRwrZuG2GZMQZle/JYBiGM=",
|
"uid": "tcxPKjSCMbVc1rVCj4vu0//jSFA=",
|
||||||
"nickname": "PeachVoiceB"
|
"nickname": "PeachVoiceB"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "both connected",
|
"name": "both connected",
|
||||||
"at": "2026-10-24T00:16:14.890Z",
|
"at": "2026-10-24T00:32:46.550Z",
|
||||||
"aClid": 37,
|
"aClid": 45,
|
||||||
"aChannel": "Welcome to the club buddy",
|
"aChannel": "Welcome to the club buddy",
|
||||||
"bClid": 36,
|
"bClid": 44,
|
||||||
"bChannel": "Welcome to the club buddy"
|
"bChannel": "Welcome to the club buddy"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "open mic received",
|
"name": "open mic received",
|
||||||
"at": "2026-10-24T00:16:18.000Z",
|
"at": "2026-10-24T00:32:49.655Z",
|
||||||
"aFramesSent": 153,
|
"aFramesSent": 152,
|
||||||
"aTransmitting": true,
|
"aTransmitting": true,
|
||||||
"bTalking": [
|
"bTalking": [
|
||||||
37
|
45
|
||||||
],
|
],
|
||||||
"bFramesPlayed": 151,
|
"bFramesPlayed": 151,
|
||||||
"bPlayback": {
|
"bPlayback": {
|
||||||
@@ -36,43 +36,56 @@
|
|||||||
"framesIn": 151,
|
"framesIn": 151,
|
||||||
"dropped": 0,
|
"dropped": 0,
|
||||||
"underruns": 0,
|
"underruns": 0,
|
||||||
"bufferedMs": 44
|
"bufferedMs": 33
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "A muted, talking stopped on B",
|
"name": "A muted, talking stopped on B",
|
||||||
"at": "2026-10-24T00:16:18.972Z"
|
"at": "2026-10-24T00:32:50.606Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PTT idle",
|
"name": "PTT idle",
|
||||||
"at": "2026-10-24T00:16:20.587Z",
|
"at": "2026-10-24T00:32:52.237Z",
|
||||||
"bTalkingIncludesA": false
|
"bTalkingIncludesA": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PTT burst received",
|
"name": "PTT burst received",
|
||||||
"at": "2026-10-24T00:16:22.203Z",
|
"at": "2026-10-24T00:32:53.869Z",
|
||||||
"bFramesDuringBurst": 79
|
"bFramesDuringBurst": 80
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "reverse direction received",
|
"name": "reverse direction received",
|
||||||
"at": "2026-10-24T00:16:24.291Z",
|
"at": "2026-10-24T00:32:55.942Z",
|
||||||
"aFramesPlayed": 102,
|
"aFramesPlayed": 101,
|
||||||
"aTalking": [
|
"aTalking": [
|
||||||
36
|
44
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "B deafened",
|
||||||
|
"at": "2026-10-24T00:32:59.632Z",
|
||||||
|
"bRxDelta": 0,
|
||||||
|
"aRxFromBDelta": 0,
|
||||||
|
"aSeesBTalking": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "B undeafened",
|
||||||
|
"at": "2026-10-24T00:33:01.685Z",
|
||||||
|
"bRxDelta": 101,
|
||||||
|
"aSeesBTalking": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "channel chat",
|
"name": "channel chat",
|
||||||
"at": "2026-10-24T00:16:24.379Z",
|
"at": "2026-10-24T00:33:01.809Z",
|
||||||
"delivered": false,
|
"delivered": false,
|
||||||
"error": "Сообщение не отправлено: Сервер отклонил действие: PermissionsClientInsufficient (TS 2568, не хватает права 224)"
|
"error": "Сообщение не отправлено: Сервер отклонил действие: PermissionsClientInsufficient (TS 2568, не хватает права 224)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "private chat delivered",
|
"name": "private chat delivered",
|
||||||
"at": "2026-10-24T00:16:24.519Z"
|
"at": "2026-10-24T00:33:01.935Z"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"console": [],
|
"console": [],
|
||||||
"finishedAt": "2026-10-24T00:16:25.868Z",
|
"finishedAt": "2026-10-24T00:33:03.282Z",
|
||||||
"ok": true
|
"ok": true
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
// Read-only live check of server metadata rendering: connect muted, stay in the default channel,
|
||||||
|
// count rendered group labels/icons, channel icons/banners and avatars, screenshot the tree.
|
||||||
|
// node scripts/smoke-tree.mjs --server 10.10.10.160:9987 --out docs/evidence/runtime/<name>
|
||||||
|
import { _electron as electron } from 'playwright-core';
|
||||||
|
import { mkdirSync, writeFileSync, mkdtempSync, rmSync } from 'node:fs';
|
||||||
|
import { tmpdir } from 'node:os';
|
||||||
|
import path from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
import { createRequire } from 'node:module';
|
||||||
|
|
||||||
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||||
|
const electronPath = createRequire(import.meta.url)('electron');
|
||||||
|
const argv = process.argv.slice(2);
|
||||||
|
const opt = (n, d) => (argv.indexOf(`--${n}`) >= 0 ? argv[argv.indexOf(`--${n}`) + 1] : d);
|
||||||
|
const out = path.resolve(root, opt('out', 'smoke-out'));
|
||||||
|
mkdirSync(out, { recursive: true });
|
||||||
|
const profile = mkdtempSync(path.join(tmpdir(), 'teamspeach-tree-'));
|
||||||
|
const result = { steps: [], console: [] };
|
||||||
|
let app;
|
||||||
|
try {
|
||||||
|
app = await electron.launch({ executablePath: electronPath, args: [root], env: { ...process.env, TEAMSPEACH_PROFILE_DIR: profile } });
|
||||||
|
const page = await app.firstWindow();
|
||||||
|
page.on('console', (m) => result.console.push(`${m.type()}: ${m.text()}`));
|
||||||
|
page.on('pageerror', (e) => result.console.push(`pageerror: ${e.message}`));
|
||||||
|
await page.waitForSelector('#view-onboarding', { state: 'visible', timeout: 20000 });
|
||||||
|
await page.fill('#onboarding-nick', 'TeamsPeach-Probe');
|
||||||
|
await page.click('#onboarding-submit');
|
||||||
|
await page.waitForSelector('#view-app', { state: 'visible', timeout: 20000 });
|
||||||
|
await page.click('#btn-mute');
|
||||||
|
await page.fill('#connect-address', opt('server'));
|
||||||
|
await page.click('#connect-submit');
|
||||||
|
await page.waitForFunction(() => window.teamspeachDiagnostics.snapshot().conn === 'connected', null, { timeout: 60000 });
|
||||||
|
await page.waitForTimeout(8000);
|
||||||
|
const counts = await page.evaluate(() => ({
|
||||||
|
channels: document.querySelectorAll('#tree .channel-row').length,
|
||||||
|
channelIcons: document.querySelectorAll('#tree .channel-icon img').length,
|
||||||
|
banners: document.querySelectorAll('#tree .channel-row.has-banner').length,
|
||||||
|
groupLabels: Array.from(document.querySelectorAll('#tree .group-label')).filter((e) => !e.hidden).map((e) => e.textContent),
|
||||||
|
groupIconImages: document.querySelectorAll('#tree .group-icon img').length,
|
||||||
|
builtinBadges: document.querySelectorAll('#tree .group-icon svg').length,
|
||||||
|
avatars: document.querySelectorAll('#tree .avatar.has-image').length,
|
||||||
|
countries: Array.from(document.querySelectorAll('#tree .country')).map((e) => e.textContent),
|
||||||
|
errorToasts: Array.from(document.querySelectorAll('.toast[data-kind="error"]')).map((e) => e.textContent),
|
||||||
|
}));
|
||||||
|
result.steps.push({ name: 'tree metadata rendered', ...counts });
|
||||||
|
console.log(JSON.stringify(counts));
|
||||||
|
await page.screenshot({ path: path.join(out, '40-tree-metadata.png') });
|
||||||
|
await page.click('#btn-disconnect');
|
||||||
|
await page.waitForTimeout(800);
|
||||||
|
result.ok = counts.errorToasts.length === 0;
|
||||||
|
} catch (err) {
|
||||||
|
result.ok = false;
|
||||||
|
result.error = String(err.stack || err);
|
||||||
|
console.error(result.error);
|
||||||
|
} finally {
|
||||||
|
if (app) await app.close().catch(() => {});
|
||||||
|
rmSync(profile, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
writeFileSync(path.join(out, 'result.json'), JSON.stringify(result, null, 2));
|
||||||
|
process.exit(result.ok ? 0 : 1);
|
||||||