Compare commits

...
461 Commits
Author SHA1 Message Date
illusia 84bdf63514 fix: persist member volume preferences 2026-10-17 12:34:57 +08:00
illusia 54e154be1a release: prepare v0.2.8 2026-10-17 09:53:27 +08:00
illusia 4375f01d05 docs: add Shanghai and Hong Kong demo links 2026-10-16 22:55:29 +08:00
ILLUSIA 6f5f4c9f4d Merge pull request #38 from LainHE/fix/audio-frame-error-reporting-upstream
fix(audio): report discarded frames as route drops, not bad frames
2026-10-16 19:33:23 +08:00
ILLUSIA a9f5a47163 Merge pull request #35 from LainHE/fix/voice-session-connect-window-upstream
fix(voice): never swallow a TeamSpeak drop while the session is settling
2026-10-16 19:33:15 +08:00
ILLUSIA 6bf6544fd6 Merge pull request #37 from LainHE/fix/client-ip-trust-boundary-upstream
fix(voice): only believe forwarding headers from declared proxies
2026-10-16 19:33:07 +08:00
ILLUSIA 9c3b86dc7a Merge pull request #40 from LainHE/fix/webrtc-peer-rollback-upstream
fix(webrtc): roll back the peer when the mixer codec is unavailable
2026-10-16 19:31:00 +08:00
ILLUSIA 411ab57b63 Merge pull request #34 from LainHE/fix/screen-share-viewer-roster-upstream
fix(screen-share): resolve viewer avatars from client ids instead of the roster
2026-10-16 19:30:01 +08:00
ILLUSIA 4de532e56b Merge pull request #31 from LainHE/fix/acceleration-relay-ssrf-upstream
fix(acceleration-relay): 在 DNS 解析后校验目标地址,阻断 SSRF
2026-10-16 19:29:43 +08:00
LainHE e9cec18345 fix(voice): only believe forwarding headers from declared proxies
resolveClientIp() read X-Forwarded-For, then X-Real-IP, then the socket
address, taking whichever parsed first, with no notion of who wrote them.
Every visitor can set those headers on the WebSocket upgrade, so the address
recorded for a connection was chosen by the client rather than observed. It is
logged when the client starts connecting, when it reaches TeamSpeak and when
its session ends, and readConnectionHistory() turns those lines into the source
column of the admin connection log, so a visitor could put any address into the
audit trail.

Nothing else was affected: join, mobile and admin-login rate limiting key on
request.socket.remoteAddress, and the admin audit records no address at all, so
no admission or authentication decision depended on the forwarded value.

Forwarding headers are now read only when the peer that sent them is a declared
proxy. A trusted chain is walked from the hop nearest to us towards the client,
and the first address that is not a trusted proxy is reported, so a value a
client injects to the left of the entry its proxy appended is never recorded.
X-Real-IP is used only for a trusted peer that sent no chain, and never in
preference to one: a proxy appends its peer to X-Forwarded-For, whereas
X-Real-IP is only as good as the proxy configuration and can still carry a
client value if it is forwarded rather than overwritten.

Whoever we believe can choose what we record, so the default trusts loopback
alone. That keeps a reverse proxy on the same host working, including the
published host-network container. WEBSPEAK_TRUSTED_PROXIES takes IPs and CIDRs
for anything else; an invalid entry stops startup instead of silently narrowing
what is trusted.

Tests cover the direct-client case including the mapped IPv4 peer form, the
chain walk over IPv4 and IPv6, chains that are trusted end to end, X-Real-IP
gating, default loopback, CIDR and ::ffff: entries, and rejected
misconfiguration.
2026-10-16 17:48:09 +08:00
LainHE 82957832a5 fix(audio): report discarded frames as route drops, not bad frames
The browser uplink judged an incoming PCM frame before it resolved the audio
route, so a frame that arrived while the route was down was reported as
malformed. Every frame is discarded in that state whatever its size, which made
the error a misattribution and, worse, a spurious client-side failure: the
browser renders `error.code` as a session error, and that code can abort an
in-flight quick connect, because WebClient.vue fails the pending favorite
connection whenever a new error code appears.

Resolve the route first and only then judge the frame. The flow counters are
unchanged: a discarded frame increments `ingressDroppedFrames` exactly once
either way, so the teardown log and the client's `audioStatsProbe` still report
the same numbers, and a malformed frame still never reaches the encoder.

Repeated faults of one kind also produced one JSON error per frame. A client
streaming malformed frames made the server build and send a ~110 byte error for
every frame it received, for a payload that can be as small as a single byte,
while the browser only ever shows the first one: it writes the same error string
into the same state, and Vue does not re-render for an unchanged value.
Rate-limit the reports per fault code so that two different faults cannot hide
each other, and keep counting every discarded frame.

Route those faults to the logger as well. The outbound error is not logged
anywhere, so an operator had no way to notice a client that kept sending
malformed audio until the session was torn down and the full flow stats were
written at once. The warning is raised under the same rate limit, so a broken
client cannot turn it into a new log flood.

Tests: the route-first ordering and the per-code window each have a case that
fails without the change.
2026-10-16 16:42:28 +08:00
LainHE 5cf7331223 fix(webrtc): roll back the peer when the mixer codec is unavailable
`WebRtcAudioSession` builds its `RTCPeerConnection`, attaches the outgoing
track and adds the audio transceiver before it creates the mixer encoder. When
that encoder cannot be created the constructor stops the track and throws, but
it never closed the peer it had already built.

The caller cannot cover for it. `handleWebRtcOffer` assigns the factory result
to a local that starts as `null`:

    let peer: WebRtcAudioSession | null = null;
    ...
    peer = this.createWebRtcSession({ ... });

so a throwing constructor leaves `peer` at `null`, and the catch block's
`if (entry.webrtc === peer) entry.webrtc = null;` and `await peer?.close()` are
both no-ops. The peer was created, never closed, and no handle to it survived
the unwind.

The impact today is bounded, and the defect is the broken invariant rather than
a measured leak: the throw lands before ICE gathering starts, before
`scheduleAudioTick()` and `activityTimer` are installed, and werift's
constructor binds no socket or timer of its own, so the unreachable instance is
reclaimed by garbage collection. But an exception during construction must not
strand a half-built resource, and any acquisition added above that point would
turn this into a real leak.

Close the peer before propagating the failure:

  * `this.peer.close()` now runs before the throw, so the peer is released even
    though the caller never receives the session;
  * `createEncoder` becomes an injectable option on `WebRtcAudioSessionOptions`,
    mirroring `VoiceBridgeDependencies.createEncoder` and `createWebRtcSession`.
    Production still resolves to `new OpusEncoder(AUDIO_SAMPLE_RATE, 1)`, so
    behaviour is unchanged; the seam exists so the failure branch is reachable
    without a machine that happens to lack the native codec.

Covered by a regression test that injects a failing encoder and instruments
`RTCPeerConnection.prototype.close` to count the distinct peers closed during
construction. It reports 0 on the old code and 1 with the fix, in any
environment and with no dependency on native Opus.
2026-10-16 14:55:13 +08:00
LainHE 9873d27222 fix(voice): never swallow a TeamSpeak drop while the session is settling
The gateway only publishes `connected` once the directory snapshot lands in
`sendInitialState()`. Between authenticating and that point the session is in
`syncing` while `hasConnectedOnce` is still false. `onDisconnect` required both
`hasConnectedOnce` and `state === "connected"`, so a transport drop inside that
gap returned early and did nothing:

  * no `disconnected` frame for the browser,
  * no `scheduleReconnect`,
  * no peer/WeRTC rollback, no teardown.

The session stayed in `syncing` with the browser socket still open, the client
kept showing the connecting state forever, and nothing could recover it short
of the user closing the tab. `onKick` had the same gap via its own
`if (!hasConnectedOnce) return;` guard, so a kick or ban during the same window
was silently ignored while the gateway kept the dead session alive.

The window is not momentary. `tsClient.connect()` resolves even when the
directory reconciliation fails (the failure is logged and the explicit snapshot
emit is skipped), and `resetDirectoryForReconnect()` clears the snapshot on
every recovery, so each reconnect attempt opens the window again.

Treat the settling states (`authenticating`, `syncing`) as an explicit concept
and handle transport loss there:

  * a drop during the first connect is a connect failure, not an interruption:
    report `connectionFailed`, close with 4003 and tear the session down;
  * the same reporting is now shared by the rejected-`connect()` path through a
    single `failConnect` helper, so a transport that reports itself twice (a
    `disconnected` event plus a rejected connect) still fails exactly once;
  * a drop during a *reconnect* handshake returns the session to `reconnecting`
    and schedules another attempt instead of stalling in `syncing`;
  * a kick that lands before the session settles is reported and terminal.

A drop on an established session keeps the previous behaviour: `disconnected`
plus a scheduled reconnect.

Covered by three regression tests over the real WebSocket wiring with only the
external SDK stubbed: a drop before the directory sync, a kick in the same
window, and a drop during a reconnect handshake. All three hang on the old code.
2026-10-16 12:23:55 +08:00
LainHE 0ef9b84237 Merge remote-tracking branch 'upstream/master' into tmp-merge-check
# Conflicts:
#	package.json
#	src/server/acceleration-relay.test.ts
#	src/server/acceleration-relay.ts
2026-10-16 10:32:06 +08:00
LainHE bcc78177c2 fix(screen-share): keep the announced viewer count in step with the roster
Two smaller gaps left over from removing the inline avatars.

The announced viewerCount summed the viewer entry ids and the native viewer
ids, while the roster silently dropped ids whose participant had vanished
from the entry map. A client that disappears without passing through the
leave path therefore inflated the count for as long as the stream lived.
Prune those ids, and derive the count in the same call that builds the
roster so the two can no longer disagree.

The legacy inline-avatar path capped each entry at 128 KiB but placed no
bound on the roster total, which still allowed 64 x 128 KiB in a single
broadcast. Bound the total as well; entries past the budget fall back to
the client-side member lookup like any other viewer without an avatar.

Both behaviours are covered by new tests: a dropped entry no longer
inflates the count, and eight 128 KiB avatars are trimmed to the budget
(measured at 1048576 bytes without the bound).
2026-10-16 09:50:26 +08:00
LainHE bfa26da9eb fix(screen-share): resolve viewer avatars from client ids instead of the roster
The screen-share viewer roster embedded every viewer's avatar as a base64
data URL, and the gateway rebroadcast the whole roster to the channel on
every viewer join and leave. With the 64-viewer cap and the 128 KiB avatar
cap that is up to ~8 MB of JSON per event, multiplied by every member of
the channel -- even though the player renders at most five avatars and
every client already holds member avatars from the directory it received
through the connected and memberAvatar messages.

Send the TeamSpeak client id instead and resolve the avatar locally,
mirroring how a stream's ownerClientId already maps to a member card. This
removes the payload entirely rather than trimming it: the roster no longer
scales with avatar size at all.

The legacy inline avatar is still parsed so a newer client keeps working
against an older gateway, and a viewer missing from the local directory
degrades to the existing initial-based avatar fallback.

Verified by a regression test that gives every viewer a 128 KiB avatar and
asserts the roster stays under 16 KiB. Restoring the previous behaviour
makes that assertion fail at 1049182 bytes for eight viewers.
2026-10-16 09:47:01 +08:00
ILLUSIA 7715214f43 Merge pull request #33 from LainHE/fix/acceleration-relay-reconnect-upstream
fix(acceleration-relay): rebuild a self-closed tunnel on reconnect
2026-10-15 22:31:50 +08:00
ILLUSIA 69c2f4776e Merge pull request #32 from LainHE/fix/acceleration-relay-error-handling-upstream
fix(acceleration-relay): 修复 socket 错误监听器内 throw 导致进程崩溃
2026-10-15 22:31:22 +08:00
LainHE 7977572362 fix(acceleration-relay): rebuild a self-closed tunnel on reconnect
An acceleration tunnel can tear itself down on its own: a socket error, a relay
OPEN_ERR/CLOSE frame, or an open timeout runs closeSockets(), which closes both
UDP sockets and leaves every later sendFrame() a silent no-op.

TSClient kept the adapter bound to that tunnel's now-dead local port and only
rebuilt the transport when adapter or client were null. An auto-reconnect
therefore dialed a port nobody reads, and because a closed tunnel reports
nothing, the session could never recover and never surfaced an error either.

- expose isClosed() on AccelerationRelayClient so callers can distinguish a live
  tunnel from one that tore itself down
- drop a stale tunnel together with its adapter and SDK client before connect()
  decides whether to rebuild the transport, detaching first so a late
  "disconnected" from the retired client cannot re-enter the reconnect path
- cover the reconnect guard with regression tests in ts-client.test.ts

Verified: tsc clean; ts-client.test.ts 35/35 pass (incl. the two new guards).
2026-10-15 21:36:31 +08:00
LainHE 96f7fd6783 fix(acceleration-poc): align the relay's target guard with the gateway policy
The PoC relay carried its own copy of the restricted-address check and had
drifted well behind src/security/open-target-policy.ts: it missed multicast,
192.0.0.0/24 and the other special-use ranges, 198.18.0.0/15, the TEST-NET
blocks, fec0::/10, ff00::/8 and 2001:db8::/32. A relay started without
allowPrivate would therefore forward to addresses the gateway refuses, and
nothing exercised the guard, so the gap could not be noticed.

The relay must stay a plain .mjs file that the README documents copying to a
remote host without a build step, so it cannot import the TypeScript policy. The
predicate is mirrored instead and pinned by a parity test that fails the moment
the two classifications disagree.

The parity test lives beside the PoC rather than under src/: .dockerignore
excludes scripts/acceleration-poc from the Docker build context while the
Dockerfile runs `tsc` over src/**, so a copy in src/ would resolve locally and
still break the image build with TS2307.

- mirror isRestrictedAddress() exactly, including fail-closed handling of any
  input that is not a literal public address
- add scripts/acceleration-poc/target-guard-parity.test.mjs comparing both
  implementations across private, loopback, link-local, carrier-grade NAT,
  special-use, IPv6 and IPv4-mapped cases
- assert the guard in the PoC smoke run: a relay without allowPrivate must
  reject loopback, private and IPv4-mapped targets while still serving a public
  one, and the run now fails with the offending target instead of passing
  silently

Verified: tsc clean; `npm run build` and `npm run web:build` succeed with
scripts/acceleration-poc moved aside to reproduce the Docker build context; the
parity test fails when either side drifts; the smoke run reports ssrf_guard_ok
and ACCELERATION_POC_OK after the fix, and fails with a LEAK line per unblocked
target once the guard is weakened; the IPv6 smoke run still reports
IPV6_ACCELERATION_POC_OK.
2026-10-15 21:26:22 +08:00
LainHE 4816c7ea62 fix(acceleration-relay): validate resolved targets to close SSRF
The relay's private-target guard ran on the caller-supplied hostname while the
connection was made to the DNS-resolved address, so any hostname could reach
loopback or an internal host even with allowPrivate=false. IPv4-mapped IPv6
literals such as ::ffff:127.0.0.1 slipped through the IPv6 branch as well.

- reuse isRestrictedAddress() instead of the weaker local isPrivateAddress()
- resolve first, then reject when any resolved address is restricted, so a
  mixed public/private DNS answer cannot be used to reach an internal host
- release the freshly created session before rejecting a blocked target
- add an injectable lookupAddresses option for deterministic tests
- mirror the same resolve-then-validate ordering in the acceleration PoC relay
- add src/server/acceleration-relay.test.ts (6 tests) to the test script

Verified: tsc clean; the 6 new tests fail 4/6 before the fix and pass 6/6 after;
the acceleration PoC still reports ACCELERATION_POC_OK.
2026-10-15 16:34:07 +08:00
LainHE feb50d29c1 fix(acceleration-relay): report socket errors instead of throwing into the void
The relay's socket error listener ended with `throw error`. A listener that throws
escapes EventEmitter.emit, so it became an uncaught exception that terminated the
whole process. Because the throw also aborts the remaining listeners, it prevented
the startup promise from ever settling when the socket failed to bind.

- extract an idempotent shutdown() used by both close() and error handling
- reject the startup promise when the failure happens before listening, so a failed
  bind behaves like any other rejected startup rather than a process crash
- tear the relay down and report via a new onError callback once it is running
- release the socket and sweep interval on a synchronous bind failure, which never
  emits error at all
- add 3 regression tests covering bind failure, a surviving relay after a failed
  sibling startup, and idempotent close
- register the new test file in the npm test list so CI actually runs it

Verified: tsc --noEmit is clean and the 3 new tests pass. Before the fix the same
bind failure terminated the process with an uncaught EADDRINUSE instead of
rejecting the startup promise.
2026-10-15 16:20:19 +08:00
illusia 62af82f253 fix(kaak): keep voice dock controls inside panel 2026-10-14 17:06:44 +08:00
illusia 42a0755ad0 feat(skin): expose visitor count widget for skins 2026-10-14 00:43:43 +08:00
illusia 26c638c2a2 docs: fix public demo links 2026-10-13 11:19:12 +08:00
illusia c19dad513a docs: format changelogs by release version 2026-10-13 10:18:58 +08:00
illusia 21ee7c322d docs: consolidate localized release and skin guides 2026-10-13 10:08:41 +08:00
illusia 4910458408 fix(admin): allow KAAK as default skin 2026-10-13 08:15:24 +08:00
illusia 292b4073b3 release: prepare v0.2.7 2026-10-13 07:35:19 +08:00
illusia 48c2fb3948 Merge dev into master 2026-10-12 23:39:18 +08:00
ILLUSIA 224a641372 fix: repair KAAK controls and add invite link action 2026-10-12 23:38:35 +08:00
illusia 19274cf0ee Merge dev into master
# Conflicts:
#	web/src/voice/screen-share.ts
2026-10-12 23:12:27 +08:00
illusia 45bec91daa fix: correct identity provider test callback 2026-10-12 23:09:24 +08:00
illusia 7fd1ea96fe feat: complete runtime and KAAK skin updates 2026-10-12 23:06:55 +08:00
illusia c994722016 fix(screen-share): preserve AV1 fallback priority 2026-10-12 13:53:52 +08:00
LainHE 7a6e054fe9 fix(screen-share): use sender capabilities for codec preference
setCodecPreferences requires codecs from RTCRtpSender.getCapabilities;
feeding it RTCRtpReceiver.getCapabilities throws InvalidModificationError
in Chrome and the swallowed exception left VP8 as the negotiated codec.
Switch the capability source so H264/AV1 preferences actually apply.
2026-10-12 13:51:49 +08:00
LainHE d919dbd82a feat(web-client): allow users to pick screen share bitrate limit
Add a bitrate select to the screen share settings dialog (auto by
resolution, or a fixed 1.5/3/5/8/12 Mbps cap), persist the choice in
localStorage, and pass it through ScreenShareOutputSettings.maxBitrate
so configureScreenShareVideoSender applies the user-chosen budget
instead of only the height-scaled default.
2026-10-12 13:51:49 +08:00
illusia f74e211d0f Merge pull request #28 from LainHE/pr/screen-share-quality 2026-10-12 13:50:02 +08:00
illusia 458f95c2dc feat: refine KAAK navigation and join experience 2026-10-12 13:49:35 +08:00
illusia 319a16f384 Add server navigation controls across modes 2026-10-12 12:01:51 +08:00
illusia c6eeb49f44 fix: unify KAAK password dialog confirm labels 2026-10-12 11:37:53 +08:00
illusia 05220b7a6e style: include KAAK connection password field 2026-10-12 11:25:49 +08:00
illusia 53324ef02b style: match KAAK password dialogs to reference 2026-10-12 11:23:31 +08:00
illusia 2f5cdcba90 feat: remember server and channel passwords locally 2026-10-12 11:08:35 +08:00
illusia 9c8647df50 fix: pass channel password flags from TeamSpeak SDK 2026-10-12 10:51:34 +08:00
illusia cec2a81549 fix: show password protected channels 2026-10-12 10:34:06 +08:00
illusia ff508a8eb9 Fix collapsed KAAK share stage 2026-10-12 10:03:42 +08:00
illusia 8a46691dbb Fix KAAK screen share layout bounds 2026-10-12 09:58:08 +08:00
illusia 64b24d0452 Expand screen-share player to content width 2026-10-12 09:43:33 +08:00
illusia 833357e278 Fix screen-share letterboxing across skins 2026-10-12 09:38:26 +08:00
illusia acdc7a2330 Fix missing screen share player 2026-10-12 08:25:57 +08:00
illusia 42190909e3 Fix screen share player fallback width 2026-10-12 08:10:17 +08:00
illusia a4e54d6341 Fix screen share player sizing 2026-10-11 23:36:58 +08:00
illusia 13499541e0 fix(voice): enable screen share in built-in member cards 2026-10-11 23:30:09 +08:00
illusia df2ff79e15 fix(skins): show active screen sharing across bundled themes 2026-10-11 23:17:11 +08:00
illusia d9749ac12f docs: record screen-share skin fix verification 2026-10-11 23:06:57 +08:00
illusia 8b5db8af1f fix(skins): expose screen-share status to custom members 2026-10-11 23:06:06 +08:00
illusia 7fe8719812 style: show noise suppression disabled state 2026-10-11 22:20:12 +08:00
illusia 0a77bdcaca docs: record channel tree drag drop work 2026-10-11 22:12:32 +08:00
illusia e800d75b7b feat: restore channel-tree member drag and drop 2026-10-11 22:12:05 +08:00
illusia 3476d4716a feat: add KAAK context menu to channel tree members 2026-10-11 21:40:14 +08:00
illusia 3459c8410c record KAAK menu update status 2026-10-11 21:14:17 +08:00
illusia 10739a7c7e style KAAK member context menu 2026-10-11 21:13:56 +08:00
illusia fb39aabbe2 docs(kaak): record banner handshake fix 2026-10-11 20:41:07 +08:00
illusia 6c57868903 fix(voice): read server banner from client handshake 2026-10-11 20:40:01 +08:00
illusia 398a4d6c7f feat(kaak): render TeamSpeak server banner 2026-10-11 19:50:35 +08:00
illusia 766a9b9b5a feat(kaak): refine compact voice dock controls 2026-10-11 19:30:42 +08:00
illusia 96d2ebae01 feat(kaak): match channel sidebar and audio dock reference 2026-10-11 19:20:57 +08:00
illusia b13bdf1eb2 feat(kaak): add trusted server switcher and channel tree 2026-10-11 18:37:13 +08:00
illusia 17fb27b89a fix: expose server identity and refine KAAK client 2026-10-11 17:14:56 +08:00
illusia e8164abafe docs(kaak): record popover stacking fix 2026-10-11 15:23:16 +08:00
illusia a1051b989e fix(kaak): layer audio popovers above metrics 2026-10-11 15:22:55 +08:00
illusia a84a12ced4 docs(kaak): record control dock fix 2026-10-11 13:02:43 +08:00
illusia 938bb0646d fix(kaak): restore dock controls and feedback 2026-10-11 13:01:47 +08:00
illusia 2f32d47036 docs(kaak): record control dock push 2026-10-11 12:51:02 +08:00
illusia 25148dd343 fix(kaak): move noise control into lower row 2026-10-11 12:49:28 +08:00
Corrupted ILLUSIA cf692174da docs(kaak): record rebuilt skin package 2026-10-11 12:39:11 +08:00
Corrupted ILLUSIA a43e6750ef docs(kaak): record corrected dock layout 2026-10-11 12:37:43 +08:00
Corrupted ILLUSIA 729e413196 fix(kaak): keep noise control in lower row 2026-10-11 12:36:56 +08:00
Corrupted ILLUSIA 93c9c2532a docs(kaak): record dock update pushed 2026-10-11 12:31:59 +08:00
Corrupted ILLUSIA 74ee82a927 feat(kaak): match provided voice dock layout 2026-10-11 12:31:02 +08:00
Corrupted ILLUSIA b9f3272210 docs(kaak): record compact dock push 2026-10-11 10:44:19 +08:00
Corrupted ILLUSIA 0ad7386fcd style(kaak): match supplied compact dock layout 2026-10-11 10:43:31 +08:00
Corrupted ILLUSIA 4adc712562 style(kaak): compact voice control dock 2026-10-11 10:25:33 +08:00
Corrupted ILLUSIA f5c0d66c10 docs(kaak): record 3.1.54 push 2026-10-11 10:13:47 +08:00
Corrupted ILLUSIA 13f4ddac4d feat(kaak): refine voice dock visuals 2026-10-11 10:12:16 +08:00
Corrupted ILLUSIA 16df12e4b2 fix(skin-editor): hide dev controls from visitors 2026-10-11 08:48:36 +08:00
Corrupted ILLUSIA 8cde1eae5a docs(kaak): sync latest checkpoint 2026-10-11 08:37:39 +08:00
Corrupted ILLUSIA 1391e02dd5 feat(kaak): add member card context actions 2026-10-11 08:36:34 +08:00
Corrupted ILLUSIA f3325458f4 docs(kaak): record local acceptance blocker 2026-10-11 08:19:55 +08:00
Corrupted ILLUSIA 72297c79b4 docs(kaak): record member actions checkpoint 2026-10-11 08:14:25 +08:00
Corrupted ILLUSIA bdd8e39a35 feat(kaak): expose member volume actions 2026-10-11 08:12:55 +08:00
Corrupted ILLUSIA 1e4fa08220 docs(kaak): record channel state checkpoint 2026-10-11 07:54:05 +08:00
Corrupted ILLUSIA 9f11d11b55 feat(kaak): isolate chat visibility per channel 2026-10-11 07:53:04 +08:00
Corrupted ILLUSIA fe578bcb60 docs(kaak): record pushed preview checkpoint 2026-10-11 07:43:23 +08:00
Corrupted ILLUSIA 650c1e0a6a style(kaak): animate performance sampling feedback 2026-10-11 07:41:32 +08:00
Corrupted ILLUSIA 5596735d4a style(kaak): unify active speaker feedback 2026-10-11 07:25:32 +08:00
Corrupted ILLUSIA 2ef21a7da5 docs(kaak): clarify branch checkpoint 2026-10-11 07:20:35 +08:00
Corrupted ILLUSIA c5146a5734 docs(kaak): update clone checkpoint 2026-10-11 07:19:23 +08:00
Corrupted ILLUSIA b01127c461 docs(kaak): preserve complete clone worklog 2026-10-11 07:11:10 +08:00
Corrupted ILLUSIA 2e67eaaa54 docs(kaak): record noise controls checkpoint 2026-10-11 07:10:16 +08:00
Corrupted ILLUSIA cb504c95bc feat(kaak): surface noise controls in audio settings 2026-10-11 07:06:49 +08:00
illusia 7c3e32d671 docs(kaak): record audio settings checkpoint 2026-10-11 06:50:19 +08:00
illusia 2a80ade08b feat(kaak): match audio settings layout 2026-10-11 06:49:53 +08:00
Corrupted ILLUSIA 2fcea5622b feat(kaak): unify audio accent feedback 2026-10-11 06:25:33 +08:00
Corrupted ILLUSIA 62a358796f feat(kaak): match KOOK channel typography 2026-10-11 06:14:17 +08:00
illusia 3f68050c81 feat(kaak): refine participant stage feedback 2026-10-11 06:00:05 +08:00
illusia 01ad967e30 feat(kaak): align KOOK brand accents 2026-10-11 05:50:00 +08:00
illusia a73a6b1a1e feat(kaak): refine volume slider states 2026-10-11 05:46:01 +08:00
illusia 0453bc6d4a feat(kaak): match device picker geometry 2026-10-11 05:41:07 +08:00
illusia c29109e898 docs(kaak): clarify voice chat defaults 2026-10-11 05:27:20 +08:00
Corrupted ILLUSIA 794b3f0ae0 docs(kaak): refresh clone checkpoint 2026-10-11 05:22:52 +08:00
Corrupted ILLUSIA 9cc6e7b765 fix(kaak): match audio label typography 2026-10-11 05:20:24 +08:00
illusia fbcbe994f0 fix(audio): keep device menus within viewport 2026-10-11 05:13:13 +08:00
Corrupted ILLUSIA 1951884d12 fix(skin): register public audio controls 2026-10-11 05:06:39 +08:00
Corrupted ILLUSIA 463f803881 fix(kaak): match audio title weight 2026-10-11 04:55:33 +08:00
illusia 61332ed846 fix(audio): show desktop volume controls 2026-10-11 04:45:06 +08:00
Corrupted ILLUSIA f3565f9859 docs(kaak): record successful dev sync 2026-10-11 04:26:20 +08:00
Corrupted ILLUSIA a3bdee9063 fix(kaak): apply skin typography to home surface 2026-10-11 04:24:25 +08:00
Corrupted ILLUSIA 2d92ca82f4 fix(kaak): match audio settings typography 2026-10-11 04:21:12 +08:00
illusia 10379829d8 fix(audio): keep volume hover panels reachable 2026-10-11 04:02:44 +08:00
illusia 5da11b41f9 fix(kaak): smooth member speaking glow 2026-10-11 04:00:04 +08:00
illusia deb5ca4e43 fix(voice): improve performance panel dismissal 2026-10-11 03:53:14 +08:00
illusia 3ff6507943 feat(kaak): animate voice channel group collapse 2026-10-11 03:38:37 +08:00
illusia e02ce7c546 feat(kaak): animate member name hover labels 2026-10-11 03:30:56 +08:00
illusia 8e580e7e18 feat(kaak): match KOOK audio device picker 2026-10-11 03:20:34 +08:00
illusia 70cc6c3bbf docs(kaak): record interaction fidelity audit 2026-10-11 02:47:39 +08:00
illusia ed6bf3a6ec docs(kaak): describe hidden chat panel 2026-10-11 02:20:24 +08:00
illusia 17a76fc1fd docs(kaak): record collapsed chat node 2026-10-11 02:06:33 +08:00
illusia ff207df20d feat(kaak): hide collapsed voice chat panel 2026-10-11 02:05:51 +08:00
illusia 5ca90c0914 docs(kaak): record channel selection feedback 2026-10-11 01:39:45 +08:00
illusia 19e693c270 feat(kaak): show channel join confirmation 2026-10-11 01:39:12 +08:00
illusia 2b6903f00a docs(kaak): record interaction polish progress 2026-10-11 01:32:43 +08:00
illusia 83902e0fb5 feat(kaak): refine interaction feedback and permissions 2026-10-11 01:31:44 +08:00
illusia bdd0c3473c feat(kaak): refine audio controls and diagnostics 2026-10-11 00:47:06 +08:00
illusia afa1e89136 fix(kaak): keep voice heading visible with chat open 2026-10-10 23:53:53 +08:00
illusia 5d27b9e4a8 fix(kaak): match KOOK member name visibility 2026-10-10 23:35:26 +08:00
illusia 7ea19e14eb docs: clarify KOOK channel entry checkpoint 2026-10-10 23:06:18 +08:00
illusia efa8f76787 docs: record KAAK reference checkpoint 2026-10-10 23:04:23 +08:00
illusia 8105a07171 fix(kaak): keep participant names visible 2026-10-10 22:53:56 +08:00
illusia 42cf4fbb8a docs: track KAAK clone progress 2026-10-10 22:40:22 +08:00
Corrupted ILLUSIA a3bf476db6 feat(kaak): show channel occupancy limits 2026-10-10 22:25:01 +08:00
Corrupted ILLUSIA 387462d89a feat(kaak): animate participant membership changes 2026-10-10 22:02:46 +08:00
Corrupted ILLUSIA 498a728d04 feat(kaak): match KOOK muted participant badge 2026-10-10 21:48:28 +08:00
Corrupted ILLUSIA 9c0fa35d38 feat(skin): improve KAAK collapsed voice stage 2026-10-10 21:28:19 +08:00
Corrupted ILLUSIA afc58799d9 feat(kaak): match KOOK voice participant tiles 2026-10-10 21:03:54 +08:00
Corrupted ILLUSIA 212bd9db2c feat(kaak): match KOOK voice dock actions 2026-10-10 20:37:23 +08:00
Corrupted ILLUSIA 5824754912 feat(kaak): match open KOOK voice stage 2026-10-10 20:13:24 +08:00
Corrupted ILLUSIA a1f92cedb2 feat(kaak): keep server rail colors stable 2026-10-10 19:51:00 +08:00
Corrupted ILLUSIA 8aefed83d1 feat(kaak): match KOOK voice chat presentation 2026-10-10 19:40:41 +08:00
Corrupted ILLUSIA 19c85ce1f5 feat(kaak): align voice room with KOOK layout 2026-10-10 19:33:48 +08:00
Corrupted ILLUSIA 7fb5e1d6ea feat(kaak): add collapsible voice channel group 2026-10-10 19:18:52 +08:00
Corrupted ILLUSIA b9c017f9aa feat(kaak): match KOOK server rail icons 2026-10-10 19:11:12 +08:00
Corrupted ILLUSIA d9b83f12cc feat(kaak): enrich channel chat message rows 2026-10-10 18:52:11 +08:00
Corrupted ILLUSIA 36ece5e582 feat(kaak): center voice participant rows 2026-10-10 18:41:05 +08:00
illusia f1f50d393a fix(kaak): keep full voice roster visible 2026-10-10 18:30:29 +08:00
illusia f6ef471960 feat(skins): refine KAAK voice channel chat 2026-10-10 18:25:22 +08:00
LainHE 20bde72c8b fix(screen-share): use sender capabilities for codec preference
setCodecPreferences requires codecs from RTCRtpSender.getCapabilities;
feeding it RTCRtpReceiver.getCapabilities throws InvalidModificationError
in Chrome and the swallowed exception left VP8 as the negotiated codec.
Switch the capability source so H264/AV1 preferences actually apply.
2026-10-10 18:02:36 +08:00
LainHE 1c328995aa feat(web-client): allow users to pick screen share bitrate limit
Add a bitrate select to the screen share settings dialog (auto by
resolution, or a fixed 1.5/3/5/8/12 Mbps cap), persist the choice in
localStorage, and pass it through ScreenShareOutputSettings.maxBitrate
so configureScreenShareVideoSender applies the user-chosen budget
instead of only the height-scaled default.
2026-10-10 18:01:04 +08:00
illusia 7b31c9106a feat(skins): refine KAAK voice room fidelity 2026-10-10 17:15:02 +08:00
illusia 7f5d3e1b3c feat(skins): refine KAAK voice workspace fidelity 2026-10-10 16:27:46 +08:00
illusia ad0aa5c120 fix(skins): correct full-surface layout and KAAK audio dock 2026-10-10 15:53:51 +08:00
illusia 54805f8928 feat(skins): add complete KAAK voice workspace skin 2026-10-10 15:53:51 +08:00
illusia f2e5695bb6 feat(skins): complete visual component CRUD authoring 2026-10-10 15:53:51 +08:00
illusia 3fd8e76a98 test(skins): verify surface deletion recovery 2026-10-10 15:53:51 +08:00
illusia da0472383d fix(skins): preserve screen capture user activation 2026-10-10 15:53:51 +08:00
illusia fd4b0c6da2 test(skins): verify live component CRUD preview 2026-10-10 15:53:51 +08:00
illusia 100a8f49ee test(skins): verify editor focus restoration 2026-10-10 15:53:51 +08:00
illusia 16f28ca348 fix(skins): refresh plugin assets when switching skins 2026-10-10 15:53:51 +08:00
illusia 0c4cc344ef feat(skins): add component authoring workflow 2026-10-10 15:53:51 +08:00
illusia 96c29394f3 feat(skin): add bounded plugin runtime and Harbor voice sample 2026-10-10 15:53:50 +08:00
illusia 8f097ec597 feat(skin): broaden runtime UI output 2026-10-10 15:53:50 +08:00
illusia b0b4a02a21 feat(skin): preserve screen share user gesture 2026-10-10 15:53:50 +08:00
illusia e20219b010 feat(skin): make runtime plugins locally reorderable 2026-10-10 15:53:50 +08:00
illusia 1499d60bc0 feat(skin): add local sibling ordering 2026-10-10 15:53:50 +08:00
illusia 11a07eae0f fix(skin): register runtime plugin layout parts 2026-10-10 15:53:50 +08:00
illusia 35cb6ad6df feat(skin): bridge trusted plugin actions 2026-10-10 15:53:50 +08:00
illusia 1aa29158ef feat(skin): project bounded read data into Wasm plugins 2026-10-10 15:53:50 +08:00
illusia 7650bd650b feat(skin): connect v4 runtime prototype to WebClient 2026-10-10 15:53:50 +08:00
illusia 7993b38eee feat(skin): support approved Wasm plugin prototype 2026-10-10 15:53:50 +08:00
illusia 26b74c5be4 feat(skin): prototype bounded wasm UI event loop 2026-10-10 15:53:50 +08:00
illusia dd0d779e49 feat(skin): render voice members under channels 2026-10-10 15:53:49 +08:00
illusia 54c77bcb27 feat(skin): prototype bounded UI callback inputs 2026-10-10 15:53:49 +08:00
illusia c3810a177a feat(skin): widen bounded wasm ui output 2026-10-10 15:53:49 +08:00
illusia ab36825a56 docs(skin): reject iframe as plugin network boundary 2026-10-10 15:53:49 +08:00
illusia 067f0c4403 feat(skin): expose custom nodes to layout editor 2026-10-10 15:53:49 +08:00
illusia c243f272fe feat(skin): bind plugin approval to package digest 2026-10-10 15:53:49 +08:00
illusia 81c35356b4 feat(skin): validate v4 plugin packages 2026-10-10 15:53:49 +08:00
illusia 17e4d78e52 feat(skin): define full plugin runtime target 2026-10-10 15:53:49 +08:00
illusia d137b41b5c feat(skin): add validated runtime UI output bridge 2026-10-10 15:53:49 +08:00
illusia 7047d71678 feat(skin): add bounded UI output bridge 2026-10-10 15:53:49 +08:00
illusia 849eb1a6d9 feat(skin): expand schema v3 voice interactions 2026-10-10 15:53:49 +08:00
illusia d505815f28 feat(skin): add approved full-page surface composition 2026-10-10 15:53:48 +08:00
illusia eabc78f36a feat(skin): add v3 declarative plugin components 2026-10-10 15:53:48 +08:00
illusia 02441410a0 feat(web): implement open skin layouts and migrate Illusia 2026-10-10 15:53:38 +08:00
illusia 58559cf839 fix(web): unify quick server history and favorites 2026-10-09 13:42:56 +08:00
illusia b6e4d349a2 feat(web): add skinnable favorite server switching 2026-10-09 10:35:01 +08:00
illusia ae1cd707be docs: credit contributor for PR #25 2026-10-09 00:26:27 +08:00
illusia efa0b85a0e fix: preserve invites on nickname lookup failure 2026-10-09 00:26:21 +08:00
Corrupted ILLUSIA 75893339c5 Merge pull request #25 from yichen11818/codex/teamspeak-server-aliases
feat: support TeamSpeak server nickname connections
2026-10-08 23:51:02 +08:00
yumi 60d3cfd569 feat: support TeamSpeak server nickname connections 2026-10-08 23:48:47 +08:00
illusia 35dde81cc2 docs: keep release notes out of project home page 2026-10-08 12:19:19 +08:00
illusia ebca754ca5 docs: refresh v0.2.6 project documentation 2026-10-08 12:07:06 +08:00
illusia 69f8d66ca9 docs: align v0.2.6 packages with supported architectures 2026-10-08 11:29:18 +08:00
illusia 7789758024 fix: provide Opus config for Windows ARM64 2026-10-08 11:17:44 +08:00
illusia c211deeb98 fix: set Android Gradle wrapper executable in CI 2026-10-08 11:13:57 +08:00
illusia aad7833509 fix: build Windows ARM64 Opus with supported toolchain 2026-10-08 11:05:13 +08:00
illusia 39413cf840 fix: update Android release setup action 2026-10-08 10:56:41 +08:00
illusia 50d9d58ad0 release: prepare v0.2.6 multi-architecture packages 2026-10-08 10:50:42 +08:00
illusia 0a552f7ee8 fix: consolidate audited dev updates 2026-10-08 10:32:59 +08:00
illusia 568b8fd8be Prepare 0.2.6-preview and remove private deployment references 2026-10-03 23:25:58 +08:00
illusia d919df1273 docs: close refactor scope with requested acceptance exclusions 2026-10-03 15:54:02 +08:00
illusia 921e83dfb3 fix: acknowledge TS6 screen cleanup and include removal reason 2026-10-03 14:31:45 +08:00
illusia 77fef3bed9 fix: restore input mute after TeamSpeak flood rejection 2026-10-03 14:06:07 +08:00
illusia 2c49ee2599 docs: record Edge dialog blocker and remaining acceptance requirements 2026-10-03 09:50:45 +08:00
illusia 81a860c3df docs: record live multi-speaker mixing and member volume checks 2026-10-03 09:45:16 +08:00
illusia d327c6f179 fix: negotiate only supported Opus audio before WebRTC activation 2026-10-03 09:38:59 +08:00
illusia 7baeff00ba fix: preserve continuous Opus state in WebRTC downlink 2026-10-03 09:28:11 +08:00
illusia 777c779d79 fix: keep accompaniment audible while microphone is muted 2026-10-03 09:18:49 +08:00
illusia 051cb402e5 docs: scope out Android and record requested TeamSpeak connectivity checks 2026-10-02 17:11:28 +08:00
illusia 1791d5946d docs: record clean Android APK installation and cold startup 2026-10-02 01:00:00 +08:00
illusia 39eba1b121 fix: describe administrative audit events in all languages 2026-10-01 20:15:24 +08:00
illusia a195681e78 build: exclude local env files and record clean release validation 2026-10-01 20:03:31 +08:00
illusia 172347aaa7 refactor: remove redundant client style declarations 2026-10-01 19:47:59 +08:00
illusia 8e28bca634 refactor: remove redundant admin style declarations 2026-10-01 19:36:43 +08:00
illusia 4ef7ec5ee3 style: expand client templates and preserve CSS rule order 2026-10-01 19:30:07 +08:00
illusia f18fa63001 refactor: extract voice member cards with page-owned sharing 2026-10-01 19:20:31 +08:00
illusia 6ed8abfb15 refactor: extract sharing views and repair player ownership 2026-10-01 19:11:29 +08:00
illusia 8b6c998c43 refactor: extract audio controls and scope whisper input 2026-10-01 18:58:19 +08:00
illusia d2caaa8f3c refactor: extract settings dialogs and guard pending feedback 2026-10-01 18:45:56 +08:00
illusia 83b2430d18 refactor: extract member panels and constrain action menus 2026-10-01 18:19:24 +08:00
illusia a416e36bd1 refactor: extract client join and chat panels and fit narrow forms 2026-10-01 18:00:31 +08:00
illusia a2f91e606f refactor: separate admin sections and fit narrow navigation 2026-10-01 17:36:54 +08:00
illusia 9dfded0fb7 fix: bind skin loading to the current page and choice 2026-10-01 17:00:05 +08:00
illusia 15e22d3099 fix: scope identity operations to the active dialog 2026-10-01 16:18:20 +08:00
illusia db08fbda6b fix: scope session state and confirm chat destinations 2026-10-01 15:46:52 +08:00
illusia c16d1d4cfb fix: keep voice diagnostics scoped to current media 2026-10-01 15:03:58 +08:00
illusia 5855d0ba67 refactor: scope browser transports and command lifecycles 2026-10-01 14:48:44 +08:00
illusia f11fe26bfe fix: isolate microphone metering resources and stale ticks 2026-10-01 14:16:10 +08:00
illusia 1a46ab83a3 fix: preserve live voice during accompaniment changes 2026-10-01 14:09:32 +08:00
illusia 878e94a93a refactor: scope SDK events and directory state to their session 2026-10-01 13:42:57 +08:00
illusia 2047e30984 fix: keep avatar transfers on their original SDK connection 2026-10-01 13:30:18 +08:00
illusia 3dfd25dab7 fix: bind member avatar downloads to connection lifecycles 2026-10-01 13:25:55 +08:00
illusia c8417edd7d refactor: isolate session audio and harden gateway teardown 2026-10-01 13:16:59 +08:00
illusia 49481145ef fix: prepare microphone graphs before replacing live capture 2026-10-01 12:49:44 +08:00
illusia 3b5c0dfc7d refactor: complete admin translations and responsive toolbar 2026-10-01 12:36:55 +08:00
illusia 525f512f4a fix: bind admin state to request and page lifecycles 2026-10-01 12:11:47 +08:00
illusia 0785f82386 fix: preserve audio capture across device reconfiguration 2026-10-01 11:30:40 +08:00
illusia 797fc135a9 fix: isolate remote playback and microphone recording lifecycles 2026-10-01 11:16:05 +08:00
illusia f0712fa3fc refactor: share admin contracts and isolate page styles 2026-10-01 10:55:36 +08:00
illusia e2f0a43762 fix: cancel stale voice operations and isolate Android startup 2026-10-01 10:08:18 +08:00
illusia 8960189bc7 refactor: isolate gateway commands and screen-sharing coordination 2026-10-01 09:20:11 +08:00
illusia f4cbd61cff refactor: share wire contracts and isolate screen-sharing lifecycle 2026-10-01 09:06:15 +08:00
illusia 541a216c4d test: establish gateway refactoring checks and prevent stale directory entries 2026-10-01 08:34:04 +08:00
illusia aeaeb15965 feat: add Android gateway preview and refactoring plan 2026-10-01 08:13:46 +08:00
illusia 9e2b9bf564 feat: import and export TeamSpeak identities 2026-09-29 11:09:18 +08:00
illusia 0a4fff6f6f feat: report live voice status and harden target handling 2026-09-28 22:28:16 +08:00
illusia e0d5916a86 fix: shrink Illusia voice artwork 2026-09-27 12:56:40 +08:00
illusia e8dc71329b fix(skins): refresh cached Illusia packages 2026-09-27 09:35:21 +08:00
illusia 30682cd659 fix(skins): localize selector and animate gradient states 2026-09-27 09:17:46 +08:00
illusia e09a19b7b4 feat(skins): ship protected built-ins and instance defaults 2026-09-27 00:45:29 +08:00
illusia 2b7e908d31 feat: add customizable skin support 2026-09-26 08:59:05 +08:00
illusia 0ea85752fd fix(admin): unify operations layout 2026-09-25 16:14:48 +08:00
illusia 97b7127ca3 refactor: modularize WebClient responsibilities 2026-09-25 07:54:31 +08:00
illusia db38feba52 fix: surface TeamSpeak handshake errors 2026-09-23 22:15:52 +08:00
illusia 1bab4df64e fix: apply screen share output limits at sender 2026-09-23 14:34:48 +08:00
Object ILLUSIA 193130c50f Merge pull request #8 from LainHE/master
fix: 缩放补偿、浮动布局及首页脚标问题修复
2026-09-23 10:55:09 +08:00
LainHE c7794a12e7 fix(web): give join footer solid background and stacking, constrain join-content scroll
- .join-footer: background var(--surface-0) so it matches page theme in light/dark/system; z-index 2 so it stays above join-content overlap on short viewports

- .join-content: overflow-y auto on desktop so oversized copy scrolls inside the container instead of spilling into the footer
2026-09-23 09:48:08 +08:00
LainHE 408d8bcda4 feat(web): float desktop audio dock and message composer
Float .desktop-audio-dock at the bottom of .member-panel and .message-composer at the bottom of .chat-panel on desktop (>=741px):
- switch both from in-flow to absolute positioning, keeping the original visual anchor semantics
- width follows the parent content width (left/right insets align with member-panel horizontal padding / chat-panel zero padding)
- add padding-bottom compensation to .member-panel and .chat-panel so member/message lists are not covered
- mobile layout (<=740px) remains untouched
2026-09-23 08:39:36 +08:00
LainHE 5a3eebecbd fix(web): zoom compensation and mobile chat scroll fixes
- WebClient: divide fixed offsets and viewport heights by --ui-scale on large displays; fix member context menu position
- WebClient: use 100dvh/100svh with fallbacks on mobile; constrain workspace-content height so message list scrolls properly
- AdminView: keep html/body at real viewport while zoomed admin shell divides height by scale
- DemoView: divide poke banner offsets by --ui-scale to keep intended margin
- package-lock: drop stale peer flags
2026-09-23 06:57:09 +08:00
illusia 713716dacc merge: release v0.2.4 from dev 2026-09-22 17:23:16 +08:00
illusia 3a7a162f97 release: prepare v0.2.4 2026-09-22 17:23:04 +08:00
illusia 2f8614d53a fix: move screen share settings into modal 2026-09-22 17:06:11 +08:00
illusia bdac15afac fix: keep screen share settings inside cards 2026-09-22 17:01:23 +08:00
illusia 7f49e2f2d7 feat: add screen share quality controls 2026-09-22 15:01:14 +08:00
illusia 24f1b9a4b8 docs: add star history chart 2026-09-22 12:04:27 +08:00
illusia 79b91fca44 feat: refine screen share member controls 2026-09-22 11:31:30 +08:00
illusia 6a821b760e fix: sync mute state and handle move permissions 2026-09-22 10:50:53 +08:00
illusia 6539479d10 feat: show homepage visitor number 2026-09-22 00:09:33 +08:00
illusia 8ed3e788be feat: add STUN candidates for screen sharing 2026-09-21 22:24:24 +08:00
illusia de8f6a11c9 chore: prepare v0.2.4-preview 2026-09-21 19:19:52 +08:00
illusia 21d53a30c9 fix: target native screen source during browser joins 2026-09-21 18:17:37 +08:00
illusia 22656b2e7d feat: bridge screen sharing with native ts6 clients 2026-09-21 17:51:43 +08:00
illusia 3a18bcebbc fix: place screen share viewers at top right 2026-09-21 08:48:19 +08:00
illusia 7b35c63a74 fix: isolate native screen share from browser p2p 2026-09-21 08:29:37 +08:00
illusia 6b9038da6c fix: include viewer id in native screen join 2026-09-21 06:06:39 +08:00
illusia 1dd04bf7ca fix: cancel pending screen capture safely 2026-09-21 05:59:54 +08:00
illusia 15af861389 fix: allow cancelling pending screen share 2026-09-21 05:56:53 +08:00
illusia 7ea63c525e fix: clean up pending screen share starts 2026-09-21 05:52:22 +08:00
illusia 3d0b8a5c97 feat: show screen share viewers 2026-09-21 05:49:11 +08:00
illusia fb39d82c01 fix: validate screen share connection state 2026-09-21 04:59:08 +08:00
illusia ae530963bf fix: clear failed screen share viewers 2026-09-21 01:05:11 +08:00
illusia f8554fc991 fix: harden browser screen share p2p signaling 2026-09-21 00:54:40 +08:00
illusia a3dad55c76 fix: forward native screen share join responses 2026-09-20 23:48:31 +08:00
illusia 0b29742bce feat: discover existing native screen streams 2026-09-20 23:33:51 +08:00
illusia c2c38fa011 Merge remote-tracking branch 'origin/master' into dev 2026-09-20 23:31:04 +08:00
illusia 578217ba41 fix: use native screen share join requests 2026-09-20 23:28:58 +08:00
illusia d75bdccfd9 feat: add direct P2P screen sharing signaling 2026-09-20 23:15:58 +08:00
illusia 412f560677 fix: keep admin settings inside scaled viewport 2026-09-20 10:16:22 +08:00
illusia fdccf86458 fix: keep admin relay settings within viewport 2026-09-20 10:03:42 +08:00
illusia d43a33aa15 docs: rewrite v0.2.3 release notes 2026-09-19 16:23:01 +08:00
illusia 056b57bcd1 release: prepare v0.2.3 2026-09-19 13:52:01 +08:00
illusia 688eb3174e fix: make member drag moves direct 2026-09-19 12:15:39 +08:00
illusia c38f67bc3b fix: keep current channel in move menu 2026-09-19 12:00:48 +08:00
illusia 67c7a27af6 fix: move members without channel passwords 2026-09-19 11:47:56 +08:00
illusia 6d1d2a1f92 fix: add pointer fallback for member moves 2026-09-19 11:32:22 +08:00
illusia faff7a2237 fix: restore member moves, avatars, and remembered identity 2026-09-19 11:12:19 +08:00
illusia dc63f4b45b Merge branch 'fix/issues-integration' into dev 2026-09-18 18:48:02 +08:00
illusia 380fb67090 merge: integrate issue 6 mute synchronization 2026-09-18 18:03:05 +08:00
illusia b71632cc29 merge: integrate issue 5 avatar support 2026-09-18 18:02:27 +08:00
illusia 38f7c94a65 merge: integrate issue 3 move permissions 2026-09-18 18:01:21 +08:00
illusia d91a145657 fix: complete client avatar loading 2026-09-18 17:58:55 +08:00
illusia a2e33ff176 feat: display TeamSpeak client avatars 2026-09-18 17:48:33 +08:00
illusia 010b8ef072 fix: gate member moves by TeamSpeak permissions 2026-09-18 17:36:45 +08:00
illusia 883703dd0c fix: preserve TeamSpeak channel order 2026-09-18 17:14:35 +08:00
illusia bcf212738b fix: synchronize microphone mute state 2026-09-18 17:06:30 +08:00
illusia fae21ec086 docs: add contributors section 2026-09-17 17:56:40 +08:00
illusia 22dcf93925 docs: label documentation links bilingually 2026-09-17 15:05:34 +08:00
illusia 4df59b80d0 docs: restore README banner and localize license 2026-09-17 15:02:20 +08:00
illusia c49b4ec715 release: prepare v0.2.2 2026-09-17 14:36:40 +08:00
illusia 1c80791109 feat: refine desktop audio controls 2026-09-17 14:28:18 +08:00
illusia 85f87ecd0b feat: add Russian Japanese localization and welcome templates 2026-09-17 13:49:43 +08:00
illusia 3d6752a5e4 docs: split README by language 2026-09-17 13:22:40 +08:00
illusia a0921c35b2 merge master error handling into denoise branch 2026-09-17 12:56:49 +08:00
Object ILLUSIA ace9e84889 Merge pull request #2 from LainHE/master
feat: 浏览器端报错翻译与提示改造(vibe coding)
2026-09-17 07:45:00 +08:00
LainHE 4ead174c04 feat: 浏览器端报错翻译与提示改造
- errors: 新增 TeamSpeak 服务器错误 ID 映射表与不可重连错误码集合,归一化
  normalizeTeamSpeakError 按 错误ID/关键词/异常类/传输层特征 分级收敛错误
- voice-bridge: 身份无效/客户端不可用时先发结构化 connectionFailed 帧再关闭,
  新增 pendingKickReason 机制在 kicked 事件后优先回放踢出原因;Opus 编码器
  不可用时限流上报 AUDIO_ENCODER_UNAVAILABLE
- ts-client: 记录本端退出 reasonID,转发 kicked 事件并归一化踢出/封禁原因
- network-probe/teamspeak-probe: 收窄关键字匹配、拒绝原因收敛到既有探测码
- session-manager: 新增 teamSpeak-kicked 拆除原因
- WebClient: 麦克风失败不再假成功,音频状态避免自相矛盾,新增降级横幅与
  中/英/德三语提示词表
- useVoiceWebSocket: 导出 ensureMicrophone 供开麦前预检,新增音频诊断状态、
  CONNECTION_FAILURE_MESSAGES 总表与网关关闭码映射
- 关键新增逻辑补充中文注释说明改动意图
2026-09-16 22:24:25 +08:00
illusia f628d19ebf fix: denoise microphone and honor WebRTC mute 2026-09-15 23:17:23 +08:00
illusia 75de8f1d2b test: use native microphone noise suppression 2026-09-15 22:05:15 +08:00
illusia 1ba8cd5ee1 docs: reorder README sections 2026-09-13 16:49:57 +08:00
illusia f639825775 docs: align README friend project section 2026-09-13 16:18:23 +08:00
illusia 0b40a69d74 docs: add dedicated friend projects section 2026-09-13 16:16:12 +08:00
illusia 6defbff591 docs: add NeteaseTSBot friend link 2026-09-13 16:13:53 +08:00
illusia b5d167e1e7 release: prepare v0.2.1 2026-09-13 08:26:45 +08:00
illusia 7f97d54206 fix: surface all connection error codes on join page 2026-09-13 08:20:27 +08:00
illusia ef3e65ea0b fix: show invalid nickname connection errors 2026-09-13 08:08:40 +08:00
illusia d13b3207a9 fix: send localized connection failure details 2026-09-13 08:00:07 +08:00
illusia 7e08ee54a5 fix: classify TeamSpeak connection failures 2026-09-12 08:09:52 +08:00
illusia 6d8e289b81 feat: scale frontend from 1080p baseline 2026-09-11 11:20:45 +08:00
illusia defbb766e4 feat: include relay route in connection records 2026-09-11 07:34:52 +08:00
illusia 69043748a1 feat: show client IP in connection records 2026-09-10 21:28:34 +08:00
illusia 8046985574 docs: clarify relay deployment instructions 2026-09-10 20:52:54 +08:00
illusia 5ce73d2c84 docs: finalize v0.2.0 release notes 2026-09-10 20:42:17 +08:00
illusia 2d1d202981 fix: use valid Docker healthcheck syntax 2026-09-10 20:20:09 +08:00
illusia 73313f9e2d feat: add relay deployment mode and multiple relays 2026-09-10 20:16:50 +08:00
illusia 097c72bc5d release: prepare v0.2.0 2026-09-10 17:47:34 +08:00
illusia 71f219b7ca merge: promote 0.2.0 preview features 2026-09-10 17:29:35 +08:00
illusia bacc9fe07e merge: integrate connection error fixes 2026-09-10 17:28:41 +08:00
illusia a9c360fb9c docs: describe 0.2.0 connection fixes 2026-09-10 17:27:44 +08:00
illusia 04926c8491 docs: record admin log improvements 2026-09-10 17:25:28 +08:00
illusia fa1d1ad01b docs: add advanced feature guides 2026-09-10 17:22:13 +08:00
illusia c0fc18c344 docs: add advanced feature guides 2026-09-10 17:20:13 +08:00
illusia 69d69f0a5a fix: show generic reason for untraceable history 2026-09-10 17:03:22 +08:00
illusia 6d7976e5d8 fix: hide disabled relay and report password errors 2026-09-10 16:32:18 +08:00
illusia aef1f68875 fix: explain TeamSpeak connection failures 2026-09-10 16:11:18 +08:00
illusia 06e5cc6d8b fix: allow explicit private targets on relay service 2026-09-10 15:35:57 +08:00
illusia 7782e9b327 feat: expose acceleration relay settings in admin console 2026-09-10 15:25:47 +08:00
illusia b82c4fe0af feat: add mainland acceleration preview 2026-09-10 14:27:33 +08:00
illusia 45584810a2 test: add IPv6 acceleration smoke 2026-09-10 11:54:31 +08:00
illusia bfefd053a0 feat: add acceleration tunnel proof of concept 2026-09-10 11:29:18 +08:00
illusia 324213de14 chore: remove repository test sources 2026-09-10 10:54:18 +08:00
illusia a041ba90bb fix: support IPv6 TeamSpeak targets safely 2026-09-10 10:39:02 +08:00
illusia 0dc623eb69 docs: simplify Docker deployment instructions 2026-09-08 13:38:23 +08:00
illusia 3e6876dbe7 release: prepare v0.1.8 2026-09-08 11:25:50 +08:00
illusia a60abffd3b fix: make performance probe handlers browser-safe 2026-09-08 11:09:51 +08:00
illusia 2b43952c01 fix: harden local targets and monitor network continuously 2026-09-08 11:01:28 +08:00
Object ILLUSIA 12f440ab8b Update README to remove image width attribute
Removed width attribute from project icon image.
2026-09-07 13:39:11 +08:00
Object ILLUSIA 7221af78bf Change project icon image in README
Updated the image source in the README file.
2026-09-07 13:38:39 +08:00
Object ILLUSIA a88b0616f5 upload banner
banner
2026-09-07 13:38:14 +08:00
illusia ea4d5b2a70 docs: expand localized interface screenshots 2026-09-06 15:36:46 +08:00
illusia a439100ad6 docs: add localized interface screenshots 2026-09-06 15:28:37 +08:00
illusia 620d24f796 fix: compact latin locale typography 2026-09-06 15:24:51 +08:00
illusia fc3bbd0c59 fix: install ping for admin diagnostics 2026-09-06 15:08:19 +08:00
illusia 3b5ce9b446 fix: restore dark welcome contrast 2026-09-06 14:51:51 +08:00
illusia 37de6067d0 fix: widen language menu options 2026-09-06 14:40:51 +08:00
illusia 45410fcc7d fix: keep quiet WebRTC audio frames 2026-09-06 14:33:15 +08:00
illusia 166cb543a1 fix: make admin diagnostics clientless 2026-09-06 14:18:41 +08:00
illusia a295ff4b27 fix: measure TeamSpeak latency over its protocol 2026-09-06 14:04:41 +08:00
illusia dcc52c4530 release: refresh v0.1.7 diagnostics 2026-09-06 13:47:37 +08:00
illusia dc3ad6a598 release: prepare v0.1.7 2026-09-06 10:48:16 +08:00
illusia ef59e51e32 fix: reveal master volume slider on hover 2026-09-06 10:38:54 +08:00
illusia 9bbc22de25 feat: add master output volume control 2026-09-06 10:25:18 +08:00
illusia 335d93a8b8 fix: preserve accompaniment levels and channel password retry 2026-09-06 09:54:01 +08:00
illusia 52ff0560d1 feat: add German language option and Telegram community link 2026-09-06 09:10:58 +08:00
illusia a5e5dd6592 fix: align connection diagnostics and localize announcement 2026-09-06 08:53:39 +08:00
illusia 62e41dbc51 docs: show demo URL directly 2026-09-06 00:59:00 +08:00
illusia d8b2fd9e1b docs: reorganize bilingual README 2026-09-06 00:49:56 +08:00
illusia 8ca3249832 feat: use penguin icon for QQ entry 2026-09-05 23:35:42 +08:00
illusia 92574fddb1 feat: add QQ community entry to homepage 2026-09-05 21:59:15 +08:00
illusia 596114e6a3 fix: repair admin theme and merge connection history 2026-09-05 21:45:54 +08:00
illusia 2868f7a478 feat: animate welcome page text 2026-09-05 20:08:29 +08:00
illusia 63ef6b673d docs: remove private server address from README 2026-09-05 19:52:04 +08:00
illusia 5a56e1706f fix: remove welcome artwork 2026-09-05 18:09:37 +08:00
illusia 986814441d fix: keep welcome artwork and text readable 2026-09-05 18:09:06 +08:00
illusia 0ab6fb6f3f fix: remove welcome background overlay 2026-09-05 17:43:06 +08:00
illusia a966be4db6 feat: refresh welcome page visuals 2026-09-05 17:35:49 +08:00
illusia 556084233d fix: do not drop WebRTC volume updates 2026-09-04 19:39:45 +08:00
illusia c38239ec35 fix: apply member volume in WebRTC playback 2026-09-04 19:31:50 +08:00
illusia 21041346e3 docs: update README version badge 2026-09-04 16:59:55 +08:00
illusia 7320aa3bb5 release: prepare v0.1.6 2026-09-04 16:31:59 +08:00
illusia d9b8ea625a feat: add repository and site branding 2026-09-04 16:08:43 +08:00
illusia 2323e22fef fix: keep identity concurrency warning visible 2026-09-04 16:03:13 +08:00
illusia b5f8f01301 fix: guard concurrent remembered identities 2026-09-04 15:53:15 +08:00
illusia e964ff460e fix: bypass mixer for single accompaniment stream 2026-09-04 15:41:58 +08:00
illusia 21d8d9c3bc fix: preserve accompaniment audio levels 2026-09-04 14:30:51 +08:00
illusia 169cf88306 fix: preserve accompaniment frames in WebRTC mixer 2026-09-04 12:46:07 +08:00
illusia 059435f4cb fix: preserve WebRTC playback diagnostics 2026-09-04 11:59:53 +08:00
illusia 4d4d4cdeb1 fix: pace WebRTC downlink audio 2026-09-04 11:50:26 +08:00
illusia d42e7a033c fix: handle canceled accompaniment sharing 2026-09-04 10:37:38 +08:00
illusia 0986c65551 feat: add desktop accompaniment controls 2026-09-04 10:24:10 +08:00
illusia 694f864d36 fix: include ca certificates in docker build 2026-09-04 08:38:06 +08:00
illusia 512854ab9f fix: pin sdk lockfile for reproducible installs 2026-09-04 08:31:48 +08:00
illusia b298496911 fix: make sdk release preparation deterministic 2026-09-04 08:27:28 +08:00
illusia b6367e2645 release: prepare v0.1.5 2026-09-04 08:18:56 +08:00
illusia b0fa4bf5d0 fix: make theme toggle respond on first click 2026-09-04 08:05:19 +08:00
illusia cb3dbe4ca4 fix: preserve remembered browser identity on exit 2026-09-03 23:40:38 +08:00
illusia 96ba467d52 release: prepare v0.1.4 2026-09-03 17:07:35 +08:00
illusia 20fdcc7b1d fix: fit welcome header actions on narrow screens 2026-09-03 16:59:28 +08:00
illusia feea39a81c feat: add bilibili profile link 2026-09-03 16:57:35 +08:00
illusia 69d1653f99 feat: add home link to admin login 2026-09-03 16:53:39 +08:00
illusia a18a5b4920 fix: wrap long admin logs on desktop 2026-09-03 16:46:40 +08:00
illusia 343dd84132 fix: wrap long mobile admin logs 2026-09-03 16:44:52 +08:00
illusia a037962cc1 fix: let mobile admin pages scroll naturally 2026-09-03 16:40:22 +08:00
illusia 680ce246fd fix: compact server settings layout 2026-09-03 16:36:52 +08:00
illusia baa09ad38c feat: customize and lock WebRTC media ports 2026-09-03 16:28:49 +08:00
illusia 767bdea018 fix: show channel broadcast messages 2026-09-03 16:08:51 +08:00
illusia 83a8fd0d5a fix: enforce WebRTC microphone mute at gateway 2026-09-03 15:25:34 +08:00
illusia e14ddc9465 fix: filter silent WebRTC uplink frames 2026-09-03 15:16:20 +08:00
illusia 7feb97d77d fix: keep WebRTC playback on native media output 2026-09-03 14:52:59 +08:00
illusia 434360cda9 fix: recover WebRTC playback and speaker state 2026-09-03 14:45:44 +08:00
illusia d0a2e9edc0 fix: make WebRTC playback reliable 2026-09-03 14:28:47 +08:00
illusia 61f66ab319 docs: simplify user-facing README 2026-09-03 12:54:11 +08:00
illusia e79ad66e1f docs: document WebRTC public UDP setup 2026-09-03 11:59:03 +08:00
illusia 522fa8f409 fix: remove obsolete WebRTC error labels 2026-09-03 11:02:42 +08:00
illusia c7def28a8f feat: make WebRTC media service self-contained 2026-09-03 10:56:39 +08:00
illusia d6c8ccb73f fix(ui): remove real IP from WebRTC placeholder 2026-09-03 08:01:08 +08:00
illusia ab5851935c merge: admin-managed WebRTC settings 2026-09-03 07:52:21 +08:00
illusia 5c3d1b7e5d feat(admin): manage WebRTC settings from console 2026-09-03 07:52:13 +08:00
illusia ecff06e9a1 docs: record SDK migration in v0.1.3 2026-09-03 07:32:11 +08:00
illusia 9c3f09b55b merge: release v0.1.3 2026-09-03 07:28:29 +08:00
illusia b42c455e7f release: prepare v0.1.3 2026-09-03 07:28:14 +08:00
illusia 40ea30b9e2 fix(audio): cleanly fall back from WebRTC 2026-09-03 01:29:34 +08:00
illusia a4cf5b5359 fix(audio): use OpusEncoder decoder API 2026-09-03 01:23:34 +08:00
illusia 1d41d5a3e7 fix(audio): honor negotiated WebRTC Opus payload 2026-09-03 01:17:01 +08:00
illusia 46b190a913 fix(audio): avoid duplicate WebRTC playback 2026-09-03 01:02:18 +08:00
illusia 8abd2d6228 feat(audio): add experimental WebRTC transport 2026-09-03 00:47:51 +08:00
illusia 7ff6836a7e fix(audio): tighten gateway voice backpressure 2026-09-03 00:23:16 +08:00
illusia a6187c18af chore(audio): attribute egress frames by client 2026-09-03 00:19:45 +08:00
illusia 8ab2fbe8ea fix(audio): move capture framing to audio worklet 2026-09-03 00:13:48 +08:00
illusia 3e7674c94f chore(audio): capture sampled flow timing 2026-09-03 00:04:17 +08:00
illusia 30c0d09a33 chore(audio): include session flow counters in teardown 2026-09-03 00:01:50 +08:00
illusia d9904fa154 fix(audio): bound realtime voice buffering 2026-09-02 23:56:24 +08:00
illusia afbbd1e2d4 refactor: migrate to maintained TeamSpeak SDK 2026-09-02 23:27:32 +08:00
illusia adca8cc1db docs(deploy): standardize published Docker image flow 2026-09-02 16:26:20 +08:00
illusia 9788e7fa1c release: prepare v0.1.2 2026-09-02 16:11:59 +08:00
illusia 66da7efe4a fix(web): align settings icons on narrow screens 2026-09-02 15:48:39 +08:00
illusia 3fb7000d02 feat(web): add prominent GitHub repository link 2026-09-02 15:35:54 +08:00
illusia 03c95abcf7 docs(deploy): simplify Docker startup and document demo 2026-09-02 12:51:43 +08:00
illusia d2ffbee873 refactor(admin): hide protocol details from users 2026-09-02 10:38:46 +08:00
illusia 413dbaf3a8 docs: record microphone mute update 2026-09-02 08:01:08 +08:00
illusia 9187d2faed fix(web): replace browser ptt with microphone mute 2026-09-02 07:52:54 +08:00
illusia af85a73c7d feat(web): optimize mobile client experience 2026-09-02 06:23:07 +08:00
466 changed files with 87747 additions and 5295 deletions

No files matched your search

@@ -0,0 +1,31 @@
---
name: webspeak-skin-development
description: Develop, review, package, or validate portable WebSpeak .wskin skins. Keep skin UI and implementation inside the package and use only released runtime APIs.
metadata:
short-description: Develop portable WebSpeak skins
---
# WebSpeak Skin Development
Develop the skin as a portable `.wskin` package. A skin task should not require a skin-specific edit to WebSpeak's client, server, shared protocol, or host-widget implementation. The package owns its page/component markup, styling, copy, layout, assets, and supported plugin logic. The host owns TeamSpeak transport, credentials, trusted actions, and the versioned public data/API contract.
## Workflow
1. Locate the `webspeak-webclient` repository root, then read the single current contract and workflow in `docs/SKIN_DEVELOPMENT.md`. It covers package schemas, runtime data, permissions, actions, security boundaries, and validation. If a request needs an undocumented capability, identify the missing public contract before editing and treat that work as a separate platform change. Inspect the closest example under `docs/examples/`; do not copy unrelated product-specific content.
2. Choose the least complex supported package format that can express the request: CSS/assets for appearance, `content.json` for localized copy, `layout.json` for author defaults, `components.json` for declarative structure and supported interactions, and the documented v4 Wasm plugin path only when local logic is required. JavaScript files in a package are not executed by the current runtime.
3. Keep all skin-authored implementation in the package. Use stable public skin parts, component schema, published context fields, existing host widgets, and permission-gated actions. Do not add a widget, data field, action, CSS hook, or branch to core code for one skin. If a reusable platform capability is missing, identify the exact contract gap and treat it as separate platform work: define a generic, versioned API and compatibility behavior first; only then use that released API from the package.
4. Set a unique skin ID, increment its package version for changed output, and set `minAppVersion` to the lowest compatible WebSpeak runtime. Keep component schema and plugin `apiVersion` aligned with the APIs actually used. Package every referenced image, font, stylesheet, component, and plugin asset. Use only safe package-relative paths; do not depend on local machine files, remote assets, private endpoints, or instance-specific frontend code.
5. Build the `.wskin` from its source directory while including only files declared by the manifest. Validate the finished archive with the repository importer and keep any distributable built-in archive synchronized with its example source. An example README or other undeclared file belongs beside the package, not inside it.
6. Verify the package at the scope of the change: run the skin package and component-schema tests; run the relevant type/build checks; import the exact archive in a compatible WebSpeak runtime. Check desktop and narrow layouts, all supported interface languages, long text, keyboard focus, reduced motion, contrast, and every interaction the skin replaces. For a portability claim, install the same archive (compare its SHA-256) in two instances with the same compatible runtime/API version; do not treat a successful build alone as proof.
## Compatibility and truthfulness
- `minAppVersion` is a lower compatibility bound, not a guarantee that an older or unrelated runtime implements every API. Read the current schema and runtime documentation before using a capability.
- Dynamic values such as public connection state or administrator-configured copy are runtime inputs. The package contains how those values are rendered; it must not bundle secrets or assume a particular server's private configuration.
- An existing host widget is a stable capability the package may declare. Its presence does not authorize changing that widget's implementation for a skin-specific design; use package CSS/components around it where supported.
- Do not describe an unimplemented API as portable, mark a feature complete from schema validation alone, or claim that different runtime versions render identically. Report the tested package hash, compatible runtime/API versions, and any platform gap.
## References
- `docs/SKIN_DEVELOPMENT.md` — the single current reference for skin formats, runtime APIs, permissions, data, actions, CSS hooks, security, and QA.
- `docs/examples/ILLUSIA-VOICE.md` and `docs/examples/OPEN-VOICE-SURFACE.md` — full skin and surface examples.
+7
View File
@@ -3,13 +3,20 @@
.claude
node_modules
web/node_modules
mobile/node_modules
web/android
.local-opus-hook.cjs
界面参考
dist
web/dist
data
certs
release-artifacts
scripts/acceleration-poc
*.tar.gz
*.tar.xz
claude.pem
config.json
.env
.env.*
*.log
+118 -22
View File
@@ -9,20 +9,31 @@ on:
version:
description: Release version without the v prefix
required: true
default: 0.1.1
default: 0.2.8
type: string
permissions:
contents: read
jobs:
windows-x64:
runs-on: windows-latest
verify:
uses: ./.github/workflows/ci.yml
windows:
needs: verify
strategy:
fail-fast: false
matrix:
include:
- arch: x64
runner: windows-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.22.2
architecture: x64
cache: npm
cache-dependency-path: |
package-lock.json
@@ -34,7 +45,11 @@ jobs:
run: |
$ErrorActionPreference = "Stop"
$releaseVersion = $env:RELEASE_REF -replace '^v', ''
npm ci --no-audit --no-fund
npm ci --ignore-scripts --no-audit --no-fund
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
npm run prepare:sdk
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
npm rebuild @discordjs/opus --foreground-scripts --no-audit --no-fund
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
npm --prefix web ci --no-audit --no-fund
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
@@ -43,20 +58,21 @@ jobs:
npm version --no-git-tag-version $releaseVersion
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
npm --prefix web run build
npm run web:build
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
npm run build
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
npm prune --omit=dev --no-audit --no-fund
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Package and smoke-test Windows x64
- name: Package and smoke-test Windows ${{ matrix.arch }}
shell: pwsh
env:
RELEASE_REF: ${{ inputs.version || github.ref_name }}
PACKAGE_ARCH: ${{ matrix.arch }}
run: |
$ErrorActionPreference = "Stop"
$releaseVersion = $env:RELEASE_REF -replace '^v', ''
$packageName = "webspeak-webclient-v$releaseVersion-windows-x64"
$packageName = "webspeak-webclient-v$releaseVersion-windows-$env:PACKAGE_ARCH"
$packageRoot = Join-Path $env:RUNNER_TEMP $packageName
$runtimeRoot = Split-Path -Parent (Get-Command node).Source
New-Item -ItemType Directory -Path $packageRoot | Out-Null
@@ -84,7 +100,7 @@ jobs:
Copy-Item -Recurse -LiteralPath $packageRoot -Destination $smokeRoot
@{
port = 3040
tsHost = "203.0.113.10"
tsHost = "127.0.0.1"
tsPort = 9987
tsServerPassword = ""
tsServerProtocol = "ts6"
@@ -108,18 +124,28 @@ jobs:
Compress-Archive -LiteralPath $packageRoot -DestinationPath (Join-Path $env:GITHUB_WORKSPACE ($packageName + ".zip")) -CompressionLevel Optimal
- uses: actions/upload-artifact@v4
with:
name: windows-x64
path: webspeak-webclient-v*-windows-x64.zip
name: windows-${{ matrix.arch }}
path: webspeak-webclient-v*-windows-${{ matrix.arch }}.zip
if-no-files-found: error
compression-level: 0
linux-x64:
runs-on: ubuntu-latest
linux:
needs: verify
strategy:
fail-fast: false
matrix:
include:
- arch: x64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.22.2
architecture: ${{ matrix.arch == 'arm64' && 'arm64' || 'x64' }}
cache: npm
cache-dependency-path: |
package-lock.json
@@ -130,22 +156,25 @@ jobs:
run: |
set -euo pipefail
release_version="${RELEASE_REF#v}"
npm ci --no-audit --no-fund
npm ci --ignore-scripts --no-audit --no-fund
npm run prepare:sdk
npm rebuild @discordjs/opus --foreground-scripts --no-audit --no-fund
npm --prefix web ci --no-audit --no-fund
current_version="$(node -p "require('./package.json').version")"
if [ "$current_version" != "$release_version" ]; then
npm version --no-git-tag-version "$release_version"
fi
npm --prefix web run build
npm run web:build
npm run build
npm prune --omit=dev --no-audit --no-fund
- name: Package and smoke-test Linux x64
- name: Package and smoke-test Linux ${{ matrix.arch }}
env:
RELEASE_REF: ${{ inputs.version || github.ref_name }}
PACKAGE_ARCH: ${{ matrix.arch }}
run: |
set -euo pipefail
release_version="${RELEASE_REF#v}"
package_name="webspeak-webclient-v${release_version}-linux-x64"
package_name="webspeak-webclient-v${release_version}-linux-${PACKAGE_ARCH}"
package_root="$RUNNER_TEMP/$package_name"
runtime_root="$(dirname "$(dirname "$(command -v node)")")"
mkdir -p "$package_root/web" "$package_root/runtime"
@@ -169,7 +198,7 @@ jobs:
cat > "$smoke_root/config.json" <<'CONFIG'
{
"port": 3040,
"tsHost": "203.0.113.10",
"tsHost": "127.0.0.1",
"tsPort": 9987,
"tsServerPassword": "",
"tsServerProtocol": "ts6",
@@ -194,28 +223,95 @@ jobs:
tar -czf "$GITHUB_WORKSPACE/${package_name}.tar.gz" -C "$RUNNER_TEMP" "$package_name"
- uses: actions/upload-artifact@v4
with:
name: linux-x64
path: webspeak-webclient-v*-linux-x64.tar.gz
name: linux-${{ matrix.arch }}
path: webspeak-webclient-v*-linux-${{ matrix.arch }}.tar.gz
if-no-files-found: error
compression-level: 0
android:
needs: verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.22.2
cache: npm
cache-dependency-path: |
package-lock.json
web/package-lock.json
mobile/package-lock.json
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "21"
- uses: android-actions/setup-android@v4
with:
packages: platform-tools
- name: Build Android APKs
env:
RELEASE_REF: ${{ inputs.version || github.ref_name }}
run: |
set -euo pipefail
release_version="${RELEASE_REF#v}"
version_code="$(node -e 'const [major, minor, patch] = process.argv[1].split(".").map(Number); process.stdout.write(String(major * 10000 + minor * 100 + patch))' "$release_version")"
sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0"
npm ci --ignore-scripts --no-audit --no-fund
current_version="$(node -p "require('./package.json').version")"
if [ "$current_version" != "$release_version" ]; then
npm version --no-git-tag-version "$release_version"
fi
npm run prepare:sdk
npm --prefix web ci --no-audit --no-fund
npm --prefix mobile ci --no-audit --no-fund
npm run android:sync
cd web/android
chmod +x gradlew
./gradlew --no-daemon assembleDebug -PappVersion="$release_version" -PappVersionCode="$version_code"
cd "$GITHUB_WORKSPACE"
mkdir -p release-apks
for apk in web/android/app/build/outputs/apk/debug/app-*-debug.apk; do
abi="${apk##*/app-}"
abi="${abi%-debug.apk}"
cp "$apk" "release-apks/webspeak-android-v${release_version}-${abi}-debug.apk"
done
test "$(find release-apks -maxdepth 1 -name '*.apk' | wc -l)" -eq 3
- uses: actions/upload-artifact@v4
with:
name: android-apks
path: release-apks/*.apk
if-no-files-found: error
compression-level: 0
publish-release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [windows-x64, linux-x64]
needs: [windows, linux, android]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download deployment packages
uses: actions/download-artifact@v4
with:
pattern: '*-x64'
pattern: '*'
path: release-assets
merge-multiple: true
- name: Create checksums
run: |
set -euo pipefail
cd release-assets
sha256sum * > SHA256SUMS.txt
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: WebSpeak ${{ github.ref_name }}
generate_release_notes: true
body: |
Release notes are maintained in each language's project documentation:
- [简体中文](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.zh-CN.md#latest-release-notes)
- [English](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.en.md#latest-release-notes)
- [Deutsch](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.de.md#latest-release-notes)
- [Русский](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.ru.md#latest-release-notes)
- [日本語](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.ja.md#latest-release-notes)
files: release-assets/*
+8 -7
View File
@@ -2,8 +2,10 @@ name: Continuous integration
on:
push:
branches: [main]
branches: [dev, master]
pull_request:
workflow_call:
workflow_dispatch:
permissions:
contents: read
@@ -22,13 +24,12 @@ jobs:
web/package-lock.json
- name: Install dependencies
run: |
npm ci --no-audit --no-fund
npm ci --ignore-scripts --no-audit --no-fund
npm run prepare:sdk
npm rebuild @discordjs/opus --foreground-scripts --no-audit --no-fund
npm --prefix web ci --no-audit --no-fund
- name: Test and build
run: |
npm test
npm run build
npm --prefix web run build
- name: Test and build application
run: npm run verify
docker-smoke:
needs: verify
+6
View File
@@ -14,10 +14,15 @@ env:
IMAGE_NAME: ghcr.io/echosixhiya/webspeak
jobs:
verify:
uses: ./.github/workflows/ci.yml
publish:
needs: verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
@@ -39,6 +44,7 @@ jobs:
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
+24 -1
View File
@@ -1,9 +1,32 @@
node_modules/
dist/
web/dist/
web/skin-wasm-interpreter/target/
mobile/node_modules/
web/android/.gradle/
web/android/build/
web/android/app/build/
web/android/local.properties
web/android/app/src/main/assets/public/
web/android/app/src/main/assets/capacitor.config.json
data/
config.json
*.log
.env
webspeak-update.tar.gz
# Local deployment notes and downloaded artifacts.
/release-artifacts/
/webspeak-deploy*.tar.gz
/webspeak-update*.tar.gz
/teamspeak6-server-linux-amd64.tar.xz
/.local-opus-hook.cjs
/界面参考/stitch_teamspeak_web_interface.zip
claude.pem
# Private credentials and deployment notes stay local.
.env.*
!.env.example
*.pem
*.key
/.claude/
/LOCAL-RELEASE-RUNBOOK.md
/DEPLOYMENT-*.md
-43
View File
@@ -1,43 +0,0 @@
# Changelog
All notable changes to WebSpeak are documented here. Versions follow SemVer.
## [0.1.1] — 2026-09-02
### Added
- M009 admin operations dashboard for managed invites, active-session inspection, per-session termination, diagnostics, logs, audit access, diagnostic report download, and SQLite backup export.
- Persistent managed invites with expiry, optional maximum uses, revocation, hashed opaque tokens, and encrypted TeamSpeak credentials at rest.
- Mobile-aware invite joining through the `invite` URL parameter without placing a TeamSpeak password in the URL.
- M010 hardening for per-peer join-ticket rate limiting and bounded rotating runtime logs.
- Bilingual README documentation with parallel Chinese and English feature, deployment, security, and operations sections.
### Changed
- Database schema is now version 2 and migrates existing version 1 installations transactionally with a migration copy.
- Admin overview and diagnostics use the application package version instead of a hard-coded display value.
- The README architecture section now uses GitHub-native Markdown instead of a Mermaid rich-display block.
- The README badge set now uses stable static Shields badges without a repository-metadata 404 dependency.
- Version tags publish Windows/Linux deployment packages to GitHub Releases and publish the matching Docker image.
### Fixed
- Late WebSpeak browser sessions now reconcile and merge the complete TeamSpeak directory, so members who joined earlier remain visible.
- Private-message delivery no longer disconnects the browser session.
- Member actions are presented through the right-click context menu with hover feedback.
- Docker release builds copy the root `postinstall` patch script before running `npm ci`.
- Release builds skip `npm version` when the project version already matches the requested version, preventing false `Version not changed` failures.
### Verification
- `npm test` — 51 tests passed.
- `npm run build` — backend TypeScript build passed.
- `npm run web:build` — frontend production build passed.
- `npm audit --omit=dev --audit-level=high` — no high or critical vulnerabilities reported.
- Local `/demo` browser checks passed at the documented narrow and desktop widths; `/demo` does not connect to TeamSpeak.
Real TS3/TS6 interoperability, Android microphone behavior, multi-client smoke, and the 24-hour long-run gate require their respective test environments and are not claimed by this local release check.
## [0.1.0] — 2026-08-31
- First normalized release with the browser client, TeamSpeak 3 / 6 gateway, browser audio controls, access modes, administrator operations, and AGPL-3.0-only licensing.
+194 -70
View File
@@ -1,87 +1,211 @@
# WebSpeak — TeamSpeak Browser Gateway
# WebSpeak TeamSpeak Browser Gateway
Server-side bridge that lets users join TeamSpeak voice channels from a browser. No TS client install needed.
WebSpeak connects browser users to TeamSpeak 3 and TeamSpeak 6 through a self-hosted Node.js gateway. Each connected browser session owns an independent TeamSpeak client. The repository also contains a standalone UDP acceleration relay and an Android preview with an embedded local gateway.
## Architecture
## Application boundaries
```
Browser (PCM capture) → WebSocket → Node.js server (PCM→Opus) → TeamSpeak server
Browser (playback) ← WebSocket ← Node.js server (Opus relay) ← TeamSpeak server
| Location | Responsibility |
| --- | --- |
| `src/index.ts` | Gateway startup, SQLite, master secret, admin service and shutdown; also supports relay mode |
| `src/server/server.ts` | HTTP or HTTPS, public configuration, skins, join tickets, admin routes and static frontend |
| `src/server/voice-bridge.ts` | `/ws/voice`, admission, connection/reconnection orchestration and voice transport assembly |
| `src/server/voice-commands.ts`, `directory-view.ts`, `audio-stats.ts` | Command execution, public directory projection and diagnostic snapshots |
| `src/server/member-avatars.ts` | Generation-bound optional avatar downloads, bounded sequential batches, cached images and timer cleanup |
| `src/server/session-events.ts` | Session-owned SDK subscriptions, directory projection, self/channel state, chat mapping and avatar coordination |
| `src/server/screen-share-coordinator.ts` | Server/channel-scoped sharing membership and browser/native signaling |
| `src/shared/` | Browser-safe wire types and runtime parsers shared by both endpoints |
| `src/shared/admin-inputs.ts`, `admin-responses.ts` | Shared admin request types and runtime-checked response projections |
| `src/server/ts-client.ts` and `teamspeak-adapter.ts` | SDK integration, TS3/TS6 negotiation, identity, chat, voice and client events |
| `src/server/session-manager.ts` and `directory-sync.ts` | Connection state, teardown, admission limits and directory reconciliation |
| `src/server/webrtc-audio.ts` and `opus-codec.ts` | WebRTC audio mixing and platform-specific Opus codecs |
| `src/server/session-audio.ts` | Per-session PCM encoding, exclusive WebRTC/WebSocket routing, whisper dispatch, bounded egress and audio counters |
| `src/admin/`, `src/security/`, `src/persistence/` | Administration, access policies, credentials and persistent settings |
| `src/relay.ts` and `src/server/acceleration-relay.ts` | Standalone relay and gateway-side relay transport |
| `web/src/views/` and `web/src/composables/` | Vue pages, connection state, audio controls, chat and screen sharing |
| `web/src/voice/screen-share.ts` | Per-session screen capture, peer negotiation, cleanup and diagnostics |
| `web/src/voice/remote-playback.ts` | Per-speaker compatibility decoding, bounded scheduling, volume and resource cleanup |
| `web/src/voice/microphone-test.ts` | Cancellable recording tests, recorder deadline and playback URL ownership |
| `web/src/voice/microphone-capture.ts` | Prepared microphone processing graphs, per-context worklet loading, optional RNNoise and independent PCM activation/cleanup |
| `web/src/voice/audio-sink.ts` | Serialized device routing per audio endpoint, with stale-operation guards |
| `web/src/voice/accompaniment.ts` | Generation-bound display-audio capture, immediate pending-capture cancellation, ended listeners and committed activity |
| `web/src/voice/webrtc-input.ts` | Stable WebRTC sender output, microphone gain and transactional accompaniment-source attachment |
| `web/src/voice/microphone-meter.ts` | Optional per-peer level sampling, owned analysis nodes and timer, partial-failure cleanup and stale-tick rejection |
| `web/src/voice/webrtc-transport.ts`, `webrtc-playback.ts` | Per-attempt peer negotiation, input/meter ownership, compatibility fallback and independently owned playback elements and retries |
| `web/src/voice/connection.ts`, `commands.ts` | Cancellable ticket acquisition, socket and connection generations, plus per-command acknowledgement deadlines and cleanup |
| `web/src/voice/session-state.ts` | Reactive directory, chat history, events and notifications; complete versus omitted directory data, session resets and private-conversation identity scopes |
| `web/src/composables/useWebClientChat.ts`, `useWebClientChannels.ts` | Destination-owned drafts and pending sends, identity-bound private history, and iterative channel-tree projection |
| `web/src/composables/useWebClientIdentity.ts`, `web/src/components/web-client/IdentityImportDialog.vue` | Page-owned identity reads, parsing, restoration and exports; a presentation dialog with explicit input and action events |
| `web/src/voice/audio-diagnostics.ts`, `web/src/composables/useWebClientPerformance.ts` | Session-owned diagnostic probes and compatibility counters, browser statistics, comparable sample scopes and cancellable UI polling |
| `web/src/platform/` | Browser mounting and cancellable Android gateway readiness handshake |
| `web/src/services/`, `web/src/i18n/`, `web/src/skins/` | Browser persistence, identity import, skin packages and translations |
| `web/src/composables/usePublicSkin.ts`, `web/src/services/skin-operation.ts` | Shared public-page skin initialization and selection, page ownership, cancellation and bounded loading |
| `web/src/services/admin-api.ts`, `admin-requests.ts` | Admin HTTP validation and cancellation, session-bound CSRF and per-feature request ownership, including skin uploads and backup downloads |
| `web/src/composables/useAdminServerSettings.ts`, `useAdminOperations.ts`, `useAdminSkins.ts` | Admin form merging, probes, operational actions and skin state; the page owns authentication, routing and overview |
| `web/src/components/admin/` | Server settings, operations and skin presentation; the parent page retains the feature controller instances across subroute changes |
| `web/src/composables/useAdminI18n.ts`, `web/src/i18n/admin.ts` | Admin formatting and error/status mappings; all five languages explicitly implement the same translation keys |
| `src/mobile/`, `mobile/`, `web/android/` | Android loopback gateway, asset packaging and Capacitor container |
## Connection and control protocol
1. The browser requests `/api/join-ticket`. The gateway validates the request against its access policy and issues a short-lived, single-use ticket.
2. The browser presents the ticket to `/ws/voice`. The bridge admits a session, acquires any required identity lease and creates its TeamSpeak client.
3. WebSocket text messages carry JSON commands, events, WebRTC negotiation and screen-sharing signaling. The server uses the WebSocket `isBinary` flag to distinguish audio from control messages.
4. Register TeamSpeak event listeners before connecting: directory and membership events may arrive during the handshake.
Channel and member data come from SDK directory snapshots and client-protocol commands, followed by realtime notifications. WebQuery and its API key are not required. `DirectorySynchronizer` reconciles snapshots with membership events.
`SessionEventCoordinator` subscribes before SDK connection and closes before waiting for peer shutdown. Remove only its own listeners and guard captured callbacks as well as registered ones. Directory events are accepted during authentication, synchronization and the live connection, but not reconnect backoff. SDK adapter listeners must reject events from a replaced client before mutating state or forwarding them. A kick remains terminal if the disconnect notification already started recovery.
Avatar downloads belong to the connected directory generation. Reset them on SDK interruption and close them before awaiting session teardown. Old success or failure results cannot refill caches, publish images, start another download, or unlock newer work. `isAlive` is only the WebSocket heartbeat acknowledgement flag; it is not a lifecycle predicate. Keep avatar failure optional, the 50-member batch limit and 250 ms continuation delay.
The SDK avatar method captures its client and connection generation across metadata, transfer initialization and download. Recheck both after each await, including reconnects that reuse the same SDK object; never continue an old transfer through a replacement `this.client`. A retired SDK client's disconnect event must not clear the current connection.
Session teardown must remain safe when requested more than once or when sockets and codec resources are already closed. Reconnection is governed by `reconnect-policy.ts`; preserve terminal error handling, bounded retries and the previous-channel fallback.
Invalidate session audio before awaiting peer closure. Each codec and track must be released independently so one disposal failure cannot abandon the remaining resources. WebRTC close callers share one completion promise, including a peer-close rejection. Preserve WebSocketServer's close listener: it owns removal from the server's client set and allows shutdown to finish.
Late socket messages and media permission/negotiation results must not mutate a replacement session. Screen-sharing ownership is scoped to both the TeamSpeak target and channel; another member moving channels must not stop the current user's share. Preserve these invariants when extracting the remaining audio responsibilities.
WebRTC offers, answers, playback callbacks and accompaniment capture belong to the session and peer that started them. Invalidate pending negotiation on stop, reconnect or teardown before awaiting resource closure. A stale peer must not publish errors, counters or audio into its successor. Negotiation and track setup failures must restore compatibility capture without misreporting a microphone failure.
The WebRTC transport owns its peer, input mixer, meter, ICE wait and answer deadline. The capture layer retains ownership of the original microphone and PCM graph; releasing input during microphone preparation must not invalidate the preparing transport. Failed stop signaling cannot prevent local cleanup or compatibility fallback. A fallback permission failure must still belong to the connection and transport generation that initiated it.
Each remote WebRTC audio element owns its in-flight play attempt and retry listeners. Coalesce overlapping gestures, guard captured callbacks against replacement and release partial element setup. Pause, listener removal, source clearing or peer closure failures must not interrupt release of other resources.
Ticket acquisition has a 15-second browser deadline covering preference readiness, fetch and response-body reading. Disconnect and replacement abort the owning request immediately; stale success, rejection and deadline callbacks cannot open a socket or update a newer connection. This is separate from the gateway's TeamSpeak handshake policy. Browser cancellation does not undo a server-side invite consumption or ticket issuance. Preserve the gateway close code over generic WebSocket errors, detach retired handlers, and tolerate socket-close failures.
Every acknowledged command owns its original socket, connection generation and deadline. Success, server rejection, synchronous send failure, timeout and disconnect all use one idempotent completion path; release the registration and timer immediately. Fire-and-forget commands keep the existing shared wire contract.
Chat sends require a connected TeamSpeak session and append local history only after acknowledgement. A queued acknowledgement cannot append after session resource release. Recovery rejections retain the command request ID. Optional channelId and clientUid command fields let the gateway verify the actual channel and recipient before invoking the SDK; legacy payloads remain accepted without those additional guards. Confirmation is not a read receipt, and a timeout does not prove non-delivery.
Directory, chat, events and poke lists retain their reactive array identities. Complete channel snapshots replace the member directory, while omitted members remain unknown rather than empty. Channel projections share canonical members. Departure and UID replacement release the old member's playback, speaking state, temporary volume and whisper selection; persisted UID-based preferences remain. A recovered TeamSpeak connection replaces its directory even when the connected message omits members.
Explicit disconnect, target replacement and ordinary socket closure reset message state and advance the page's session epoch. Same-socket recovery may preserve chat history, but cannot send until connected; recovered directories and events replace old snapshots and clear old pokes. Failed recovery may retain its history for the failure panel until retry or exit.
Private history uses UID scopes when available and member-lifetime scopes for legacy clients without UIDs. Unknown senders must not become later members merely because a numeric ID matches. Preserve the recipient name in outgoing history. Drafts, pending submissions and errors belong to a destination within a session; switching tabs cannot duplicate an in-flight send. Confirmation clears only the unchanged submitted draft, including when its tab is inactive. Reset or disposal retires late feedback.
Channel projection uses iterative parent and sibling traversal, emits each ID at most once, keeps the first duplicate, promotes missing-parent channels to roots and starts isolated cycles at their first source entry. Do not reintroduce recursive traversal or silently discard the entire directory on a malformed topology.
Audio diagnostic probes retain their cancellation entry and deadline until both gateway and browser statistics finish. Bind the result to the original socket, connection generation and peer; disconnect settles pending consumers immediately, and a late browser getStats result cannot mix with a replacement peer. A probe send failure returns no sample.
Diagnostic samples also include the WebRTC transport generation, so a probe cannot survive a failed attempt that starts and ends without a peer. A browser-local scope ID changes with the source and session resets; compatibility counters reset at session teardown and snapshots stay independent. The scope ID is internal metadata, not part of the gateway protocol. Keep the exported diagnostic types available from the voice composable for existing callers.
The performance panel only subtracts counters from matching scopes, transports and downlink sources (PCM, RTP or gateway frames). Null or rejected probes clear stale activity and restart the baseline. Check the polling generation before starting work as well as after awaiting results; unmount retires callbacks and manual refresh. Preserve the 2-second polling interval. For loss estimates, packetsSent already includes all sent packets, while packetsReceived requires adding lost packets to form the denominator; keep percentages bounded and treat RTCP/local snapshots as estimates.
Accompaniment changes keep the WebRTC sender output alive. Prepare and connect the new source before replacing the old one; a failure preserves the current microphone and accompaniment. The input mixer owns its nodes and output track, never the externally owned capture streams. Release partial allocations and continue cleanup if an individual node fails. Application audio bypasses microphone gain/denoising and retains its source level.
The accompaniment controller owns both active and pending captures. Stop, disconnect and replacement immediately release candidates already returned by the browser, even while optional constraints are pending. Late permissions are stopped on arrival; ended or stale candidates cannot be published. Register ended listeners during preparation and publish activity only after attachment succeeds. Optional content hints and processing constraints may fail without losing capture; distinguish audio attachment errors from permission errors in all five languages.
Microphone metering is optional and must not interrupt voice. Its nodes and timer belong to one meter instance; a queued old tick cannot read the next session's analyser or publish a level. Allocation, connection and read failures release all meter resources and clear level/speaking presentation, while preserving the capture stream and peer. Keep the 512-sample analyser and 50 ms cadence unless audio validation justifies changing them.
## Audio and screen sharing
The compatibility voice path captures 48 kHz mono PCM using an AudioWorklet, with a ScriptProcessor fallback. The browser assembles 960-sample, 20 ms frames and sends 1,920-byte Int16 payloads over WebSocket. The gateway encodes them as Opus for TeamSpeak. Incoming Opus uses a three-byte header containing codec and client ID, then browser WebCodecs decoding and playback.
When enabled by the administrator, WebRTC provides a separate voice transport between the browser and gateway. The gateway uses `werift` and mixes incoming TeamSpeak speakers for WebRTC playback. Negotiation failures can fall back to the compatibility path. Keep microphone mute, per-member volume and playback behavior consistent across both transports.
Screen sharing has its own peer connections. The gateway coordinates stream membership and SDP/ICE signaling between browsers and supported TeamSpeak 6 clients. Screen media travels directly or through an externally configured TURN server; the WebSpeak gateway does not carry screen media.
Preserve bounded audio buffering and stale-playback recovery. Audio counters stay in memory and are exposed in session diagnostics. Do not add per-frame persistent logging to the voice path.
Remote playback owns each speaker's decoder, gain and source nodes as one resource set. Member departure, decoder failure and session teardown release that set; queued callbacks must not touch its replacement. Preserve the 80 ms playback window and three-frame decoder queue threshold unless audio validation justifies changing them.
Microphone recording tests own their recorder, timeout and object URL, while the capture layer owns the microphone stream. A normal stop may publish its final recording; replacement and session teardown discard late results and revoke the old URL. Stopping a test while connected must preserve room capture. Test cancellation and stale permission failures must not change a newer test's state.
Device and noise-suppression changes share one configuration operation. Persist only the last successful settings; stale failures cannot roll back a newer choice. Acquiring a replacement microphone must preserve the current WebRTC peer and compatibility PCM capture until the replacement is ready. Capture callbacks are invalidated when their graph stops, separately from permission-request generations. Closing settings also releases standalone device-preview capture when no recording was started.
Prepare microphone nodes and streams before replacing the live graph. A failed allocation or delayed worklet load must leave the old capture usable. Aborting preparation releases its candidate resources immediately; only activation enables PCM callbacks. Worklet module caches belong to their AudioContext. Device removal uses the normal input/output configuration transactions, including WebRTC restart and rollback on failed default-device selection. A committed graph becomes the fallback preference before subsequent device enumeration completes.
Serialize `setSinkId` on each audio context or media element, since an in-flight browser sink change cannot be cancelled. Bind subsequent work to the original endpoint and current operation; session teardown invalidates queued changes and device enumeration results. If one output endpoint rejects after another changed, attempt to restore the last committed output.
`src/server/opus-codec.ts` loads the native `@discordjs/opus` implementation for server deployments and `opusscript` for the Android bundle. Dispose codec and media resources at the end of their owning session.
## Configuration and persistence
Identity file reads belong to the current selection, text revision and dialog lifetime. New files (including invalid selections), manual edits, closing, entering the room, clearing local data and page disposal retire old results. Parsing owns its submitted draft; only a current result may replace the identity or notify. Preserve the 128 KiB limit, UTF-8/UTF-16 BOM decoding and existing busy-close behavior. The dialog disables submission while a selected file is being read and disables edits while parsing.
Startup identity restoration must not overwrite a newer import or remember preference. Exports belong to the identity and page that started them; coalesce pending clicks, discard late serialization and release download anchors, URLs and timers independently. Keep codec parsing in the existing identity service and persistence in the page/storage layer.
Admin requests belong to the login session and feature that started them. Invalidate pending work on authentication changes and page disposal; cancel feature work on management subroute exit. A late 401 must not expire a newer session, and late login or backup results must not navigate or download after disposal. Aborted work is not a user-facing failure. Failed logout preserves the authenticated draft; successful logout or session expiry resets private page state.
Settings responses merge against the submitted snapshot instead of replacing newer edits. Password and action, and relay token and action, are atomic draft groups. Clear acknowledged secret inputs, retain edits made during the request, merge relay nodes by ID, and do not restore obsolete probe metadata. Serialize skin mutations and prevent duplicate invite actions; cancelling browser work does not undo a server mutation already executed.
| Source | Purpose |
| --- | --- |
| SQLite `webspeak.db` | Admin credentials, target and access settings, relay nodes, invitations, audit records and visitor metadata |
| `master.key` beside the database | Encryption key for persisted secrets; retain it with database backups |
| `/admin` | Normal configuration and operational controls |
| Legacy `config.json` | One-time import of `tsHost`, `tsPort` and `tsServerPassword`; later changes do not replace database settings |
| `WEBSPEAK_DATA_DIR` | Persistent data directory; defaults to project `data/`, while Docker uses `/data` |
| `WEBSPEAK_SCREEN_SHARE_ICE_SERVERS` | Screen-sharing ICE configuration read at startup |
| `WEBSPEAK_TRUSTED_PROXIES` | Comma-separated IPs/CIDRs whose `X-Forwarded-For` may be believed; defaults to loopback so a same-host reverse proxy keeps working |
| Relay environment variables | Standalone relay mode; public gateway relay choices come from saved admin settings |
| Browser IndexedDB and localStorage | Local identities, preferences, server history and skin state |
The current SQLite schema version is defined in `src/persistence/database.ts`. Keep schema migrations separate from structural refactors. Legacy fields such as `voiceToken`, `tsApiKey`, `tsQueryPort`, `port` and `maxClients` do not configure the current gateway.
The gateway HTTP port is `3040`. Its admission ceiling is `100` sessions, defined in `src/constants.ts`; this is an application limit, not a TeamSpeak license allowance or a measured performance guarantee. Target server capacity and permissions still apply.
The server uses HTTPS when `certs/cert.pem` and `certs/key.pem` are supplied; otherwise it starts HTTP. It does not generate certificates. Use an appropriate secure browser origin for microphone and screen capture, typically HTTPS in public deployments. Feature support depends on the browser and selected transport; do not infer a universal minimum browser version from WebCodecs alone.
## Development and verification
Server deployments require Node.js 22.5 or newer. CI uses Node.js 22.22.2. Root and frontend dependencies are installed separately. The pinned Git SDK and native Opus module require the preparation steps used by CI:
```sh
npm ci --ignore-scripts --no-audit --no-fund
npm run prepare:sdk
npm rebuild @discordjs/opus --foreground-scripts --no-audit --no-fund
npm --prefix web ci --no-audit --no-fund
npm run verify
```
- Each browser user = one independent TS3 virtual client via `@honeybbq/teamspeak-client`
- Frontend captures PCM via `ScriptProcessorNode`, sends as Int16 binary over WebSocket
- Server encodes PCM → Opus using `@discordjs/opus` (CJS, loaded via `createRequire`)
- Server sends Opus to TS via `client.sendVoice(data, codec=4)`
- Incoming TS voice → Opus frames → binary WebSocket → browser `AudioDecoder` → playback
- Channel/member list fetched via TS6 WebQuery HTTP API (port 10080, requires API key)
- WebSocket text frames = JSON commands, binary frames = PCM audio / Opus relay
`npm run verify` runs unit tests, the backend build and `npm run web:build`. The latter delegates to the frontend build, including `vue-tsc --noEmit`. Use `npm run dev` and `npm run web:dev` for development, or `npm start` after building both applications.
## Project Structure
Headless Vue tests use Vite middleware mode with both HMR and the WebSocket listener disabled (`hmr: false`, `ws: false`). Disabling HMR alone still reserves Vite's default socket port and causes parallel test processes to conflict.
```
web/ # Vue 3 + Vite frontend (SPA)
src/composables/useVoiceWebSocket.ts # Mic capture, VOX/PTT, playback, WS client
src/views/WebClient.vue # Connect form + channel/member tree
src/
index.ts # Entry point, config loading, server startup
config.ts # AppConfig interface + load/save
logger.ts # Pino wrapper
server/
server.ts # Express + HTTPS + WS setup
voice-bridge.ts # /ws/voice endpoint, PCM→Opus encoding, WebQuery API
ts-client.ts # TS3Client wrapper around @honeybbq/teamspeak-client
```
CI verifies pushes to `dev` and `master`, pull requests and manual runs. Docker publication on `master` or release tags, and release packaging on tags or manual runs, call the same verification workflow before publishing or packaging. Verification includes the application checks and a Docker HTTP health smoke test; that smoke test does not prove voice or screen-sharing functionality.
## Key Technical Details
Tests requiring a real TeamSpeak server, browser media devices or Android hardware must document their environment and outcome separately. Never substitute a mock codec or an HTTP health response for a successful audio test.
### Audio Pipeline
1. Browser mic → `getUserMedia` (48kHz mono) → `ScriptProcessorNode` (1024 samples)
2. Float32 → Int16 conversion → PTT/VOX gate → WebSocket binary send
3. Server accumulates PCM → every 1920 bytes (960 samples, 20ms) → `OpusEncoder.encode()` → `tsClient.sendVoice(opus, 4)`
4. Incoming: TS → `voiceData` event → 3-byte header `[codec][clientId BE]` → WS binary → browser `AudioDecoder` → playback
## Android preview
### CJS Interop
`@discordjs/opus` is CommonJS, loaded via:
```ts
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const { OpusEncoder } = require("@discordjs/opus");
```
The Android app starts an embedded Node.js gateway on `127.0.0.1:3040` and opens it in the WebView. This preview disables gateway WebRTC voice and the admin console, while reusing the compatibility voice path. Its dependencies and runtime differ from server deployments.
### WebSocket Message Routing
- Text frames → JSON commands (`listChannels`, `switchChannel`)
- Binary frames → PCM audio (browser→server) or Opus frames (server→browser)
- JSON detection: `typeof data === "string"` first, then fallback `data[0] === 0x7b` with try/catch
See `mobile/README.md` for build steps and recorded limitations. The embedded Node.js version, SDK compatibility, real-device connections, background audio and native screen sharing require their own validation. Do not present these capabilities as production-ready based on desktop tests.
### Event Handlers
Must be registered BEFORE `tsClient.connect()` because `clientEnter`/`clientLeave` fire during handshake.
Platform startup owns its message listener, polling interval and deadline, including slow listener registration. Release them on success, failure, timeout and page exit. The retry button repeats the readiness handshake; it does not restart the embedded Node.js runtime.
### Channel List
Uses TS6 WebQuery HTTP API (`http://tsHost:tsQueryPort/1/channellist`) with `x-api-key` header. Falls back empty if `tsApiKey` not configured. Regular TS3 voice clients lack permission for `listChannels`/`listClients`.
## Repository maintenance
### Config (config.json)
```json
{
"port": 3040, "tsHost": "127.0.0.1", "tsPort": 9987,
"tsQueryPort": 10080, "tsServerProtocol": "ts6",
"tsApiKey": "", "voiceToken": "change-me", "maxClients": 10
}
```
Routes load their page modules on demand. Document-level page styles must be gated by `html[data-ws-route]` because loaded CSS remains after navigation. The admin stylesheet is independent of public skins. Component extraction must retain `data-ws-part` hooks and account for Vue scoped styles across component boundaries.
## Build & Deploy
```bash
npm install && cd web && npm install && npx vite build && cd .. && npx tsc
node dist/index.js
```
The identity dialog retains page-owned CSS with narrowly targeted `:deep` selectors so the existing declaration order and specificity remain intact. Shared button rules target its dedicated classes across the component boundary. Its close button is positioned within the modal. Public skin-contract tests include Vue files recursively under `components/web-client`; keep new public parts documented.
## Git
- Remote: `https://github.com/EchoSixHIYA/web-client-for-TeamSpeak`
- `webspeak-update.tar.gz` is in .gitignore (deployment artifact)
- No secrets in source; config.json is gitignored
The public join form uses explicit named field models and emits page actions. The chat panel receives a presentation subset of the single page-owned chat controller; keep its list ref bound to the rendered scroller so tab changes and new messages retain automatic scrolling. Form grid columns must allow shrinking, and narrow identity/relay controls must wrap without clipping translated text.
## Known Limitations
- Browser must be Chrome/Edge 94+ (WebCodecs AudioDecoder)
- HTTPS required (self-signed cert OK, generated in `certs/`)
- Max 32 concurrent users (TS3 license limit)
- `tsApiKey` required for channel list; voice works without it
The member panel and actions menu also share one page-owned member controller. The panel exposes an audio-dock slot; menu placement uses measured viewport bounds, converts through the page CSS zoom, and releases its resize observer/listener on unmount. Only desktop may open the move submenu on hover: mobile bottom-anchored menus change position when expanded and must open on click to avoid moving a member accidentally. Constrain short-window menus and allow scrolling.
Voice member cards receive the current channel projection, speaking/avatar helpers and a narrow sharing interface. Keep the sharing refs stable; member menus and stop-sharing actions return to the page through events. Empty, self, speaking, starting, sharing and viewing states must retain their skin hooks and mobile behavior.
Voice diagnostics and screen-sharing presentation also reuse page-owned controllers. Bind the player and video with explicit element callbacks. Rebind an existing stream when its video element changes, clear the previous element, and never stop the media owner's tracks during presentation cleanup. Fullscreen requires a non-null owned player; removing it exits only its own fullscreen. Known screen owner IDs take precedence over nickname fallback, including duplicate nicknames. Sharing settings use the common dialog focus handling.
The audio dock and whisper strip share the page-owned audio controller. Push-to-talk belongs to one primary pointer or one Space/Enter press; unrelated releases and key repeats must not change it. Failed pointer capture must not enable whispering. Clear ownership before releasing capture, and stop on blur, hidden controls/pages and disposal. The whisper component owns and releases its window/document listeners; keep media state in the voice layer.
Audio settings and password dialogs retain one page-owned media/connection state. Dialog focus supports initial focus, Tab cycling, Escape and return to the opener, with a connect-button fallback after pending connections disable that opener. Settings error feedback belongs to the current opening and latest request; closing synchronously stops recording tests, and scope disposal retires pending feedback and stops tests too. A non-password channel error must release the password dialog's pending state and preserve its draft for retry; reject duplicate submissions while pending.
Admin presentation components receive stable feature controllers; do not instantiate duplicate controllers in children. The welcome-language model remains page-owned and the skin file input belongs to its presentation component. Feature CSS crosses these boundaries with `:deep`, while shell and language-control selectors retain their existing scope. On narrow screens the brand and logout occupy the first row and all four navigation links share a separate row with at least 44 px high targets.
Keep each repair batch tied to its current plan item. Combine related fixes before running the full verification command; use focused checks during diagnosis and repeat the full suite only when subsequent changes or failures warrant it.
Keep template/CSS formatting separate from behavior changes. Preserve inline whitespace text nodes when wrapping Vue tags; compare compiled render output when needed. CSS formatting must retain selector meaning, values and declaration/rule order. Layout assertions should tolerate formatting whitespace while still checking the intended rules and values.
Public skin activation is last-choice-owned across both public pages. Retire previous runtime work before preparing a replacement, and reject results after page disposal, a newer choice or local-data reset. Check ownership before modifying document styles, selected content, asset URLs or stored preferences. An already aborted caller must not cancel a newer page's activation. Release compiled candidate URLs on failed installation.
Skin initialization has an 8-second total deadline covering preference reads, directory fetch and body, package loading and activation. Network stages also have bounded standalone operations. A timeout reveals a usable built-in palette and retires late work; retain the explicit skin choice for a later retry. Normal initialization still respects the enabled instance default unless the visitor made a deliberate choice. Home and demo use the same controller; do not restore duplicate unguarded refresh paths.
Skin cache writes and preference persistence accept the owning AbortSignal, including while waiting for IndexedDB to open and during its write transaction. Report storage success at transaction completion. Merge preferences within one transaction so concurrent unrelated settings are preserved. Cancellation of optional persistence must never block page use.
Validate admin responses before applying them to page state. Network and protocol failures must preserve unsaved input; a failed logout must not be presented as a successful logout. Keep secret keep/replace/remove actions intact and do not persist credentials in UI error messages or diagnostic logs.
The repository remote is `https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak`. Preserve existing local work and keep private configuration, runtime data, local deployment archives, and machine-specific notes out of source commits. Preserve documented skin hooks and browser persistence formats during component refactors.
+10 -8
View File
@@ -2,18 +2,19 @@ FROM node:22-bookworm-slim AS build
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 make g++ \
&& apt-get install -y --no-install-recommends ca-certificates git python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json ./
COPY web/package.json web/package-lock.json ./web/
# The root postinstall hook patches the TeamSpeak SDK during npm ci.
COPY scripts ./scripts
RUN npm ci
RUN npm ci --ignore-scripts --no-audit --no-fund
COPY scripts/prepare-sdk.mjs ./scripts/prepare-sdk.mjs
RUN npm run prepare:sdk
RUN npm rebuild @discordjs/opus --foreground-scripts --no-audit --no-fund
RUN npm --prefix web ci
COPY . .
RUN npm --prefix web run build \
RUN npm run web:build \
&& npm run build \
&& npm prune --omit=dev \
&& rm -rf web/node_modules
@@ -22,7 +23,7 @@ FROM node:22-bookworm-slim AS runtime
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates libstdc++6 \
&& apt-get install -y --no-install-recommends ca-certificates libstdc++6 iputils-ping \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /data \
&& chown node:node /data
@@ -34,11 +35,12 @@ COPY --from=build --chown=node:node /app/package.json /app/package-lock.json ./
COPY --from=build --chown=node:node /app/node_modules ./node_modules
COPY --from=build --chown=node:node /app/dist ./dist
COPY --from=build --chown=node:node /app/web/dist ./web/dist
COPY --from=build --chown=node:node /app/scripts/docker-healthcheck.mjs ./scripts/docker-healthcheck.mjs
USER node
VOLUME ["/data"]
EXPOSE 3040
EXPOSE 3040/tcp 39087/udp 40000-40099/udp
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD node -e "fetch('http://127.0.0.1:3040/health').then(r => { if (!r.ok) process.exit(1) }).catch(() => process.exit(1))"
CMD ["node", "scripts/docker-healthcheck.mjs"]
CMD ["node", "dist/index.js"]
+82 -439
View File
@@ -1,461 +1,104 @@
<div align="center">
<a id="readme-top"></a>
<img src="./image.png" alt="WebSpeak 项目横幅" width="100%" />
<h1>WebSpeak</h1>
<p><strong>让 TeamSpeak 自然地进入浏览器。</strong></p>
<p>A self-hosted browser voice client for TeamSpeak 3 and TeamSpeak 6.</p>
[![Latest Release](https://img.shields.io/github/v/release/EchoSixHIYA/WebSpeak-client-for-TeamSpeak?sort=semver&display_name=tag&style=flat-square&color=0f766e)](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/latest)
[![Docker Image](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/actions/workflows/docker-publish.yml/badge.svg?branch=master)](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/actions/workflows/docker-publish.yml)
[![License](https://img.shields.io/badge/license-AGPL--3.0--only-0f766e?style=flat-square)](./LICENSE)
[![GitHub Stars](https://img.shields.io/github/stars/EchoSixHIYA/WebSpeak-client-for-TeamSpeak?style=flat-square&logo=github&color=0f766e)](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/stargazers)
<br />
[![TeamSpeak](https://img.shields.io/badge/TeamSpeak-3%20%7C%206-2580C3?style=flat-square)](https://www.teamspeak.com/)
[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D22.5-339933?style=flat-square&logo=nodedotjs&logoColor=white)](https://nodejs.org/)
[![Vue](https://img.shields.io/badge/Vue-3-42B883?style=flat-square&logo=vuedotjs&logoColor=white)](https://vuejs.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-6-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![Docker](https://img.shields.io/badge/Docker-GHCR-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/EchoSixHIYA/packages/container/package/webspeak)
<p>
<a href="./docs/README.zh-CN.md">简体中文文档</a> ·
<a href="./docs/README.en.md">English documentation</a> ·
<a href="./docs/README.de.md">Deutsche Dokumentation</a> ·
<a href="./docs/README.ru.md">Русская документация</a> ·
<a href="./docs/README.ja.md">日本語ドキュメント</a>
</p>
</div>
## 项目简介 · Overview
| 逻辑 | 中文 | English |
| --- | --- | --- |
| **WHAT** | WebSpeak 是一个可自行部署的 TeamSpeak 3 / TeamSpeak 6 网页客户端与语音网关。 | WebSpeak is a self-hosted browser client and voice gateway for TeamSpeak 3 and TeamSpeak 6. |
| **WHY** | 无需安装桌面客户端,用户打开网页即可加入频道;部署者仍然掌控目标服务器、访问策略和数据。 | Users can join a voice channel from a browser without installing a desktop client, while the operator keeps control of servers, access, and data. |
| **HOW** | 部署后在管理员控制台配置 TeamSpeak 目标和访问方式,浏览器负责交互与音频,WebSpeak 负责网关连接。 | Configure the TeamSpeak target and access policy in the administration console. The browser handles interaction and audio; WebSpeak provides the gateway connection. |
## 在线演示 · Live Demo
- 上海节点 / Shanghai: <https://shanghai.webspeak.online>
- 香港节点 / Hong Kong: <https://webspeak.online>
## 文档 · Documentation
- [简体中文](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.zh-CN.md)
- [English](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.en.md)
- [Deutsch](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.de.md)
- [Русский](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.ru.md)
- [日本語](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.ja.md)
- [皮肤开发指南 / Skin development guide](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/SKIN_DEVELOPMENT.md)
- [皮肤开发 Agent Skill / Skin Development Agent Skill](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/.agents/skills/webspeak-skin-development/SKILL.md)
## 社区 · Community
<div align="center">
# WebSpeak
<a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=yhumUMDD9PmyYFWdXWUb_x7hM5trFQY8&authKey=Pw3HBGT7GwMinTQnuFGfnpf0aRSzXOJKcAiujVP1%2BXMpjheAKrncTRivicBJxpjV&noverify=0&group_code=869500475">
<img src="./web/public/qq-group-qr.jpg" alt="WebSpeak QQ 群二维码" width="290" />
</a>
**让 TeamSpeak 真正进入浏览器。**
**QQ群 / QQ group:`869500475`**
自托管的 TeamSpeak 3 / TeamSpeak 6 网页客户端与语音接入网关。无需安装桌面客户端,打开浏览器即可进入你的语音空间。
[通过群聊链接直接加入 / Join directly](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=yhumUMDD9PmyYFWdXWUb_x7hM5trFQY8&authKey=Pw3HBGT7GwMinTQnuFGfnpf0aRSzXOJKcAiujVP1%2BXMpjheAKrncTRivicBJxpjV&noverify=0&group_code=869500475)
A self-hosted TeamSpeak 3 / TeamSpeak 6 web client and voice gateway. Join your voice space from a modern browser without installing a desktop client.
[![License](https://img.shields.io/badge/License-AGPL--3.0--only-0f766e?style=flat-square)](LICENSE)
[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D22.5.0-0f766e?style=flat-square)](https://nodejs.org/)
[![TeamSpeak](https://img.shields.io/badge/TeamSpeak-3%20%7C%206-0f766e?style=flat-square)](https://www.teamspeak.com/)
**[中文](#中文)**<br />
[更新日志](#更新日志) · [为什么是 WebSpeak](#为什么是-webspeak) · [核心能力](#核心能力) · [架构](#架构) · [快速开始](#快速开始) · [首次登录与默认目标](#首次登录与默认目标) · [访问模式与邀请](#访问模式与邀请) · [音频与设备](#音频与设备) · [数据与安全边界](#数据与安全边界) · [旧版本升级](#旧版本升级) · [健康检查](#健康检查开发与验证) · [项目结构](#项目结构) · [已知边界](#已知边界) · [社区](#社区)
**[English](#english)**<br />
[Changelog](#changelog) · [Why WebSpeak](#why-webspeak) · [Core capabilities](#core-capabilities) · [Architecture](#architecture) · [Quick Start](#quick-start) · [First login](#first-login-and-default-target) · [Access modes](#access-modes-and-invites) · [Audio](#audio-and-devices) · [Security](#data-and-security-boundary) · [Upgrade](#upgrading-from-a-legacy-version) · [Health](#health-development-and-verification) · [Project layout](#project-layout) · [Known boundaries](#known-boundaries) · [License](#license) · [Community](#community)
[Telegram 群组 / Telegram group](https://t.me/+8qShpTcuN9A3MWY9)
</div>
> WebSpeak 是一个面向浏览器的 TeamSpeak 客户端,让频道、成员、文字与语音协作在网页中自然完成。
## 友链项目 · Friend projects
> WebSpeak is a browser-based TeamSpeak client that brings channels, members, text chat, and voice collaboration into one web experience.
### [NeteaseTSBot](https://github.com/yichen11818/NeteaseTSBot)
## 中文
面向 TeamSpeak 3/6 的多平台音乐点播机器人,支持网易云音乐、QQ 音乐和 Bilibili 音频播放,并提供 Web 控制台。<br />
A multi-platform music bot for TeamSpeak 3/6 with Netease Cloud Music, QQ Music, and Bilibili playback, plus a web console.<br />
Ein plattformübergreifender Musikbot für TeamSpeak 3/6 mit Netease Cloud Music, QQ Music und Bilibili sowie Webkonsole.
### 更新日志
## Contributors · 贡献者
#### 2026-09-02 · v0.1.1
感谢通过 PR 改进 WebSpeak 的贡献者。以下按 GitHub 的合并记录列出。
- 汇总并正式发布浏览器客户端、管理员控制台、受控邀请、Session 运维、审计记录、诊断报告和 SQLite 备份能力。
- 修复晚进入 WebSpeak 的浏览器会话无法看到先进入成员的问题;连接建立后会完成目录同步,并合并分阶段成员事件。
- 修复私聊消息到达后网页端断开连接的问题,完善成员右键菜单、悬停高亮和语音活动状态展示。
- 完成中英文界面、默认 TeamSpeak 目标、旧版配置迁移和首次登录强制改密流程。
- 发布流程稳定生成 Windows/Linux 部署包并同步发布 Docker 镜像;Docker 构建会正确处理依赖安装脚本。
- [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) 修正缩放、浮动布局和首页脚注。
- [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 注册昵称连接,并在设置、收藏和邀请中保留昵称目标。
#### 2026-08-31 · v0.1.0
## 许可证 · License · Lizenz · Лицензия · ライセンス
- 首个规范化版本,提供浏览器客户端、TeamSpeak 3 / 6 网关、浏览器音频控制、访问模式、管理员运维能力和 AGPL-3.0-only 许可证。
WebSpeak 使用 [GNU Affero General Public License v3.0 only](./LICENSE) 发布。你可以使用、研究、修改和再分发本项目;如果修改后的版本通过网络向用户提供服务,需要按照 AGPL-3.0 向这些用户提供对应源代码。
### 为什么是 WebSpeak
WebSpeak is released under the [GNU Affero General Public License v3.0 only](./LICENSE). If a modified version is offered to users over a network, its corresponding source code must be offered under AGPL-3.0.
| 体验 | WebSpeak 的答案 |
| --- | --- |
| 加入方式 | 浏览器打开链接即可加入,不安装桌面客户端 |
| 兼容性 | 支持 TeamSpeak 3 / TeamSpeak 6,并自动识别协议 |
| 连接模型 | HTTPS / WSS 连接 WebSpeak,WebSpeak 连接目标 TeamSpeak |
| 入口控制 | 固定目标、开放目标、一次性受控邀请三种路径 |
| 语言与主题 | 访客端和管理控制台均支持中英文与主题切换 |
WebSpeak wird unter der [GNU Affero General Public License v3.0 only](./LICENSE) veröffentlicht. Bei Bereitstellung einer veränderten Version über ein Netzwerk muss der entsprechende Quellcode unter AGPL-3.0 angeboten werden.
### 核心能力
WebSpeak распространяется по лицензии [GNU Affero General Public License v3.0 only](./LICENSE). Если изменённая версия предоставляется пользователям через сеть, соответствующий исходный код должен быть доступен этим пользователям на условиях AGPL-3.0.
| 领域 | 已提供 |
| --- | --- |
| 语音 | Opus / PCM 桥接、自由麦、按键说话、VOX、连接状态与重连提示 |
| 设备 | 浏览器麦克风与扬声器选择、音量调节、实时输入电平、本地麦克风测试 |
| 频道 | 频道树、频道切换、成员移动、频道文字聊天、服务器事件与状态展示 |
| 成员 | 在线成员、发言绿色头像边框、Away 状态、私聊、Poke、昵称复制、成员音量 |
| 管理 | 默认账号首次登录强制改密、默认 TeamSpeak 目标、站点信息、真实连接测试 |
| 运维 | 活动 Session、邀请创建与撤销、审计事件、结构化日志、诊断报告、SQLite 备份 |
| 浏览器体验 | 响应式布局、移动端按住说话、紧凑滚动布局、浏览器本地收藏与最近连接 |
WebSpeak は [GNU Affero General Public License v3.0 only](./LICENSE) の下で公開されています。変更版をネットワーク経由でユーザーに提供する場合は、対応するソースコードを AGPL-3.0 に従ってユーザーに提供する必要があります。
### 架构
## Star History
| 层级 | 职责 | 连接 |
| --- | --- | --- |
| 浏览器会话 | 昵称、设备、频道、成员、文字和语音交互 | HTTPS / WSS → WebSpeak |
| WebSpeak 网关 | 会话管理、访问控制、语音桥接、目录同步、管理控制台 | TeamSpeak 客户端协议 |
| TeamSpeak 3 / 6 | 提供频道、成员、文字和语音服务 | 目标地址与语音端口 |
<a href="https://star-history.com/#EchoSixHIYA/WebSpeak-client-for-TeamSpeak&Date">
<img src="https://api.star-history.com/svg?repos=EchoSixHIYA/WebSpeak-client-for-TeamSpeak&type=Date" alt="WebSpeak Star History" width="100%" />
</a>
### 快速开始
#### 方式 A:从 Dockerfile 构建
```bash
docker build -t webspeak:local .
docker volume create webspeak-data
docker run -d \
--name webspeak \
--restart unless-stopped \
-p 3040:3040 \
-v webspeak-data:/data \
webspeak:local
```
容器固定监听 `3040`,SQLite 数据库、安装级主密钥和日志保存在 `/data`。公网部署时,请在前面配置 HTTPS 反向代理;麦克风和部分浏览器音频能力需要安全上下文。
#### 方式 B:源码运行
环境要求:
- Node.js `22.5.0` 或更高版本。
- `@discordjs/opus` 所需的原生编译工具;Linux 通常需要 `python3`、`make`、`g++`。
- 一台可访问的 TeamSpeak 3 或 TeamSpeak 6 服务端。
- 较新的 Chrome 或 Edge;生产环境建议使用 HTTPS。
```bash
npm ci
npm --prefix web ci
npm --prefix web run build
npm run build
node dist/index.js
```
随后打开:
```text
http://127.0.0.1:3040/
```
### 首次登录与默认目标
1. 打开 `/admin`。
2. 使用默认账户 `admin / admin` 登录。
3. 按页面要求设置一个至少 12 个字符的新管理员密码。
4. 在“服务器”页面的“默认 TeamSpeak 目标”中填写服务器地址与语音端口。
5. 执行连接测试并保存。
欢迎页没有邀请链接目标参数时,会使用管理员设置的默认 TeamSpeak 目标进行预填写。邀请链接参数优先;固定模式下访客只能进入管理员配置的目标,开放模式下访客可以输入经过安全校验的公网目标。
WebSpeak 的 HTTP 端口固定为 `3040`,TeamSpeak 默认语音端口为 `9987`。目标地址在界面中拆分为“地址”和“语音端口”两个字段;旧版 `地址:端口` 与 `地址#端口` 文本仍可兼容解析。
### 访问模式与邀请
| 模式 | 行为 | 适用场景 |
| --- | --- | --- |
| `fixed` | 访客不改变目标,服务端管理目标与服务器密码 | 私有社区、固定服务器 |
| `open` | 访客可输入公网目标与本次会话密码 | 临时接入、多服务器入口 |
| 受控邀请 | 管理员生成一次性、可过期、可限次、可撤销链接 | 活动、临时房间、定向分享 |
开放模式会在 DNS 解析后阻止 loopback、私网、链路本地、组播、广播和保留地址,并使用已验证的 IP 进行实际连接。服务器密码不会写入分享链接、浏览器本地存储或 WebSocket URL。
### 音频与设备
进入语音空间后,在设置中可以:
- 选择浏览器检测到的麦克风与扬声器;
- 切换自由麦和按键说话;
- 调整输入、输出、通知音量与 VOX 阈值;
- 查看麦克风权限、实时输入电平和音频上下文状态;
- 使用最多 5 秒的本地麦克风测试,录音只在浏览器本地播放,不发送到 TeamSpeak。
设备标签由浏览器权限模型决定。首次选择设备前,浏览器可能要求授予麦克风权限;输出设备选择依赖浏览器支持,不支持时会明确回退到默认扬声器。
### 数据与安全边界
运行数据默认位于 `data/`,Docker 环境默认位于 `/data`:
```text
data/
├── webspeak.db SQLite 配置、管理员凭据、邀请与有限审计事件
├── master.key 32 字节安装级主密钥
└── logs/ 本地轮转日志
```
- 管理员密码使用 Node.js `crypto.scrypt`、随机 salt 与 constant-time compare。
- TeamSpeak 服务器密码使用 AES-256-GCM 加密保存,管理 API 不返回明文。
- 管理 Session 使用服务端会话、HttpOnly / SameSite Strict Cookie、同源校验与 CSRF token。
- 管理登录具有固定窗口限速与失败延迟。
- 普通用户 identity 只在当前 Join Ticket / Session 中使用;启用“记住此设备”后,私钥只保存在浏览器 IndexedDB,不上传到网关,也不会进入日志、诊断或数据库。
- WebSpeak 不提供身份文件导入/导出界面;清除浏览器本地数据会移除本机记住的身份与偏好。
- 日志、诊断报告与 Overview 不返回服务器密码、管理员密码或身份私钥。
- 请同时备份 `webspeak.db` 与 `master.key`;只有数据库而没有主密钥时,加密的服务器密码无法恢复。
### 旧版本升级
如果升级启动时项目根目录仍有旧 `config.json`,WebSpeak 只做一次性导入:
- `tsHost`
- `tsPort`
- `tsServerPassword`
导入后 `data/webspeak.db` 成为唯一实时配置源;旧文件不会被删除或改写。旧版的 `port`、`tsServerProtocol`、`maxClients` 和 `trustProxy` 不再作为运行配置。
### 健康检查、开发与验证
无需认证的健康检查:
```text
GET /health
GET /api/health
```
开发命令:
```bash
# 后端:固定监听 3040
npm run dev
# 前端:Vite 监听 5173,并将 /api 与 /ws 代理到 3040
npm run web:dev
# 前端生产构建
npm --prefix web run build
# 后端类型检查与构建
npm run build
# 自动化测试
npm test
# 依赖审计
npm audit
```
`/demo` 是不连接真实 TeamSpeak 的交互式演示页面,仅用于界面预览、录屏和前端回归,不能替代真实 TS3 / TS6 验证。
### 项目结构
```text
src/
├── admin/ 管理服务、登录、Session、邀请与运维接口
├── persistence/ SQLite schema、repository 与迁移边界
├── security/ 主密钥、秘密加密、密码与开放目标策略
├── domain/ TeamSpeak 目标地址与端口解析
└── server/ TeamSpeak 适配器、Session、票据与语音桥
web/src/
├── views/WebClient.vue 访客端、语音空间、聊天与音频设置
├── views/AdminView.vue 管理登录、服务器、概览与运维控制台
├── composables/ WebSocket 与语音状态
└── services/ 主题、本地持久化与目标解析
```
### 已知边界
- 服务端固定限制最多 100 个活动连接。
- 管理员模型目前是单管理员,不提供用户列表、角色或权限管理后台。
- 浏览器麦克风权限、HTTPS 与浏览器对音频输出设备的支持会影响最终体验。
- TeamSpeak 服务端自身的版本、协议兼容性和网络可达性不由 WebSpeak 代替管理。
### 社区
QQ群:`869500475`
加入 QQ 群获取使用帮助、版本更新和交流支持:
![WebSpeak 群聊二维码](group-chat.png)
## English
WebSpeak brings TeamSpeak voice spaces to the browser. It is a self-hosted gateway and web client for TeamSpeak 3 and TeamSpeak 6: open a link, choose a nickname, and join from a modern browser without installing a desktop client.
### Changelog
#### 2026-09-02 · v0.1.1
- Consolidated and officially released the browser client, administrator console, managed invites, session operations, audit records, diagnostics, and SQLite backup support.
- Fixed late WebSpeak browser sessions missing members who joined earlier by reconciling the directory after connect and merging staged member events.
- Fixed browser sessions disconnecting after receiving a private message, and improved member context menus, hover highlighting, and speaking-state presentation.
- Added the bilingual interface, default TeamSpeak target, legacy configuration migration, and mandatory first-login password rotation.
- Stabilized release publishing for Windows/Linux packages and the matching Docker image; Docker builds now handle the dependency patch script correctly.
#### 2026-08-31 · v0.1.0
- First normalized release with the browser client, TeamSpeak 3 / 6 gateway, browser audio controls, access modes, administrator operations, and AGPL-3.0-only licensing.
### Why WebSpeak
| Experience | WebSpeak's answer |
| --- | --- |
| Joining | Open a browser link and join without installing the desktop client |
| Compatibility | Supports TeamSpeak 3 and TeamSpeak 6 with automatic protocol detection |
| Connection model | The browser connects to WebSpeak over HTTPS / WSS, and WebSpeak connects to TeamSpeak |
| Access control | Fixed targets, open targets, and one-time managed invites |
| Language and theme | Chinese and English interfaces with theme switching for guests and administrators |
### Core capabilities
| Area | Included |
| --- | --- |
| Voice | Opus / PCM bridging, free mic, push-to-talk, VOX, connection state, reconnect feedback, and speaking indicators |
| Devices | Browser microphone and speaker selection, volume controls, live input level, and a local microphone test |
| Channels | Channel tree, channel switching, member movement, channel text chat, server events, and status display |
| Members | Online members, green speaking borders, Away state, private messages, Poke, nickname copy, and per-member volume |
| Administration | Mandatory first-login password rotation, default TeamSpeak target, site information, and real connection tests |
| Operations | Active sessions, invite creation and revocation, audit events, structured logs, diagnostics, and SQLite backup |
| Browser experience | Responsive layouts, press-and-hold mobile PTT, compact scrolling regions, local favorites, and recent connections |
### Architecture
| Layer | Responsibility | Connection |
| --- | --- | --- |
| Browser session | Nickname, device, channel, member, text, and voice interactions | HTTPS / WSS → WebSpeak |
| WebSpeak gateway | Session management, access control, voice bridging, directory synchronization, and admin console | TeamSpeak client protocol |
| TeamSpeak 3 / 6 | Channel, member, text, and voice services | Configured host and voice port |
### Quick Start
#### Option A: Build with Docker
```bash
docker build -t webspeak:local .
docker volume create webspeak-data
docker run -d \
--name webspeak \
--restart unless-stopped \
-p 3040:3040 \
-v webspeak-data:/data \
webspeak:local
```
The container listens on `3040`. SQLite data, the installation master key, and logs are stored in `/data`. If `certs/cert.pem` and `certs/key.pem` are present, the service enables HTTPS directly; for public deployments, an HTTPS reverse proxy is recommended. Microphone access and some browser audio features require a secure context.
#### Option B: Run from source
Requirements:
- Node.js `22.5.0` or newer.
- Native build tools required by `@discordjs/opus`; Linux installations typically need `python3`, `make`, and `g++`.
- An accessible TeamSpeak 3 or TeamSpeak 6 server.
- A recent Chrome or Edge release; HTTPS is recommended for production.
```bash
npm ci
npm --prefix web ci
npm --prefix web run build
npm run build
node dist/index.js
```
Then open:
```text
http://127.0.0.1:3040/
```
Use `https://127.0.0.1:3040/` when direct certificates are enabled. On first run, WebSpeak creates its SQLite database and installation master key in the data directory.
### First login and default target
1. Open `/admin`.
2. Sign in with the default account `admin / admin`.
3. Follow the prompt to set a new administrator password of at least 12 characters.
4. In **Servers**, configure the **Default TeamSpeak target** with a host and voice port.
5. Run the connection test and save the settings.
When a welcome link has no target parameters, the welcome page pre-fills the administrator's default TeamSpeak target. Invite parameters take precedence. In fixed mode, guests stay on the administrator-configured target; in open mode, guests may enter a public target that passes the network policy.
WebSpeak's web port is fixed at `3040`, and TeamSpeak's default voice port is `9987`. The web fields use separate host and voice-port inputs; legacy `host:port` and `host#port` text remains accepted by the parser.
### Access modes and invites
| Mode | Behavior | Typical use |
| --- | --- | --- |
| `fixed` | Guests cannot change the target; the server and password are managed by the administrator | Private communities and a single permanent server |
| `open` | Guests may enter a public target and a password for that session | Temporary access and multi-server entry points |
| Managed invite | An administrator creates a one-time, expiring, usage-limited, revocable link | Events, temporary rooms, and targeted sharing |
In open mode, DNS resolution is followed by blocking loopback, private, link-local, multicast, broadcast, and reserved addresses. The verified IP is used for the actual connection. Server passwords never appear in share links, browser storage, or WebSocket URLs.
### Audio and devices
Inside a voice space, the settings panel lets users:
- Choose a microphone and speaker detected by the browser.
- Switch between free mic and push-to-talk.
- Adjust input, output, notification, and VOX-threshold volumes.
- Inspect microphone permission, live input level, and audio-context state.
- Run a local microphone test of up to five seconds; the recording is played in the browser and is not sent to TeamSpeak.
Device labels are controlled by the browser permission model. The first device selection may request microphone permission. Output-device selection depends on browser support; unsupported browsers clearly fall back to the default speaker.
### Data and Security Boundary
Runtime data is stored in `data/` by default and in `/data` in Docker:
```text
data/
├── webspeak.db SQLite settings, admin credentials, invites, and bounded audit events
├── master.key 32-byte installation master key
└── logs/ Locally rotated logs
```
- Administrator passwords use Node.js `crypto.scrypt`, a random salt, and constant-time comparison.
- TeamSpeak server passwords are encrypted with AES-256-GCM; admin APIs never return them in plaintext.
- Admin sessions use server-side sessions, HttpOnly / SameSite Strict cookies, same-origin checks, and CSRF tokens.
- Admin login applies bounded-window rate limiting and failure delays.
- A user identity is used only by the current join ticket and session. When “remember this device” is enabled, the private key stays in browser IndexedDB and is not uploaded to the gateway or written to logs, diagnostics, or the database.
- WebSpeak has no identity-file import/export controls; clearing browser data removes the remembered identity and local preferences.
- Logs, diagnostic reports, and the overview do not return server passwords, admin passwords, or private identity keys.
- Back up `webspeak.db` together with `master.key`; an encrypted TeamSpeak password cannot be recovered from the database alone.
### Upgrading from a legacy version
If an old `config.json` is still present in the project root at startup, WebSpeak imports these fields once:
- `tsHost`
- `tsPort`
- `tsServerPassword`
After the import, `data/webspeak.db` is the only live configuration source. The legacy file is not deleted or rewritten. Legacy `port`, `tsServerProtocol`, `maxClients`, and `trustProxy` values are no longer runtime controls.
### Health, development, and verification
Unauthenticated health endpoints:
```text
GET /health
GET /api/health
```
Development commands:
```bash
# Backend: fixed port 3040
npm run dev
# Frontend: Vite on 5173, proxying /api and /ws to 3040
npm run web:dev
# Frontend production build
npm --prefix web run build
# Backend type check and build
npm run build
# Automated tests
npm test
# Dependency audit
npm audit
```
`/demo` is an interactive simulated page that never connects to a real TeamSpeak server. It is useful for UI previews, recordings, and frontend regression checks, but does not replace real TS3 / TS6 verification.
### Project layout
```text
src/
├── admin/ Admin service, login, sessions, invites, and operations APIs
├── persistence/ SQLite schema, repositories, and migration boundaries
├── security/ Master key, secret encryption, passwords, and target policy
├── domain/ TeamSpeak target and port parsing
└── server/ TeamSpeak adapter, sessions, tickets, and voice bridge
web/src/
├── views/WebClient.vue Guest client, voice space, chat, and audio settings
├── views/AdminView.vue Admin login, server, overview, and operations console
├── composables/ WebSocket and voice state
└── services/ Theme, local persistence, and target parsing
```
### Known boundaries
- The server has a fixed limit of 100 active connections.
- The current administrator model is single-admin; there is no user, role, or permission-management panel.
- Browser microphone permissions, HTTPS, and browser support for output-device selection affect the final experience.
- WebSpeak does not replace TeamSpeak server version, protocol-compatibility, or network-reachability management.
### License
WebSpeak is licensed under the [GNU Affero General Public License v3.0 only](LICENSE) (`AGPL-3.0-only`). If you run a modified version as a network service, provide the corresponding source under the terms of the license.
### Community
QQ group: `869500475`
![WebSpeak group QR code](group-chat.png)
<div align="right"><a href="#readme-top">返回顶部 · Back to top ↑</a></div>
+5 -4
View File
@@ -1,10 +1,11 @@
services:
webspeak:
image: ghcr.io/EchoSixHIYA/webspeak:latest
container_name: webspeak
image: ${WEBSPEAK_IMAGE:-ghcr.io/echosixhiya/webspeak:latest}
pull_policy: missing
restart: unless-stopped
ports:
- "3040:3040"
# WebSpeak needs to reach a TeamSpeak server running on the same host.
# Host networking also exposes the configured WebRTC UDP range directly.
network_mode: host
volumes:
- webspeak-data:/data
+333
View File
@@ -0,0 +1,333 @@
# WebSpeak · Deutsch
[Projektstartseite](../README.md) · [简体中文](./README.zh-CN.md) · [English](./README.en.md) · [Русский](./README.ru.md) · [日本語](./README.ja.md)
WebSpeak ist ein selbst gehosteter Webclient und ein Sprach-Gateway für TeamSpeak 3 und TeamSpeak 6. Nutzer können ohne Desktop-Client im Browser Kanälen beitreten; Administratoren verwalten Zielserver, Zugriff und Laufzeitstatus über die Webkonsole.
Aktuelle Version: [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8).
## Live-Demo
- Shanghai: <https://shanghai.webspeak.online>
- Hongkong: <https://webspeak.online>
Netzwerkbedingungen und Auslastung können bei beiden Demos schwanken; Latenz, Verbindungsabbrüche oder kurze Ausfälle beschreiben nicht jede eigene Bereitstellung.
## ✨ Funktionen
| Funktion | Beschreibung |
| --- | --- |
| TeamSpeak-Kompatibilität | Unterstützt TeamSpeak 3 und TeamSpeak 6 und erkennt das Zielprotokoll automatisch. |
| Plattformübergreifendes P2P-Bildschirmteilen | Browsernutzer und native TeamSpeak-6-Clients können die Bildschirmfreigabe gegenseitig starten und ansehen; WebRTC/ICE überträgt Medien direkt, WebSpeak leitet nur die Signalisierung weiter. |
| IPv6-Ziele | IPv6-TeamSpeak-Ziele und über DNS aufgelöste IPv6-Adressen werden standardmäßig unterstützt. |
| Kanäle und Mitglieder | Kanalstruktur und aktuelle Mitglieder anzeigen und Kanäle wechseln. |
| Echtzeit-Sprache | Opus-Audio mit kompatiblem Transport und optional integriertem WebRTC für geringere Latenz. |
| Audiosteuerung | Mikrofon und Lautsprecher auswählen, Lautstärke regeln, testen, stummschalten, VOX und individuelle Mitgliedslautstärke. |
| Browserseitige Geräuschunterdrückung | Optionale Mikrofon-Geräuschunterdrückung in der Browseraufnahme, ohne zusätzliche serverseitige Audioverarbeitung. |
| Nachrichten und Aktionen | Kanal- und Serverchat, private Nachrichten, Anstupsen und Flüsterziele. |
| Desktop-Begleitton | Audio eines freigegebenen Fensters oder Browser-Tabs im aktuellen Kanal teilen. |
| Identität und Zugriff | Gespeicherte Identität, eigene Ziele, widerrufbare Einladungen sowie Import, Konvertierung, Prüfung und Export von TeamSpeak-3-Identitäten. |
| Administration | Ziele, Zugriff, öffentliche Medienadresse, IPv6-Kandidaten, Sprach-STUN, Relays, Einladungen, Sitzungen, Protokolle, Diagnosen und Backups verwalten. |
| Projektstruktur | In 0.2.6 wurden Sprach-Gateway, Sitzungsereignisse, Audio und Bildschirmfreigabe in Module aufgeteilt; Sprach- und Admin-Oberflächen in Komponenten, Composables und Dienste zerlegt und um Lebenszyklus- und Wiederverbindungstests ergänzt. |
| Skins | Geschützte Tages-, Nacht- und ILLUSIA-Skins sowie instanzverwaltete `.wskin`-Designs mit Aktivierungs- und Standardauswahl im Adminbereich. |
| Oberfläche | Chinesische, englische, deutsche, russische und japanische Oberfläche sowie responsive Desktop-/Mobilansicht. |
| Selbsthosting | Daten bleiben beim Betreiber; Pakete für Windows x64 und Linux x64/ARM64, Docker für amd64/arm64 und Android-APKs für arm64-v8a, armeabi-v7a und x86_64. |
## 🖼️ Screenshots
Die Screenshots zeigen die deutsche Willkommensseite, den Sprachbereich, die Audiosteuerung und das Mitgliedermenü.
### Willkommensseite
<p align="center"><img src="./screenshots/webspeak-de-home.png" alt="WebSpeak deutsche Willkommensseite" width="100%" /></p>
### Sprachbereich
<p align="center"><img src="./screenshots/webspeak-de.png" alt="WebSpeak deutscher Sprachbereich" width="100%" /></p>
### Audiosteuerung
<p align="center"><img src="./screenshots/webspeak-de-audio.png" alt="WebSpeak deutsche Audiosteuerung" width="100%" /></p>
### Mitgliedermenü
<p align="center"><img src="./screenshots/webspeak-de-menu.png" alt="WebSpeak deutsches Mitgliedermenü" width="100%" /></p>
## 🧩 Erweiterte Funktionen
Diese Funktionen sind optional. Ohne sie arbeitet WebSpeak weiterhin mit dem kompatiblen Sprachtransport. Die Einstellungen befinden sich unter **Administration → Server** und gelten für neue Verbindungen.
### 1. WebRTC-Sprache mit niedriger Latenz
WebRTC verwendet für Browser-Sprache einen Echtzeit-Medienpfad und ermöglicht außerdem Desktop-Begleitton. Das aktuelle WebSpeak-Gateway stellt WebRTC selbst bereit; ein zusätzlicher Medienserver ist nicht erforderlich.
1. Unter `/admin` anmelden und auf der Seite **Server** die **Erweiterten Einstellungen** öffnen.
2. Bei deaktiviertem WebRTC Start- und Endport für UDP festlegen. Der Standardbereich ist `40000–40099`.
3. Den gesamten UDP-Bereich in Sicherheitsgruppe und Firewall des WebSpeak-Hosts freigeben.
4. **WebRTC** aktivieren und speichern. Nicht unterstützte Browser oder Netzwerke wechseln automatisch zum kompatiblen Transport.
Der Portbereich ist bei aktiviertem WebRTC gesperrt. Zum Ändern WebRTC zuerst deaktivieren und speichern, danach die Firewall-Regeln anpassen. Für öffentliche Bereitstellungen ist HTTPS erforderlich.
### ICE-Kandidaten für Bildschirmfreigabe
Die Medien der Bildschirmfreigabe versuchen weiterhin eine direkte Browser-zu-Browser-Verbindung; WebSpeak leitet nur die Signalisierung weiter. Standardmäßig werden die öffentlichen TeamSpeak-STUN-Dienste zur Ermittlung öffentlicher Kandidaten verwendet. STUN überträgt keine Medien. Ein autorisierter externer TURN-Dienst kann über `WEBSPEAK_SCREEN_SHARE_ICE_SERVERS` als JSON-Array konfiguriert werden, zum Beispiel:
```json
[{"urls":"stun:turn.teamspeak.com:3478"},{"urls":"turns:turn.example.com:5349","username":"<username>","credential":"<credential>"}]
```
Mit TURN kann die Medienübertragung diesen externen Dienst verwenden, aber niemals das WebSpeak-Gateway. Ohne TURN werden nur direkte ICE-Pfade und STUN verwendet.
### Plattformübergreifendes P2P-Bildschirmteilen
Browsernutzer und native TeamSpeak-6-Clients können Bildschirmfreigaben gegenseitig erkennen, starten und ansehen. Zwischen Browsern sowie zwischen Browser und nativem Client werden die Bildschirmmedien möglichst über eine direkte WebRTC/ICE-Peer-to-Peer-Verbindung übertragen; WebSpeak übernimmt Sitzungsberechtigung, Freigabestatus und SDP-/ICE-Signalisierung, transportiert aber keine Bildschirmmedien. Die Oberfläche zeigt Live-Status und Zuschauerzahl und bietet Lautstärke-, Vollbild- und Beenden-Steuerung. Für die Aufnahme stehen bis zu 1080p und 60 FPS sowie WebRTC-Statistiken zur Verfügung.
### 2. Relay-Modus
Ein Relay hilft, wenn ein TeamSpeak-Server Verbindungen aus einer anderen Region ablehnt oder der direkte Weg instabil ist. Es ist kein VPN, sondern leitet nur den TeamSpeak-Verkehr der aktuellen WebSpeak-Sitzung weiter.
Eine Relay-Instanz ist ein dedizierter Weiterleitungsdienst ohne Besucher- oder Administrationsseite. Sie akzeptiert nur Gateway-Sitzungen mit passendem Token. Ein zufälliges Token mit mindestens 16 Zeichen verwenden.
#### Aus dem Quellcode starten
```bash
git clone --depth 1 https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
npm ci --ignore-scripts
npm run prepare:sdk
npm run build
WEBSPEAK_MODE=relay \
WEBSPEAK_RELAY_TOKEN='replace-with-a-long-random-token' \
WEBSPEAK_RELAY_HOST='0.0.0.0' \
WEBSPEAK_RELAY_PORT='39087' \
node dist/index.js
```
Windows PowerShell:
```powershell
$env:WEBSPEAK_MODE = "relay"
$env:WEBSPEAK_RELAY_TOKEN = "replace-with-a-long-random-token"
$env:WEBSPEAK_RELAY_HOST = "0.0.0.0"
$env:WEBSPEAK_RELAY_PORT = "39087"
node .\dist\index.js
```
#### Aus einem Release-Paket starten
Das passende Paket aus den [Releases](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/latest) herunterladen und entpacken:
```bash
# Linux
export WEBSPEAK_MODE=relay
export WEBSPEAK_RELAY_TOKEN='replace-with-a-long-random-token'
export WEBSPEAK_RELAY_HOST='0.0.0.0'
export WEBSPEAK_RELAY_PORT='39087'
./runtime/node ./dist/index.js
```
Unter Windows PowerShell dieselben Variablen setzen und `.\runtime\node.exe .\dist\index.js` ausführen.
#### Mit Docker starten
```bash
docker run -d --name webspeak-relay --restart unless-stopped --network host \
-e WEBSPEAK_MODE=relay \
-e WEBSPEAK_RELAY_TOKEN='replace-with-a-long-random-token' \
-e WEBSPEAK_RELAY_PORT='39087' \
ghcr.io/echosixhiya/webspeak:latest
```
Den UDP-Listening-Port des Relay-Hosts freigeben, standardmäßig `39087`.
#### Im Gateway aktivieren
1. **Administration → Server → Relay-Server** öffnen und einen oder mehrere Knoten hinzufügen.
2. Für jeden Knoten einen Anzeigenamen, einen Endpunkt wie `relay.example.com#39087` und das passende Token eintragen und speichern.
3. Besucher können auf der Willkommensseite Direktzugriff oder einen konfigurierten Relay-Knoten auswählen.
Relay deaktivieren und speichern, um die Option von der Willkommensseite zu entfernen.
### 3. Abhängigkeiten und Hinweise zur Herkunft
- Der Relay-Dienst ist Bestandteil von WebSpeak und verwendet Node.js-Standardbibliotheken; GOST, sing-box oder ein anderes Proxy-Framework werden nicht verwendet.
- WebRTC verwendet [werift](https://github.com/shinyoshiaki/werift-webrtc) `0.24.4`; das Upstream-Projekt steht unter MIT-Lizenz.
- Die TeamSpeak-Protokollverbindung verwendet den projektgepflegten [EchoSixHIYA/teamspeak-js](https://github.com/EchoSixHIYA/teamspeak-js)-SDK-Fork.
## 🧾 Änderungsprotokoll
<a id="latest-release-notes"></a>
### [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8) · 2026-10-17
#### Bildschirmfreigabe und Verbindungsstabilität
- Aushandlung und Verarbeitung der Videospur für Bildschirmfreigaben zwischen Browsern und nativen TeamSpeak-Clients korrigiert.
- Schnelle Kanalwechsel werden zuverlässiger verarbeitet, um inkonsistente Clientzustände zu vermeiden.
- Darstellungsfehler in einigen Skin-Komponenten und der KAAK-Übersetzung behoben.
#### Verbesserungen der Oberfläche
- Audiogerätenamen werden vollständig angezeigt und bei wenig Platz umgebrochen, damit lange Namen unterscheidbar bleiben.
- Unbeabsichtigte Textauswahl des Avatar-Platzhalters behoben.
### [v0.2.7](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.7) · 2026-10-13
#### Offeneres Skin-System
- Ein offenerer Skin-Editor und die zugehörige Laufzeit erlauben es nun, Stil und Position beliebiger Komponenten anzupassen und Widgets hinzuzufügen.
- Öffne nach dem Wechsel in den Sprachbereich im selben Browser ein neues Fenster mit der Administrationsoberfläche und melde dich an, um den Skin-Editor zu aktivieren.
- Der Skin „KAAK“ ist als Entwicklungsbeispiel enthalten.
- Der Agent Skill für die Skin-Entwicklung wurde aktualisiert.
#### Funktionserweiterungen
- Serveradressen können nun über SRV-Einträge und TeamSpeak-Nickname-Einträge aufgelöst werden.
- Im freien Modus lassen sich mehrere Server-Tabs verwalten; diese Schaltflächen sind im Modus „Fester Server“ nicht verfügbar.
- Eine Option für die Bitrate der Bildschirmfreigabe wurde hinzugefügt.
- WebSpeak speichert eingegebene Kanalpasswörter nun im Browser.
- Gesperrte Kanäle werden mit einem Schlosssymbol angezeigt.
- Der Chatverlauf wird nun dauerhaft gespeichert.
#### Fehlerbehebungen
- Fehler bei der Adressauflösung behoben.
- Fokuskonflikte zwischen Lautstärkeregelung und dem Ziehen von Mitgliedskarten behoben.
- Fehler behoben, durch den der Benutzerstatus fälschlich als unbekannt erkannt wurde.
### [v0.2.6](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.6) · 2026-10-08
Gegenüber 0.2.5 wurden Sprach-Gateway, gemeinsame Protokolle, Sprachoberfläche und Admin-Module umfassend umstrukturiert; #6/#7/#10 behoben, #9/#12 umgesetzt und der in PR #13 gemeldete Fall bereits aktiver TS6-Freigaben behoben. Opus- und Sitzungslebenszyklen sowie mobile Steuerung verbessert. Pakete: Windows x64, Linux x64/ARM64, Docker amd64/arm64 und Android arm64-v8a/armeabi-v7a/x86_64.
### [v0.2.5](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.5) · 2026-09-27
`.wskin`-Skins, Aktivierungs-/Standardverwaltung und geschützte Tages-, Nacht- und ILLUSIA-Skins ergänzt; unfertiges Aurora-Voice-Beispiel entfernt, Skin-Ladeblitze, dunkle Bedienelemente und Artwork-Ebenen im Sprachbereich korrigiert sowie offiziellen Skin-Entwicklungs-Agent-Skill hinzugefügt.
### [v0.2.4](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.4) · 2026-09-22
Plattformübergreifendes P2P-Bildschirmteilen zwischen Browsern und nativen TeamSpeak-6-Clients ergänzt; STUN-/externes-TURN-Konfiguration, Live-Player und Zuschauerstatus, Aufnahmeoptionen bis 1080p/60 FPS und WebRTC-Statistiken hinzugefügt; Bildschirmfreigabe-Interaktion verbessert und Besucherzählung ergänzt.
### [v0.2.3](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.3) · 2026-09-19
Mitgliederplanung und direkte Verschiebung nach Berechtigung ergänzt; Avatar-, Stummschaltstatus- und Identitätsunterstützung hinzugefügt; Screenshots und Dokumentation für alle fünf Sprachen aktualisiert.
### [v0.2.2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.2) · 2026-09-17
Browserseitige Mikrofon-Geräuschunterdrückung, russische und japanische Oberfläche sowie sprachabhängige Begrüßungstexte ergänzt; Lautstärkeinteraktion und Fehlertexte/-codes auf Basis von PR #2 verbessert.
### [v0.2.1](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.1) · 2026-09-13
Verbindungsfehler auf der Willkommensseite verbessert, Fehlercodes erhalten und sicher gekürzt sowie IPv6-Ziele standardmäßig unterstützt.
### [v0.2.0](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.0) · 2026-09-10
Passwortabfrage, dedizierter Relay-Modus, Auswahl mehrerer Relays und Ursachendarstellung in der Administration ergänzt.
### [v0.1.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.8) · 2026-09-08
Docker-Bereitstellung vereinfacht, lokale TeamSpeak-Ziele unterstützt, 15-Sekunden-Timeout ergänzt und kontinuierliche Netzwerküberwachung eingeführt.
### [v0.1.7](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.7) · 2026-09-06
Deutsch, Telegram, Netzwerkleistung und Gesamtlautstärke ergänzt; Lautstärkeschwankungen beim Begleitton behoben.
### [v0.1.6](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.6) · 2026-09-04
Desktop-Begleitton, Hinweise zur gespeicherten Identität und Website-Symbol ergänzt; WebRTC-Mitgliederlautstärke korrigiert.
### [v0.1.5](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.5) · 2026-09-04
Identitätsspeicherung korrigiert und Designumschaltung verbessert.
### [v0.1.4](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.4) · 2026-09-03
WebRTC und Kanalchat korrigiert sowie Administration, Protokolle und Mobilansicht verbessert.
### [v0.1.3](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.3) · 2026-09-03
Integriertes WebRTC, aktualisiertes TeamSpeak-SDK und bessere Mitgliedersynchronisierung und Sprachpufferung.
## 🚀 Bereitstellung
| Methode | Geeignet für | Umgebung |
| --- | --- | --- |
| Docker Compose (empfohlen) | Dauerbetrieb, einfache Updates und persistente Daten | Docker Engine + Docker Compose |
| Release-Paket | Betrieb ohne Node.js und Build-Werkzeuge | Windows x64 oder Linux x64/ARM64 |
| Aus dem Quellcode | Entwicklung und Anpassungen | Node.js 22.5+, Git und native Build-Werkzeuge |
### Docker Compose (empfohlen)
```bash
git clone --depth 1 https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
docker compose pull
docker compose up -d
```
Nach dem Start ist WebSpeak unter `http://<dein-host>:3040` erreichbar. Bei einem Reverse Proxy auf diese Adresse zeigen; für WebRTC den im Adminbereich angezeigten UDP-Bereich freigeben. Die Daten liegen im Volume `webspeak-data`.
```bash
docker compose ps
docker compose logs -f webspeak
```
Upgrade:
```bash
git pull --ff-only
docker compose pull
docker compose up -d
```
`docker compose down -v` nicht ausführen, da dadurch Datenbank und Administratoreinstellungen gelöscht werden.
### Release-Paket
Das passende `windows-x64.zip`, `linux-x64.tar.gz` oder `linux-arm64.tar.gz` aus den [GitHub Releases](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/latest) herunterladen und den enthaltenen Starter ausführen. Die Pakete enthalten Node.js und Produktionsabhängigkeiten. Docker unterstützt amd64/arm64.
Android-APKs für `arm64-v8a`, `armeabi-v7a` und `x86_64` sind ebenfalls verfügbar. Sie sind für Tests per Sideload debug-signiert, keine Google-Play-Pakete; echte TeamSpeak-Sprachtests auf Geräten stehen noch aus.
### Aus dem Quellcode
```bash
git clone https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
npm ci --ignore-scripts
npm run prepare:sdk
npm rebuild @discordjs/opus --foreground-scripts
npm --prefix web ci
npm --prefix web run build
npm run build
npm start
```
Für den Bau von `@discordjs/opus` werden Python, Make und eine C/C++-Toolchain benötigt.
### Erste Konfiguration
1. `http://<dein-host>:3040/admin` öffnen.
2. Mit `admin` / `admin` anmelden und sofort ein neues Passwort mit mindestens 12 Zeichen setzen.
3. Unter **Server** TeamSpeak-Ziel und Zugriffsmethode konfigurieren, zum Beispiel `voice.example.com#9987`.
4. Für öffentliche Nutzung HTTPS einrichten; bei aktiviertem WebRTC den im Adminbereich angezeigten UDP-Bereich freigeben.
## ⚠️ Voraussetzungen und Hinweise
| Bereich | Hinweis |
| --- | --- |
| Browser | Aktuelles Chrome, Edge oder ein moderner WebRTC-fähiger Browser wird empfohlen. Mikrofon- und Fenster-Audio benötigen normalerweise HTTPS. |
| TeamSpeak-Netzwerk | Der WebSpeak-Host muss den Zielserver erreichen können; der Standard-Sprachport ist `9987`. |
| Webnetzwerk | Der Dienst verwendet `3040/TCP`; öffentlich sollte ein HTTPS-Reverse-Proxy für Seite und WebSocket verwendet werden. |
| IPv6 | Literale Ziele als `[2001:db8::1]#9987` eintragen. Host/Container benötigen geroutetes IPv6, aktiviertes IPv6 in Betriebssystem und Node.js sowie passende Firewall-Regeln. |
| WebRTC | Standardbereich `40000–40099/UDP`; den gesamten Bereich freigeben und WebRTC vor einer Änderung deaktivieren. |
| Gespeicherte Identität | Eine Browseridentität kann nur eine aktive gespeicherte Verbindung halten. Für parallele Verbindungen deaktivieren oder ein anderes Browserprofil verwenden. |
| Begleitton | Nur auf dem Desktop verfügbar und WebRTC erforderlich. Bei Fenster- oder Tab-Freigabe auch Audio freigeben. |
| 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
- 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.
- [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.
+343
View File
@@ -0,0 +1,343 @@
# WebSpeak · English
[Project home](../README.md) · [简体中文](./README.zh-CN.md) · [Deutsch](./README.de.md) · [Русский](./README.ru.md) · [日本語](./README.ja.md)
WebSpeak is a self-hosted browser client and voice gateway for TeamSpeak 3 and TeamSpeak 6. Visitors can join channels without installing a desktop client, while administrators manage the target servers, access policy, and runtime state from the web console.
Latest release: [read the 0.2.8 changelog on this page](#latest-release-notes).
Skin authors should start with the [current skin development guide](./SKIN_DEVELOPMENT.md), which combines the `.wskin` package format, current runtime APIs, permission boundaries, and authoring workflow. The repository also includes the [WebSpeak skin development skill for agents](../.agents/skills/webspeak-skin-development/SKILL.md).
## Live demo
- Shanghai: <https://shanghai.webspeak.online>
- Hong Kong: <https://webspeak.online>
Network conditions and load may vary at either demo. Latency, disconnections, or temporary downtime do not represent every self-hosted deployment.
## ✨ Features
| Capability | Description |
| --- | --- |
| TeamSpeak compatibility | Supports TeamSpeak 3 and TeamSpeak 6 and automatically detects the target protocol. |
| Cross-platform P2P screen sharing | Browser users and native TeamSpeak 6 clients can start and watch each other's screen shares; WebRTC/ICE carries media directly while WebSpeak relays negotiation signaling only. |
| IPv6 targets | IPv6 TeamSpeak targets and IPv6 addresses resolved from hostnames are supported by default. |
| Channels and members | Browse the channel tree, see live member states, and switch channels. |
| Realtime voice | Opus audio with a compatibility transport and optional bundled WebRTC low-latency transport. |
| Audio controls | Select microphones and speakers, adjust volume, test the microphone, mute, use VOX, and control member volume. |
| Browser-side noise suppression | Optional microphone noise suppression runs at the browser capture stage, without adding server-side audio processing. |
| Messaging and actions | Channel chat, server chat, private messages, poke actions, and whisper targets. |
| Desktop accompaniment | Select an audio-enabled window or browser tab and share its sound with the current channel. |
| Identity and access | Remembered identity, visitor-defined targets, revocable expiring invite links, and TeamSpeak 3 identity import, conversion, validation, and export. |
| Administration | Manage targets, access policy, public media address, IPv6 candidates, voice STUN, relays, invites, sessions, logs, diagnostics, and backups. |
| Engineering structure | In 0.2.6, gateway voice, session events, audio, and screen-share coordination were split into modules; frontend voice and admin pages were decomposed into components, composables, and services, with lifecycle and reconnect tests. |
| Skins | Protected Day, Night, and ILLUSIA skins, plus instance-managed `.wskin` appearances with administrator enable/default controls. |
| User experience | Chinese, English, German, Russian, and Japanese UI with responsive desktop/mobile layouts. |
| Self-hosting | Data stays with the operator; packages include Windows x64 and Linux x64/ARM64, Docker supports amd64/arm64, and Android APKs target arm64-v8a, armeabi-v7a, and x86_64. |
## 🖼️ Screenshots
The screenshots show the English welcome page, voice workspace, audio controls, and member menu.
### Welcome page
<p align="center"><img src="./screenshots/webspeak-en-home.png" alt="WebSpeak English welcome page" width="100%" /></p>
### Voice workspace
<p align="center"><img src="./screenshots/webspeak-en.png" alt="WebSpeak English voice workspace" width="100%" /></p>
### Audio controls
<p align="center"><img src="./screenshots/webspeak-en-audio.png" alt="WebSpeak English audio controls" width="100%" /></p>
### Member menu
<p align="center"><img src="./screenshots/webspeak-en-menu.png" alt="WebSpeak English member menu" width="100%" /></p>
## 🧩 Advanced features
These features are optional. WebSpeak continues to work with the compatibility voice transport when they are disabled. Configure them under **Administration → Servers**; saved changes apply to new connections.
### 1. WebRTC low-latency voice
WebRTC moves browser voice to a realtime media path and also enables desktop accompaniment. The current WebSpeak gateway provides it directly; no separate media server is required.
1. Sign in at `/admin` and open **Advanced settings** on the **Servers** page.
2. While WebRTC is disabled, choose the UDP start and end ports. The default range is `40000–40099`.
3. Allow the complete UDP range in the WebSpeak host's security group and firewall.
4. Enable **WebRTC** and save. New visitors will negotiate WebRTC; unsupported browsers and networks fall back to the compatibility transport.
The port range is locked while WebRTC is enabled. Disable and save WebRTC before changing it, then update the firewall rules. Public deployments also need HTTPS.
### Voice WebRTC behind a reverse proxy or TCP tunnel
The WebRTC advanced settings now include a **public media address**, **IPv6 candidates**, and a **voice STUN server**. The media address must be a gateway IP or hostname reachable over UDP, without a scheme, path or port. It overrides the address inferred from `Origin`, `X-Forwarded-Host`, or `Host`; DNS names are resolved into IP candidates. IPv6 is opt-in and retains IPv4 candidates.
Set a UDP STUN URL such as `stun:turn.teamspeak.com:3478` to use the same discovery service in the browser and gateway. Empty preserves the previous behavior: the gateway library uses its built-in STUN service while the browser has none. The gateway requires an IPv4-reachable UDP STUN hostname or IPv4 address; IPv6 literals and TURN credentials are not accepted. IPv6 media candidates work independently of STUN. Save and reconnect to apply changes.
HTTP/WebSocket reachability does not imply media reachability. Allow the complete configured UDP range and preserve port numbers when using static port forwarding. STUN discovers mappings but cannot relay audio or traverse every NAT. Deployments with only a TCP tunnel and no usable UDP/IPv6 path still fall back to compatibility transport.
### Screen-share ICE candidates
Screen-share media still prefers a direct browser-to-browser path; WebSpeak only relays negotiation signaling. By default it uses TeamSpeak's public STUN services to discover server-reflexive candidates; STUN does not carry media. If the deployment has an authorized external TURN service, set `WEBSPEAK_SCREEN_SHARE_ICE_SERVERS` before starting WebSpeak with a JSON array, for example:
```json
[{"urls":"stun:turn.teamspeak.com:3478"},{"urls":"turns:turn.example.com:5349","username":"<username>","credential":"<credential>"}]
```
With TURN configured, media may use that external TURN service but never the WebSpeak gateway; without it, only direct ICE paths and STUN are used.
### Cross-platform P2P screen sharing
Browser users and native TeamSpeak 6 clients can discover, start, and watch each other's screen shares. Screen media between browsers, and between a browser and a native client, is sent over a WebRTC/ICE peer-to-peer path whenever possible; WebSpeak handles session authorization, share state, and SDP/ICE signaling, but does not carry the screen media. The UI includes live status, viewer count, player volume, fullscreen, and exit controls. Share settings support up to 1080p and 60 FPS, with live WebRTC statistics for diagnosis.
### 2. Relay mode
Use a relay when a TeamSpeak server rejects connections from another region or when the direct path is unstable. It is not a VPN: it forwards only the TeamSpeak traffic of the current WebSpeak session, while the visitor still chooses the target server in the web page.
A relay instance is a dedicated forwarding service with no visitor page or administration console. It accepts only gateway sessions with a matching token. Use a random token of at least 16 characters.
#### Run from source
```bash
git clone --depth 1 https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
npm ci --ignore-scripts
npm run prepare:sdk
npm run build
WEBSPEAK_MODE=relay \
WEBSPEAK_RELAY_TOKEN='replace-with-a-long-random-token' \
WEBSPEAK_RELAY_HOST='0.0.0.0' \
WEBSPEAK_RELAY_PORT='39087' \
node dist/index.js
```
Windows PowerShell:
```powershell
$env:WEBSPEAK_MODE = "relay"
$env:WEBSPEAK_RELAY_TOKEN = "replace-with-a-long-random-token"
$env:WEBSPEAK_RELAY_HOST = "0.0.0.0"
$env:WEBSPEAK_RELAY_PORT = "39087"
node .\dist\index.js
```
#### Run from a release package
Download and extract the appropriate package from [Releases](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/latest):
```bash
# Linux
export WEBSPEAK_MODE=relay
export WEBSPEAK_RELAY_TOKEN='replace-with-a-long-random-token'
export WEBSPEAK_RELAY_HOST='0.0.0.0'
export WEBSPEAK_RELAY_PORT='39087'
./runtime/node ./dist/index.js
```
On Windows PowerShell, set the same variables and run `.\runtime\node.exe .\dist\index.js`.
#### Run with Docker
```bash
docker run -d --name webspeak-relay --restart unless-stopped --network host \
-e WEBSPEAK_MODE=relay \
-e WEBSPEAK_RELAY_TOKEN='replace-with-a-long-random-token' \
-e WEBSPEAK_RELAY_PORT='39087' \
ghcr.io/echosixhiya/webspeak:latest
```
Allow the relay host's UDP listen port, `39087` by default.
#### Enable it in the gateway
1. Open **Administration → Servers → Relay server** and add one or more nodes.
2. Set a custom display name, endpoint such as `relay.example.com#39087`, and matching token for each node, then save.
3. Visitors can choose direct access or one of the configured relays on the welcome page.
Disable and save the relay configuration to remove the relay option from the welcome page.
### 3. Dependencies and attribution
- The relay service is built into WebSpeak with Node.js standard libraries; it does not use GOST, sing-box, or another proxy framework.
- WebRTC uses [werift](https://github.com/shinyoshiaki/werift-webrtc) `0.24.4`, whose upstream project is licensed under MIT.
- TeamSpeak protocol connectivity uses the project-maintained [EchoSixHIYA/teamspeak-js](https://github.com/EchoSixHIYA/teamspeak-js) SDK fork.
## 🧾 Changelog
<a id="latest-release-notes"></a>
### [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8) · 2026-10-17
#### Screen sharing and connection reliability
- Fixed negotiation and video-track handling for screen sharing between browsers and native TeamSpeak clients.
- Improved handling of rapid channel switches to reduce inconsistent client state.
- Fixed content rendering in some skin components and localization in the KAAK skin.
#### Interface improvements
- Audio device names now display in full and wrap when space is limited, making long names easier to distinguish.
- Fixed avatar fallback text being selected unintentionally.
### [v0.2.7](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.7) · 2026-10-13
#### A more open skin system
- A more open skin editor and runtime now let authors customize the style and position of any component and add widgets.
- After entering the voice panel, open a new administrator-console window in the same browser and sign in to activate the skin editor.
- The KAAK skin is included as a development example.
- Updated the skin development Agent Skill.
#### Enhancements
- Server addresses can now be resolved through SRV records and TeamSpeak Nickname entries.
- Free mode supports managing multiple server tabs; these controls are unavailable in fixed-server mode.
- Added a screen-share bitrate option.
- WebSpeak now saves entered channel passwords in the browser.
- Locked channels now show a lock icon.
- Chat history is now stored persistently.
#### Bug fixes
- Fixed address parsing.
- Fixed focus conflicts between volume controls and dragging member cards.
- Fixed user status being incorrectly parsed as unknown.
### [v0.2.6](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.6) · 2026-10-08
Relative to 0.2.5, broadly refactored gateway voice, shared protocol, frontend voice workspace, and admin modules; fixed #6/#7/#10, implemented #9/#12 settings, and fixed the existing-TS6-share discovery case reported in PR #13. Improved Opus/session lifecycles and mobile controls. Packages: Windows x64, Linux x64/ARM64, Docker amd64/arm64, and Android arm64-v8a/armeabi-v7a/x86_64.
### [v0.2.5](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.5) · 2026-09-27
Added `.wskin` skins, administrator enable/default controls, and protected Day/Night/ILLUSIA built-ins; removed the unfinished Aurora Voice sample, fixed skin-load flashes, dark-control contrast, and voice-room artwork layering, and added the official skin-development Agent Skill.
### [v0.2.4](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.4) · 2026-09-22
Added cross-platform P2P screen sharing between browsers and native TeamSpeak 6 clients; added STUN/external-TURN configuration, live player and viewer state, 1080p/60 FPS capture settings, and WebRTC statistics; refined screen-share interactions and added visitor numbering.
### [v0.2.3](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.3) · 2026-09-19
Added channel member scheduling and permission-aware direct moves; added avatar, mute-state, and remembered-identity support; refreshed feature screenshots and documentation for all five languages.
### [v0.2.2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.2) · 2026-09-17
Added browser-side microphone noise suppression, Russian and Japanese UI, and per-language welcome text; refined volume interaction and error messages/codes on top of PR #2.
### [v0.2.1](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.1) · 2026-09-13
Improved welcome-page connection errors, preserved and safely truncated error codes, and added default IPv6 target support.
### [v0.2.0](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.0) · 2026-09-10
Added server-password prompts, formal relay mode, multiple relay selection, and administrator connection-reason reporting.
### [v0.1.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.8) · 2026-09-08
Simplified Docker deployment, supported local TeamSpeak targets, added a 15-second connection timeout, and made network monitoring continuous.
### [v0.1.7](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.7) · 2026-09-06
Added German, Telegram, network performance, and master-volume features; fixed accompaniment volume fluctuation.
### [v0.1.6](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.6) · 2026-09-04
Added desktop accompaniment, remembered-identity guidance, and the site icon; fixed WebRTC member volume.
### [v0.1.5](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.5) · 2026-09-04
Fixed identity persistence and refined the theme toggle.
### [v0.1.4](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.4) · 2026-09-03
Fixed WebRTC and channel chat and refined administration, logs, and mobile layouts.
### [v0.1.3](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.3) · 2026-09-03
Added bundled WebRTC, migrated the TeamSpeak SDK, and improved member synchronization and voice buffering.
## 🚀 Deployment
| Method | Best for | Environment |
| --- | --- | --- |
| Docker Compose (recommended) | Long-running servers, simple upgrades, and persistent data | Docker Engine + Docker Compose |
| Release package | Running without Node.js or build dependencies | Windows x64 or Linux x64/ARM64 |
| From source | Development, debugging, and customization | Node.js 22.5+, Git, and native build tools |
### Docker Compose (recommended)
```bash
git clone --depth 1 https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
docker compose pull
docker compose up -d
```
Open `http://<your-host>:3040` after startup. If using a reverse proxy, point it to that address. When WebRTC is enabled, allow the UDP range shown in the administration console. Data is stored in the `webspeak-data` volume.
```bash
docker compose ps
docker compose logs -f webspeak
```
Upgrade:
```bash
git pull --ff-only
docker compose pull
docker compose up -d
```
Do not run `docker compose down -v`; it removes the database and administrator settings.
### Release package
Download the matching `windows-x64.zip`, `linux-x64.tar.gz`, or `linux-arm64.tar.gz` from [GitHub Releases](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/latest). Extract it and run the included launcher. Packages include the Node.js runtime and production dependencies. Docker images support amd64/arm64.
Android APKs for `arm64-v8a`, `armeabi-v7a`, and `x86_64` are also attached. They use debug signing for sideload testing; they are not Google Play packages, and real-device voice still needs validation.
### From source
```bash
git clone https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
npm ci --ignore-scripts
npm run prepare:sdk
npm rebuild @discordjs/opus --foreground-scripts
npm --prefix web ci
npm --prefix web run build
npm run build
npm start
```
Building `@discordjs/opus` requires Python, Make, and a C/C++ toolchain.
### First-time setup
1. Open `http://<your-host>:3040/admin`.
2. Sign in with `admin` / `admin` and immediately set a new password of at least 12 characters.
3. Configure the TeamSpeak target and access mode under **Servers**, for example `voice.example.com#9987`.
4. Configure HTTPS for public access; when WebRTC is enabled, allow the UDP range shown in the console.
## ⚠️ Requirements and notes
| Area | Requirement or note |
| --- | --- |
| Browser | Use a current Chrome, Edge, or other modern browser with WebRTC support. Microphone and window audio normally require HTTPS. |
| TeamSpeak network | The WebSpeak host must reach the target TeamSpeak server; the default voice port is `9987`. |
| Web network | The service uses `3040/TCP`; public deployments should expose the page and WebSocket through an HTTPS reverse proxy. |
| IPv6 | Write literal targets as `[2001:db8::1]#9987`. The host/container needs routed IPv6, IPv6 enabled in the OS and Node.js, and the relevant firewall rules. |
| WebRTC | The default range is `40000–40099/UDP`; allow it and disable WebRTC before changing the range. |
| Remembered identity | One browser identity can hold one active remembered connection. Disable it for parallel connections or use another browser profile. |
| Accompaniment | Desktop only and requires WebRTC. Enable audio sharing when selecting a window or tab. |
| 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
- 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.
- [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.
+222
View File
@@ -0,0 +1,222 @@
# WebSpeak · 日本語
[プロジェクトトップ](../README.md) · [简体中文](./README.zh-CN.md) · [English](./README.en.md) · [Deutsch](./README.de.md) · [Русский](./README.ru.md)
## プロジェクト概要
最新リリース:[v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8)。
| 観点 | 説明 |
| --- | --- |
| **WHAT** | WebSpeak は TeamSpeak 3 / TeamSpeak 6 向けのセルフホスト型ブラウザクライアント兼音声ゲートウェイです。 |
| **WHY** | デスクトップクライアントをインストールせず、ブラウザからチャンネルに参加できます。運用者はサーバーとデータを管理できます。 |
| **HOW** | 起動後、管理コンソールで TeamSpeak の接続先とアクセス方針を設定します。ブラウザが画面と音声を担当し、WebSpeak がゲートウェイとして接続します。 |
## オンラインデモ
- 上海: <https://shanghai.webspeak.online>
- 香港: <https://webspeak.online>
各デモのネットワークや負荷は変動する場合があります。遅延、切断、一時的な利用不可は各自の環境での動作を示すものではありません。
## ✨ 機能
| 機能 | 説明 |
| --- | --- |
| TeamSpeak | TeamSpeak 3 / 6 に対応し、対象プロトコルを自動検出します。 |
| クロスプラットフォーム P2P 画面共有 | ブラウザユーザーと TeamSpeak 6 ネイティブクライアントが互いに画面共有を開始・視聴できます。メディアは WebRTC/ICE で直接送信し、WebSpeak はシグナリングだけを中継します。 |
| IPv6 | IPv6 の接続先と DNS から解決された IPv6 アドレスに標準対応します。 |
| チャンネルとメンバー | チャンネルツリー、リアルタイムのメンバー状態、チャンネル移動。 |
| リアルタイム音声 | Opus、互換トランスポート、内蔵 WebRTC による低遅延音声。 |
| 音声操作 | マイク、スピーカー、音量、VOX、ミュート、メンバーごとの音量調整。 |
| ブラウザ側ノイズ抑制 | マイクのノイズ抑制をブラウザの音声取得段階で任意に使用でき、サーバー側の追加処理は不要です。 |
| チャットと操作 | チャンネル/サーバーチャット、個人メッセージ、つつく、ウィスパー対象。 |
| BGM共有 | デスクトップブラウザで音声付きウィンドウやタブの音をチャンネルに共有。 |
| ID とアクセス | ID の保存、接続先の指定、期限・回数付き招待リンクに加え、TeamSpeak 3 ID のインポート、変換、検証、エクスポート。 |
| 管理コンソール | 接続先、アクセス、公開メディアアドレス、IPv6 候補、音声 STUN、中継、招待、セッション、ログ、診断、バックアップ。 |
| プロジェクト構造 | 0.2.6 では音声ゲートウェイ、セッションイベント、音声処理、画面共有調整を分割し、音声・管理画面をコンポーネント、composable、サービスに整理しました。ライフサイクルと再接続のテストも追加しました。 |
| スキン | 保護された昼・夜・ILLUSIA スキンに加え、管理者が有効化とデフォルトを管理するインスタンス `.wskin` に対応。 |
| インターフェース | 中文、English、Deutsch、Русский、日本語、レスポンシブ表示。 |
| デプロイ | Windows x64、Linux x64/ARM64 パッケージ、Docker amd64/arm64、Android arm64-v8a・armeabi-v7a・x86_64 APK。 |
## 🖼️ インターフェースのスクリーンショット
日本語のホーム、音声ワークスペース、オーディオ設定、メンバー操作メニューを掲載しています。
### ホーム
<p align="center"><img src="./screenshots/webspeak-ja-home.png" alt="WebSpeak 日本語ホーム" width="100%" /></p>
### 音声ワークスペース
<p align="center"><img src="./screenshots/webspeak-ja.png" alt="WebSpeak 日本語音声ワークスペース" width="100%" /></p>
### オーディオ設定
<p align="center"><img src="./screenshots/webspeak-ja-audio.png" alt="WebSpeak 日本語オーディオ設定" width="100%" /></p>
### メンバーメニュー
<p align="center"><img src="./screenshots/webspeak-ja-menu.png" alt="WebSpeak 日本語メンバーメニュー" width="100%" /></p>
## 🧩 高度な機能
### WebRTC
**管理コンソール → サーバー → 詳細設定** で有効にします。無効の状態で UDP ポート範囲(初期値 `40000–40099`)を設定し、ファイアウォールで許可して保存してください。有効中は範囲がロックされ、新しい接続で WebRTC を使用します。非対応のブラウザは互換トランスポートに戻ります。公開サイトでは HTTPS が必要です。
### 画面共有の ICE 候補
画面共有のメディアは引き続きブラウザ間の直接接続を優先し、WebSpeak はシグナリングだけを中継します。初期状態では TeamSpeak の公開 STUN サービスで外部候補を検出します。STUN はメディアを運びません。認可済みの外部 TURN を使う場合は、起動前に `WEBSPEAK_SCREEN_SHARE_ICE_SERVERS` を JSON 配列で設定できます。
```json
[{"urls":"stun:turn.teamspeak.com:3478"},{"urls":"turns:turn.example.com:5349","username":"<username>","credential":"<credential>"}]
```
TURN を設定した場合、メディアは外部 TURN サービスを経由することがありますが、WebSpeak ゲートウェイは経由しません。未設定時は直接接続と STUN のみを使用します。
### クロスプラットフォーム P2P 画面共有
ブラウザユーザーと TeamSpeak 6 ネイティブクライアントは、互いの画面共有を検出・開始・視聴できます。ブラウザ間、およびブラウザとネイティブクライアント間の画面メディアは、可能な限り WebRTC/ICE の直接接続で送信されます。WebSpeak はセッション認証、共有状態、SDP/ICE シグナリングを担当しますが、画面メディア自体は転送しません。画面には配信中の状態と視聴者数が表示され、音量、全画面、終了を操作できます。取得設定は最大 1080p / 60 FPS に対応し、WebRTC 統計も確認できます。
### 中継サーバー
中継は現在の WebSpeak セッションの TeamSpeak 通信だけを転送し、VPN ではありません。管理コンソールで複数のノードに名前、アドレス、トークンを設定すると、ユーザーは直接接続または中継を選択できます。中継モードは専用の転送サービスとして動作し、ゲスト画面や管理コンソールを提供しません。
中継サービスは WebSpeak に組み込まれており、Node.js の標準ライブラリを使用します。GOST や sing-box などのプロキシフレームワークは不要です。WebRTC は [werift](https://github.com/shinyoshiaki/werift-webrtc)、TeamSpeak 接続はプロジェクトが保守する [EchoSixHIYA/teamspeak-js](https://github.com/EchoSixHIYA/teamspeak-js) SDK を使用します。
## 🚀 デプロイ
| 方法 | 用途 |
| --- | --- |
| Docker Compose | 常時稼働サーバーと簡単な更新 |
| Release パッケージ | Node.js やビルドツールを使わない起動 |
| ソースから | 開発やカスタマイズ |
### Docker Compose
```bash
git clone --depth 1 https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
docker compose pull
docker compose up -d
```
起動後に `http://<your-host>:3040/admin` を開き、`admin` / `admin` でログインして直ちにパスワードを変更し、TeamSpeak を設定します。データは `webspeak-data` volume に保存されます。データベースを消さない場合は `docker compose down -v` を実行しないでください。
### Release パッケージ
[Releases](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/latest) から `windows-x64.zip`、`linux-x64.tar.gz`、`linux-arm64.tar.gz` のいずれかを取得し、同梱ランチャーを実行します。Docker は amd64/arm64 に対応します。`arm64-v8a`、`armeabi-v7a`、`x86_64` の Android APK もあります。APK は手動インストールとテスト向けのデバッグ署名で、Google Play 用ではありません。実機 TeamSpeak 音声は未検証です。
### ソースから
```bash
npm ci --ignore-scripts
npm run prepare:sdk
npm rebuild @discordjs/opus --foreground-scripts
npm --prefix web ci
npm --prefix web run build
npm run build
npm start
```
## ⚠️ 要件と注意
- ソースからのビルドには Node.js `>=22.5` が必要です。Docker と Release には必要な実行環境が含まれます。
- WebRTC に対応した最新の Chrome、Edge などを使用してください。マイクとウィンドウ音声には通常 HTTPS が必要です。
- WebSpeak のホストから TeamSpeak に到達できる必要があります。標準音声ポートは `9987` です。
- Web サービスは `3040/TCP` を使用します。公開時は HTTPS と WebSocket をリバースプロキシ経由で公開してください。
- IPv6 にはルーティング可能な IPv6、OS/コンテナで有効な IPv6、適切なファイアウォール設定が必要です。リテラルは `[2001:db8::1]#9987` の形式です。
- 保存したブラウザ ID は同じブラウザで同時に1接続だけ使用できます。
- BGM共有はデスクトップのみで、WebRTC が必要です。
## コミュニティと関連プロジェクト
- [QQ グループ](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=yhumUMDD9PmyYFWdXWUb_x7hM5trFQY8&authKey=Pw3HBGT7GwMinTQnuFGfnpf0aRSzXOJKcAiujVP1%2BXMpjheAKrncTRivicBJxpjV&noverify=0&group_code=869500475)
- [Telegram グループ](https://t.me/+8qShpTcuN9A3MWY9)
- [NeteaseTSBot](https://github.com/yichen11818/NeteaseTSBot) — Web コンソール付き TeamSpeak 音楽ボット。
## 🧾 更新履歴
<a id="latest-release-notes"></a>
### [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8) · 2026-10-17
#### 画面共有と接続の安定性
- ブラウザーと TeamSpeak ネイティブクライアント間の画面共有で、接続ネゴシエーションと映像トラックの処理を修正しました。
- チャンネルをすばやく切り替えた際の処理を改善し、クライアント状態の不整合を減らしました。
- 一部スキンコンポーネントの内容表示と KAAK の多言語表示を修正しました。
#### インターフェースの改善
- 音声デバイス名を省略せず表示し、幅が足りない場合は折り返して、長い名前を判別しやすくしました。
- アバターの代替テキストが誤って選択される問題を修正しました。
### [v0.2.7](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.7) · 2026-10-13
#### より開かれたスキンシステム
- より開かれたスキン編集・実行環境を提供し、任意のコンポーネントのスタイルや配置を変更したり、ウィジェットを追加したりできるようになりました。
- 音声パネルに入った後、同じブラウザーで管理画面を新しいウィンドウに開いてログインすると、スキンエディターが有効になります。
- 開発例として「KAAK」スキンを同梱しました。
- スキン開発 Agent Skill を更新しました。
#### 機能強化
- SRV レコードと TeamSpeak Nickname 形式のサーバーアドレス解決に対応しました。
- 自由モードでは複数サーバーのタブを管理できます。このボタンは「固定サーバー」モードでは使用できません。
- 画面共有にビットレート設定を追加しました。
- 入力したチャンネルパスワードを WebSpeak がブラウザーに保存するようになりました。
- ロックされたチャンネルの前に鍵アイコンを表示します。
- チャット履歴を永続的に保存するようになりました。
#### バグ修正
- アドレス解析の不具合を修正しました。
- 音量操作とメンバーカードのドラッグでフォーカスが競合する問題を修正しました。
- ユーザーステータスが誤って「不明」と解析される問題を修正しました。
### [v0.2.6](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.6) · 2026-10-08
0.2.5 から音声ゲートウェイ、共有プロトコル、音声ワークスペース、管理モジュールを大規模に再構成。#6/#7/#10 を修正し、#9/#12 を実装。PR #13 が報告した既存 TS6 画面共有の検出漏れも修正しました。Opus、セッションのライフサイクル、モバイル操作を改善。Windows x64、Linux x64/ARM64、Docker amd64/arm64、Android arm64-v8a/armeabi-v7a/x86_64 APK を提供。
### [v0.2.5](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.5) · 2026-09-27
`.wskin` スキン、管理者向けの有効化/デフォルト設定、保護された昼・夜・ILLUSIA 内蔵スキンを追加。未完成の Aurora Voice サンプルを削除し、読み込み時のちらつき、ダークモードの視認性、音声画面のアートレイヤーを修正。公式スキン開発 Agent Skill も追加しました。
### [v0.2.4](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.4) · 2026-09-22
ブラウザと TeamSpeak 6 ネイティブクライアント間のクロスプラットフォーム P2P 画面共有を追加しました。STUN/外部 TURN 設定、プレーヤーと視聴者状態、1080p/60 FPS 取得設定、WebRTC 統計に対応し、共有操作と訪問者番号も改善しました。
### [v0.2.3](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.3) · 2026-09-19
チャンネルメンバーの移動操作と権限に応じた直接移動を追加し、アバター表示、ミュート状態の同期、保存 ID の復元に対応しました。5 言語のスクリーンショットとドキュメントも更新しました。
### [v0.2.2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.2) · 2026-09-17
ブラウザ側マイクノイズ抑制、ロシア語・日本語 UI、言語別ウェルカム文を追加。音量操作と PR #2 を基にしたエラー表示・エラーコードを改善しました。
### [v0.2.1](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.1) · 2026-09-13
接続エラー表示を改善し、IPv6 接続先を標準対応しました。
### [v0.2.0](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.0) · 2026-09-10
パスワード案内、正式な中継モード、複数中継選択、接続診断を追加しました。
### [v0.1.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.8) · 2026-09-08
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) で拡大縮小、フローティングレイアウト、ホームのフッターを修正。
- [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 の登録済みニックネームによる接続に対応し、設定・お気に入り・招待リンクにニックネームの接続先を保持。
+224
View File
@@ -0,0 +1,224 @@
# WebSpeak · Русский
[Главная проекта](../README.md) · [简体中文](./README.zh-CN.md) · [English](./README.en.md) · [Deutsch](./README.de.md) · [日本語](./README.ja.md)
## О проекте
Последний выпуск: [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8).
| Логика | Описание |
| --- | --- |
| **WHAT** | WebSpeak — самостоятельно размещаемый веб-клиент и голосовой шлюз для TeamSpeak 3 и TeamSpeak 6. |
| **WHY** | Пользователям не нужно устанавливать настольный клиент: достаточно открыть браузер, а оператор сохраняет контроль над сервером и данными. |
| **HOW** | После запуска настройте цель TeamSpeak и политику доступа в панели администратора. Браузер отвечает за интерфейс и аудио, WebSpeak — за шлюз. |
## Онлайн-демо
Адреса:
- Шанхай: <https://shanghai.webspeak.online>
- Гонконг: <https://webspeak.online>
Сеть и нагрузка на обоих демо-серверах могут быть нестабильными. Задержки, разрывы или временная недоступность не характеризуют самостоятельное развертывание.
## ✨ Возможности
| Возможность | Описание |
| --- | --- |
| TeamSpeak | Поддержка TeamSpeak 3 и TeamSpeak 6 с автоматическим определением протокола. |
| Кроссплатформенная P2P-трансляция экрана | Пользователи браузера и нативные клиенты TeamSpeak 6 могут запускать и смотреть трансляции друг друга; медиаданные идут напрямую по WebRTC/ICE, а WebSpeak передаёт только сигнальные сообщения. |
| IPv6 | IPv6-цели и IPv6-адреса, полученные через DNS, поддерживаются по умолчанию. |
| Каналы и участники | Дерево каналов, состояние участников в реальном времени и переход между каналами. |
| Голос в реальном времени | Opus, совместимый транспорт и встроенный WebRTC с низкой задержкой. |
| Управление аудио | Микрофон, динамики, громкость, VOX, отключение микрофона и отдельная громкость участников. |
| Шумоподавление в браузере | Опциональное шумоподавление микрофона на этапе захвата в браузере без дополнительной обработки звука на сервере. |
| Чат и действия | Чат канала и сервера, личные сообщения, толчки и цели шёпота. |
| Фоновая музыка | На компьютере можно поделиться звуком окна или вкладки с текущим каналом. |
| Идентичность и доступ | Сохранение идентичности, собственные цели, приглашения с ограничением срока и числа использований, а также импорт, преобразование, проверка и экспорт идентификаторов TeamSpeak 3. |
| Панель администратора | Цели, доступ, публичный адрес медиа, IPv6-кандидаты, голосовой STUN, ретрансляторы, приглашения, сессии, логи, диагностика и резервные копии. |
| Структура проекта | В 0.2.6 голосовой шлюз, события сессий, аудио и координация демонстрации разделены на модули; голосовые и административные страницы — на компоненты, composables и сервисы. Добавлены тесты жизненного цикла и переподключения. |
| Скины | Защищённые дневная, ночная и ILLUSIA-темы, а также `.wskin` экземпляра с управлением включением и темой по умолчанию в панели администратора. |
| Интерфейс | 中文, English, Deutsch, Русский и 日本語, адаптивная верстка. |
| Развёртывание | Пакеты Windows x64 и Linux x64/ARM64, Docker amd64/arm64, Android APK для arm64-v8a, armeabi-v7a и x86_64. |
## 🖼️ Скриншоты интерфейса
Скриншоты показывают русскую главную страницу, голосовое пространство, настройки аудио и меню участника.
### Главная страница
<p align="center"><img src="./screenshots/webspeak-ru-home.png" alt="Главная страница WebSpeak на русском" width="100%" /></p>
### Голосовое пространство
<p align="center"><img src="./screenshots/webspeak-ru.png" alt="Русское голосовое пространство WebSpeak" width="100%" /></p>
### Настройки аудио
<p align="center"><img src="./screenshots/webspeak-ru-audio.png" alt="Настройки аудио WebSpeak на русском" width="100%" /></p>
### Меню участника
<p align="center"><img src="./screenshots/webspeak-ru-menu.png" alt="Меню участника WebSpeak на русском" width="100%" /></p>
## 🧩 Расширенные функции
### WebRTC
Включается в **Панель администратора → Сервер → Расширенные настройки**. До включения задайте диапазон UDP-портов (по умолчанию `40000–40099`), откройте его в firewall и сохраните. При включённом WebRTC диапазон заблокирован; новые подключения используют WebRTC, а неподдерживаемые браузеры переходят на совместимый транспорт. Для публичного доступа нужен HTTPS.
### ICE для демонстрации экрана
Медиа демонстрации экрана по-прежнему предпочитает прямое соединение между браузерами; WebSpeak только передаёт сигнальные сообщения. По умолчанию используются публичные STUN-серверы TeamSpeak для поиска внешних кандидатов, STUN не передаёт медиаданные. Авторизованный внешний TURN можно задать через `WEBSPEAK_SCREEN_SHARE_ICE_SERVERS` в виде JSON-массива, например:
```json
[{"urls":"stun:turn.teamspeak.com:3478"},{"urls":"turns:turn.example.com:5349","username":"<username>","credential":"<credential>"}]
```
При настроенном TURN медиа может идти через этот внешний сервис, но не через шлюз WebSpeak. Без TURN используются только прямые ICE-пути и STUN.
### Кроссплатформенная P2P-трансляция экрана
Пользователи браузера и нативные клиенты TeamSpeak 6 могут обнаруживать, запускать и смотреть трансляции друг друга. Между браузерами, а также между браузером и нативным клиентом, экран передаётся по прямому соединению WebRTC/ICE, когда это возможно; WebSpeak отвечает за авторизацию сессии, состояние трансляции и передачу SDP/ICE-сигналов, но не переносит медиаданные экрана. Интерфейс показывает статус трансляции и число зрителей и предоставляет регулировку громкости, полноэкранный режим и выход. Для захвата доступны настройки до 1080p и 60 FPS, а также статистика WebRTC.
### Ретрансляторы
Ретранслятор передаёт только TeamSpeak-трафик текущей сессии и не является VPN. В панели администратора добавьте один или несколько узлов, задайте имя, адрес и токен. Пользователь сможет выбрать прямое подключение или настроенный ретранслятор. Режим ретранслятора запускается отдельно и не предоставляет страницу посетителя или панель администратора.
Сервис ретрансляции встроен в WebSpeak и использует стандартные библиотеки Node.js; GOST, sing-box и другие прокси-фреймворки не требуются. WebRTC использует [werift](https://github.com/shinyoshiaki/werift-webrtc), а TeamSpeak — поддерживаемый проектом [SDK EchoSixHIYA/teamspeak-js](https://github.com/EchoSixHIYA/teamspeak-js).
## 🚀 Развертывание
| Способ | Подходит для |
| --- | --- |
| Docker Compose | Постоянного сервера и простых обновлений |
| Пакет Release | Запуска без Node.js и инструментов сборки |
| Из исходников | Разработки и настройки проекта |
### Docker Compose
```bash
git clone --depth 1 https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
docker compose pull
docker compose up -d
```
После запуска откройте `http://<ваш-хост>:3040/admin`, войдите с `admin` / `admin`, сразу смените пароль и настройте TeamSpeak. Данные хранятся в volume `webspeak-data`. Не используйте `docker compose down -v`, если не хотите удалить базу и настройки.
### Пакет Release
Скачайте подходящий пакет `windows-x64.zip`, `linux-x64.tar.gz` или `linux-arm64.tar.gz` из [Releases](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/latest) и запустите приложенный скрипт. Docker поддерживает amd64/arm64. Также доступны Android APK для `arm64-v8a`, `armeabi-v7a` и `x86_64`; они подписаны отладочным ключом для ручной установки и тестирования, а не для Google Play. Голос TeamSpeak на реальных устройствах пока не проверен.
### Из исходников
```bash
npm ci --ignore-scripts
npm run prepare:sdk
npm rebuild @discordjs/opus --foreground-scripts
npm --prefix web ci
npm --prefix web run build
npm run build
npm start
```
## ⚠️ Требования и замечания
- Node.js `>=22.5` нужен для сборки из исходников; Docker и Release уже содержат необходимые компоненты.
- Нужен современный Chrome, Edge или другой браузер с WebRTC. Микрофон и звук окна обычно требуют HTTPS.
- WebSpeak должен иметь доступ к TeamSpeak; стандартный голосовой порт — `9987`.
- Веб-сервис использует `3040/TCP`; для публичного сайта направьте HTTPS и WebSocket через обратный прокси.
- Для IPv6 нужен маршрутизируемый IPv6, включённый IPv6 в ОС/контейнере и правила firewall. Литерал задаётся как `[2001:db8::1]#9987`.
- Одна сохранённая браузерная идентичность может использоваться только одним активным подключением.
- Фоновая музыка доступна только на компьютере и требует WebRTC.
## Сообщество и проекты
- [QQ-группа](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=yhumUMDD9PmyYFWdXWUb_x7hM5trFQY8&authKey=Pw3HBGT7GwMinTQnuFGfnpf0aRSzXOJKcAiujVP1%2BXMpjheAKrncTRivicBJxpjV&noverify=0&group_code=869500475)
- [Telegram-группа](https://t.me/+8qShpTcuN9A3MWY9)
- [NeteaseTSBot](https://github.com/yichen11818/NeteaseTSBot) — музыкальный бот для TeamSpeak с веб-консолью.
## 🧾 История изменений
<a id="latest-release-notes"></a>
### [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8) · 2026-10-17
#### Демонстрация экрана и стабильность соединения
- Исправлены согласование соединения и обработка видеопотока при демонстрации экрана между браузерами и нативными клиентами TeamSpeak.
- Улучшена обработка быстрых переключений каналов, чтобы избежать несогласованного состояния клиента.
- Исправлено отображение содержимого некоторых компонентов скинов и локализации KAAK.
#### Улучшения интерфейса
- Названия аудиоустройств теперь отображаются полностью и переносятся при нехватке места, чтобы длинные названия было легче различать.
- Исправлено случайное выделение текста-заглушки аватара.
### [v0.2.7](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.7) · 2026-10-13
#### Более открытая система скинов
- Более открытый редактор и среда выполнения скинов позволяют настраивать стиль и расположение любых компонентов, а также добавлять виджеты.
- Откройте голосовую панель, затем в том же браузере откройте новое окно панели администратора и войдите в систему, чтобы активировать редактор скинов.
- Скин KAAK включён в комплект как пример для разработки.
- Обновлён Agent Skill по разработке скинов.
#### Улучшения функций
- Добавлено разрешение серверных адресов через записи SRV и записи TeamSpeak Nickname.
- В свободном режиме можно управлять вкладками нескольких серверов; эти кнопки недоступны в режиме фиксированного сервера.
- Добавлен выбор битрейта демонстрации экрана.
- WebSpeak теперь сохраняет введённые пароли каналов в браузере.
- Перед закрытыми паролем каналами отображается значок замка.
- История чата теперь хранится постоянно.
#### Исправления ошибок
- Исправлена ошибка разбора адресов.
- Устранён конфликт фокуса между регулировкой громкости и перетаскиванием карточек участников.
- Исправлена ошибочная классификация состояния пользователя как неизвестного.
### [v0.2.6](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.6) · 2026-10-08
Относительно 0.2.5 масштабно перестроены голосовой шлюз, общие протоколы, голосовая область и модули администратора; исправлены #6/#7/#10, реализованы #9/#12 и случай с обнаружением уже активной демонстрации TS6 из PR #13. Улучшены Opus, жизненные циклы сессий и мобильное управление. Пакеты: Windows x64, Linux x64/ARM64, Docker amd64/arm64, Android arm64-v8a/armeabi-v7a/x86_64.
### [v0.2.5](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.5) · 2026-09-27
Добавлены скины `.wskin`, управление включением и темой по умолчанию, а также защищённые темы «День», «Ночь» и ILLUSIA; удалён незавершённый пример Aurora Voice, исправлены мерцание при загрузке скина, контраст элементов в тёмном режиме и слои иллюстраций в голосовом пространстве; добавлен официальный Agent Skill для разработки скинов.
### [v0.2.4](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.4) · 2026-09-22
Добавлена кроссплатформенная P2P-трансляция экрана между браузерами и нативными клиентами TeamSpeak 6; добавлены настройка STUN/внешнего TURN, проигрыватель и состояние зрителей, захват до 1080p/60 FPS и статистика WebRTC; улучшено управление трансляцией и добавлен номер посетителя.
### [v0.2.3](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.3) · 2026-09-19
Добавлены управление перемещением участников и прямое перемещение с учётом прав; поддержаны аватары, синхронизация микрофона и восстановление идентичности; обновлены скриншоты и документация для пяти языков.
### [v0.2.2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.2) · 2026-09-17
Добавлены браузерное шумоподавление микрофона, русский и японский интерфейсы и отдельные тексты приветствия; улучшены управление громкостью и сообщения/коды ошибок на основе PR #2.
### [v0.2.1](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.1) · 2026-09-13
Улучшены ошибки на странице входа и добавлена поддержка IPv6-целей по умолчанию.
### [v0.2.0](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.0) · 2026-09-10
Добавлены подсказки пароля, режим ретранслятора, выбор нескольких узлов и диагностика подключений.
### [v0.1.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.8) · 2026-09-08
Упрощён 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) исправил масштабирование, плавающую компоновку и нижний колонтитул главной страницы.
- [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 и сохранение имени цели в настройках, избранном и приглашениях.
+345
View File
@@ -0,0 +1,345 @@
# WebSpeak · 简体中文
[返回项目首页](../README.md) · [English](./README.en.md) · [Deutsch](./README.de.md) · [Русский](./README.ru.md) · [日本語](./README.ja.md)
WebSpeak 是一个可自行部署的 TeamSpeak 3 / TeamSpeak 6 网页客户端与语音网关。用户无需安装桌面客户端即可从浏览器加入频道,管理员可以在控制台管理目标服务器、访问方式和运行状态。
皮肤开发请从[当前皮肤开发指南](./SKIN_DEVELOPMENT.md)开始。它整合 `.wskin` 包格式、当前运行时接口、权限边界和制作验收流程。Agent 工作流见[WebSpeak Skin Development Skill](../.agents/skills/webspeak-skin-development/SKILL.md)。
## 在线 Demo
- 上海节点:<https://shanghai.webspeak.online>
- 香港节点:<https://webspeak.online>
演示站点的网络和负载可能不稳定;延迟、断线或暂时不可用不代表自行部署后的实际表现。
最新版本:[查看本页的 0.2.8 更新日志](#latest-release-notes)。
## ✨ 特性
| 能力 | 说明 |
| --- | --- |
| TeamSpeak 兼容 | 支持 TeamSpeak 3 与 TeamSpeak 6,并自动探测目标服务器协议。 |
| 跨端 P2P 屏幕共享 | 支持浏览器用户与 TeamSpeak 6 原生客户端互相发起和观看屏幕共享;媒体优先通过 WebRTC/ICE 直连,WebSpeak 仅转发协商信令。 |
| IPv6 目标 | 默认支持 IPv6 TeamSpeak 目标和域名解析出的 IPv6 地址。 |
| 频道与成员 | 浏览频道树、查看实时成员状态并切换频道。 |
| 实时语音 | 使用 Opus,支持兼容传输和可选的内置 WebRTC 低延迟传输。 |
| 音频控制 | 选择麦克风与扬声器、调节音量、测试麦克风、闭麦、VOX 和成员独立音量。 |
| 浏览器端降噪 | 提供可开关的麦克风降噪,在浏览器采集端处理,不增加服务器端音频处理压力。 |
| 消息与互动 | 支持频道消息、服务器消息、私聊、戳一戳和耳语目标。 |
| 桌面端伴奏 | 在桌面浏览器选择带音频的窗口或标签页,将声音分享给当前频道。 |
| 身份与访问 | 支持身份保持、访客自定义目标、可撤销/可过期邀请链接,以及 TeamSpeak 3 身份导入、转换、校验与导出。 |
| 工程结构 | 0.2.6 将网关语音、会话事件、音频和屏幕共享拆分为独立模块;前端语音与管理页拆分为组件、composables 和服务,并补充生命周期与重连测试。 |
| 管理控制台 | 管理目标、访问策略、WebRTC、中继、邀请、会话、日志、诊断和备份。 |
| 皮肤 | 提供日间、夜间和 ILLUSIA 三款受保护皮肤,并支持实例自定义 `.wskin` 外观与管理员默认/启用管理。 |
| 界面体验 | 提供中文、English、Deutsch、Русский、日本語及响应式桌面/移动布局。 |
| 自托管 | 数据由部署者保存,支持 Docker amd64/arm64、Windows x64、Linux x64/ARM64 服务端包和 Android 客户端。 |
## 🖼️ 界面截图
以下截图展示中文界面的欢迎页、语音工作区、音量控制和成员操作菜单。
### 欢迎页
<p align="center"><img src="./screenshots/webspeak-zh-home.png" alt="WebSpeak 中文欢迎页" width="100%" /></p>
### 语音工作区
<p align="center"><img src="./screenshots/webspeak-zh.png" alt="WebSpeak 中文语音工作区" width="100%" /></p>
### 音量控制
<p align="center"><img src="./screenshots/webspeak-zh-audio.png" alt="WebSpeak 中文音量控制" width="100%" /></p>
### 成员菜单
<p align="center"><img src="./screenshots/webspeak-zh-menu.png" alt="WebSpeak 中文成员菜单" width="100%" /></p>
## 🧩 高级功能
高级功能均为可选项;关闭时仍可使用兼容语音传输。配置入口在管理员控制台的“服务器”页,保存后对新连接生效。
### 1. WebRTC 低延迟语音
WebRTC 将浏览器语音切换到实时媒体通道,也支持桌面端伴奏。媒体服务由当前 WebSpeak 网关直接提供,不需要另设媒体服务器。
1. 登录 `/admin`,打开“服务器”页的“高级参数”。
2. 关闭 WebRTC 时设置 UDP 起止端口,默认范围为 `40000–40099`。
3. 在 WebSpeak 主机的安全组和防火墙中放行整个 UDP 范围。
4. 勾选“启用 WebRTC”并保存,用户重新进入后即可协商;不支持时会回退到兼容传输。
WebRTC 启用后端口范围会锁定。要修改端口,先关闭 WebRTC 并保存,再修改端口并同步防火墙规则。公网使用还需要 HTTPS。
### 反向代理 / TCP 隧道下的语音 WebRTC
在管理后台的 WebRTC 高级参数中可设置:
- **公网媒体地址**:WebSpeak 网关可被 UDP 访问的 IP 或域名,不含协议、路径或端口。优先于网页入口推断;留空时按 `Origin`、`X-Forwarded-Host`、`Host` 推断。域名会解析为 IP 候选。反代域名不一定是媒体地址。
- **启用 IPv6 候选**:默认关闭;开启后保留 IPv4,同时收集 IPv6。需确保 IPv6 路由及 UDP 防火墙放行。
- **语音 STUN 服务**:可设置 `stun:turn.teamspeak.com:3478`,浏览器和网关使用同一服务发现公网映射。留空保留旧行为:werift 网关仍使用库内置 STUN,浏览器不配置 STUN。当前字段仅支持可通过 IPv4 访问的 UDP STUN 域名或 IPv4 地址,不接受 IPv6 字面量、TURN 或凭据;IPv6 媒体候选独立于 STUN 开关。
保存后重新连接。网页和 WebSocket 经反代可达,不代表媒体 UDP 可达;STUN 仅发现地址,不中继音频,也不保证穿透所有 NAT。只有 TCP 隧道而无可用 UDP/IPv6 路径时,仍会回退兼容传输。应开放配置的整个 UDP 端口范围;静态端口转发需保持相同端口映射。
### 屏幕共享的 ICE 候选
屏幕共享媒体仍优先走浏览器之间的直连,WebSpeak 只转发协商信令。默认使用 TeamSpeak 官方 STUN 服务发现公网候选地址;STUN 不承载媒体。若部署者有合规的外部 TURN 服务,可在启动 WebSpeak 前设置 `WEBSPEAK_SCREEN_SHARE_ICE_SERVERS`,值为 JSON 数组,例如:
```json
[{"urls":"stun:turn.teamspeak.com:3478"},{"urls":"turns:turn.example.com:5349","username":"<username>","credential":"<credential>"}]
```
配置 TURN 后,媒体可能经过该外部 TURN 服务,但不会经过 WebSpeak 网关;未配置时只使用直连和 STUN。
### 跨端 P2P 屏幕共享
浏览器用户与 TeamSpeak 6 原生客户端可以互相发现、发起和观看屏幕共享。浏览器之间以及浏览器与原生客户端之间的屏幕媒体优先通过 WebRTC/ICE 端到端传输;WebSpeak 负责会话鉴权、共享状态和 SDP/ICE 信令转发,不承载屏幕媒体流量。页面提供直播状态、观众人数、播放器音量、全屏和退出控制,也可在共享设置窗口中选择最高 1080p 与 60 FPS,并查看 WebRTC 统计。
### 2. 中继模式
中继适用于 TeamSpeak 拒绝境外连接或直连不稳定的情况。它不是 VPN,只转发当前 WebSpeak 会话的 TeamSpeak 数据;目标服务器仍由用户在网页中选择。
中继实例是专用转发服务,不提供前台和管理员后台,只接受带匹配令牌的 WebSpeak 网关会话。令牌至少使用 16 个字符的随机值。
#### 源码启动
```bash
git clone --depth 1 https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
npm ci --ignore-scripts
npm run prepare:sdk
npm run build
WEBSPEAK_MODE=relay \
WEBSPEAK_RELAY_TOKEN='replace-with-a-long-random-token' \
WEBSPEAK_RELAY_HOST='0.0.0.0' \
WEBSPEAK_RELAY_PORT='39087' \
node dist/index.js
```
Windows PowerShell:
```powershell
$env:WEBSPEAK_MODE = "relay"
$env:WEBSPEAK_RELAY_TOKEN = "replace-with-a-long-random-token"
$env:WEBSPEAK_RELAY_HOST = "0.0.0.0"
$env:WEBSPEAK_RELAY_PORT = "39087"
node .\dist\index.js
```
#### 发布包启动
从 [Releases](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/latest) 下载并解压对应平台的包:
```bash
# Linux
export WEBSPEAK_MODE=relay
export WEBSPEAK_RELAY_TOKEN='replace-with-a-long-random-token'
export WEBSPEAK_RELAY_HOST='0.0.0.0'
export WEBSPEAK_RELAY_PORT='39087'
./runtime/node ./dist/index.js
```
Windows PowerShell 使用同名环境变量后运行 `.\runtime\node.exe .\dist\index.js`。
#### Docker 启动
```bash
docker run -d --name webspeak-relay --restart unless-stopped --network host \
-e WEBSPEAK_MODE=relay \
-e WEBSPEAK_RELAY_TOKEN='replace-with-a-long-random-token' \
-e WEBSPEAK_RELAY_PORT='39087' \
ghcr.io/echosixhiya/webspeak:latest
```
放行中继主机的 UDP 监听端口,默认是 `39087`。
#### 在网关中启用
1. 管理员控制台 → “服务器” → “中继服务器”,添加一个或多个节点。
2. 为每个节点填写自定义名称、地址(例如 `relay.example.com#39087`)和匹配令牌并保存。
3. 访客欢迎页即可选择直连或其中一个中继。
关闭并保存中继配置后,访客页面不会显示中继选项。
### 3. 依赖与归属
- 中继服务是 WebSpeak 自带实现,使用 Node.js 标准库,不依赖 GOST、sing-box 或其他代理框架。
- WebRTC 使用 [werift](https://github.com/shinyoshiaki/werift-webrtc) `0.24.4`,上游采用 MIT 许可证。
- TeamSpeak 协议使用项目维护的 [EchoSixHIYA/teamspeak-js](https://github.com/EchoSixHIYA/teamspeak-js) SDK fork。
## 🧾 更新日志
<a id="latest-release-notes"></a>
### [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8) · 2026-10-17
#### 屏幕共享与连接稳定性
- 修复网页与 TeamSpeak 原生客户端之间屏幕共享的协商和视频轨道处理问题。
- 改善快速切换频道时的队列处理,减少客户端状态错乱。
- 修复部分皮肤组件内容和 KAAK 皮肤多语言显示问题。
#### 界面改进
- 音频设备名称会完整显示;空间不足时自动换行,便于区分名称较长的设备。
- 修复头像占位文字被意外选中的问题。
### [v0.2.7](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.7) · 2026-10-13
#### 更开放的皮肤系统
- 现在提供更开放的皮肤编辑系统与运行支持,可以自定义任意组件的样式与位置并可添加小组件。
- 进入语音面板后,在同一个浏览器中新开并登录一个管理员后台窗口即可激活皮肤编辑器。
- 随包提供一款“KAAK”皮肤作为开发示例。
- 更新了皮肤开发 Agent Skill。
#### 功能增强
- 现在支持 SRV 和 Nickname 形式的服务器地址解析。
- 自由模式下,允许用户进行多服务器标签管理(这些按钮在“固定服务器”的模式下不可用)。
- 屏幕共享新增码率选项。
- 现在 WebSpeak 会将输入过的频道密码保存到浏览器中。
- 现在会在上锁的频道前显示带锁的图标。
- 现在聊天记录能够持久化存储了。
#### Bug 修复列表
- 修复了解析 bug。
- 修复了音量和卡片拖动争抢焦点的问题。
- 修复了用户状态被错误地解析为未知的问题。
### [v0.2.6](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.6) · 2026-10-08
相对 0.2.5 大范围重构语音网关、共享协议、前端语音工作区与管理模块;修复 #6/#7/#10,完成 #9/#12 配置,并修复 PR #13 报告的既有 TS6 屏幕共享漏发现问题;改善 Opus/重连生命周期和移动端控制。提供 Windows x64、Linux x64/ARM64、Docker amd64/arm64,以及 Android arm64-v8a、armeabi-v7a、x86_64 APK。
### [v0.2.5](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.5) · 2026-09-27
新增 `.wskin` 皮肤系统、管理员启用/默认管理和受保护的日间/夜间/ILLUSIA 内置皮肤;移除未完成 Aurora Voice 样例,修复皮肤加载闪烁、暗色控件可读性与语音界面美术层级,并加入官方皮肤开发 Agent Skill。
### [v0.2.4](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.4) · 2026-09-22
新增浏览器与 TeamSpeak 6 原生客户端之间的跨端 P2P 屏幕共享;提供 STUN/外部 TURN 配置、直播播放器、观众状态、1080p/60 FPS 采集设置和 WebRTC 统计;优化屏幕共享交互并新增访客编号。
### [v0.2.3](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.3) · 2026-09-19
新增频道成员调度与按权限直接移动;支持头像、静音状态同步和身份恢复;更新五种语言的功能截图与文档。
### [v0.2.2](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.2) · 2026-09-17
提供浏览器端麦克风降噪、俄语和日语支持及按语言欢迎词配置;优化音量交互和 PR #2 基础上的错误提示与错误代码。
### [v0.2.1](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.1) · 2026-09-13
优化首页连接错误显示,保留并安全截断错误代码;默认支持 IPv6 TeamSpeak 目标。
### [v0.2.0](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.0) · 2026-09-10
增加服务器密码提示、正式中继部署模式、多中继选择和管理员日志原因显示。
### [v0.1.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.8) · 2026-09-08
简化 Docker 部署,支持同机 TeamSpeak,增加 15 秒连接超时和持续网络监测。
### [v0.1.7](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.7) · 2026-09-06
增加德语、Telegram、网络性能面板和整体音量;修复伴奏音量波动。
### [v0.1.6](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.6) · 2026-09-04
增加桌面端伴奏、身份保持提醒和网站图标;修复 WebRTC 成员独立音量。
### [v0.1.5](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.5) · 2026-09-04
修复身份保存逻辑并优化主题切换。
### [v0.1.4](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.4) · 2026-09-03
修复 WebRTC、频道聊天并优化管理页、日志和移动端布局。
### [v0.1.3](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.1.3) · 2026-09-03
引入内置 WebRTC、迁移 TeamSpeak SDK 并改善成员同步和语音缓冲。
## 🚀 部署方案
| 方案 | 适用场景 | 环境 |
| --- | --- | --- |
| Docker Compose(推荐) | 长期运行、升级简单、数据持久化 | Docker Engine + Docker Compose |
| 发布包 | 不安装 Node.js 和构建依赖 | Windows x64 或 Linux x64/ARM64 |
| 源码运行 | 开发、调试和二次开发 | Node.js 22.5+、Git 和本地编译工具 |
### Docker Compose(推荐)
```bash
git clone --depth 1 https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
docker compose pull
docker compose up -d
```
启动后访问 `http://<你的主机>:3040`。使用反向代理时将上游指向该地址;启用 WebRTC 时放行控制台显示的 UDP 端口范围。数据保存在 `webspeak-data` volume 中。
```bash
docker compose ps
docker compose logs -f webspeak
```
升级:
```bash
git pull --ff-only
docker compose pull
docker compose up -d
```
不要执行 `docker compose down -v`,否则会删除数据库和管理员设置。
### 发布包
从 [GitHub Releases](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/latest) 下载与系统和架构匹配的 `windows-x64.zip`、`linux-x64.tar.gz` 或 `linux-arm64.tar.gz`,解压后运行对应启动脚本。发布包自带 Node.js 运行时和生产依赖。Docker 镜像支持 amd64/arm64。
Release 同时提供 Android `arm64-v8a`、`armeabi-v7a` 和 `x86_64` APK。它们使用 debug 签名,可手动侧载测试;不是 Google Play 发布包,Android 真机语音仍需验收。
### 源码运行
```bash
git clone https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
cd WebSpeak-client-for-TeamSpeak
npm ci --ignore-scripts
npm run prepare:sdk
npm rebuild @discordjs/opus --foreground-scripts
npm --prefix web ci
npm --prefix web run build
npm run build
npm start
```
构建 `@discordjs/opus` 需要 Python、Make 和 C/C++ 编译工具。
### 首次配置
1. 打开 `http://<你的主机>:3040/admin`。
2. 使用默认账号 `admin` / `admin` 登录,并立即设置至少 12 位的新密码。
3. 在“服务器”页配置 TeamSpeak 目标和访问方式,例如 `voice.example.com#9987`。
4. 公网使用时配置 HTTPS;启用 WebRTC 时放行控制台显示的 UDP 范围。
## ⚠️ 要求和注意事项
| 项目 | 要求或注意事项 |
| --- | --- |
| 浏览器 | 建议使用最新版 Chrome、Edge 或其他支持 WebRTC 的现代浏览器。麦克风和窗口音频通常要求 HTTPS。 |
| TeamSpeak 网络 | WebSpeak 主机必须能够访问目标 TeamSpeak;默认语音端口为 `9987`。 |
| Web 服务网络 | 服务使用 `3040/TCP`,公网建议通过 HTTPS 反向代理提供网页和 WebSocket。 |
| IPv6 | IPv6 字面量写为 `[2001:db8::1]#9987`。主机/容器需要可路由 IPv6、启用 IPv6 的操作系统和 Node.js,以及相应防火墙放行。 |
| WebRTC | 默认使用 `40000–40099/UDP`,启用后需放行整个范围;修改范围前先关闭 WebRTC。 |
| 身份保持 | 同一浏览器身份同时只能保持一条活动连接;并行连接请关闭第二条的身份保持或使用其他浏览器配置文件。 |
| 伴奏 | 仅桌面端提供且要求 WebRTC;选择窗口或标签页时还要勾选共享音频。 |
| 数据 | 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) 修正缩放、浮动布局和首页脚注。
- [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 注册昵称连接,并在设置、收藏和邀请中保留昵称目标。
+468
View File
@@ -0,0 +1,468 @@
# WebSpeak 0.2.7 皮肤系统开发指南
本文是 WebSpeak 0.2.7 的唯一皮肤开发说明,整合原皮肤开发规范与开放皮肤系统规格。它覆盖仍受支持的 v1/v2 兼容皮肤、v3 声明式开放皮肤和 v4 插件包,以及当前公开数据、宿主动作、授权、校验与开发流程。v4 有界 Wasm 已在生产构建开放;皮肤 JavaScript 仍只校验和缓存,不会执行。本文件是当前包格式和运行时接口的唯一文档来源。
## 目标:皮肤是可移植的外挂包
`.wskin` 是皮肤唯一的交付物。页面结构、样式、文案、布局、图片、字体和皮肤自己的组件/逻辑都应随包分发;导入皮肤不应要求为某款皮肤单独修改、部署或配置 WebSpeak 核心代码。宿主只提供稳定、通用且版本化的渲染和能力接口,皮肤包声明如何使用它们。
开发皮肤时,优先在包内完成工作:用 `skin.css` 和包内资源做视觉,用 `content.json` 提供皮肤文案,用 `layout.json` 提供默认排布,用 `components.json` 描述页面组件、数据绑定和已支持的交互;需要本地逻辑时,根据当前支持情况使用 v4 有界 Wasm。所有图片、字体、CSS 和插件文件都放进 `.wskin`,引用包内相对路径。不要为了单款皮肤给 `WebClient.vue`、宿主控件注册表、共享协议、服务端或其他核心运行时添加专用实现。
运行时数据和安全敏感的 TeamSpeak 行为仍由 WebSpeak 提供。皮肤只能读取当前协议明确公开的数据,并调用已支持、经用户授权和宿主复核的动作;包内 UI 消费这些输入并负责呈现。若多个皮肤确实缺少同一项通用数据或动作,应另立平台接口工作:先定义稳定字段/动作、权限和兼容版本,再由皮肤包使用。不要把平台接口改动伪装成某款皮肤的必要步骤,也不要为单个皮肤新增专用宿主控件。
可移植性由 WebSpeak 运行时与皮肤协议版本决定。清单的 `minAppVersion`、组件 schema、插件 `apiVersion` 必须对应实际使用的接口;兼容同一协议版本的 WebSpeak 实例应能导入并运行相同字节的 `.wskin`,无需单独部署该皮肤的前端代码。实例配置、公开服务器数据、屏幕尺寸和用户授权可以影响显示结果,但不改变包的实现。旧包继续遵循其声明的 schema 和宿主兼容规则。
开发者 Skill:[WebSpeak Skin Development](../.agents/skills/webspeak-skin-development/SKILL.md)。它给 Agent 提供皮肤任务的决策和交付步骤;本文件是格式、接口与安全边界的事实来源。
示例展示公开皮肤接口的用法,不代表未记录的运行时接口也可依赖;发现、活动、广告、商城和管理后台不属于语音皮肤范围。
完整的 KOOK 语音端体验测试皮肤见 [KAAK](./examples/KAAK-VOICE.md):它复用 WebSpeak 可信宿主控件和公开 TeamSpeak 会话数据,不包含站点素材、运营页面或后台。Harbor Voice 保留为通用 surface 格式验证样例。
v3 保留安全的标准元素和属性白名单;组件可通过完整页面 surface 自己构建界面,不需要把聊天、音频或成员 UI 锁在固定宿主面板里。条件可比较权限化公开数据、重复项和皮肤本地状态,也可判断已登记公开集合是否为空。表单输入先留在宿主渲染的本地状态;宿主动作不能在逐字输入时触发,可在已提交的 `change`、表单提交或显式点击上触发。作者自定义代码逻辑由 v4 有界 Wasm 路径提供。生产构建中的 v4 Wasm 运行时已接入本地摘要授权、页面生命周期、动态 HTML/SVG 节点渲染、插件 CSS、权限化只读数据投影、宿主动作桥、语义挂载槽位和全局 worker 资源治理;目前支持 `session.status.read`、频道/成员/聊天、收藏/最近列表和音频/共享状态读取权限,以及 `ui.surface.replace`、`ui.input.read`。每份公开数据投影最多 48 KiB,只传清单准许的字段;Wasm 可生成自定义节点树、有限本地状态并响应命名 UI 事件。宿主动作只接受可信 UI 事件触发的同一轮输出中的单个请求,并重新检查插件权限、参数和当前会话;`dblclick` 可绑定到加入频道等已授权宿主动作。JavaScript 仍只校验和缓存,不执行。每个 v4 插件有独立布局根,用户可调整插件整体、组件根和 DOM 节点的位置、尺寸、显隐、安全外观及 Flex/Grid 同级显示顺序;`plugins.json` 可将 widget 放到公开页面的注册槽位,也可通过 surface 重做整页。这个边界能承载完整自定义客户端界面,但不等于已完成插件商城和作者管理平台;跨浏览器测试与独立安全审查尚未完成。
`.wskin` 包可为公开页面定制艺术表现。v1 提供 CSS 与美术资源;v2 另外携带受校验的布局 JSON;v3 可自由安排公开组件,并用 components.json 声明由宿主渲染的安全组件。所有版本均由 WebSpeak 保留基础组件的业务逻辑和 TeamSpeak 行为。
页面结构、必要控件和所有基础翻译均由 WebSpeak 提供。皮肤包不必携带文案;如果只包含样式与美术素材,所有界面文字仍由 WebSpeak 按当前语言显示。`content.json` 仅用于可选覆盖,缺少的语言或字段回退到 WebSpeak 的基础内容。皮肤不注入 HTML 或 JavaScript;授权后的交互只调用 WebSpeak 登记并校验过的 TeamSpeak 功能。**管理后台 `/admin/**` 不属于皮肤范围,始终使用 WebSpeak 自己的固定样式。**
可直接查看 [ILLUSIA 风示例源码](examples/illusia-voice/) 与 [示例说明](examples/ILLUSIA-VOICE.md)。它使用本地美术素材和 CSS 完整定制首页、语音房间、成员区、聊天空状态及播放器,同时沿用 WebSpeak 提供的基础翻译;也是管理控制台内置且不可移除的示例皮肤。
## 使用与发布
管理员在 `/admin/skins` 查看三款随 WebSpeak 提供的内置皮肤,并可导入、替换、启用/停用或删除实例自定义皮肤;还可指定访客首次访问时使用的默认皮肤。默认日间、默认夜间和 ILLUSIA 风为受保护内置项,不可替换、停用或移除。访客手动选择的皮肤保存在该浏览器,后续实例默认值变更不会覆盖该明确选择;仅自动套用过旧默认值的浏览器会采用最新实例默认值。皮肤包会缓存在浏览器本地;页面启动时会查询实例目录,目录可用且版本更新时拉取新包。若网络不可用,已缓存的版本仍可使用。
选择器提供默认日间、默认夜间、内置 ILLUSIA 风和已启用的实例皮肤;没有“跟随系统”选项。停用的实例皮肤不向访客展示,也不能从服务端下载;若它是当前默认皮肤,系统会安全回退到默认日间。管理员设置的默认值只影响未手动选择皮肤的访客。自定义皮肤是独立的外观选择,不继承之前的日间或夜间模式;皮肤未覆盖的部件回退到浅色基础外观,避免一套组件混入另一套模式。自定义皮肤可自行声明 `color-scheme` 并定义深色外观;切换为日间或夜间时,会停用当前自定义包。文档级 `data-theme` 仍由 WebSpeak 保留给管理后台使用。
## 包结构
`.wskin` 是标准 ZIP 容器,推荐把下列文件直接放在 ZIP 根目录:
```text
manifest.json # 必需:身份、版本与入口
skin.css # 必需:皮肤样式
content.json # 可选:首页内容与多语言界面文案
assets/preview.jpg # 可选:管理后台显示的预览图,也可在 CSS 中使用
assets/background.webp # 可选:页面艺术素材
assets/brand.woff2 # 可选:自带字体
components.json # v3 可选:声明式组件或完整页面 surface
plugins.json # v4 必需:插件入口、页面、模式、权限与包内文件
plugins/<plugin-id>/index.js # v4 插件代码,目前只校验和缓存
plugins/<plugin-id>/index.wasm # v4 有界 Wasm 插件入口
plugins/<plugin-id>/style.css # v4 可选:插件样式,目前只校验和缓存
plugins/<plugin-id>/assets/ # v4 插件专属的本地图片或字体素材
```
所有资源路径使用 `/`,区分大小写,并相对于包根目录。CSS 的 `url()` 使用同样的包根相对路径,例如 `url("assets/background.webp")`。不得使用机器本地路径、站点绝对路径或远程 URL。说明文档放在源码目录旁边,不能打进 `.wskin`;导入器会拒绝 `README.md` 等未声明文件。
### `manifest.json`
```json
{
"schemaVersion": 1,
"id": "community.example-skin",
"name": "Example skin",
"version": "1.0.0",
"author": "Example author",
"license": "CC-BY-4.0",
"description": "A visual-only art skin using the WebSpeak interface translations.",
"entry": "skin.css",
"preview": "assets/background-composite.webp",
"minAppVersion": "0.2.7"
}
```
| 字段 | 规则 |
| --- | --- |
| `schemaVersion` | 当前必须为数字 `1`。 |
| `id` | 必需,最多 80 个字符;只允许小写字母、数字、点和连字符;不能以 `builtin.` 开头,也不能使用受保护 ID `builtin.light`、`builtin.dark` 或 `community.illusia-voice`。发布后不要更改。 |
| `name`、`author`、`license` | 必需,各最多 80 个字符。资源授权由作者负责确认。 |
| `version`、`minAppVersion` | 必需,使用语义化版本号,例如 `1.2.0`。 |
| `entry` | 必需,包内 CSS 文件路径,最多 120 个字符。 |
| `content` | 可选,包内 JSON 文件路径,最多 120 个字符。 |
| `preview` | 可选,包内 PNG、JPG/JPEG、WebP、AVIF 或 GIF 图片路径,最多 120 个字符。 |
| `description` | 可选,最多 400 个字符。 |
清单不得重复声明同一个文件为 CSS、内容或预览入口。
### schemaVersion 2:声明式布局皮肤
v2 为 v1 增加一个必需布局文件。清单和布局 JSON 会在导入端及服务端分别验证;未知清单字段、权限、组件、布局字段及越界数值都会导致包被拒绝。v2 不支持 HTML、JavaScript、WebAssembly、远程资源或扩展插件代码。皮肤 CSS 仍使用当前解析器规则,不能控制几何布局和交互区域。
```json
{
"schemaVersion": 2,
"packageType": "layout-skin",
"id": "community.example-layout",
"name": "Example layout",
"version": "1.0.0",
"author": "Example author",
"license": "CC-BY-4.0",
"entry": "skin.css",
"layout": "layout.json",
"permissions": [],
"minAppVersion": "0.2.7"
}
```
布局只引用 WebSpeak 登记的稳定组件 ID。当前支持 `home`、`voice`、`demo` 页面及 `desktop`、`tablet`、`mobile` 三种设备配置。组件位置使用有界的水平/垂直偏移,尺寸使用缩放、宽、高,外观字段只接受六位十六进制颜色和受限圆角;`visible` 控制显示状态;`order` 在 -100 到 100 之间,仅当父容器使用 Flex 或 Grid 时改变同级显示顺序,不改变 DOM 和键盘焦点顺序。`home.security-note`、身份安全提示、连接状态与屏幕共享错误属于可信宿主 UI,不允许布局隐藏或改写。
示例 `layout.json`:
```json
{
"schemaVersion": 1,
"pages": {
"home": {
"desktop": {
"home.feature": { "x": 12, "y": 8, "scale": 1.05, "order": -1 },
"home.features": { "visible": false }
},
"tablet": { "home.join-card": { "width": 680 } },
"mobile": { "home.header": { "x": 0, "y": 4 } }
}
}
}
```
作者包中的布局是初始默认值。用户编辑内容单独存放在本地浏览器,覆盖作者默认值;支持撤销/重做、单个组件重置、整套布局恢复、导入和导出。更换设备宽度会选择对应设备配置,不会删除其他设备的值。恢复入口由宿主在皮肤根节点之外绘制,即使用户隐藏了页面组件,也能再次打开编辑器并恢复默认值。
v1 和 v2 都只支持公开页面。`/admin/**` 不加载布局、用户覆盖和皮肤组件编辑器。布局包没有数据/API 权限;后续插件必须另行设计独立沙箱与授权协议,不能通过增加 v2 清单字段取得能力。
### schemaVersion 3:开放皮肤和完整声明式页面
v3 清单的 packageType 固定为 open-skin,entry 指向 CSS,components 可选指向 components.json;与 v2 不同,v3 不声明 permissions,但可以可选声明 layout 指向作者默认布局 `layout.json`。组件文件可以省略。仅 v3 开放公开页面的 CSS 排版能力,v1/v2 仍按旧 CSS 规则校验。客户端导入和服务端登记使用同一共享组件 schema 与权限白名单。
components.json 顶层接受 schemaVersion 1、2 或 3 和 components 数组。schema v1 维持旧兼容;schema v2 引入 `mode: "widget"`(默认)或 `mode: "surface"`,并提供可选宿主控件节点;schema v3 保持这些能力,扩大声明式 UI 的节点/状态/动作边界,并增加用户操作事件和语音功能动作。v3 仍使用固定元素/属性、公开数据集合和宿主动作白名单,不是任意 HTML 或任意脚本。每个组件需声明 id、name、page、accessibleName、permissions、actions 和 root,可选 state。page 接受 home、voice、demo;surface 仅可用于 home 和 voice,并且必须请求 `ui.surface.replace`。用户批准前不会显示 surface,撤销后宿主立即恢复普通页面。所有皮肤组件根节点及其中的每个可见元素都以动态布局项加入本地布局编辑器,可独立移动、缩放、改尺寸、改外观或隐藏。按钮、输入框及显式用户操作节点保留 44 px 最小触控区域。为让用户覆盖在树结构调整后仍能指向同一元素,请给重要节点设置稳定的 `part` 名称;未设置时按组件树位置生成标识。v4 插件格式与运行时见本指南的 v4 章节;Wasm 生产运行已开启,作者 JavaScript 仍关闭。
普通节点使用白名单 HTML/SVG 元素。节点可包含 text、part、className、受限 attributes、包内图片 asset、bindValue、本地 repeat/when、events 和 children。文本与属性支持简单的双大括号数据路径;不支持表达式、HTML 字符串或脚本。重复列表可使用注册的公开集合;频道重复项仅能再重复其 `channel.members`,并且需要额外批准 `session.members.read`。宿主每个组件的实际渲染节点最多 8192 个,防止嵌套集合放大界面。v3/v4 的作者默认布局使用与 v2 相同的有界 layout schema;可通过 `skin.<page>.<component-id>` 指定声明式自定义组件,通过 `skin.<page>.runtime_plugin_root_<plugin-id>` 指定 v4 插件根。用户的本地布局覆盖优先于包默认值。schema v2 另允许固定宿主控件节点,例如:
申请 `session.channels.read` 的 `session.channels` 列表还提供 `memberCount`、两位数显示用的 `memberCountLabel`、`maxClients` 和 `maxClientsLimited`。后两个字段仅在 TeamSpeak 返回有效上限数据时出现;`maxClientsLimited: false` 表示频道不限人数。它们与频道树一起属于公开只读数据,不会授予服务器写入能力。
```json
{
"schemaVersion": 2,
"components": [{
"id": "example-voice-surface",
"name": "Example voice surface",
"page": "voice",
"mode": "surface",
"accessibleName": "Example voice workspace",
"permissions": ["ui.surface.replace"],
"actions": {},
"root": {
"tag": "main",
"children": [
{ "widget": "voice.channel-panel" },
{ "widget": "voice.member-cards" },
{ "widget": "voice.chat-panel" },
{ "widget": "voice.audio-controls" },
{ "widget": "voice.disconnect-control" }
]
}
}]
}
```
当前可选宿主控件 ID:`home.connection-form`、`home.connection-status`、`home.visitor-count`、`home.server-announcement`、`home.social-links`、`home.identity-provider`、`app.skin-switcher`、`app.language-switcher`、`voice.channel-panel`、`voice.member-cards`、`voice.chat-panel`、`voice.audio-controls`、`voice.screen-share-player`、`voice.screen-share-start`、`voice.whisper-controls`、`voice.performance-panel`、`voice.connection-controls`、`voice.disconnect-control`、`voice.server-header`、`voice.server-banner`、`voice.server-switcher`、`voice.channel-tree`。未知控件和同页重复控件会被拒绝;每个控件的状态和业务动作仍由 WebSpeak 内部处理。`home.identity-provider` 是通用身份提供方入口,需用 `options.identityProviderId` 和 `options.identityProviderLabel` 指定稳定提供方标识与显示名;宿主会把点击转交给应用代码的 `registerIdentityProviderAdapter` 分发接口,皮肤只能发起请求、不能注册适配器。当前没有 MyTS 适配器,所以 MyTS 入口仍提示开发中;这不代表已经实现登录认证。schema v3 会检查受保护控件所需权限:音频控件需 `audio.status.read`、`audio.microphone.control` 和 `audio.output.control`;聊天需 `chat.channel.read` 与 `chat.channel.send`;成员卡片始终需 `session.members.read` 和 `session.memberAvatars.read`;schema v3 可为成员卡片设置 `options.memberActions: true`,在非本人卡片上显示可信宿主成员操作入口(包含现有个人音量控件);也可为 `voice.channel-tree` 设置该选项,在非本人频道树成员行上启用右键菜单;菜单仍由 WebSpeak 宿主处理,皮肤不获得额外动作或数据接口。频道树还可单独设置 `options.memberDragDrop: true`,将非本人成员拖到另一频道行时复用 WebSpeak 现有移动成员操作;悬停和拖入高亮由皮肤样式控制,此选项默认关闭且只适用于频道树。成员卡片或性能卡片可设置 `options.screenShare: false`,同时隐藏共享 UI/指标并免除成员卡片所需的屏幕共享权限;默认成员共享操作仍需屏幕共享读取/控制权限;头像只在可信宿主控件内显示,不暴露给皮肤代码;屏幕共享播放器需 `voice.screenShare.read` 与 `voice.screenShare.control`;悄悄话控件需对应状态读取和控制权限;断开/连接控件需 `voice.disconnect`。既有 v2 包维持旧校验行为,`voice.screen-share-start` 仍像此前一样要求 `voice.screenShare.control`。该控件仅能放在语音页;宿主按钮在可信点击处理器内直接启动屏幕采集,避免异步 Wasm 回调丢失浏览器瞬时用户激活。自定义 UI 可以完全用普通声明式节点搭建,不需要采用这些控件。只显示收藏时可用 `favorites.items` 和 `favorites.switch`;若要将收藏与最近连接放在同一自定义栏,可用 `servers.quickList` 数据与 `quickServers.switch` 动作。服务器目标始终使用本机生成的不透明令牌,不把地址、密码或身份材料交给组件。频道行也可把 `voice.joinChannel` 绑定到双击事件,切房继续走 TeamSpeak 原有权限和密码流程。v3 还提供经独立权限保护的麦克风/扬声器、输出音量、噪声抑制、伴奏、离开状态、悄悄话、断开连接和屏幕共享动作;噪声抑制使用 `audio.toggleNoiseSuppression` 与 `audio.microphone.control`,伴奏使用 `audio.toggleAccompaniment` 与 `audio.output.control`。它们只调用 WebSpeak 已有操作,屏幕采集仍由浏览器或操作系统询问用户。
首页访客统计使用公开宿主控件 `home.visitor-count`:它展示当前访客序号与累计访客数,文本跟随当前界面语言,并在统计数据尚不可用时隐藏;不需声明权限。该控件复用 WebSpeak 日间首页的同一结构与基础样式,皮肤通过包内 CSS 定位,不需要自建统计逻辑。组件节点可用稳定的 `part` 名称(例如 `visitor-stats`)控制位置;内部 `home.visitors`、`home.visitors.orbit`、`home.visitors.icon`、`home.visitors.label`、`home.visitors.divider`、`home.visitors.total` 和 `home.visitors.spark` 是稳定样式部件。控件只能放在 `home` 页面。
可信语音导航控件包括 `voice.channel-tree`、`voice.server-switcher` 和 `voice.server-header`。频道树要求 `session.channels.read`、`session.members.read`、`session.memberAvatars.read` 与 `session.channel.join`;头像只由宿主读取并在频道树中绘制。它可选 `layout: "server-sidebar"` 展示频道成员并让频道行与成员行分别控制折叠;未指定时保留默认呈现。独立服务器切换器要求 `servers.quickList.read` 与 `servers.quickList.switch`。服务器头部还要求 `session.status.read`,并在同一可信部件中组合服务器身份、状态、频道搜索和快速切换。两种入口都只接收不透明本地标识,点击后复用 WebSpeak 当前连接流程。v3 还可用 `session.invite.copy` 授权 `session.copyInviteLink`,让宿主复制当前公开服务器与频道的邀请链接并排除连接凭据。语音状态投影中的 `serverLabel` 会在看起来像 IP、域名或连接目标时省略,避免把地址显示为服务器名称。
示例包见 [KAAK voice 示例](./examples/KAAK-VOICE.md),其 components.json 使用完整首页与语音工作区 surface,展示收藏服务器、频道树、在线成员、聊天和可信语音控制的组合;[Open Voice Surface](./examples/OPEN-VOICE-SURFACE.md) 保留为通用格式验证脚手架。KAAK 的语音视觉参考来自用户授权进入的前两个语音房间;只记录布局,不保留服务器/房间标识、成员名或聊天内容。组件按本地用户授权后才渲染;权限对每个皮肤版本、页面和组件分别保存,可在宿主权限入口撤销。页面替换时,宿主会额外显示“返回标准界面”和“恢复内置皮肤”入口;拒绝授权或离开 surface 后,普通页面可立即恢复。
组件树有硬上限:components.json 256 KiB。schema v1/v2 上限为 32 个组件、每组件 256 个模板节点、16 层深度和 100 条重复记录;schema v3 上限为 128 个组件、每组件 2048 个模板节点、32 层深度和 250 个重复行,并允许 64 个本地标量状态与 64 个动作。Wasm 动态 UI 输出的 schema v4/v5/v6 有 256 KiB 总输出上限、最多 64 个组件、每个节点最多 64 个属性和 256 个子节点,并沿用每组件节点/深度限制;渲染器接受标准 HTML/SVG 元素及普通属性,而不是由元素/属性展示白名单限制。脚本、嵌入式浏览器、网络/导航属性、事件属性和行内 style 仍拒绝;样式通过经过隔离校验的插件 CSS 提供。包内图片通过专用资源字段引用,自定义元素映射为惰性 `div`。宿主只通过 `isTrusted` 用户事件发出剥离 DOM/Event 对象后的 `extension-event`,Wasm 侧只能经 `env.ui_input_read` 一次读取最多 64 KiB 的 JSON,包含插件本地状态、安全事件和宿主按插件读取权限投影的数据。每份数据投影最多 48 KiB,只含公开字段;地址、凭据、SDK 对象和未声明字段不会进入 guest。输入字段限长;生成界面中的 password/file/hidden 类型输入会拒绝。UI 循环已经接入 WebClient 授权生命周期,可把可信事件或最新数据快照作为下一次独立 Wasm 调用输入,最多串行排队 8 项并验证回调/状态归属;动作桥复核清单权限和会话状态。单个页面实例最多并发运行 2 个 Wasm worker,并限制最多排队 64 项。
图片资源只能从包内引用,CSS 不能读取外部 URL、脚本或浏览器存储。宿主动作需显式权限,并只能绑定可信的用户事件;输入或 change 事件不能触发宿主动作。focus/blur、hover 和 drag-start/over 等被动事件只可改动组件本地状态,不能触发语音操作。
注意:v3 CSS 和 surface 可以隐藏或遮挡普通语音控件。权限和返回标准界面提示由宿主在皮肤根之外绘制;其他界面控件仍受皮肤排版影响。测试时务必确保麦克风、设置、退出语音、屏幕共享操作和移动端导航仍有可达路径。组件演示页 /demo 使用合成数据,加入频道和聊天动作只更新演示状态;它不支持宿主控件或整页替换。
### 本地组件结构编辑器
公开客户端页可打开“组件结构”编辑器,直接管理当前皮肤版本的声明式组件树。它支持创建、复制、删除组件和节点、添加子节点或同级节点、调整顺序、编辑组件元数据与节点 JSON、撤销/重做,以及导入/导出 components.json。该编辑器不属于管理员面板,不加载到 /admin/**。
编辑器只保存本地 authoring 覆盖,键按皮肤 ID 和版本隔离;原始皮肤包不会被改写。导入及每次提交都会走 parseSkinPluginDocument 的同一 schema 和权限校验,运行时也再次验证从本地存储读出的文档。不能通过编辑器新增任意脚本、事件处理器属性、外部资源、未知数据路径、宿主保留的 data-ws-* 属性、未授权宿主动作或未登记的宿主控件。旧 v2 组件首次升级到 v3 时,编辑器会为受保护的内置宿主控件补齐对应权限声明;这不会自动批准权限,控件继续等待宿主授权 UI 明确确认。
旧 schema v1/v2 皮肤可以保持原样使用,第一次结构编辑时会把已验证的数据规范化为 schema v3;旧包自身不被升级或覆盖。schema v3 允许 components 为空:删除最后一个皮肤组件会恢复基础 WebSpeak 页面,宿主授权与恢复控件始终在皮肤内容之外。节点不能脱离组件根单独删除;重要节点应设置稳定 part 名称,避免树顺序变化后基于路径生成的布局覆盖指向其他节点。
### schemaVersion 4:插件包描述与有界 Wasm 运行时
v4 在 open-skin 包中增加必需的 `plugins` 路径,并允许沿用可选 `layout` 路径提供插件根和节点的作者默认布局。服务端登记和客户端导入共用 `plugins.json` schema v1 校验器;校验插件 ID、页面、模式、权限、文件归属、路径唯一性和包内文件大小,并将插件文件与普通皮肤素材分别缓存。客户端还会对 Wasm 入口执行固定导入/导出 ABI 预检。SHA-256 授权基础会绑定插件描述、入口、样式和全部素材;本机授权记录还会绑定皮肤/插件版本、API 版本和权限策略版本。摘要只能发现已授权内容被替换,不能证明发布者身份。WebClient 有本地授权对话框和 Wasm 运行生命周期;目前支持安全 UI 输出、可信 UI 事件回调、插件专属 CSS、按清单权限过滤的公开数据投影(单份最多 48 KiB)和首版单动作宿主桥。支持的数据读取权限包括 `session.status.read`、`session.channels.read`、`session.members.read`、`chat.channel.read`、`favorites.read`、`servers.quickList.read`、`audio.status.read`、`voice.whisper.status.read`、`voice.screenShare.status.read` 和 `voice.screenShare.read`,另支持 `ui.surface.replace`。`ui.input.read` 单独控制插件是否能收到用户在插件自有输入框中输入或被浏览器自动填入的值;未获授权时仍可收到事件类型,但不会收到文本或勾选值。密码、文件和隐藏输入始终拒绝。宿主动作仅可由可信 UI 事件触发,按清单权限、动作参数和会话状态再次校验;生产构建也有全局 worker 上限。跨浏览器验证和独立安全审查仍待完成。
```json
{
"schemaVersion": 4,
"packageType": "open-skin",
"id": "community.example-plugin-skin",
"name": "Example plugin skin",
"version": "1.0.0",
"author": "Example author",
"license": "MIT",
"entry": "skin.css",
"plugins": "plugins.json",
"minAppVersion": "0.2.7"
}
```
`plugins.json` 顶层 `schemaVersion` 当前为 `1`,并包含 1–64 个插件。每个插件声明 `id`、`name`、`version`、`apiVersion: 1`、`page`(`home` 或 `voice`)、`mode`(`widget` 或 `surface`)、必需的 `entry`、可选的 `mount`、`runtime`、`style`、素材路径数组 `assets` 和 `permissions`。入口扩展名 `.js` 默认对应 `javascript`,`.wasm` 默认对应 `wasm`;显式 `runtime` 必须与入口扩展名一致。入口及样式必须位于 `plugins/<id>/`;素材必须位于该插件自己的 `assets/` 子目录,只能是本地图片或 woff2 字体。插件不能共享文件;同一公开页面最多有一个 `surface`,且必须申请 `ui.surface.replace`。surface 不能声明 `mount`;widget 可选声明一个与 page 相符的宿主槽位。未指定时放在页面级插件宿主中。`ui.input.read` 是单独的输入值读取权限,授权提示会说明浏览器自动填入的值也可能被读取;不得让用户在皮肤输入框中输入密码或其他秘密。其余权限只能从 `src/shared/skin-plugin.ts` 的现有权限表中选择。
`plugins.json` 不超过 256 KiB;每个入口 JS 或 Wasm 不超过 256 KiB,每个样式 CSS 不超过 512 KiB;每个插件最多声明 32 个素材。客户端导入会拒绝不符合固定内存、导入、导出和 Wasm 模块结构限制的入口。皮肤包整体仍受通用 ZIP 文件数、展开大小、图像和字体限额约束。v1–v3 不接受插件代码。v4 JavaScript 仍只校验、缓存,不执行。生产 Wasm 仅在用户显式授权、摘要匹配时通过有界解释器启动一次性任务;它已支持上述权限化只读投影、安全 UI 更新和首版宿主动作桥。动作由可信 UI 事件引发、由宿主按插件权限和会话状态复核;浏览器瞬时手势不会跨越异步 Wasm 执行,因此屏幕采集必须通过可信宿主控件直接开始。数据变化会触发一轮新的有界执行。不要将有 DOM 的 iframe 当作网络沙箱:sandbox 不阻止 iframe 自己导航,`navigate-to` 也不能作为跨浏览器安全保证。
widget 的可选 `mount` 只接受这些公开锚点:`home.header.after`、`home.content.before`、`home.content.after`、`home.footer.before`、`voice.server-rail.before`、`voice.server-rail.after`、`voice.header.before`、`voice.header.after`、`voice.activity.before`、`voice.activity.after`、`voice.chat.before`、`voice.chat.after`、`voice.channel-panel.before`、`voice.channel-panel.after`、`voice.audio-dock.before`、`voice.audio-dock.after`、`voice.mobile-nav.before`、`voice.mobile-nav.after` 和 `voice.workspace.overlay`。它们提供初始语义位置;作者仍可用插件 CSS 和本地布局编辑器自由调整位置、尺寸、显隐、安全外观及同级顺序。surface 替换内置页面时,如果声明的槽位不存在,插件会回退到页面级宿主,避免 UI 丢失。专用的插件挂载管理界面仍未实现。布局权限只覆盖当前皮肤中实际渲染的插件节点,不能越过自身节点调整其他插件或宿主恢复控件。生产 v4 宿主已按 descriptor 管理当前页 widget/surface、授权、输出、事件循环、样式和清理。
## 当前运行时数据与权限
以下数据权限按组件或插件单独声明。授权按皮肤/插件版本、页面、组件和权限策略绑定;拒绝或撤销后,相应组件不再渲染或调用动作。服务端地址、密码、身份密钥、访问令牌、Cookie、私聊内容、原始音频和屏幕流不会传给皮肤。
| 权限 | 公开内容 |
| --- | --- |
| `session.status.read` | 当前连接状态、频道和显示名称。 |
| `session.channels.read` | 可见频道树、名称、层级、当前人数、服务器公布的人数上限和当前频道标记;不包含密码或服务器地址。 |
| `session.members.read` | 可见成员名称、频道、在线/说话状态及本人标记;不含头像图像。 |
| `session.memberAvatars.read` | 允许可信 `voice.member-cards` 控件在宿主内显示已缓存头像,图像字节和 URL 不进入皮肤数据。 |
| `chat.channel.read` | 当前公开文字频道中可见的消息,不含私聊。 |
| `favorites.read` | 收藏名称、类型、当前标记和不透明本地令牌,不含地址或凭据。 |
| `servers.quickList.read` | 收藏与最近服务器的名称、类型、当前标记和不透明本地令牌,不含地址或凭据。 |
| `audio.status.read` | 用户自己的麦克风/扬声器静音、降噪和伴奏状态,不含音频。 |
| `voice.whisper.status.read` | 悄悄话状态和已配置目标数量。 |
| `voice.screenShare.status.read` | 用户自己的屏幕共享状态。 |
| `voice.screenShare.read` | 当前可见共享的名称、来源、所有者名称、音频标记和观看人数,不含媒体流。 |
`ui.surface.replace` 授权公开首页或语音页的整页替换。`ui.input.read` 是独立的输入读取权限;用户同意后,插件可读取其输入框文本或浏览器自动填入值。密码、文件和隐藏输入始终不提供给插件。不要在插件输入框中要求用户输入密码或其他秘密。
宿主动作只允许从公开运行时 API 中选择,并在调用时重新核对权限、参数和当前会话:
- `session.copyInviteLink`(`session.invite.copy`)复制不含连接凭据的当前服务器/频道邀请链接。
- `voice.joinChannel`(`session.channel.join`)仅请求加入当前公开可见的频道,继续使用宿主的频道密码和权限流程。
- `favorites.switch`(`favorites.switch`)与 `quickServers.switch`(`servers.quickList.switch`)使用不透明令牌选择本机已有目标,并复用宿主连接流程。
- `chat.sendMessage`(`chat.channel.send`)只向当前公开文字频道发送消息,不包括私聊。
- `ui.setState` 和 schema v3 的 `ui.toggleState` 只修改该组件隔离的本地状态。
- schema v3 还支持经相应权限验证的本人麦克风/扬声器静音、降噪、伴奏、输出音量、音频设置、断开连接、离开状态、悄悄话和屏幕共享操作。`voice.startScreenShare` 必须通过可信宿主控件触发,以保留浏览器的用户操作授权。
- 屏幕共享成员标记可读取 `session.members` 中的 `screenSharing` 和 `screenShareStreamId`;观看操作 `voice.joinScreenShare` 还需 `voice.screenShare.control`。
控件节点将 WebSpeak 原生控件放进皮肤布局,但不会暴露其内部状态或数据对象。事件可包含 click、dblclick、键盘、焦点、指针和拖放等受限类型;被动事件只能改动组件本地状态,敏感动作必须由可信的明确用户操作触发。宿主再次校验目标、令牌、共享 ID 和当前权限。
## v4 Wasm 运行限制与恢复
每个 v4 插件使用按皮肤、插件、版本、API、文件摘要和权限策略绑定的本地授权。安装不等于运行;内容或权限变化后须重新授权。运行时通过宿主过滤权限字段后提供结构化快照,不传递 DOM、原生 TeamSpeak 对象或网络/持久化 API。
| 资源 | 当前上限 |
| --- | ---: |
| 单份插件数据快照 | 48 KiB |
| 单次 UI 输入 | 64 KiB |
| 单次动态 UI 输出 | 256 KiB |
| Wasm 客体线性内存 | 4 MiB |
| Wasm 指令燃料 | 10,000,000 |
| 每个页面实例并发运行 | 2 个 worker |
| 等待队列 | 64 个任务;等待 120 秒后拒绝 |
Wasm 每轮最多读取一次输入并提交一个 UI 输出;首版宿主动作桥只接受可信 UI 事件同一轮执行提出的一个动作。共享屏幕采集不允许从异步动作启动,必须走可信宿主按钮。动态输出由宿主校验后创建安全 HTML/SVG 节点,不按 HTML 字符串执行;作者 CSS 限定在皮肤或插件容器中。切页、撤权、超时或插件错误会停止相应任务并恢复宿主界面。插件不能创建 DOM iframe、调用外部资源、导航页面或读写任意浏览器存储。
## 首页内容和文案
`content.json` 完全可选。WebSpeak 自带中文、英语、德语、俄语和日语的基础内容,因此纯美术皮肤无需复制翻译文件。若希望为皮肤定制部分文案,可按 locale 覆盖连接首页内容和公开界面文案;未定义的语言、字段或翻译键会回退到 WebSpeak 内容,不要求皮肤重复提供整套文字。当前允许 1–20 个 locale,locale 写作 `en`、`zh-CN`、`ja-JP` 等形式。`defaultLocale` 必须指向一个已定义的 locale。示例:
声明式 `components.json` 也可以显示皮肤自己的多语言文案。文本节点、字符串属性,以及组件 `name` / `accessibleName` 可使用 `{{skin.messages.<key>}}` 绑定。WebSpeak 会把皮肤 `content.json` 中 `defaultLocale`、当前语言代码和完整语言代码的 `messages` 合并到 `skin.messages`,当前语言内容覆盖默认文案;这个绑定适用于首页、语音页和 Demo 页的声明式组件。没有匹配的 key 会显示为空字符串,因此组件引用的 key 应在默认语言中提供。该本地化路径只提供皮肤包自身的文案,不会扩展 Wasm 插件的权限化运行时数据。
```json
{
"defaultLocale": "en",
"locales": {
"en": {
"home": {
"eyebrow": "A room of your own",
"title": "Talk",
"titleAccent": "together",
"description": "Join a voice room from your browser.",
"welcomeTitle": "Join the room",
"welcomeDescription": "Choose a name and connect.",
"features": [
{ "title": "Clear voice", "description": "Low-latency Opus audio." }
]
},
"messages": {
"home.connect": "Enter the room",
"voice.activity-heading": "Voice activity",
"demo.heroLead": "A preview customized by this skin."
}
}
}
}
```
`home` 支持 `brandName`、`eyebrow`、`title`、`titleAccent`、`description`、`welcomeTitle`、`welcomeDescription` 和 `features`。普通文字最多 500 个字符;`features` 最多 8 项,每项的 `title` 最多 80 个字符、`description` 最多 240 个字符。功能卡片图标和状态由应用提供,皮肤不能通过 JSON 注入节点。
`messages` 的键是公开页面中翻译调用使用的键;首页/语音页键可在 `web/src/i18n/web-client.ts` 查找,演示页键使用 `demo.` 前缀加字段名(例如 `demo.heroLead`、`demo.speakingNow`)。每个 locale 最多覆盖 200 条,每条文案最多 500 个字符。键只能由小写字母开头,并包含字母、数字或点。语言回退顺序为默认 locale、当前语言和更具体的 locale;之后回退到 WebSpeak 原文。
管理后台的文字不读取皮肤包,不能通过 `messages` 修改。
## CSS 皮肤接口
### 自动隔离
运行时把 `skin.css` 的每个选择器限定在皮肤自己的公开页面根节点内:
```css
/* 选择器必须使用公开的页面/部件钩子;运行时再加上皮肤根作用域。 */
[data-ws-page="voice"] [data-ws-part="voice.member.avatar"] {
outline: 2px solid var(--skin-accent);
outline-offset: 4px;
}
```
实际规则会被限定在类似下面的根节点内,不会匹配 `/admin/**`:
```css
[data-ws-page="voice"] [data-ws-part="voice.member.avatar"]
```
也可以写 `:root { --skin-accent: ... }` 设置皮肤自己的变量;`:root` 会被转换成当前皮肤根。选择器必须包含 `:root`、`[data-ws-page]` 或 `[data-ws-part]`。不要写 `:global()`、`html`、`body` 或 Vue 内部 class 作为公开接口。组件 class 可能随版本调整,`data-ws-part` 才是皮肤作者接口。自定义变量名必须使用 `--skin-` 前缀,不能覆盖 WebSpeak 的内部令牌。
页面根节点使用 `data-ws-page` 区分 `home`、`voice` 和 `demo`。使用 `data-ws-state` 选择明确状态,如 `active`、`idle`、`current`、`open`、`closed`、`drag-over`、`dragging`、`speaking`、`connected`、`self`、`mine` 或 `other`。语音成员还提供 `data-ws-speaking="true|false"` 和 `data-ws-self="true|false"`。交互元素会带有 `data-ws-critical="true"`;没有专属部件名称的按钮、链接、输入框、滑块和可拖动成员会使用通用部件 `data-ws-part="control"`,并以 `data-ws-control-kind` 标出 `button`、`link`、`input`、`checkbox`、`range`、`select`、`textarea`、`menuitem` 或 `draggable`。
### 已发布的部件名称
下列名称来自当前前端模板。对新功能,作者可以先用通用 `control` 部件;后续新增稳定部件会更新本目录。
服务器和频道密码弹窗共用 `auth.password.backdrop`、`auth.password.dialog`、`auth.password.decoration`、`auth.password.eyebrow`、`auth.password.title`、`auth.password.lead`、`auth.password.form`、`auth.password.label`、`auth.password.field`、`auth.password.field-icon`、`auth.password.error` 和 `auth.password.actions`。
服务器和频道密码弹窗共用 `auth.password.backdrop`、`auth.password.dialog`、`auth.password.close`、`auth.password.close-icon`、`auth.password.decoration`、`auth.password.eyebrow`、`auth.password.title`、`auth.password.lead`、`auth.password.form`、`auth.password.label`、`auth.password.field`、`auth.password.field-icon`、`auth.password.input`、`auth.password.error`、`auth.password.actions`、`auth.password.cancel`、`auth.password.submit`、`auth.password.spinner` 和 `auth.password.submit-icon`。
| 页面区域 | `data-ws-part` |
| --- | --- |
| 通用 | `app`、`app.toast`、`control`、`skin.trigger`、`skin.menu`、`skin.option`、`language.trigger`、`language.menu`、`language.option` |
| 首页 | `home`、`home.header`、`home.brand`、`home.header-tools`、`home.gateway-status`、`home.content`、`home.hero`、`home.hero.eyebrow`、`home.hero.title`、`home.hero.description`、`home.features`、`home.feature`、`home.visitors`、`home.visitors.orbit`、`home.visitors.icon`、`home.visitors.label`、`home.visitors.divider`、`home.visitors.total`、`home.visitors.spark`、`home.join-card`、`home.join-card.waveform`、`home.join-card.sonar`、`home.join-title`、`home.join-description`、`home.notice`、`home.form`、`home.server-target`、`home.field-label`、`home.field`、`home.relay-choice`、`home.relay-choice.copy`、`home.server-history`、`home.server-history.group`、`home.server-history.item`、`home.server-history.select`、`home.server-history.favorite-toggle`、`home.favorite-toggle`、`home.identity`、`home.identity-actions`、`home.identity-provider.button`、`home.identity-provider.label`、`home.identity-import.open`、`home.identity-export.button`、`home.identity-import-dialog`、`home.identity-import.header`、`home.identity-import.close`、`home.identity-import.textarea`、`home.identity-import.drop-zone`、`home.identity-import.file-button`、`home.identity-import.error`、`home.identity-import.security`、`home.identity-import.footer`、`home.identity-import.cancel`、`home.identity-import.submit`、`home.server-announcement`、`home.server-announcement.title`、`home.server-announcement.body`、`home.social-links`、`home.connection-status`、`home.connect`、`home.security-note`、`home.footer`、`home.community-dialog` |
| 语音工作区 | `voice.shell`、`voice.workspace`、`voice.header`、`voice.header-actions`、`voice.breadcrumbs`、`voice.performance`、`voice.performance.panel`、`voice.performance.route`、`voice.performance.metrics`、`voice.performance.status`、`voice.performance.webrtc-stats`、`voice.connection-status`、`voice.audio-status`、`voice.poke`、`voice.scroll`、`voice.content`、`voice.activity`、`voice.activity.artwork`、`voice.activity-heading`、`voice.screen-share-error`、`voice.members`、`voice.members.empty`、`voice.member`、`voice.member.action-trigger`、`voice.member.avatar-wrap`、`voice.member.avatar`、`voice.member.mic-status`、`voice.member.name`、`voice.member.status`、`voice.member.live-indicator`、`voice.member.stop-share`、`voice.member.share-actions`、`voice.member-panel`、`voice.member-panel.heading`、`voice.member-panel.search`、`voice.member-panel.channels`、`voice.channel-group`、`voice.channel-group.heading`、`voice.channel-group.members`、`voice.member-row`、`voice.member-row.avatar`、`voice.member-row.copy`、`voice.member-row.flags`、`voice.member-row.volume`、`voice.whisper-strip`、`voice.audio-dock`、`voice.audio-dock.microphone`、`voice.audio-dock.microphone-panel`、`voice.audio-dock.output`、`voice.audio-dock.output-panel`、`voice.audio-settings`、`voice.audio-settings.device-select`、`voice.audio-settings.device-select-trigger`、`voice.audio-settings.device-select-chevron`、`voice.audio-settings.device-select-menu`、`voice.audio-settings.device-select-option`、`voice.mobile-more`、`voice.mobile-nav` |
| KOOK 频道树与服务器切换 | `voice.server-switcher`、`voice.server-switcher.trigger`、`voice.server-switcher.menu`、`voice.server-switcher.item`、`voice.server-switcher.icon`、`voice.server-switcher.label`、`voice.server-switcher.current`、`voice.server-switcher.empty`、`voice.channel-tree.list`、`voice.channel-tree.empty`、`voice.channel-tree.node`、`voice.channel-tree.line`、`voice.channel-tree.expander`、`voice.channel-tree.row`、`voice.channel-tree.icon`、`voice.channel-tree.join-hint`、`voice.channel-tree.name`、`voice.channel-tree.count`、`voice.channel-tree.branch`、`voice.channel-tree.member`、`voice.channel-tree.avatar`、`voice.channel-tree.member-name`、`voice.channel-tree.member-muted`、`voice.channel-tree.member-screen-share`、`voice.channel-tree.member-speaking`、`voice.channel-tree.member-away` |
| 快速服务器 | `voice.favorite-servers.rail`、`voice.favorite-servers.rail.list`、`voice.favorite-servers.rail.item`、`voice.favorite-servers.server`、`voice.favorite-servers.avatar`、`voice.favorite-servers.tooltip`、`voice.favorite-servers.favorite-toggle`、`voice.favorite-servers.add`、`voice.favorite-servers.strip`、`voice.favorite-servers.strip.item`、`voice.favorite-servers.strip.server`、`voice.favorite-servers.strip.favorite-toggle`、`voice.favorite-servers.strip.add`、`voice.favorite-servers.switch-status`、`voice.favorite-servers.current-toggle`、`voice.favorite-servers.dialog-backdrop`、`voice.favorite-servers.dialog`、`voice.favorite-servers.dialog.header`、`voice.favorite-servers.dialog.close`、`voice.favorite-servers.dialog.form`、`voice.favorite-servers.dialog.field`、`voice.favorite-servers.dialog.input`、`voice.favorite-servers.dialog.target`、`voice.favorite-servers.dialog.hint`、`voice.favorite-servers.dialog.actions`、`voice.favorite-servers.dialog.cancel`、`voice.favorite-servers.dialog.submit` |
| 聊天与菜单 | `voice.chat`、`voice.chat.tabs`、`voice.chat.tab`、`voice.chat.heading`、`voice.chat.messages`、`voice.chat.event`、`voice.chat.message`、`voice.chat.message-avatar`、`voice.chat.message-body`、`voice.chat.message-bubble`、`voice.chat.empty`、`voice.chat.composer`、`voice.chat.status`、`voice.context-menu-backdrop`、`voice.context-menu`、`voice.context-menu.header`、`voice.context-menu.move-submenu` |
| 屏幕共享 | `voice.screen-share-settings`、`voice.screen-share-settings.heading`、`voice.screen-share-settings.fields`、`voice.screen-share-settings.note`、`voice.screen-share-settings.actions`、`voice.screen-player`、`voice.screen-player.stage`、`voice.screen-player.video`、`voice.screen-player.placeholder`、`voice.screen-player.exit`、`voice.screen-player.viewers`、`voice.screen-player.viewer-avatar`、`voice.screen-player.live`、`voice.screen-player.source`、`voice.screen-player.controls`、`voice.screen-player.volume`、`voice.screen-player.fullscreen` |
| `/demo` 演示页 | `demo.header`、`demo.brand`、`demo.header-tools`、`demo.badge`、`demo.skin-switcher`、`demo.language-switcher`、`demo.home-link`、`demo.reconnect`、`demo.reconnect.restore`、`demo.layout`、`demo.channels`、`demo.channels.heading`、`demo.channel`、`demo.channel.select`、`demo.channel.members`、`demo.main`、`demo.hero`、`demo.live`、`demo.hero.title`、`demo.hero.description`、`demo.hero.online`、`demo.wave`、`demo.voice-heading`、`demo.voice-grid`、`demo.voice-card`、`demo.avatar`、`demo.member-name`、`demo.member-status`、`demo.chat.heading`、`demo.chat.tabs`、`demo.chat.tab`、`demo.chat.messages`、`demo.chat.message`、`demo.chat.empty`、`demo.chat.composer`、`demo.chat.input`、`demo.chat.send`、`demo.actions`、`demo.actions.heading`、`demo.action.speaking`、`demo.action.poke`、`demo.action.reconnect`、`demo.note`、`demo.user`、`demo.poke-notification`、`demo.poke.dismiss` |
`voice.member.avatar` 是语音活动区头像;`voice.member.mic-status` 在成员麦克风静音时显示,状态值为 `muted`;`voice.member.action-trigger` 是打开宿主成员操作菜单的按钮,由成员卡片小组件的 `options.memberActions` 控制;`voice.member-row.avatar` 是右侧成员树头像。语音成员列表的动态项提供 `.ws-voice-member-enter-active`、`.ws-voice-member-leave-active`、`.ws-voice-member-enter-from`、`.ws-voice-member-leave-to` 和 `.ws-voice-member-move` 动效钩子,可分别设置加入、离开和排序变化的过渡。状态属性还会使用 `current`、`drag-over`、`dragging`、`self`、`events-empty` 和 `messages-empty`。当前根节点以及屏幕共享播放器、弹窗、菜单都属于同一皮肤作用域。
`voice.channel-tree`、`voice.server-switcher`、`voice.server-header` 和 `voice.server-banner` 是 WebSpeak 可信宿主控件。频道树按 TeamSpeak 返回的层级展示语音频道与成员;展开按钮只改变本地显示,双击频道或聚焦后按 Enter 才加入频道。服务器栏布局让频道成员保持可见,折叠按钮只收起子频道。成员头像和语音状态只在宿主渲染的频道树中出现,不会传给皮肤插件。服务器头部在宿主中展示状态并按频道名筛选;切换入口只列出本机收藏和最近连接,可用不透明本地标识触发既有连接流程;地址、密码和身份材料不会传给皮肤组件。服务器欢迎区需 `session.status.read`,从 TeamSpeak `serverinfo` 读取横幅 URL 和欢迎语;没有可用内容时隐藏。欢迎语作为纯文本渲染;`voice.server-banner.image`、`voice.server-banner.welcome`、`voice.server-banner.icon`、`voice.server-banner.title` 与 `voice.server-banner.body` 可由布局编辑器调整。
首页快速连接和语音工作区的服务器栏共用同一列表:收藏项排在前面,最近连接补在后面;地址相同的收藏与历史只显示一项。每项的星标按钮可在两个位置收藏或取消收藏,取消收藏后若该服务器仍在最近连接中,它会留在列表的最近连接位置。皮肤可通过 `data-ws-state="favorite|recent"` 区分首页条目,通过 `data-ws-server-kind="favorite|recent"` 区分语音栏条目。
首页身份选项支持导入 TeamSpeak `.ini` 或身份字段,并可导出为 TeamSpeak `.ini`;导入弹窗解析身份的过程在浏览器本地完成。自定义皮肤可以分别调整身份操作按钮、粘贴区、拖放区域、安全提示和弹窗按钮,但不得隐藏或弱化权限继承与私钥安全提示。
`voice.activity.artwork` 是位于语音活动区内容上方的固定装饰平面。皮肤可以在其上绘制带透明背景的立绘,让角色压住成员卡片或直播画面的边缘;平面本身不占布局空间、不拦截点击,成员和播放器控件仍保持可交互。只通过背景图及背景定位/缩放来适配素材,不改变其定位和层级。
`voice.member-panel` 的 `::before` 是成员栏耳机/场景插画层,宿主已固定它的尺寸、位置、透视和前后层级;皮肤只需提供透明背景素材并调整背景显示、滤镜或阴影,不能自行定位或改变尺寸。消息空状态的 `::before` / `::after` 预留给气泡等小型装饰,宿主负责形状位置;皮肤可以绘制边框、底色和点状背景,但标题和说明文字仍由 WebSpeak 翻译并保持可见。
皮肤与语言选择器的触发按钮、菜单和每个选项都提供上述通用部件钩子。`skin.option` 另带有 `data-ws-skin-id`(内置项为 `builtin.light`、`builtin.dark` 和 `community.illusia-voice`,实例皮肤项为其清单 ID);`language.option` 带有 `data-ws-language`。皮肤可以据此只装饰自己的选择项,而不影响其他皮肤、语言选项或选择器交互。例如:
```css
[data-ws-part="skin.option"][data-ws-skin-id="community.illusia-voice"][role="option"] {
background-image: linear-gradient(110deg, #efffff, #c8f3f2);
}
```
### 令牌、字体、动效和图片
皮肤只负责“画什么样”,不负责“放在哪里”。可用的视觉规则包括文字/背景颜色、背景图片及其裁切、圆角、轮廓、阴影、滤镜和动画;边框可用不占空间的内阴影绘制。推荐先定义皮肤变量,再为公开部件编写视觉规则:
```css
:root {
--skin-page-bg: #091317;
--skin-panel: #142329;
--skin-text: #edf8f5;
--skin-muted: #9db5af;
--skin-accent: #47dcc4;
--skin-card-radius: 20px;
}
[data-ws-part="voice.screen-player"] {
border-radius: var(--skin-card-radius);
box-shadow: 0 18px 50px #0008, inset 0 0 0 1px color-mix(in srgb, var(--skin-accent) 50%, transparent);
}
```
`url()` 只允许引用包内图片或 WOFF2 字体。支持 PNG、JPG/JPEG、WebP、AVIF、GIF 和 WOFF2;SVG 不接受。自带字体示例:
```css
@font-face {
font-family: "ILLUSIA Sans";
src: url("assets/illusia-sans.woff2") format("woff2");
font-display: swap;
}
[data-ws-page="voice"] { font-family: "ILLUSIA Sans", sans-serif; }
```
字体必须随包附带并拥有可再分发许可。自定义字体可能改变不同语言的字宽,因此校验器会给出提示;发布前必须检查中文、英语、德语、俄语和日语下的标题、按钮和长文案是否仍完整可读。字体族名和 `@keyframes` / `@layer` 名称会自动隔离,避免与其他皮肤冲突。请支持 `prefers-reduced-motion`,并确保焦点、错误、静音、正在说话等状态仍容易辨认。
### 固定布局与交互边界
以下 CSS 限制适用于 v1 和 v2:校验器会拒绝改变布局、定位、尺寸、文字流向/换行或交互命中区域的声明,包括 display、position、inset、z-index、宽高、内外边距、网格/弹性布局、间距、溢出裁切、变换、指针事件和字号等。v2 的位置和尺寸只从经过 schema 校验的 layout.json 生效。v3 为支持自由布局而允许这些声明,但仍限制皮肤根作用域、公开钩子、危险值和外部资源;只通过 CSS 隔离不能阻止皮肤作者遮挡控件。
因此,v1/v2 CSS 可以更换艺术素材、颜色和表面风格,但不能重排组件。v3 可以用 CSS 重新安排界面和组件盒子,也能隐藏普通界面部分;基础组件由宿主继续创建,宿主的恢复和权限 UI 位于皮肤作用域外。所有版本都应确保焦点、文字、键盘和触屏操作可用。
v1/v2 外观可以因窄屏而更换图片裁切或装饰,但 @media 规则也受固定布局限制。v2 应在布局数据中分别设置桌面、平板和手机配置;v3 可用媒体查询构建响应式 CSS。上线前仍需预览各设备尺寸、所有五种语言、键盘焦点、减少动效偏好,并确认必要控件可用、文字未被裁切。
## 安全边界和限制
校验在上传端和服务端执行;服务端只登记有效皮肤包,访客只能下载登记的包。当前限制如下:
| 项目 | 上限 |
| --- | ---: |
| ZIP `.wskin` | 20 MiB |
| 解压总大小 | 50 MiB |
| ZIP 条目数 | 128 |
| 单个 CSS 文件 | 512 KiB |
| `content.json` / `components.json` | 256 KiB |
| 单张图片(包括预览) | 16 MiB |
| 单个 WOFF2 字体 | 4 MiB |
| 每实例皮肤数 | 50 |
| 每实例皮肤包总存储 | 200 MiB |
压缩包路径穿越、重复/冲突路径、符号链接、异常 ZIP 元数据和本地文件头/目录不一致都会被拒绝。仅允许受支持的 CSS at-rule:`@media`、`@supports`、`@container`、具名 `@layer`、`@font-face` 和 keyframes。`@import`、脚本、HTML、外部网络资源会被拒绝;`!important` 可用于皮肤作用域内的样式。字体 `local()` 也会拒绝,避免绕过包内字体来源。
v1/v2 校验器会阻止隐藏必要操作控件和其容器。v3 可改变显示状态,因此皮肤开发者必须保留语音操作路径;授权界面、皮肤选择和恢复入口由宿主在皮肤作用域之外提供。以下选择器是旧格式对可选装饰部件的透明度白名单:
```css
[data-ws-part="home.hero.eyebrow"]
[data-ws-part="home.gateway-status"]
[data-ws-part="home.features"]
[data-ws-part="home.feature"]
[data-ws-part="home.visitors"]
[data-ws-part="voice.activity-heading"]
[data-ws-part="voice.member.avatar"]
[data-ws-part="voice.member.live-indicator"]
[data-ws-part="voice.member-row.avatar"]
[data-ws-part="voice.screen-player.viewer-avatar"]
[data-ws-part="voice.screen-player.live"]
[data-ws-part="demo.badge"]
[data-ws-part="demo.wave"]
[data-ws-part="demo.avatar"]
[data-ws-part="demo.member-status"]
[data-ws-part="demo.note"]
```
上面必须使用单独的精确属性选择器;不能通过父容器、组合选择器或子元素间接隐藏/重置内容。关键帧只有在其动画仅被这些可选部件引用时,才可使用透明度归零;若关键帧也被必要控件引用或动画名通过变量指定,则会被拒绝。`clip`、`clip-path` 和 `mask` 一律不允许,避免视觉裁切误伤真实控件。校验器是防止布局回归的边界,不是视觉质量证明;自定义字体、复杂背景和高对比特效仍需人工检查文字可读性与控件辨识度。
皮肤可以重画控制外观。v1/v2 不能重新布置必要操作;v3 可以,因此须人工实测加入/退出、麦克风状态、设置、菜单、屏幕共享退出、音量、全屏等操作的可达性。校验成功不代表设计质量合格;提交前要逐页实测窄屏和桌面尺寸、所有界面语言、键盘焦点与减少动效设置。
CSS 被限定在 `.ws-skin-root` 内,管理员页面不会继承皮肤。删除实例里的包会停止从服务器提供该包;已经下载过的浏览器副本会保留在本地存储,因此仍可能在该浏览器的选择器中出现。清除该站点的浏览器数据可移除本地副本。
## 制作与验收
1. 选择最接近目标的 `docs/examples/` 示例,复制其皮肤源码目录,并修改 `manifest.json` 的唯一 `id`、名称、作者、版本和授权。ILLUSIA 是美术参考,不要求沿用它的角色或配色。
2. 先查本文件和系统规格中已经发布的公开钩子、数据、控件和动作。不要依赖 Vue 内部 class、未公开的数据路径或某个实例的本地文件。
3. 将皮肤的页面/组件结构、样式、文案、布局及所有资源放在包目录中:CSS/图片/字体写入 `skin.css` 和 `assets/`,可选多语言文案写入 `content.json`,声明式组件写入 `components.json`,作者默认布局写入 `layout.json`,当前支持的插件逻辑和资源放进 v4 `plugins/`。运行时动态数据使用公开上下文;TeamSpeak 行为使用已发布的宿主动作。
4. 皮肤任务中不要修改 WebSpeak 核心客户端、服务端、共享协议或宿主控件。若没有足够的通用公开接口,先写明需要的数据/动作、权限和兼容性,再将它作为独立的平台工作处理;不要给某款皮肤增加专用核心分支。
5. 在包根目录生成 ZIP,再改扩展名为 `.wskin`,只包含 manifest 声明的文件。PowerShell 示例:
```powershell
Compress-Archive -Path .\docs\examples\illusia-voice\* -DestinationPath .\illusia-voice.zip -Force
Rename-Item .\illusia-voice.zip illusia-voice.wskin
```
6. 使用皮肤导入器验证生成的 `.wskin`,再在 `/admin/skins` 导入这个确切文件。用访客浏览器分别检查连接首页、语音页和 `/demo`;测试自定义图片、交互控件、会话状态、成员、聊天、屏幕共享及设置。v1/v2 检查固定布局;v2 检查作者默认布局和用户本地覆盖;v3/v4 检查授权拒绝/撤销、数据边界和失效恢复。
7. 检查窄屏与桌面、所有支持的语言、长文案、键盘焦点、对比度和减少动效偏好,并确认素材可再分发。若声称跨实例可移植,应在两个兼容版本的实例导入同一份 `.wskin`,记录并比较文件 SHA-256;不要为第二个实例复制核心代码改动。
当前自动化回归涵盖 ZIP/清单验证、资源路径、CSS 隔离与拒绝规则、文案结构和服务端皮肤目录读写。视觉排版、内容遮挡和浏览器间表现仍须人工预览。
自绘成员列表时,`session.members` 可读取 `screenSharing` 与 `screenShareStreamId`;这两个成员字段和 `screenShare.streams` 一样要求 `voice.screenShare.read`。用 `member.screenSharing` 显示共享标记,再将 `member.screenShareStreamId` 绑定到 `voice.joinScreenShare`(还需 `voice.screenShare.control`)即可让用户观看。未声明/未获共享读取权限的皮肤不会收到这两个字段;整页替换皮肤仍须在自己的成员列表中绘制标记或观看入口。
\n
+11
View File
@@ -0,0 +1,11 @@
# ILLUSIA风
ILLUSIA 风格 is a schema v3 open-skin example built from the local artwork in [illusia-voice/assets](./illusia-voice/assets/). Version 2.0.2 keeps its existing light-glass CSS and current-channel card, adds matching visual treatment for the host member-card screen-share status and watch action, and uses a black letterbox background for the fixed WebSpeak screen-share player. The package still uses WebSpeak's base translations and contains no executable skin code.
The new voice-page component is defined in [components.json](./illusia-voice/components.json). It reads only the current public channel name through session.status.read and uses a local mascot image for a compact, non-interactive glass badge. The component needs the user's local approval before it renders; that approval is scoped to this skin version and can be revoked from the host access control. It cannot switch channels, read favorites, access a server address, or control audio.
The CSS continues to style the WebSpeak home page, voice workspace, screen-share player and /demo with cyan accents and original art. The homepage includes translucent navigation and selectors, animated mascot details, feature tiles, a visitor badge, a join action and a curved footer. The voice workspace includes the shared quick-server list, channel/member views, chat empty state, screen-share art and audio controls. The shared member cards detect active screen shares and show a themed live badge and watch button. The mobile view keeps WebSpeak's responsive host navigation while applying ILLUSIA colors and artwork.
The distributable package and the copy served from web/public/skins are built from the source folder. After changing source files, run `npm run skin:illusia:build` to recreate both copies. Run the package import test to confirm both copies stay byte-identical and valid.
Use only artwork you have permission to redistribute when publishing a skin to other WebSpeak instances.
+48
View File
@@ -0,0 +1,48 @@
# KAAK voice skin
The participant stage uses larger profile portraits (104px on desktop, reduced for narrow layouts). A live speaking state adds a pulsing accent ring and a visible waveform marker, including when participant names are hidden while chat is open. The ring and speaking status use KAAK's shared green accent.
The server sidebar can show the connected TeamSpeak virtual server's configured host-banner image and welcome message between the server header and channel tree. Both fields come from live server information; the card disappears when neither is configured, and a missing or failed banner image does not hide the welcome text. Welcome content is rendered as plain text.
The server sidebar can show the connected TeamSpeak virtual server's configured host-banner image and welcome message between the server header and channel tree. Both fields come from live server information; the card disappears when neither is configured, and a missing or failed banner image does not hide the welcome text. Welcome content is rendered as plain text.
The voice-channel sidebar follows KOOK's observed typography: 16px/700 server title, 12px/700 group title, 14px/700 channel title, and 12px/400 low-contrast member count.
Chat visibility is kept separately for each active TeamSpeak channel, so collapsing one room does not collapse the next room. TeamSpeak does not expose KOOK's music-channel category; a new channel therefore starts expanded until the user changes its chat visibility.
While the WebSpeak performance card is sampling, its refresh icon spins to show the busy state; the animation is disabled when reduced motion is requested.
KAAK is a schema v3 open-skin package with full connection and voice-workspace surfaces. Its desktop voice page follows KOOK's proportions: an 86px server rail with 58px icons and 18px vertical spacing, a 290px channel pane, a 40px top bar, a central participant stage, right-side chat attached to the current voice channel, and a lower-left voice dock. The server rail uses KOOK's rounded-square silhouette, a 2px green active outline and left-edge marker, with neutral fallback tiles and the muted purple active tile from the reference. The identity tile stays pinned at the bottom with a 54px circular monogram and connection-aware online dot; the server list scrolls when the window is short. The host provides a stable color-tone value derived only from the privacy-safe label, but the rail keeps the KOOK neutral tile treatment rather than exposing those tones. The KOOK voice room is the point-to-point visual reference: composition, member presentation, styling, and motion should be compared directly, rather than treating matching component types or approximate placement as sufficient. The left tree contains the TeamSpeak voice channels only; KOOK's separate text-channel group is outside this pass because TeamSpeak has no equivalent channel type. The current voice channel's text chat remains on the right. Closing it hides the entire panel, expands the participant stage, and leaves a reopen button in the stage heading; this happens without leaving the voice room. Its header uses the `#` channel mark and an unobtrusive close control; the composer sits at the bottom edge. Messages use author monograms, a separate identity/time line, and readable message text. The central stage uses WebSpeak's reusable member-card widget so available TeamSpeak profile avatars appear inside KAAK's participant tiles; the tiles use a wide 1.82:1 layout with a responsive grid to match KOOK's participant presentation. Member names stay hidden at rest while chat is open and fade upward into the lower-left label on hover; they remain visible while chat is collapsed. KAAK's CSS adds hover depth and a smoothly transitioning speaking ring driven by live voice state. Active screen shares appear on member cards with a live badge and a themed watch action; the share player remains a WebSpeak host component. The dock retains WebSpeak's trusted connection-quality, audio, and disconnect controls. Input/output volume buttons open hover or keyboard-focus panels with live numeric levels; sliders use a skin-colored progress track, a distinct thumb, and visible focus feedback. Audio input and output devices use a reusable keyboard-accessible picker with a scrollable option list, selected/highlighted states, and an animated chevron; KAAK styles the trigger and open list. The connection surface, voice workspace, and audio settings share KOOK's PingFang SC-first font stack; audio settings use 16px/600 section headings and observed 14px/400 field labels. Audio sliders use a 16px thumb with hover/focus feedback. The performance card opens with a short entrance motion and readable network/audio metrics. No real device, volume, or microphone state is changed during visual checks. The roster shows connected TeamSpeak clients only; it does not invent an offline list. Channel selection is single-click; joining is double-click. The narrow layout keeps the host's mobile controls available while retaining readable member tiles.
The single TeamSpeak voice-channel group in the left tree collapses and expands with a short two-way height and fade transition like KOOK's voice group; the separate KOOK text-channel group remains outside this pass. A first click selects a channel and reveals a brief “双击加入” hint; the hint disappears on the active room. The current voice-room heading keeps the channel name and live member count visible above the participant stage while the attached chat is expanded, matching KOOK's room view. Member cards expose WebSpeak's trusted member-actions menu from a small hover or keyboard-focus control; desktop cards also open it on right-click, and touch layouts keep the control visible. KAAK gives the host menu KOOK's compact dark panel, separated volume section, and highlighted action rows while keeping WebSpeak's own individual-volume slider and member actions; it does not add KOOK menu actions or skin-side audio logic. While a screen-share peer is active, the voice-status panel also displays its browser-side video codec and transport statistics.
The design target is the voice-client portion of KOOK, as requested by the project owner. It does not include discovery, companion/party, event, store, advertising, administrator, or other service-operator pages. It does not add a KOOK account flow, direct messages, server administration, or channels absent from the connected TeamSpeak server. The voice performance card also closes on outside click or Escape; Escape returns focus to its trigger, and its entrance/exit motion respects reduced-motion preferences.
The device picker now follows the public KOOK style geometry: a 40px trigger with 12px corners, a menu with 12px corners and 8px inset, and 32px rows with 2px gaps and 8px corners. Hover and selected rows use distinct low-contrast fills. The shared host measures the rendered menu before applying viewport limits, so skin-defined padding and row spacing stay visible without a KAAK-specific placement path. KAAK uses KOOK's dark-theme brand green (`#6cbf00`, `#7ac51a` hover) for speaker, slider, and control highlights. The performance trigger, metric values, volume readouts, audio settings icons, and sliders reuse the same accent tokens. Volume sliders use a 4px track, a 16px white thumb with a 2px brand-green border, and a 3px hover/focus halo without extra hover scaling.
The audio settings surface now follows the observed KOOK form proportions: a 660px dark card, 16px corners, 72px field rows, and a two-column label/control layout. Device and volume controls keep their WebSpeak behavior; only their shared form grouping and KAAK skin presentation changed. The layout stacks fields on narrow screens. KOOK's settings typography remains PingFang SC-first, with a 32px/600 title, 16px/600 section headings, and 14px/400 field labels.
The existing WebSpeak noise-suppression switch is available in the audio settings on desktop and mobile, matching its placement in KOOK's voice settings. It remains the browser's current noise-suppression control; KAAK does not claim to reproduce KOOK's branded processing modes.
## Reference access note
The owner authorized inspection of the first two voice rooms in the KOOK server. Both rooms were entered and viewed; the microphone remained off and no message was sent. The in-room view confirmed a single large participant tile in the center, a separate right-side panel for the active voice channel's text chat, a narrow server rail, grouped voice channels, and a compact voice-control dock near the lower left. The chat was empty, so no message contents were recorded. Server/room identifiers and member names were not recorded.
## Components and permissions
The connection page and voice workspace are full-page declarative surfaces in [components.json](./kaak-voice/components.json). The voice surface requests only the capabilities it uses: visible server shortcuts, channel and member data, cached profile-avatar display inside the trusted member-card widget, channel joining, channel chat, voice status, microphone/output controls, whisper controls, disconnect, and screen-share status/read/control. Its member-card widget explicitly enables share status and watch actions; the KAAK dock uses the host's screen-share control. When a screen-share peer is active, the performance panel shows browser-side video codec and transport metrics. The host renders trusted connection, language, skin, and audio controls. KAAK keeps the shared-screen player inside the central voice-stage column with an explicit responsive height, so the player cannot collapse when the host applies its inline video sizing; member cards scroll in the remaining area. The full source image remains visible with black letterboxing. Server and channel password prompts use the compact dark KAAK dialog style while retaining WebSpeak's trusted password, error, cancel, and retry behavior. It rechecks permissions and connection state when each action runs; approval is local to this skin version and can be revoked from the host access control.
The server header uses the live, privacy-filtered TeamSpeak server label and a trusted `voice.server-switcher` menu backed by favorites and recent connections. Its click handler reuses WebSpeak's existing connection flow with an opaque local ID; addresses and credentials never enter skin data. The left panel uses the trusted `voice.channel-tree` widget to retain TeamSpeak channel nesting, member counts and capacity, available avatars, and mute/speaking/away states. Expanding a branch is local UI state, a single click selects a channel, and double-click joins it. With `memberActions` enabled, right-clicking another member row opens WebSpeak's existing host-owned action menu. With `memberDragDrop` enabled, another member can be dragged onto a different channel row; the member row and target channel receive visual feedback, and the host reuses its existing move-client operation. Both options default off for other skins. The skin does not add KOOK's separate text-channel list.
On desktop, right-clicking another member row in the channel tree or member card opens WebSpeak's existing host-owned member actions menu. Member cards also retain their accessible action button; keyboard activation remains anchored to that button, and touch layouts keep it available. The menu's actions come from WebSpeak and are unchanged by the skin.
Member cards are rendered by WebSpeak's trusted `voice.member-cards` widget. It displays an already available TeamSpeak profile avatar, or the host-generated nickname initial when no avatar is available; image bytes stay in the host and are not exposed in the skin's data context or Wasm runtime. The skin does not receive server addresses, passwords, identity keys, raw audio, private messages, or arbitrary network/storage APIs. Its markup is data-only; it contains no executable JavaScript or Wasm. The `/demo` page uses synthetic data and does not connect to TeamSpeak.
## Files
- Source package: [kaak-voice](./kaak-voice/)
- Component schema: [components.json](./kaak-voice/components.json)
- Distributable archive: [kaak-voice.wskin](./kaak-voice.wskin)
- Shared format and safety rules: [SKIN_DEVELOPMENT.md](../SKIN_DEVELOPMENT.md)
KAAK is included in the public skin selector and its `.wskin` archive is also available as a standalone package. After changing the source, run `npm run skin:kaak:build` to rebuild both copies, then run the package tests and verify the connection page, approval, denial, revoke, desktop, and narrow-screen paths in the local browser. The connected voice surface can be verified when a TeamSpeak session is available.
+10
View File
@@ -0,0 +1,10 @@
# Open Voice Surface scaffold
This importable schema v3 surface package exercises complete public home and voice pages using only declarative nodes and WebSpeak-owned controls. It includes server switching, channel navigation, visible members, per-member screen-share status and a watch action, chat, audio, whisper, connection controls, and the built-in language and skin selectors. It contains no discovery, events, shop, companion, advertising, or administration pages.
This is an implementation scaffold for testing the open-skin format, not a pixel-matched KOOK skin. The visual reference was read in the in-app browser in the first two user-authorized voice rooms. The separate [KAAK voice sample](./KAAK-VOICE.md) records the voice-only layout findings and applies them to the channel and member sidebars. No server/room identifiers, member names, or chat contents were retained. Discovery, companion shop, events, ads, and operator/admin pages are outside the sample's scope.
- Source: [open-voice-surface](./open-voice-surface/)
- Importable package: [open-voice-surface.wskin](./open-voice-surface.wskin)
- Shared component and permission rules: [skin development guide](../SKIN_DEVELOPMENT.md)
- Current runtime contract and safety boundaries: [skin development guide](../SKIN_DEVELOPMENT.md)
Binary file not shown.
@@ -0,0 +1,9 @@
# Harbor Voice Workspace
这是一个 KOOK 语音工作区风格的完整皮肤测试包,参考范围只限语音客户端:服务器快捷栏、频道列表、中央聊天、成员列表和底部语音控制。没有复用 KOOK 的图片、标志、广告或站点文案,也没有加入发现、陪玩、派对、商城、活动通知、排行榜或管理后台。
皮肤使用 `components.json` 的完整声明式 surface 自己构建频道树、聊天消息与输入框、成员状态和悄悄话控制;底部音频区嵌入 WebSpeak 的可信音频控件,继续使用现有麦克风/扬声器开关和音频设置(包括麦克风灵敏度)。样例隐藏与语音布局无关的伴奏开关;断开和频道控制仍由 WebSpeak 校验并执行。频道缩进直接映射 TeamSpeak 公开树深度;频道单击只改变皮肤本地选中态,双击才请求 TeamSpeak 切换频道。语音成员列表显示公开的说话、静音和离开状态。消息、频道和成员数据由权限筛选后提供。屏幕共享启动保留一个可自行排版和换肤的可信宿主按钮,以保留浏览器要求的真实用户手势;视频流和设备 API 不交给皮肤代码。皮肤不读取服务器地址、账号凭据或连接密钥,也不包含可执行 JavaScript/Wasm;这个样例用于验证 v3 surface 的可定制界面和交互,v4 Wasm 插件运行时另由运行时测试覆盖。
桌面布局保留四个区域:服务器快捷栏、频道树、聊天区和成员区;服务器栏底部展示当前 TeamSpeak 昵称,连接后语音控制坞固定在频道栏底部。昵称项只呈现当前会话身份,不模拟 KOOK 账号或资料运营功能。窄屏下服务器栏保持可用,频道项转为横向滚动,成员与语音控制各自占一行,基础连接控制不被隐藏。
`manifest.json`、`components.json` 与 `skin.css` 是可编辑源码。根目录的 `../harbor-voice.wskin` 是源码打包后的本地导入包;源码修改后运行 `npm run skin:harbor:build` 重新打包,再在测试实例的皮肤管理页导入验证。当前没有加入公共皮肤目录或发布到服务器。
+480
View File
@@ -0,0 +1,480 @@
{
"schemaVersion": 3,
"components": [
{
"id": "harbor-home",
"name": "Harbor connection home",
"page": "home",
"mode": "surface",
"accessibleName": "WebSpeak connection page",
"permissions": ["ui.surface.replace"],
"actions": {},
"root": {
"tag": "main",
"part": "home",
"children": [
{
"tag": "header",
"part": "home-header",
"children": [
{ "tag": "span", "part": "brand-mark", "children": [{ "text": "W" }] },
{ "tag": "span", "part": "brand-name", "children": [{ "text": "WEBSPEAK" }] },
{ "widget": "app.language-switcher", "part": "language" },
{ "widget": "app.skin-switcher", "part": "skin" }
]
},
{
"tag": "section",
"part": "connection-card",
"children": [
{ "tag": "p", "part": "eyebrow", "children": [{ "text": "VOICE CLIENT" }] },
{ "tag": "h1", "part": "title", "children": [{ "text": "Connect with your community" }] },
{ "tag": "p", "part": "description", "children": [{ "text": "Choose a TeamSpeak server and return to your voice channels." }] },
{ "widget": "home.connection-form", "part": "connection-form" }
]
},
{
"tag": "footer",
"part": "home-footer",
"children": [{ "text": "Your connection and identity stay under WebSpeak's control." }]
}
]
}
},
{
"id": "harbor-workspace",
"name": "Harbor voice workspace",
"page": "voice",
"mode": "surface",
"accessibleName": "WebSpeak voice workspace",
"permissions": [
"ui.surface.replace",
"session.status.read",
"session.channels.read",
"session.members.read",
"session.channel.join",
"servers.quickList.read",
"servers.quickList.switch",
"chat.channel.read",
"chat.channel.send",
"audio.status.read",
"audio.microphone.control",
"audio.output.control",
"voice.whisper.status.read",
"voice.whisper.control",
"voice.disconnect",
"voice.screenShare.read",
"voice.screenShare.control"
],
"actions": {
"switch-server": {
"type": "quickServers.switch",
"args": { "quickServerId": "{{server.id}}" }
},
"select-channel": {
"type": "ui.setState",
"args": { "key": "selectedchannel", "value": "{{channel.id}}" }
},
"join-channel": {
"type": "voice.joinChannel",
"args": { "channelId": "{{channel.id}}" }
},
"send-message": {
"type": "chat.sendMessage",
"args": { "text": "{{state.message}}" }
},
"disconnect": { "type": "voice.disconnect", "args": {} },
"whisper-on": { "type": "voice.setWhisperActive", "args": { "active": true } },
"whisper-off": { "type": "voice.setWhisperActive", "args": { "active": false } },
"watch-screen-share": {
"type": "voice.joinScreenShare",
"args": { "streamId": "{{member.screenShareStreamId}}" }
},
"watch-channel-member-screen-share": {
"type": "voice.joinScreenShare",
"args": { "streamId": "{{voicemember.screenShareStreamId}}" }
}
},
"state": { "selectedchannel": "", "message": "" },
"root": {
"tag": "main",
"part": "workspace",
"children": [
{
"tag": "header",
"part": "topbar",
"children": [
{ "tag": "span", "part": "brand-mark", "children": [{ "text": "W" }] },
{ "tag": "span", "part": "brand-name", "children": [{ "text": "WEBSPEAK" }] },
{ "tag": "span", "part": "server-title", "children": [{ "text": "{{session.status.serverLabel}}" }] },
{ "widget": "app.language-switcher", "part": "language" },
{ "widget": "app.skin-switcher", "part": "skin" }
]
},
{
"tag": "nav",
"part": "server-rail",
"attributes": { "aria-label": "Favorite and recent servers" },
"children": [
{
"tag": "div",
"part": "quick-server-item",
"repeat": { "path": "servers.quickList", "as": "server" },
"children": [
{
"tag": "button",
"part": "quick-server",
"attributes": {
"type": "button",
"aria-current": "{{server.current}}",
"aria-label": "Switch to {{server.label}}"
},
"events": { "click": "switch-server" },
"children": [
{ "tag": "span", "part": "server-monogram", "children": [{ "text": "{{server.label}}" }] },
{
"tag": "span",
"part": "server-kind",
"when": { "path": "server.favorite", "equals": true },
"children": [{ "text": "Saved" }]
},
{
"tag": "span",
"part": "server-kind",
"when": { "path": "server.kind", "equals": "recent" },
"children": [{ "text": "Recent" }]
}
]
}
]
}
]
},
{
"tag": "aside",
"part": "channel-panel",
"attributes": { "aria-label": "Server channels" },
"children": [
{
"tag": "header",
"part": "server-summary",
"children": [
{ "tag": "strong", "part": "server-name", "children": [{ "text": "{{session.status.serverLabel}}" }] },
{ "tag": "small", "part": "server-subtitle", "children": [{ "text": "VOICE CHANNELS" }] }
]
},
{
"tag": "nav",
"part": "channel-list",
"attributes": { "aria-label": "Channels" },
"children": [
{ "tag": "h2", "part": "section-label", "children": [{ "text": "CHANNELS" }] },
{
"tag": "div",
"part": "channel-item",
"repeat": { "path": "session.channels", "as": "channel" },
"children": [
{
"tag": "button",
"part": "channel-row",
"attributes": {
"type": "button",
"aria-current": "{{channel.current}}",
"aria-label": "Double-click to join {{channel.name}}",
"data-depth": "{{channel.depth}}"
},
"events": { "click": "select-channel", "dblclick": "join-channel" },
"children": [
{ "tag": "span", "part": "channel-glyph", "children": [{ "text": "◉" }] },
{ "tag": "span", "part": "channel-name", "children": [{ "text": "{{channel.name}}" }] },
{ "tag": "small", "part": "channel-count", "children": [{ "text": "{{channel.memberCount}}" }] },
{
"tag": "span",
"part": "selected-channel-indicator",
"when": { "path": "state.selectedchannel", "equals": "{{channel.id}}" },
"attributes": { "aria-label": "Selected" }
}
]
},
{
"tag": "ul",
"part": "channel-voice-members",
"when": { "path": "channel.current", "equals": true },
"attributes": { "aria-label": "Members connected to this channel" },
"children": [
{
"tag": "li",
"part": "channel-voice-member",
"repeat": { "path": "channel.members", "as": "voicemember" },
"children": [
{ "tag": "span", "part": "channel-member-avatar", "children": [{ "text": "{{voicemember.name}}" }] },
{ "tag": "span", "part": "channel-member-name", "children": [{ "text": "{{voicemember.name}}" }] },
{
"tag": "span",
"part": "channel-member-muted",
"when": { "path": "voicemember.status", "equals": "muted" },
"attributes": { "aria-label": "Microphone muted" },
"children": [{ "text": "MIC OFF" }]
},
{
"tag": "span",
"part": "channel-member-away",
"when": { "path": "voicemember.status", "equals": "away" },
"attributes": { "aria-label": "Away" },
"children": [{ "text": "AWAY" }]
},
{
"tag": "span",
"part": "channel-member-state",
"when": { "path": "voicemember.self", "equals": true },
"children": [{ "text": "YOU" }]
},
{
"tag": "span",
"part": "channel-member-state",
"when": { "path": "voicemember.speaking", "equals": true },
"attributes": { "aria-label": "Speaking" },
"children": [{ "text": "●" }]
},
{
"tag": "div",
"part": "channel-member-screen-share",
"when": { "path": "voicemember.screenSharing", "equals": true },
"children": [
{ "tag": "span", "part": "channel-member-screen-share-live", "children": [{ "text": "SHARING" }] },
{
"tag": "button",
"part": "channel-member-screen-share-watch",
"when": { "path": "voicemember.self", "equals": false },
"attributes": { "type": "button", "aria-label": "Watch {{voicemember.name}}'s screen" },
"events": { "click": "watch-channel-member-screen-share" },
"children": [{ "text": "WATCH" }]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"tag": "section",
"part": "conversation",
"attributes": { "aria-label": "Current channel conversation" },
"children": [
{
"tag": "header",
"part": "conversation-heading",
"children": [
{ "tag": "span", "part": "conversation-glyph", "children": [{ "text": "◉" }] },
{ "tag": "h1", "part": "channel-title", "children": [{ "text": "{{session.status.channelName}}" }] },
{
"tag": "span",
"part": "connection-state",
"when": { "path": "session.status.connected", "equals": true },
"children": [{ "text": "CONNECTED" }]
}
]
},
{
"tag": "div",
"part": "chat",
"children": [
{
"tag": "div",
"part": "chat-message-list",
"attributes": { "aria-label": "Current channel messages", "role": "log", "aria-live": "polite" },
"children": [
{
"tag": "p",
"part": "chat-empty",
"when": { "path": "chat.messages", "empty": true },
"children": [{ "text": "No messages yet. Say hello to the channel." }]
},
{
"tag": "article",
"part": "chat-message",
"repeat": { "path": "chat.messages", "as": "message" },
"children": [
{
"tag": "header",
"part": "chat-message-heading",
"children": [
{ "tag": "strong", "part": "chat-message-author", "children": [{ "text": "{{message.author}}" }] },
{ "tag": "time", "part": "chat-message-time", "children": [{ "text": "{{message.time}}" }] }
]
},
{ "tag": "p", "part": "chat-message-text", "children": [{ "text": "{{message.text}}" }] }
]
}
]
},
{
"tag": "form",
"part": "chat-composer",
"events": { "submit": "send-message" },
"children": [
{
"tag": "input",
"part": "chat-input",
"bindValue": "message",
"attributes": {
"type": "text",
"maxlength": 1000,
"autocomplete": "off",
"placeholder": "Message this channel",
"aria-label": "Message this channel"
}
},
{
"tag": "button",
"part": "chat-send",
"attributes": { "type": "submit", "aria-label": "Send message" },
"children": [{ "text": "Send" }]
}
]
}
]
},
{ "widget": "voice.screen-share-player", "part": "screen-player" }
]
},
{
"tag": "aside",
"part": "members-panel",
"attributes": { "aria-label": "Members in this channel" },
"children": [
{
"tag": "header",
"part": "members-heading",
"children": [
{ "tag": "h2", "part": "section-label", "children": [{ "text": "MEMBERS" }] }
]
},
{
"tag": "ul",
"part": "member-list",
"children": [
{
"tag": "li",
"part": "member-row",
"repeat": { "path": "session.members", "as": "member" },
"children": [
{ "tag": "span", "part": "member-avatar", "children": [{ "text": "{{member.name}}" }] },
{ "tag": "span", "part": "member-name", "children": [{ "text": "{{member.name}}" }] },
{
"tag": "span",
"part": "speaking-indicator",
"when": { "path": "member.speaking", "equals": true },
"attributes": { "aria-label": "Speaking" },
"children": [{ "text": "SPEAKING" }]
},
{
"tag": "span",
"part": "member-muted-state",
"when": { "path": "member.status", "equals": "muted" },
"attributes": { "aria-label": "Microphone muted" },
"children": [{ "text": "MIC OFF" }]
},
{
"tag": "span",
"part": "member-away-state",
"when": { "path": "member.status", "equals": "away" },
"attributes": { "aria-label": "Away" },
"children": [{ "text": "AWAY" }]
},
{
"tag": "div",
"part": "member-screen-share",
"when": { "path": "member.screenSharing", "equals": true },
"children": [
{ "tag": "span", "part": "member-screen-share-live", "children": [{ "text": "SHARING" }] },
{
"tag": "button",
"part": "member-screen-share-watch",
"when": { "path": "member.self", "equals": false },
"attributes": { "type": "button", "aria-label": "Watch {{member.name}}'s screen" },
"events": { "click": "watch-screen-share" },
"children": [{ "text": "WATCH" }]
}
]
}
]
}
]
},
{
"tag": "div",
"part": "whisper-controls",
"children": [
{
"tag": "button",
"part": "whisper-start",
"when": { "path": "whisper.status.active", "equals": false },
"attributes": { "type": "button", "aria-label": "Start whisper" },
"events": { "click": "whisper-on" },
"children": [{ "text": "Whisper" }]
},
{
"tag": "button",
"part": "whisper-stop",
"when": { "path": "whisper.status.active", "equals": true },
"attributes": { "type": "button", "aria-label": "Stop whisper" },
"events": { "click": "whisper-off" },
"children": [{ "text": "Whisper on" }]
}
]
}
]
},
{
"tag": "footer",
"part": "voice-dock",
"attributes": { "aria-label": "Voice controls" },
"children": [
{
"tag": "div",
"part": "voice-dock-heading",
"children": [
{ "tag": "span", "part": "connection-indicator", "children": [{ "text": "●" }] },
{ "tag": "strong", "part": "voice-channel-name", "children": [{ "text": "{{session.status.channelName}}" }] },
{ "tag": "span", "part": "voice-dock-caption", "children": [{ "text": "VOICE CONNECTED" }] }
]
},
{
"tag": "div",
"part": "voice-dock-actions",
"children": [
{ "widget": "voice.screen-share-start", "part": "screen-share-start" },
{ "widget": "voice.audio-controls", "part": "audio-controls" },
{
"tag": "button",
"part": "disconnect-control",
"attributes": { "type": "button", "aria-label": "Disconnect voice" },
"events": { "click": "disconnect" },
"children": [{ "text": "Leave" }]
}
]
}
]
},
{
"tag": "div",
"part": "identity-entry",
"when": { "path": "session.status.userName" },
"attributes": { "role": "group", "aria-label": "Current TeamSpeak identity" },
"children": [
{ "tag": "span", "part": "identity-monogram", "children": [{ "text": "TS" }] },
{ "tag": "span", "part": "identity-name", "children": [{ "text": "{{session.status.userName}}" }] }
]
}
]
}
}
]
}
+13
View File
@@ -0,0 +1,13 @@
{
"schemaVersion": 3,
"packageType": "open-skin",
"id": "community.harbor-voice",
"name": "Harbor Voice Workspace",
"version": "1.1.1",
"author": "WebSpeak Project",
"license": "AGPL-3.0-only",
"description": "A KOOK-inspired dark voice workspace using only WebSpeak host controls and public session data.",
"entry": "skin.css",
"components": "components.json",
"minAppVersion": "0.2.7"
}
+946
View File
@@ -0,0 +1,946 @@
:root {
color-scheme: dark;
--skin-harbor-bg: #17181b;
--skin-harbor-rail: #141518;
--skin-harbor-panel: #1d1e22;
--skin-harbor-raised: #292a2f;
--skin-harbor-hover: #303137;
--skin-harbor-border: #303136;
--skin-harbor-text: #f0f1f3;
--skin-harbor-muted: #a0a2a8;
--skin-harbor-dim: #777a82;
--skin-harbor-accent: #58c877;
--skin-harbor-danger: #e36b6b;
--skin-harbor-radius: 9px;
}
[data-ws-plugin-part="harbor-home"] {
display: grid;
grid-template-rows: auto 1fr auto;
justify-items: center;
min-height: 100dvh;
gap: 28px;
padding: clamp(16px, 4vw, 42px);
color: var(--skin-harbor-text);
background:
radial-gradient(ellipse at 50% 44%, #25272b 0, transparent 58%),
var(--skin-harbor-bg);
}
[data-ws-plugin-part="harbor-home.home-header"] {
display: flex;
align-items: center;
gap: 11px;
width: min(100%, 1080px);
}
[data-ws-plugin-part="harbor-home.brand-mark"],
[data-ws-plugin-part="harbor-workspace.brand-mark"] {
display: grid;
place-items: center;
flex: 0 0 34px;
width: 34px;
height: 34px;
border-radius: 50%;
color: #101512;
background: var(--skin-harbor-accent);
font-size: 14px;
font-weight: 900;
}
[data-ws-plugin-part="harbor-home.brand-name"],
[data-ws-plugin-part="harbor-workspace.brand-name"] {
color: var(--skin-harbor-text);
font-size: 12px;
font-weight: 850;
letter-spacing: .1em;
}
[data-ws-plugin-part="harbor-home.language"] { margin-left: auto; }
[data-ws-plugin-part="harbor-home.connection-card"] {
align-self: center;
width: min(100%, 510px);
padding: clamp(22px, 5vw, 40px);
border: 1px solid var(--skin-harbor-border);
border-radius: 16px;
background: color-mix(in srgb, var(--skin-harbor-panel) 96%, transparent);
box-shadow: 0 24px 70px #0007;
}
[data-ws-plugin-part="harbor-home.eyebrow"] {
color: var(--skin-harbor-accent);
font-size: 10px;
font-weight: 800;
letter-spacing: .14em;
}
[data-ws-plugin-part="harbor-home.title"] {
margin: 12px 0 8px;
font-size: clamp(26px, 5vw, 38px);
letter-spacing: -.04em;
}
[data-ws-plugin-part="harbor-home.description"],
[data-ws-plugin-part="harbor-home.home-footer"] {
color: var(--skin-harbor-muted);
line-height: 1.6;
}
[data-ws-plugin-part="harbor-home.home-footer"] {
width: min(100%, 1080px);
font-size: 12px;
}
[data-ws-plugin-part="harbor-home"] .join-card {
color: var(--skin-harbor-text);
background: transparent;
border-color: var(--skin-harbor-border);
box-shadow: none;
}
[data-ws-plugin-part="harbor-home"] .field-wrap,
[data-ws-plugin-part="harbor-home"] .settings-select {
color: var(--skin-harbor-muted);
background: var(--skin-harbor-raised);
border-color: var(--skin-harbor-border);
}
[data-ws-plugin-part="harbor-home"] .field-wrap input,
[data-ws-plugin-part="harbor-home"] .settings-select {
color: var(--skin-harbor-text);
}
[data-ws-plugin-part="harbor-workspace"] {
display: grid;
grid-template-columns: 68px 276px minmax(340px, 1fr) 244px;
grid-template-rows: 54px minmax(0, 1fr);
width: 100%;
height: 100dvh;
min-height: 560px;
overflow: hidden;
color: var(--skin-harbor-text);
background: var(--skin-harbor-bg);
font-family: Inter, "Segoe UI", system-ui, sans-serif;
}
[data-ws-plugin-part="harbor-workspace"],
[data-ws-plugin-part="harbor-workspace"] * {
scrollbar-color: #4a4c51 transparent;
scrollbar-width: thin;
}
[data-ws-plugin-part="harbor-workspace"] *::-webkit-scrollbar { width: 6px; height: 6px; }
[data-ws-plugin-part="harbor-workspace"] *::-webkit-scrollbar-thumb { background: #4a4c51; border-radius: 6px; }
[data-ws-plugin-part="harbor-workspace.topbar"] {
z-index: 2;
grid-column: 1 / -1;
grid-row: 1;
display: flex;
align-items: center;
gap: 11px;
min-width: 0;
padding: 0 14px;
border-bottom: 1px solid var(--skin-harbor-border);
background: var(--skin-harbor-rail);
}
[data-ws-plugin-part="harbor-workspace.server-title"] {
overflow: hidden;
margin-right: auto;
color: var(--skin-harbor-muted);
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
[data-ws-plugin-part="harbor-workspace.server-rail"] {
grid-column: 1;
grid-row: 2;
display: flex;
flex-direction: column;
align-items: center;
gap: 9px;
min-height: 0;
overflow-y: auto;
padding: 13px 7px;
background: var(--skin-harbor-rail);
border-right: 1px solid #ffffff08;
}
[data-ws-plugin-part="harbor-workspace.quick-server"] {
display: grid;
justify-items: center;
gap: 3px;
width: 52px;
min-height: 54px;
padding: 4px;
border: 0;
border-radius: 13px;
color: var(--skin-harbor-muted);
background: transparent;
cursor: pointer;
}
[data-ws-plugin-part="harbor-workspace.quick-server"]:hover,
[data-ws-plugin-part="harbor-workspace.quick-server"]:focus-visible {
color: var(--skin-harbor-text);
background: var(--skin-harbor-raised);
}
[data-ws-plugin-part="harbor-workspace.quick-server"][aria-current="true"] {
color: var(--skin-harbor-text);
background: var(--skin-harbor-raised);
box-shadow: inset 3px 0 var(--skin-harbor-accent);
}
[data-ws-plugin-part="harbor-workspace.server-monogram"] {
display: grid;
place-items: center;
width: 40px;
height: 40px;
overflow: hidden;
border: 1px solid #ffffff12;
border-radius: 13px;
color: var(--skin-harbor-text);
background: linear-gradient(145deg, #383a40, #222429);
font-size: 11px;
font-weight: 800;
text-align: center;
}
[data-ws-plugin-part="harbor-workspace.server-kind"] {
color: var(--skin-harbor-dim);
font-size: 8px;
line-height: 1;
}
[data-ws-plugin-part="harbor-workspace.identity-entry"] {
display: grid;
justify-items: center;
gap: 4px;
width: 100%;
margin-top: auto;
padding: 9px 1px 1px;
border-top: 1px solid var(--skin-harbor-border);
}
[data-ws-plugin-part="harbor-workspace.identity-monogram"] {
display: grid;
place-items: center;
width: 38px;
height: 38px;
border: 1px solid #ffffff18;
border-radius: 50%;
color: var(--skin-harbor-text);
background: linear-gradient(145deg, #4a4c53, #292a30);
font-size: 10px;
font-weight: 850;
}
[data-ws-plugin-part="harbor-workspace.identity-name"] {
display: block;
max-width: 100%;
overflow: hidden;
color: var(--skin-harbor-muted);
font-size: 8px;
text-overflow: ellipsis;
white-space: nowrap;
}
[data-ws-plugin-part="harbor-workspace.channel-panel"] {
z-index: 1;
grid-column: 2;
grid-row: 2;
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
overflow: auto;
padding: 12px 9px 118px;
border-right: 1px solid var(--skin-harbor-border);
background: var(--skin-harbor-panel);
}
[data-ws-plugin-part="harbor-workspace.server-summary"] {
display: flex;
flex-direction: column;
gap: 4px;
min-height: 49px;
padding: 3px 9px 13px;
border-bottom: 1px solid #ffffff0b;
}
[data-ws-plugin-part="harbor-workspace.server-name"] {
overflow: hidden;
color: var(--skin-harbor-text);
font-size: 13px;
text-overflow: ellipsis;
white-space: nowrap;
}
[data-ws-plugin-part="harbor-workspace.server-subtitle"],
[data-ws-plugin-part="harbor-workspace.section-label"] {
color: var(--skin-harbor-dim);
font-size: 10px;
font-weight: 800;
letter-spacing: .08em;
}
[data-ws-plugin-part="harbor-workspace.channel-list"] {
display: flex;
flex-direction: column;
gap: 2px;
min-height: 0;
padding-top: 13px;
}
[data-ws-plugin-part="harbor-workspace.section-label"] { margin: 0 8px 7px; }
[data-ws-plugin-part="harbor-workspace.channel-row"] {
position: relative;
display: flex;
align-items: center;
gap: 9px;
width: 100%;
min-height: 38px;
padding: 6px 9px;
border: 0;
border-radius: 6px;
color: var(--skin-harbor-muted);
background: transparent;
text-align: left;
cursor: pointer;
}
[data-ws-plugin-part="harbor-workspace.selected-channel-indicator"] {
position: absolute;
inset: 0;
border: 1px solid var(--skin-harbor-accent);
border-radius: inherit;
pointer-events: none;
}
[data-ws-plugin-part="harbor-workspace.channel-row"]:hover,
[data-ws-plugin-part="harbor-workspace.channel-row"][aria-current="true"] {
color: var(--skin-harbor-text);
background: var(--skin-harbor-raised);
}
[data-ws-plugin-part="harbor-workspace.channel-row"][aria-current="true"] {
box-shadow: inset 2px 0 var(--skin-harbor-accent);
}
[data-ws-plugin-part="harbor-workspace.channel-row"][data-depth="1"] { padding-inline-start: 19px; }
[data-ws-plugin-part="harbor-workspace.channel-row"][data-depth="2"] { padding-inline-start: 29px; }
[data-ws-plugin-part="harbor-workspace.channel-row"][data-depth="3"] { padding-inline-start: 39px; }
[data-ws-plugin-part="harbor-workspace.channel-row"][data-depth="4"] { padding-inline-start: 49px; }
[data-ws-plugin-part="harbor-workspace.channel-row"][data-depth="5"] { padding-inline-start: 59px; }
[data-ws-plugin-part="harbor-workspace.channel-row"][data-depth="6"] { padding-inline-start: 69px; }
[data-ws-plugin-part="harbor-workspace.channel-row"][data-depth="7"] { padding-inline-start: 79px; }
[data-ws-plugin-part="harbor-workspace.channel-row"][data-depth="8"] { padding-inline-start: 89px; }
[data-ws-plugin-part="harbor-workspace.channel-glyph"] {
display: grid;
place-items: center;
width: 18px;
color: var(--skin-harbor-dim);
font-size: 13px;
}
[data-ws-plugin-part="harbor-workspace.channel-name"] {
min-width: 0;
flex: 1;
overflow: hidden;
font-size: 13px;
text-overflow: ellipsis;
white-space: nowrap;
}
[data-ws-plugin-part="harbor-workspace.channel-count"] {
color: var(--skin-harbor-dim);
font-size: 10px;
}
[data-ws-plugin-part="harbor-workspace.channel-voice-members"] {
display: grid;
gap: 1px;
margin: 0 0 6px 29px;
padding: 2px 0 3px;
list-style: none;
}
[data-ws-plugin-part="harbor-workspace.channel-voice-member"] {
display: grid;
grid-template-columns: 18px minmax(0, 1fr) auto auto;
align-items: center;
gap: 5px;
min-height: 21px;
color: var(--skin-harbor-muted);
font-size: 10px;
}
[data-ws-plugin-part="harbor-workspace.channel-member-avatar"] {
display: grid;
place-items: center;
width: 16px;
height: 16px;
overflow: hidden;
border-radius: 50%;
color: var(--skin-harbor-text);
background: #393b41;
font-size: 7px;
font-weight: 800;
}
[data-ws-plugin-part="harbor-workspace.channel-member-name"] {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
[data-ws-plugin-part="harbor-workspace.channel-member-state"] {
color: var(--skin-harbor-accent);
font-size: 8px;
font-weight: 800;
}
[data-ws-plugin-part="harbor-workspace.channel-member-muted"],
[data-ws-plugin-part="harbor-workspace.member-muted-state"] {
color: var(--skin-harbor-danger);
font-size: 8px;
font-weight: 800;
}
[data-ws-plugin-part="harbor-workspace.channel-member-away"],
[data-ws-plugin-part="harbor-workspace.member-away-state"] {
color: var(--skin-harbor-dim);
font-size: 8px;
font-weight: 800;
}
[data-ws-plugin-part="harbor-workspace.channel-member-screen-share"] {
grid-column: 2 / -1;
display: flex;
align-items: center;
gap: 6px;
color: var(--skin-harbor-accent);
font-size: 8px;
font-weight: 800;
}
[data-ws-plugin-part="harbor-workspace.channel-member-screen-share-watch"],
[data-ws-plugin-part="harbor-workspace.member-screen-share-watch"] {
min-height: 28px;
padding: 0 8px;
border: 1px solid #7ed95755;
border-radius: 5px;
color: var(--skin-harbor-text);
background: var(--skin-harbor-raised);
font-size: 9px;
font-weight: 800;
cursor: pointer;
}
[data-ws-plugin-part="harbor-workspace.channel-member-screen-share-watch"]:hover,
[data-ws-plugin-part="harbor-workspace.member-screen-share-watch"]:hover {
color: var(--skin-harbor-accent);
background: #313238;
}
[data-ws-plugin-part="harbor-workspace.conversation"] {
grid-column: 3;
grid-row: 2;
display: grid;
grid-template-rows: 48px minmax(0, 1fr) auto;
gap: 10px;
min-width: 0;
min-height: 0;
padding: 0 17px 12px;
background: var(--skin-harbor-bg);
}
[data-ws-plugin-part="harbor-workspace.conversation-heading"] {
display: flex;
align-items: center;
gap: 9px;
min-width: 0;
border-bottom: 1px solid var(--skin-harbor-border);
}
[data-ws-plugin-part="harbor-workspace.conversation-glyph"] {
color: var(--skin-harbor-muted);
font-size: 15px;
}
[data-ws-plugin-part="harbor-workspace.channel-title"] {
min-width: 0;
margin: 0 auto 0 0;
overflow: hidden;
font-size: 14px;
font-weight: 700;
text-overflow: ellipsis;
white-space: nowrap;
}
[data-ws-plugin-part="harbor-workspace.connection-state"] {
color: var(--skin-harbor-accent);
font-size: 9px;
font-weight: 800;
letter-spacing: .06em;
}
[data-ws-plugin-part="harbor-workspace"] [data-ws-part="voice.chat"] {
min-width: 0;
min-height: 0;
color: var(--skin-harbor-text);
background: transparent;
border-color: transparent;
}
[data-ws-plugin-part="harbor-workspace.chat"] {
display: grid;
grid-template-rows: minmax(0, 1fr) auto;
min-width: 0;
min-height: 0;
overflow: hidden;
color: var(--skin-harbor-text);
}
[data-ws-plugin-part="harbor-workspace.chat-message-list"] {
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: 14px;
min-height: 0;
overflow: auto;
padding: 8px 4px 16px;
}
[data-ws-plugin-part="harbor-workspace.chat-empty"] {
align-self: center;
margin: auto;
color: var(--skin-harbor-muted);
font-size: 13px;
}
[data-ws-plugin-part="harbor-workspace.chat-message"] { min-width: 0; }
[data-ws-plugin-part="harbor-workspace.chat-message-heading"] { display: flex; align-items: baseline; gap: 8px; }
[data-ws-plugin-part="harbor-workspace.chat-message-author"] { color: var(--skin-harbor-text); font-size: 12px; }
[data-ws-plugin-part="harbor-workspace.chat-message-time"] { color: var(--skin-harbor-dim); font-size: 10px; }
[data-ws-plugin-part="harbor-workspace.chat-message-text"] { margin: 3px 0 0; color: var(--skin-harbor-muted); font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }
[data-ws-plugin-part="harbor-workspace.chat-composer"] {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
padding: 8px;
border: 1px solid var(--skin-harbor-border);
border-radius: 9px;
background: var(--skin-harbor-panel);
}
[data-ws-plugin-part="harbor-workspace.chat-input"] {
flex: 1;
min-width: 0;
height: 38px;
padding: 0 10px;
border: 0;
outline: 0;
color: var(--skin-harbor-text);
background: transparent;
}
[data-ws-plugin-part="harbor-workspace.chat-send"] {
min-width: 54px;
min-height: 36px;
border: 0;
border-radius: 7px;
color: #111;
background: var(--skin-harbor-accent);
font-weight: 700;
cursor: pointer;
}
[data-ws-plugin-part="harbor-workspace"] .chat-panel { min-height: 0; background: transparent; }
[data-ws-plugin-part="harbor-workspace"] .chat-heading { border-color: var(--skin-harbor-border); }
[data-ws-plugin-part="harbor-workspace"] .message-bubble { color: var(--skin-harbor-text); background: var(--skin-harbor-panel); }
[data-ws-plugin-part="harbor-workspace"] .message-composer { border-color: var(--skin-harbor-border); background: var(--skin-harbor-panel); }
[data-ws-plugin-part="harbor-workspace"] .message-composer input { color: var(--skin-harbor-text); }
[data-ws-plugin-part="harbor-workspace.members-panel"] {
grid-column: 4;
grid-row: 2;
min-width: 0;
min-height: 0;
overflow: auto;
padding: 16px 11px 118px;
border-left: 1px solid var(--skin-harbor-border);
background: var(--skin-harbor-panel);
}
[data-ws-plugin-part="harbor-workspace.members-heading"] {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 30px;
}
[data-ws-plugin-part="harbor-workspace.members-heading"] .section-label { margin: 0; }
[data-ws-plugin-part="harbor-workspace.member-total"] { color: var(--skin-harbor-dim); font-size: 11px; }
[data-ws-plugin-part="harbor-workspace.member-list"] {
display: grid;
gap: 3px;
margin: 8px 0 16px;
padding: 0;
list-style: none;
}
[data-ws-plugin-part="harbor-workspace.member-row"] {
display: grid;
grid-template-columns: 32px minmax(0, 1fr);
align-items: center;
column-gap: 8px;
min-height: 42px;
padding: 4px 5px;
border-radius: 6px;
color: var(--skin-harbor-muted);
font-size: 12px;
}
[data-ws-plugin-part="harbor-workspace.member-row"]:hover { background: var(--skin-harbor-raised); }
[data-ws-plugin-part="harbor-workspace.member-avatar"] {
grid-row: span 2;
display: grid;
place-items: center;
width: 30px;
height: 30px;
overflow: hidden;
border-radius: 50%;
color: var(--skin-harbor-text);
background: #393b41;
font-size: 10px;
font-weight: 700;
}
[data-ws-plugin-part="harbor-workspace.member-name"] {
min-width: 0;
overflow: hidden;
color: var(--skin-harbor-text);
text-overflow: ellipsis;
white-space: nowrap;
}
[data-ws-plugin-part="harbor-workspace.speaking-indicator"] {
color: var(--skin-harbor-accent);
font-size: 8px;
font-weight: 800;
letter-spacing: .05em;
}
[data-ws-plugin-part="harbor-workspace.member-muted-state"],
[data-ws-plugin-part="harbor-workspace.member-away-state"],
[data-ws-plugin-part="harbor-workspace.speaking-indicator"] { grid-column: 2 / -1; }
[data-ws-plugin-part="harbor-workspace.member-screen-share"] {
grid-column: 2 / -1;
display: flex;
align-items: center;
gap: 6px;
color: var(--skin-harbor-accent);
font-size: 8px;
font-weight: 800;
}
[data-ws-plugin-part="harbor-workspace.voice-dock"] {
z-index: 4;
grid-column: 2;
grid-row: 2;
align-self: end;
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 6px 8px;
min-width: 0;
padding: 9px;
border: 1px solid var(--skin-harbor-border);
border-radius: 10px;
background: #222328;
box-shadow: 0 8px 20px #0005;
}
[data-ws-plugin-part="harbor-workspace.voice-dock-heading"] {
grid-column: 1 / -1;
display: grid;
grid-template-columns: 10px minmax(0, 1fr);
align-items: center;
gap: 2px 7px;
}
[data-ws-plugin-part="harbor-workspace.voice-dock-actions"] {
grid-column: 1 / -1;
display: flex;
align-items: center;
justify-content: space-between;
gap: 4px;
min-width: 0;
}
[data-ws-plugin-part="harbor-workspace.connection-indicator"] {
grid-row: span 2;
color: var(--skin-harbor-accent);
font-size: 9px;
}
[data-ws-plugin-part="harbor-workspace.voice-channel-name"] {
overflow: hidden;
color: var(--skin-harbor-text);
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
[data-ws-plugin-part="harbor-workspace.voice-dock-caption"] {
color: var(--skin-harbor-dim);
font-size: 8px;
letter-spacing: .05em;
}
[data-ws-plugin-part="harbor-workspace.audio-controls"] {
display: flex;
align-items: center;
gap: 4px;
min-width: 0;
}
[data-ws-plugin-part="harbor-workspace.microphone-control"],
[data-ws-plugin-part="harbor-workspace.output-control"],
[data-ws-plugin-part="harbor-workspace.disconnect-control"],
[data-ws-plugin-part="harbor-workspace.whisper-start"],
[data-ws-plugin-part="harbor-workspace.whisper-stop"] {
min-width: 38px;
min-height: 38px;
padding: 0 8px;
border: 1px solid var(--skin-harbor-border);
border-radius: 7px;
color: var(--skin-harbor-muted);
background: var(--skin-harbor-raised);
cursor: pointer;
}
[data-ws-plugin-part="harbor-workspace.microphone-control"][aria-pressed="true"],
[data-ws-plugin-part="harbor-workspace.output-control"][aria-pressed="true"] { color: var(--skin-harbor-danger); }
[data-ws-plugin-part="harbor-workspace.disconnect-control"] { color: var(--skin-harbor-danger); }
[data-ws-plugin-part="harbor-workspace.output-volume"] { width: 72px; accent-color: var(--skin-harbor-accent); }
[data-ws-plugin-part="harbor-workspace.whisper-controls"] { display: flex; gap: 6px; margin-top: 12px; }
[data-ws-plugin-part="harbor-workspace.screen-share-start"] { flex: 0 0 auto; }
[data-ws-plugin-part="harbor-workspace.screen-share-start"] button {
display: grid;
place-items: center;
width: 34px;
height: 34px;
padding: 0;
border: 1px solid var(--skin-harbor-border);
border-radius: 7px;
color: var(--skin-harbor-muted);
background: var(--skin-harbor-raised);
cursor: pointer;
}
[data-ws-plugin-part="harbor-workspace.screen-share-start"] button:hover:not(:disabled),
[data-ws-plugin-part="harbor-workspace.screen-share-start"] button:focus-visible { color: var(--skin-harbor-accent); }
[data-ws-plugin-part="harbor-workspace.screen-share-start"] button:disabled { opacity: .45; cursor: not-allowed; }
[data-ws-plugin-part="harbor-workspace.screen-share-start"] button span {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
[data-ws-plugin-part="harbor-workspace"] .desktop-audio-dock {
min-width: 0;
margin: 0;
padding: 4px;
border: 0;
border-radius: 7px;
background: transparent;
box-shadow: none;
}
[data-ws-plugin-part="harbor-workspace"] .desktop-audio-dock-copy { display: none; }
[data-ws-plugin-part="harbor-workspace"] .desktop-audio-dock-actions { gap: 2px; }
[data-ws-plugin-part="harbor-workspace"] .dock-audio-button { width: 34px; height: 34px; color: var(--skin-harbor-muted); }
[data-ws-plugin-part="harbor-workspace"] .dock-audio-button:hover,
[data-ws-plugin-part="harbor-workspace"] .dock-audio-button:focus-visible { color: var(--skin-harbor-accent); background: var(--skin-harbor-raised); border-color: var(--skin-harbor-border); }
[data-ws-plugin-part="harbor-workspace.audio-controls"] .accompaniment-toggle { display: none; }
[data-ws-plugin-part="harbor-workspace.disconnect-control"] {
display: grid;
align-content: center;
}
[data-ws-plugin-part="harbor-workspace"] .ws-plugin-disconnect-control {
display: grid;
place-items: center;
width: 38px;
height: 38px;
border: 0;
border-radius: 8px;
color: var(--skin-harbor-danger);
background: var(--skin-harbor-raised);
cursor: pointer;
}
[data-ws-plugin-part="harbor-workspace"] .ws-plugin-disconnect-control:hover { background: #3a292b; }
[data-ws-plugin-part="harbor-workspace"] button:focus-visible,
[data-ws-plugin-part="harbor-home"] button:focus-visible,
[data-ws-plugin-part="harbor-home"] input:focus-visible {
outline: 2px solid var(--skin-harbor-accent);
outline-offset: 2px;
}
@media (max-width: 1060px) {
[data-ws-plugin-part="harbor-workspace"] {
grid-template-columns: 60px 236px minmax(300px, 1fr) 204px;
}
}
@media (max-width: 820px) {
[data-ws-plugin-part="harbor-workspace"] {
grid-template-columns: 56px minmax(0, 1fr);
grid-template-rows: 50px 126px minmax(220px, 1fr) 82px 74px;
height: 100dvh;
min-height: 540px;
}
[data-ws-plugin-part="harbor-workspace.topbar"] { padding: 0 8px; gap: 7px; }
[data-ws-plugin-part="harbor-workspace.brand-mark"] { flex-basis: 28px; width: 28px; height: 28px; }
[data-ws-plugin-part="harbor-workspace.brand-name"] { font-size: 10px; }
[data-ws-plugin-part="harbor-workspace.server-title"] { font-size: 10px; }
[data-ws-plugin-part="harbor-workspace.server-rail"] { grid-column: 1; grid-row: 2 / 6; padding: 8px 3px; }
[data-ws-plugin-part="harbor-workspace.quick-server"] { width: 48px; min-height: 48px; }
[data-ws-plugin-part="harbor-workspace.server-monogram"] { width: 36px; height: 36px; }
[data-ws-plugin-part="harbor-workspace.identity-monogram"] { width: 34px; height: 34px; }
[data-ws-plugin-part="harbor-workspace.channel-panel"] {
grid-column: 2;
grid-row: 2;
display: grid;
grid-template-columns: minmax(0, 1fr);
grid-template-rows: 30px minmax(0, 1fr);
gap: 4px;
overflow: hidden;
padding: 5px 8px;
border-right: 0;
border-bottom: 1px solid var(--skin-harbor-border);
}
[data-ws-plugin-part="harbor-workspace.server-summary"] {
min-height: 0;
flex-direction: row;
align-items: center;
gap: 8px;
padding: 0 2px;
border: 0;
}
[data-ws-plugin-part="harbor-workspace.server-name"] { max-width: 60%; font-size: 11px; }
[data-ws-plugin-part="harbor-workspace.server-subtitle"],
[data-ws-plugin-part="harbor-workspace.channel-list"] > [data-ws-plugin-part="harbor-workspace.section-label"] { display: none; }
[data-ws-plugin-part="harbor-workspace.channel-list"] {
flex-direction: row;
gap: 5px;
overflow: auto hidden;
padding: 0;
}
[data-ws-plugin-part="harbor-workspace.channel-item"] { flex: 0 0 auto; }
[data-ws-plugin-part="harbor-workspace.channel-row"] { width: max-content; min-width: 116px; min-height: 42px; margin: 0; }
[data-ws-plugin-part="harbor-workspace.channel-row"][data-depth] { padding-inline-start: 9px; }
[data-ws-plugin-part="harbor-workspace.channel-voice-members"] { display: none; }
[data-ws-plugin-part="harbor-workspace.conversation"] {
grid-column: 2;
grid-row: 3;
grid-template-rows: 40px minmax(0, 1fr) auto;
gap: 6px;
padding: 0 8px 6px;
}
[data-ws-plugin-part="harbor-workspace.members-panel"] {
grid-column: 2;
grid-row: 4;
display: grid;
grid-template-columns: auto minmax(0, 1fr);
align-items: center;
gap: 7px;
overflow: hidden;
padding: 5px 8px;
border-top: 1px solid var(--skin-harbor-border);
border-left: 0;
}
[data-ws-plugin-part="harbor-workspace.members-heading"] { gap: 5px; }
[data-ws-plugin-part="harbor-workspace.members-heading"] .section-label { max-width: 60px; font-size: 8px; }
[data-ws-plugin-part="harbor-workspace.member-list"] {
display: flex;
gap: 5px;
min-width: 0;
overflow: auto hidden;
margin: 0;
}
[data-ws-plugin-part="harbor-workspace.member-row"] { flex: 0 0 auto; grid-template-columns: 28px auto; min-height: 38px; padding: 2px 4px; }
[data-ws-plugin-part="harbor-workspace.member-avatar"] { width: 26px; height: 26px; }
[data-ws-plugin-part="harbor-workspace.speaking-indicator"] { display: none; }
[data-ws-plugin-part="harbor-workspace.member-muted-state"],
[data-ws-plugin-part="harbor-workspace.member-away-state"] { display: none; }
[data-ws-plugin-part="harbor-workspace.voice-dock"] {
grid-column: 2;
grid-row: 5;
align-self: stretch;
grid-template-columns: minmax(0, 1fr) auto;
grid-template-rows: minmax(0, 1fr);
align-items: center;
gap: 6px;
padding: 6px 8px;
border-radius: 0;
border-right: 0;
border-bottom: 0;
}
[data-ws-plugin-part="harbor-workspace.voice-dock-heading"] { grid-column: auto; grid-row: auto; }
[data-ws-plugin-part="harbor-workspace.voice-dock-actions"] { grid-column: 2; grid-row: 1; justify-content: flex-end; gap: 3px; }
[data-ws-plugin-part="harbor-workspace.voice-dock-caption"] { display: none; }
[data-ws-plugin-part="harbor-workspace.disconnect-control"] { grid-column: 2; grid-row: 1; }
[data-ws-plugin-part="harbor-workspace.audio-controls"] .mobile-voice-controls { display: flex; gap: 4px; }
[data-ws-plugin-part="harbor-workspace.audio-controls"] .mobile-voice-toggle { min-width: 44px; min-height: 44px; border-radius: 7px; color: var(--skin-harbor-muted); background: var(--skin-harbor-raised); }
[data-ws-plugin-part="harbor-workspace.microphone-control"],
[data-ws-plugin-part="harbor-workspace.output-control"],
[data-ws-plugin-part="harbor-workspace.disconnect-control"] { min-width: 42px; min-height: 44px; }
[data-ws-plugin-part="harbor-workspace.output-volume"] { width: 58px; }
[data-ws-plugin-part="harbor-workspace.screen-share-start"] button { width: 42px; height: 44px; }
}
@media (max-width: 460px) {
[data-ws-plugin-part="harbor-workspace"] { grid-template-columns: 50px minmax(0, 1fr); }
[data-ws-plugin-part="harbor-workspace.server-rail"] { padding-inline: 1px; }
[data-ws-plugin-part="harbor-workspace.quick-server"] { width: 44px; }
[data-ws-plugin-part="harbor-workspace.identity-name"] { max-width: 43px; }
[data-ws-plugin-part="harbor-workspace.topbar"] { padding-inline: 5px; }
[data-ws-plugin-part="harbor-workspace.brand-name"] { display: none; }
[data-ws-plugin-part="harbor-workspace.server-title"] { max-width: 100px; }
[data-ws-plugin-part="harbor-workspace.channel-panel"] { grid-column: 2; }
[data-ws-plugin-part="harbor-workspace.conversation"] { grid-column: 2; }
[data-ws-plugin-part="harbor-workspace.members-panel"] { grid-column: 2; }
[data-ws-plugin-part="harbor-workspace.voice-dock"] { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
[data-ws-plugin-part="harbor-home"] *,
[data-ws-plugin-part="harbor-workspace"] * {
scroll-behavior: auto;
animation-duration: .01ms;
animation-iteration-count: 1;
transition-duration: .01ms;
}
}
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1014 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

@@ -0,0 +1,31 @@
{
"schemaVersion": 1,
"components": [
{
"id": "illusia-now-playing",
"name": "ILLUSIA 当前频道 / current channel",
"page": "voice",
"accessibleName": "当前语音频道 / Current voice channel",
"permissions": ["session.status.read"],
"actions": {},
"root": {
"tag": "aside",
"part": "room-card",
"className": "illusia-now-playing",
"attributes": { "role": "status" },
"children": [
{
"tag": "small",
"part": "eyebrow",
"children": [{ "text": "ILLUSIA · 当前频道 / NOW IN" }]
},
{
"tag": "strong",
"part": "channel-name",
"children": [{ "text": "{{session.status.channelName}}" }]
}
]
}
}
]
}
+14
View File
@@ -0,0 +1,14 @@
{
"schemaVersion": 3,
"packageType": "open-skin",
"id": "community.illusia-voice",
"name": "ILLUSIA风",
"version": "2.0.2",
"author": "WebSpeak Project",
"license": "All rights reserved",
"description": "A bright original-character art skin with a safe declarative live-channel badge.",
"entry": "skin.css",
"components": "components.json",
"preview": "assets/background-composite.webp",
"minAppVersion": "0.2.7"
}
File diff suppressed because it is too large. Load diff
Binary file not shown.
File diff suppressed because it is too large. Load diff
+320
View File
@@ -0,0 +1,320 @@
{
"defaultLocale": "zh-CN",
"locales": {
"zh-CN": {
"home": {
"brandName": "KAAK"
},
"messages": {
"passwordDialogConfirm": "确定",
"kaakHomeComponentName": "KAAK 首页",
"kaakVoiceComponentName": "KAAK 语音工作区",
"kaakHomeAccessibleName": "KAAK 连接页",
"kaakVoiceAccessibleName": "KAAK 语音工作区",
"kaakTagline": "你的声音,随时随地。",
"kaakHomeIllustrationAlt": "WebSpeak 语音连接插图",
"kaakWelcomeTitle": "欢迎来到 WebSpeak",
"kaakConnectTitle": "连接 TeamSpeak 服务器",
"kaakConnectDescription": "无需注册账号,填写服务器信息即可加入语音",
"kaakBrowserDirect": "浏览器直连 · 无需安装 TeamSpeak 客户端",
"kaakFavoritesAndHistory": "收藏与最近服务器",
"kaakFavorites": "收藏",
"kaakRecent": "最近",
"kaakVoiceRoomControls": "语音房间控制",
"kaakReturnChannelsNoDisconnect": "返回频道树,不断开语音",
"kaakVoiceRoom": "语音房间",
"kaakMoreVoiceActions": "更多语音功能",
"kaakOpenChatHistory": "打开聊天记录",
"kaakChatHistory": "聊天记录",
"kaakCopyInviteLink": "复制邀请链接",
"kaakCloseMenu": "关闭菜单",
"kaakCurrentVoiceChannel": "当前语音频道",
"kaakVoiceConnected": "TeamSpeak · 已加入语音",
"kaakServerChannels": "服务器频道",
"kaakChannels": "频道",
"kaakToggleVoiceGroup": "展开或收起语音分组",
"kaakVoiceGroup": "语音分组",
"kaakReturnVoiceRoom": "返回当前语音房间",
"kaakReturnVoiceRoomConnected": "语音已连接 · 点击返回房间",
"kaakChat": "聊天",
"kaakToggleChatPanel": "收起或展开聊天面板",
"kaakVoiceRoomAccessibleName": "语音房间",
"kaakBackToChannels": "返回频道列表",
"kaakChannelMemberCount": "频道成员数",
"kaakExpandChatPanel": "展开聊天面板",
"kaakVoiceControls": "语音控制",
"kaakDisconnectVoice": "断开语音",
"kaakStopScreenShare": "停止屏幕共享",
"kaakAudioControls": "语音设置",
"kaakAudioSettings": "语音设置",
"kaakAudioSettingsShort": "语音设置",
"kaakNoiseSuppression": "噪声抑制",
"kaakMicrophone": "麦克风",
"kaakSpeakerMute": "扬声器静音",
"kaakAccompaniment": "伴奏",
"kaakMuteMicrophone": "闭麦",
"kaakUnmuteMicrophone": "开麦",
"kaakMuteOutput": "耳机静音",
"kaakMute": "静音",
"kaakUnmute": "恢复",
"kaakSpeaker": "扬声器",
"kaakScreenShare": "屏幕共享",
"kaakLeaveVoice": "退出",
"kaakCurrentIdentity": "当前 TeamSpeak 身份",
"kaakOnline": "在线"
}
},
"en": {
"home": {
"brandName": "KAAK"
},
"messages": {
"passwordDialogConfirm": "Confirm",
"kaakHomeComponentName": "KAAK connection home",
"kaakVoiceComponentName": "KAAK voice workspace",
"kaakHomeAccessibleName": "KAAK connection page",
"kaakVoiceAccessibleName": "KAAK voice workspace",
"kaakTagline": "YOUR VOICE, EVERYWHERE.",
"kaakHomeIllustrationAlt": "WebSpeak voice connection illustration",
"kaakWelcomeTitle": "Welcome to WebSpeak",
"kaakConnectTitle": "Connect to a TeamSpeak server",
"kaakConnectDescription": "No account required. Enter the server details to join voice.",
"kaakBrowserDirect": "Connect directly in your browser · No TeamSpeak client needed",
"kaakFavoritesAndHistory": "Favorites and recent servers",
"kaakFavorites": "Favorites",
"kaakRecent": "Recent",
"kaakVoiceRoomControls": "Voice room controls",
"kaakReturnChannelsNoDisconnect": "Return to channels without disconnecting",
"kaakVoiceRoom": "Voice room",
"kaakMoreVoiceActions": "More voice actions",
"kaakOpenChatHistory": "Open chat history",
"kaakChatHistory": "Chat history",
"kaakCopyInviteLink": "Copy invite link",
"kaakCloseMenu": "Close menu",
"kaakCurrentVoiceChannel": "Current voice channel",
"kaakVoiceConnected": "TeamSpeak · Voice connected",
"kaakServerChannels": "Server channels",
"kaakChannels": "Channels",
"kaakToggleVoiceGroup": "Expand or collapse voice group",
"kaakVoiceGroup": "Voice group",
"kaakReturnVoiceRoom": "Return to the current voice room",
"kaakReturnVoiceRoomConnected": "Voice connected · Click to return to the room",
"kaakChat": "Chat",
"kaakToggleChatPanel": "Collapse or expand chat panel",
"kaakVoiceRoomAccessibleName": "Voice room",
"kaakBackToChannels": "Back to channel list",
"kaakChannelMemberCount": "Channel member count",
"kaakExpandChatPanel": "Expand chat panel",
"kaakVoiceControls": "Voice controls",
"kaakDisconnectVoice": "Disconnect voice",
"kaakStopScreenShare": "Stop screen sharing",
"kaakAudioControls": "Audio controls",
"kaakAudioSettings": "Audio settings",
"kaakAudioSettingsShort": "Audio settings",
"kaakNoiseSuppression": "Noise suppression",
"kaakMicrophone": "Microphone",
"kaakSpeakerMute": "Mute speakers",
"kaakAccompaniment": "Accompaniment",
"kaakMuteMicrophone": "Mute microphone",
"kaakUnmuteMicrophone": "Unmute microphone",
"kaakMuteOutput": "Mute output",
"kaakMute": "Mute",
"kaakUnmute": "Unmute",
"kaakSpeaker": "Speaker",
"kaakScreenShare": "Screen share",
"kaakLeaveVoice": "Leave",
"kaakCurrentIdentity": "Current TeamSpeak identity",
"kaakOnline": "Online"
}
},
"de": {
"home": {
"brandName": "KAAK"
},
"messages": {
"passwordDialogConfirm": "Bestätigen",
"kaakHomeComponentName": "KAAK-Verbindungsseite",
"kaakVoiceComponentName": "KAAK-Sprachbereich",
"kaakHomeAccessibleName": "KAAK-Verbindungsseite",
"kaakVoiceAccessibleName": "KAAK-Sprachbereich",
"kaakTagline": "DEINE STIMME. ÜBERALL.",
"kaakHomeIllustrationAlt": "Illustration zur WebSpeak-Sprachverbindung",
"kaakWelcomeTitle": "Willkommen bei WebSpeak",
"kaakConnectTitle": "Mit einem TeamSpeak-Server verbinden",
"kaakConnectDescription": "Kein Konto nötig. Gib die Serverdaten ein, um dem Sprachkanal beizutreten.",
"kaakBrowserDirect": "Direkt im Browser · Kein TeamSpeak-Client erforderlich",
"kaakFavoritesAndHistory": "Favoriten und zuletzt verwendete Server",
"kaakFavorites": "Favoriten",
"kaakRecent": "Zuletzt",
"kaakVoiceRoomControls": "Sprachraum-Steuerung",
"kaakReturnChannelsNoDisconnect": "Zurück zu den Kanälen, ohne die Verbindung zu trennen",
"kaakVoiceRoom": "Sprachraum",
"kaakMoreVoiceActions": "Weitere Sprachaktionen",
"kaakOpenChatHistory": "Chatverlauf öffnen",
"kaakChatHistory": "Chatverlauf",
"kaakCopyInviteLink": "Einladungslink kopieren",
"kaakCloseMenu": "Menü schließen",
"kaakCurrentVoiceChannel": "Aktueller Sprachkanal",
"kaakVoiceConnected": "TeamSpeak · Sprachkanal beigetreten",
"kaakServerChannels": "Serverkanäle",
"kaakChannels": "Kanäle",
"kaakToggleVoiceGroup": "Sprachgruppe ein- oder ausklappen",
"kaakVoiceGroup": "Sprachgruppe",
"kaakReturnVoiceRoom": "Zum aktuellen Sprachraum zurückkehren",
"kaakReturnVoiceRoomConnected": "Sprachverbindung aktiv · Klicken, um zum Raum zurückzukehren",
"kaakChat": "Chat",
"kaakToggleChatPanel": "Chatbereich ein- oder ausklappen",
"kaakVoiceRoomAccessibleName": "Sprachraum",
"kaakBackToChannels": "Zur Kanalliste",
"kaakChannelMemberCount": "Anzahl der Kanalmitglieder",
"kaakExpandChatPanel": "Chatbereich erweitern",
"kaakVoiceControls": "Sprachsteuerung",
"kaakDisconnectVoice": "Sprachverbindung trennen",
"kaakStopScreenShare": "Bildschirmfreigabe beenden",
"kaakAudioControls": "Audio-Steuerung",
"kaakAudioSettings": "Audioeinstellungen",
"kaakAudioSettingsShort": "Audioeinstellungen",
"kaakNoiseSuppression": "Rauschunterdrückung",
"kaakMicrophone": "Mikrofon",
"kaakSpeakerMute": "Lautsprecher stummschalten",
"kaakAccompaniment": "Begleitton",
"kaakMuteMicrophone": "Mikrofon stummschalten",
"kaakUnmuteMicrophone": "Mikrofon einschalten",
"kaakMuteOutput": "Ausgabe stummschalten",
"kaakMute": "Stumm",
"kaakUnmute": "Ton einschalten",
"kaakSpeaker": "Lautsprecher",
"kaakScreenShare": "Bildschirm teilen",
"kaakLeaveVoice": "Verlassen",
"kaakCurrentIdentity": "Aktuelle TeamSpeak-Identität",
"kaakOnline": "Online"
}
},
"ru": {
"home": {
"brandName": "KAAK"
},
"messages": {
"passwordDialogConfirm": "Подтвердить",
"kaakHomeComponentName": "Страница подключения KAAK",
"kaakVoiceComponentName": "Голосовое пространство KAAK",
"kaakHomeAccessibleName": "Страница подключения KAAK",
"kaakVoiceAccessibleName": "Голосовое пространство KAAK",
"kaakTagline": "ТВОЙ ГОЛОС — ВЕЗДЕ.",
"kaakHomeIllustrationAlt": "Иллюстрация голосового подключения WebSpeak",
"kaakWelcomeTitle": "Добро пожаловать в WebSpeak",
"kaakConnectTitle": "Подключение к серверу TeamSpeak",
"kaakConnectDescription": "Аккаунт не нужен. Укажите данные сервера, чтобы подключиться к голосовому каналу.",
"kaakBrowserDirect": "Прямое подключение в браузере · Клиент TeamSpeak не нужен",
"kaakFavoritesAndHistory": "Избранные и недавние серверы",
"kaakFavorites": "Избранное",
"kaakRecent": "Недавние",
"kaakVoiceRoomControls": "Управление голосовой комнатой",
"kaakReturnChannelsNoDisconnect": "Вернуться к каналам без отключения",
"kaakVoiceRoom": "Голосовая комната",
"kaakMoreVoiceActions": "Дополнительные голосовые действия",
"kaakOpenChatHistory": "Открыть историю чата",
"kaakChatHistory": "История чата",
"kaakCopyInviteLink": "Скопировать ссылку-приглашение",
"kaakCloseMenu": "Закрыть меню",
"kaakCurrentVoiceChannel": "Текущий голосовой канал",
"kaakVoiceConnected": "TeamSpeak · Подключён к голосовому каналу",
"kaakServerChannels": "Каналы сервера",
"kaakChannels": "Каналы",
"kaakToggleVoiceGroup": "Развернуть или свернуть группу",
"kaakVoiceGroup": "Голосовая группа",
"kaakReturnVoiceRoom": "Вернуться в текущую голосовую комнату",
"kaakReturnVoiceRoomConnected": "Подключено · Нажмите, чтобы вернуться в комнату",
"kaakChat": "Чат",
"kaakToggleChatPanel": "Свернуть или развернуть панель чата",
"kaakVoiceRoomAccessibleName": "Голосовая комната",
"kaakBackToChannels": "Вернуться к списку каналов",
"kaakChannelMemberCount": "Количество участников канала",
"kaakExpandChatPanel": "Развернуть панель чата",
"kaakVoiceControls": "Голосовое управление",
"kaakDisconnectVoice": "Отключиться от голосового канала",
"kaakStopScreenShare": "Остановить демонстрацию экрана",
"kaakAudioControls": "Управление звуком",
"kaakAudioSettings": "Настройки звука",
"kaakAudioSettingsShort": "Настройки звука",
"kaakNoiseSuppression": "Шумоподавление",
"kaakMicrophone": "Микрофон",
"kaakSpeakerMute": "Отключить звук динамиков",
"kaakAccompaniment": "Сопровождение",
"kaakMuteMicrophone": "Выключить микрофон",
"kaakUnmuteMicrophone": "Включить микрофон",
"kaakMuteOutput": "Отключить звук",
"kaakMute": "Без звука",
"kaakUnmute": "Включить звук",
"kaakSpeaker": "Динамик",
"kaakScreenShare": "Демонстрация экрана",
"kaakLeaveVoice": "Выйти",
"kaakCurrentIdentity": "Текущая личность TeamSpeak",
"kaakOnline": "В сети"
}
},
"ja": {
"home": {
"brandName": "KAAK"
},
"messages": {
"passwordDialogConfirm": "確定",
"kaakHomeComponentName": "KAAK 接続ページ",
"kaakVoiceComponentName": "KAAK 音声ワークスペース",
"kaakHomeAccessibleName": "KAAK 接続ページ",
"kaakVoiceAccessibleName": "KAAK 音声ワークスペース",
"kaakTagline": "あなたの声を、どこでも。",
"kaakHomeIllustrationAlt": "WebSpeak 音声接続のイラスト",
"kaakWelcomeTitle": "WebSpeak へようこそ",
"kaakConnectTitle": "TeamSpeak サーバーに接続",
"kaakConnectDescription": "アカウント登録は不要です。サーバー情報を入力して音声に参加できます。",
"kaakBrowserDirect": "ブラウザーから直接接続 · TeamSpeak クライアント不要",
"kaakFavoritesAndHistory": "お気に入りと最近使ったサーバー",
"kaakFavorites": "お気に入り",
"kaakRecent": "最近",
"kaakVoiceRoomControls": "音声ルーム操作",
"kaakReturnChannelsNoDisconnect": "切断せずにチャンネル一覧へ戻る",
"kaakVoiceRoom": "音声ルーム",
"kaakMoreVoiceActions": "その他の音声操作",
"kaakOpenChatHistory": "チャット履歴を開く",
"kaakChatHistory": "チャット履歴",
"kaakCopyInviteLink": "招待リンクをコピー",
"kaakCloseMenu": "メニューを閉じる",
"kaakCurrentVoiceChannel": "現在の音声チャンネル",
"kaakVoiceConnected": "TeamSpeak · 音声に接続中",
"kaakServerChannels": "サーバーチャンネル",
"kaakChannels": "チャンネル",
"kaakToggleVoiceGroup": "音声グループを展開/折りたたむ",
"kaakVoiceGroup": "音声グループ",
"kaakReturnVoiceRoom": "現在の音声ルームに戻る",
"kaakReturnVoiceRoomConnected": "音声接続中 · タップしてルームに戻る",
"kaakChat": "チャット",
"kaakToggleChatPanel": "チャットパネルを折りたたむ/展開",
"kaakVoiceRoomAccessibleName": "音声ルーム",
"kaakBackToChannels": "チャンネル一覧に戻る",
"kaakChannelMemberCount": "チャンネルの参加者数",
"kaakExpandChatPanel": "チャットパネルを展開",
"kaakVoiceControls": "音声コントロール",
"kaakDisconnectVoice": "音声接続を切断",
"kaakStopScreenShare": "画面共有を停止",
"kaakAudioControls": "音声コントロール",
"kaakAudioSettings": "音声設定",
"kaakAudioSettingsShort": "音声設定",
"kaakNoiseSuppression": "ノイズ抑制",
"kaakMicrophone": "マイク",
"kaakSpeakerMute": "スピーカーをミュート",
"kaakAccompaniment": "伴奏音声",
"kaakMuteMicrophone": "マイクをミュート",
"kaakUnmuteMicrophone": "マイクのミュートを解除",
"kaakMuteOutput": "出力をミュート",
"kaakMute": "ミュート",
"kaakUnmute": "ミュート解除",
"kaakSpeaker": "スピーカー",
"kaakScreenShare": "画面共有",
"kaakLeaveVoice": "退出",
"kaakCurrentIdentity": "現在の TeamSpeak ID",
"kaakOnline": "オンライン"
}
}
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"schemaVersion": 3,
"packageType": "open-skin",
"id": "community.kaak-voice",
"name": "KAAK",
"version": "3.1.121",
"author": "WebSpeak Project",
"license": "AGPL-3.0-only",
"description": "A KOOK-inspired WebSpeak skin with a split-screen connection home, searchable server header, TeamSpeak banner, nested channel members, unified chat with local history, and a compact audio dock.",
"entry": "skin.css",
"components": "components.json",
"content": "content.json",
"minAppVersion": "0.2.7"
}
File diff suppressed because it is too large. Load diff
Binary file not shown.
@@ -0,0 +1,240 @@
{
"schemaVersion": 3,
"components": [
{
"id": "open-voice-home",
"name": "Open voice connection page",
"page": "home",
"mode": "surface",
"accessibleName": "WebSpeak connection page",
"permissions": ["ui.surface.replace"],
"actions": {},
"root": {
"tag": "main",
"part": "home",
"children": [
{
"tag": "header",
"part": "home-header",
"children": [
{ "tag": "span", "part": "brand-mark", "children": [{ "text": "W" }] },
{ "tag": "span", "part": "brand-name", "children": [{ "text": "VOICE SPACE" }] },
{ "widget": "app.language-switcher", "part": "language" },
{ "widget": "app.skin-switcher", "part": "skin" }
]
},
{
"tag": "section",
"part": "connection-card",
"children": [
{ "tag": "p", "part": "eyebrow", "children": [{ "text": "TEAM SPEAK · VOICE CLIENT" }] },
{ "tag": "h1", "part": "title", "children": [{ "text": "Connect with your people" }] },
{ "tag": "p", "part": "description", "children": [{ "text": "Join a voice server and continue where your community meets." }] },
{ "widget": "home.connection-form", "part": "connection-form" }
]
},
{
"tag": "footer",
"part": "home-footer",
"children": [{ "text": "Your connection and identity remain managed by WebSpeak." }]
}
]
}
},
{
"id": "open-voice-workspace",
"name": "Open voice workspace",
"page": "voice",
"mode": "surface",
"accessibleName": "WebSpeak voice workspace",
"permissions": [
"ui.surface.replace",
"session.status.read",
"servers.quickList.read",
"servers.quickList.switch",
"session.channels.read",
"session.members.read",
"session.channel.join",
"chat.channel.read",
"chat.channel.send",
"audio.status.read",
"audio.microphone.control",
"audio.output.control",
"voice.whisper.status.read",
"voice.whisper.control",
"voice.disconnect",
"voice.screenShare.read",
"voice.screenShare.control"
],
"actions": {
"switch-server": {
"type": "quickServers.switch",
"args": { "quickServerId": "{{server.id}}" }
},
"join-channel": {
"type": "voice.joinChannel",
"args": { "channelId": "{{channel.id}}" }
},
"watch-screen-share": {
"type": "voice.joinScreenShare",
"args": { "streamId": "{{member.screenShareStreamId}}" }
}
},
"root": {
"tag": "main",
"part": "workspace",
"children": [
{
"tag": "header",
"part": "workspace-header",
"children": [
{ "tag": "span", "part": "brand-mark", "children": [{ "text": "W" }] },
{ "tag": "strong", "part": "server-title", "children": [{ "text": "{{session.status.channelName}}" }] },
{ "widget": "app.language-switcher", "part": "language" },
{ "widget": "app.skin-switcher", "part": "skin" }
]
},
{
"tag": "nav",
"part": "quick-rail",
"attributes": { "aria-label": "Favorite and recent servers" },
"children": [
{
"tag": "div",
"part": "quick-server-item",
"repeat": { "path": "servers.quickList", "as": "server" },
"children": [
{
"tag": "button",
"part": "quick-server",
"attributes": {
"type": "button",
"aria-current": "{{server.current}}",
"aria-label": "Switch to {{server.label}}"
},
"events": { "click": "switch-server" },
"children": [
{ "tag": "span", "part": "server-monogram", "children": [{ "text": "{{server.label}}" }] },
{
"tag": "small",
"part": "server-kind",
"when": { "path": "server.favorite", "equals": true },
"children": [{ "text": "Favorite" }]
},
{
"tag": "small",
"part": "server-kind",
"when": { "path": "server.kind", "equals": "recent" },
"children": [{ "text": "Recent" }]
}
]
}
]
}
]
},
{
"tag": "nav",
"part": "channels",
"attributes": { "aria-label": "Voice channels" },
"children": [
{ "tag": "h2", "part": "section-title", "children": [{ "text": "VOICE CHANNELS" }] },
{
"tag": "div",
"part": "channel-item",
"repeat": { "path": "session.channels", "as": "channel" },
"children": [
{
"tag": "button",
"part": "channel-row",
"attributes": {
"type": "button",
"aria-current": "{{channel.current}}",
"aria-label": "Join {{channel.name}}"
},
"events": { "dblclick": "join-channel", "keydown": "join-channel" },
"children": [
{ "tag": "span", "part": "channel-glyph", "children": [{ "text": "◖" }] },
{ "tag": "span", "part": "channel-name", "children": [{ "text": "{{channel.name}}" }] },
{ "tag": "small", "part": "channel-count", "children": [{ "text": "{{channel.memberCount}}" }] }
]
}
]
}
]
},
{
"tag": "section",
"part": "conversation",
"children": [
{
"tag": "header",
"part": "conversation-heading",
"children": [
{ "tag": "h1", "part": "channel-title", "children": [{ "text": "{{session.status.channelName}}" }] },
{ "tag": "span", "part": "connection-state", "children": [{ "text": "Connected" }] }
]
},
{ "widget": "voice.chat-panel", "part": "chat" },
{ "widget": "voice.screen-share-player", "part": "screen-share" }
]
},
{
"tag": "aside",
"part": "members-and-controls",
"children": [
{ "tag": "h2", "part": "section-title", "children": [{ "text": "IN THIS CHANNEL" }] },
{
"tag": "ul",
"part": "member-list",
"children": [
{
"tag": "li",
"part": "member-row",
"repeat": { "path": "session.members", "as": "member" },
"children": [
{ "tag": "span", "part": "member-avatar", "children": [{ "text": "{{member.name}}" }] },
{ "tag": "span", "part": "member-name", "children": [{ "text": "{{member.name}}" }] },
{
"tag": "small",
"part": "speaking-indicator",
"when": { "path": "member.speaking", "equals": true },
"attributes": { "aria-label": "Speaking" },
"children": [{ "text": "Speaking" }]
},
{
"tag": "div",
"part": "member-screen-share",
"when": { "path": "member.screenSharing", "equals": true },
"children": [
{
"tag": "span",
"part": "member-screen-share-live",
"attributes": { "role": "status" },
"children": [{ "text": "Sharing screen" }]
},
{
"tag": "button",
"part": "member-screen-share-watch",
"when": { "path": "member.self", "equals": false },
"attributes": { "type": "button", "aria-label": "Watch {{member.name}}'s screen" },
"events": { "click": "watch-screen-share" },
"children": [{ "text": "Watch" }]
}
]
}
]
}
]
},
{ "widget": "voice.whisper-controls", "part": "whisper" },
{ "widget": "voice.audio-controls", "part": "audio" },
{ "widget": "voice.connection-controls", "part": "connection" },
{ "widget": "voice.disconnect-control", "part": "disconnect" }
]
}
]
}
}
]
}
@@ -0,0 +1,13 @@
{
"schemaVersion": 3,
"packageType": "open-skin",
"id": "community.open-voice-surface",
"name": "Open Voice Surface",
"version": "1.0.1",
"author": "WebSpeak Project",
"license": "AGPL-3.0-only",
"description": "A complete, script-free public voice client surface scaffold.",
"entry": "skin.css",
"components": "components.json",
"minAppVersion": "0.2.7"
}
+313
View File
@@ -0,0 +1,313 @@
:root {
color-scheme: dark;
--skin-voice-bg: #111318;
--skin-voice-panel: #191c24;
--skin-voice-raised: #222631;
--skin-voice-text: #f0f1f5;
--skin-voice-muted: #969baa;
--skin-voice-accent: #8e7bff;
--skin-voice-live: #62d5a7;
}
[data-ws-plugin-part="open-voice-home"] {
min-height: 100vh;
display: grid;
grid-template-rows: auto 1fr auto;
justify-items: center;
gap: 32px;
padding: clamp(18px, 5vw, 56px);
color: var(--skin-voice-text);
background: radial-gradient(ellipse at 50% 42%, #25253c 0, var(--skin-voice-bg) 66%);
}
[data-ws-plugin-part="open-voice-home.home-header"] {
display: flex;
align-items: center;
gap: 12px;
width: min(100%, 1080px);
}
[data-ws-plugin-part="open-voice-home.brand-mark"],
[data-ws-plugin-part="open-voice-workspace.brand-mark"] {
display: grid;
place-items: center;
width: 38px;
height: 38px;
border-radius: 14px;
color: white;
background: var(--skin-voice-accent);
font-weight: 800;
}
[data-ws-plugin-part="open-voice-home.brand-name"] {
margin-right: auto;
font-size: 13px;
font-weight: 800;
letter-spacing: .14em;
}
[data-ws-plugin-part="open-voice-home.connection-card"] {
align-self: center;
width: min(100%, 520px);
padding: clamp(22px, 5vw, 42px);
border: 1px solid #ffffff17;
border-radius: 24px;
background: color-mix(in srgb, var(--skin-voice-panel) 94%, transparent);
box-shadow: 0 28px 90px #0008;
}
[data-ws-plugin-part="open-voice-home.eyebrow"],
[data-ws-plugin-part="open-voice-workspace.section-title"] {
color: var(--skin-voice-muted);
font-size: 10px;
font-weight: 800;
letter-spacing: .14em;
}
[data-ws-plugin-part="open-voice-home.title"] {
margin: 10px 0;
font-size: clamp(27px, 5vw, 40px);
letter-spacing: -.04em;
}
[data-ws-plugin-part="open-voice-home.description"],
[data-ws-plugin-part="open-voice-home.home-footer"] {
color: var(--skin-voice-muted);
line-height: 1.6;
}
[data-ws-plugin-part="open-voice-workspace"] {
display: grid;
grid-template-columns: 72px 228px minmax(320px, 1fr) 252px;
grid-template-rows: 62px minmax(0, 1fr);
width: 100%;
min-height: 100vh;
color: var(--skin-voice-text);
background: var(--skin-voice-bg);
}
[data-ws-plugin-part="open-voice-workspace.workspace-header"] {
grid-column: 1 / -1;
display: flex;
align-items: center;
gap: 14px;
padding: 0 18px;
border-bottom: 1px solid #ffffff12;
background: #171920;
}
[data-ws-plugin-part="open-voice-workspace.server-title"] { margin-right: auto; }
[data-ws-plugin-part="open-voice-workspace.quick-rail"] {
grid-column: 1;
grid-row: 2;
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
overflow-y: auto;
padding: 14px 8px;
background: #171920;
}
[data-ws-plugin-part="open-voice-workspace.quick-server"] {
display: grid;
justify-items: center;
gap: 4px;
width: 52px;
min-height: 58px;
padding: 5px;
border: 0;
border-radius: 16px;
color: var(--skin-voice-muted);
background: transparent;
cursor: pointer;
}
[data-ws-plugin-part="open-voice-workspace.quick-server"][aria-current="true"] {
color: white;
background: var(--skin-voice-accent);
}
[data-ws-plugin-part="open-voice-workspace.server-monogram"] {
display: grid;
place-items: center;
width: 36px;
height: 36px;
overflow: hidden;
border-radius: 12px;
background: #ffffff18;
font-size: 11px;
font-weight: 800;
}
[data-ws-plugin-part="open-voice-workspace.server-kind"] { font-size: 8px; }
[data-ws-plugin-part="open-voice-workspace.channels"],
[data-ws-plugin-part="open-voice-workspace.members-and-controls"] {
min-height: 0;
overflow: auto;
padding: 18px 12px;
background: var(--skin-voice-panel);
}
[data-ws-plugin-part="open-voice-workspace.channels"] { grid-column: 2; grid-row: 2; }
[data-ws-plugin-part="open-voice-workspace.members-and-controls"] { grid-column: 4; grid-row: 2; }
[data-ws-plugin-part="open-voice-workspace.channel-row"] {
display: flex;
align-items: center;
gap: 9px;
width: 100%;
margin-top: 4px;
padding: 9px 10px;
border: 0;
border-radius: 8px;
color: var(--skin-voice-muted);
background: transparent;
text-align: left;
cursor: pointer;
}
[data-ws-plugin-part="open-voice-workspace.channel-row"][aria-current="true"] {
color: var(--skin-voice-text);
background: var(--skin-voice-raised);
}
[data-ws-plugin-part="open-voice-workspace.channel-name"] { flex: 1; }
[data-ws-plugin-part="open-voice-workspace.channel-count"] { font-size: 11px; }
[data-ws-plugin-part="open-voice-workspace.conversation"] {
grid-column: 3;
grid-row: 2;
display: grid;
grid-template-rows: auto minmax(0, 1fr) auto;
min-width: 0;
min-height: 0;
padding: 18px;
gap: 12px;
}
[data-ws-plugin-part="open-voice-workspace.conversation-heading"] {
display: flex;
align-items: center;
gap: 12px;
min-height: 46px;
border-bottom: 1px solid #ffffff12;
}
[data-ws-plugin-part="open-voice-workspace.channel-title"] { margin-right: auto; }
[data-ws-plugin-part="open-voice-workspace.connection-state"] { color: var(--skin-voice-live); font-size: 12px; }
[data-ws-plugin-part="open-voice-workspace.member-list"] {
display: grid;
gap: 8px;
margin: 12px 0 20px;
padding: 0;
list-style: none;
}
[data-ws-plugin-part="open-voice-workspace.member-row"] {
display: grid;
grid-template-columns: 34px minmax(0, 1fr);
align-items: center;
column-gap: 10px;
color: var(--skin-voice-text);
font-size: 12px;
}
[data-ws-plugin-part="open-voice-workspace.member-avatar"] {
grid-row: span 2;
display: grid;
place-items: center;
width: 34px;
height: 34px;
overflow: hidden;
border-radius: 50%;
color: white;
background: var(--skin-voice-raised);
font-weight: 700;
}
[data-ws-plugin-part="open-voice-workspace.speaking-indicator"] { color: var(--skin-voice-live); font-size: 10px; }
[data-ws-plugin-part="open-voice-workspace.member-screen-share"] {
grid-column: 2;
display: flex;
align-items: center;
gap: 8px;
color: var(--skin-voice-live);
font-size: 10px;
}
[data-ws-plugin-part="open-voice-workspace.member-screen-share-watch"] {
min-height: 32px;
padding: 0 10px;
border: 1px solid color-mix(in srgb, var(--skin-voice-live) 50%, transparent);
border-radius: 7px;
color: var(--skin-voice-text);
background: var(--skin-voice-raised);
cursor: pointer;
}
[data-ws-plugin-part="open-voice-workspace"] [data-ws-part="voice.chat"],
[data-ws-plugin-part="open-voice-workspace"] [data-ws-part="voice.audio-controls"],
[data-ws-plugin-part="open-voice-workspace"] [data-ws-part="voice.connection-controls"],
[data-ws-plugin-part="open-voice-workspace"] [data-ws-part="voice.disconnect-control"],
[data-ws-plugin-part="open-voice-workspace"] [data-ws-part="voice.whisper-controls"],
[data-ws-plugin-part="open-voice-workspace"] [data-ws-part="voice.screen-player"] {
border-radius: 12px;
color: var(--skin-voice-text);
background-color: var(--skin-voice-panel);
}
[data-ws-plugin-part="open-voice-workspace"] button:focus-visible {
outline: 2px solid var(--skin-voice-accent);
outline-offset: 2px;
}
@media (max-width: 800px) {
[data-ws-plugin-part="open-voice-workspace"] {
grid-template-columns: 58px minmax(0, 1fr);
grid-template-rows: 56px minmax(320px, 1fr) auto;
min-height: 100dvh;
}
[data-ws-plugin-part="open-voice-workspace.workspace-header"] { padding: 0 10px; }
[data-ws-plugin-part="open-voice-workspace.quick-rail"] { grid-column: 1; grid-row: 2; }
[data-ws-plugin-part="open-voice-workspace.channels"] {
grid-column: 1 / -1;
grid-row: 3;
display: flex;
gap: 6px;
overflow-x: auto;
overflow-y: hidden;
padding: 8px;
}
[data-ws-plugin-part="open-voice-workspace.section-title"] { display: none; }
[data-ws-plugin-part="open-voice-workspace.channel-row"] { width: max-content; min-width: 130px; margin: 0; }
[data-ws-plugin-part="open-voice-workspace.conversation"] {
grid-column: 2;
grid-row: 2;
padding: 10px;
}
[data-ws-plugin-part="open-voice-workspace.members-and-controls"] {
grid-column: 1 / -1;
grid-row: 4;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
padding: 8px;
}
[data-ws-plugin-part="open-voice-workspace.member-list"] { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
[data-ws-plugin-part="open-voice-workspace"] *,
[data-ws-plugin-part="open-voice-home"] * {
scroll-behavior: auto;
animation-duration: .01ms;
animation-iteration-count: 1;
transition-duration: .01ms;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

+38
View File
@@ -0,0 +1,38 @@
# Android client
The Android app packages the Vue client with a small local gateway. Capacitor starts the embedded Node.js runtime, the gateway listens on `127.0.0.1:3040`, and the WebView opens that local address. The gateway is loopback-only; it does not expose an HTTP listener to the LAN. Release APKs are debug-signed sideload packages, not Google Play builds.
## Build on Windows
Use a short checkout path such as `C:\src\webspeak`. The Node.js plugin's CMake/Ninja object paths can exceed the Windows toolchain limit in deeply nested workspaces. A clean build in a nested validation directory failed with CMake's 250-character object-path warning and a Ninja `mkdir` error; the same source and dependencies built successfully from a shorter path. Changing application code or the embedded runtime is not required for this build-host issue.
Use the server development Node.js version (22.5 or newer) on the build host. Install all three dependency sets, then prepare and sync the Android project:
```powershell
npm ci --ignore-scripts --no-audit --no-fund
npm run prepare:sdk
npm rebuild @discordjs/opus --foreground-scripts --no-audit --no-fund
npm --prefix web ci --no-audit --no-fund
npm --prefix mobile ci --no-audit --no-fund
npm run android:sync
```
Build the debug APKs with Android Studio's JDK and the checked-in Gradle wrapper:
```powershell
$env:JAVA_HOME = "C:\Program Files\Android\Android Studio\jbr"
$env:ANDROID_HOME = "$env:LOCALAPPDATA\Android\Sdk"
Set-Location web\android
.\gradlew.bat assembleDebug
```
Gradle writes one APK per supported CPU architecture under `web/android/app/build/outputs/apk/debug/`: `arm64-v8a`, `armeabi-v7a`, and `x86_64`. Use `arm64-v8a` for most modern Android phones and `x86_64` for the Android emulator. GitHub Releases contains all three APKs with versioned filenames.
## Current scope
- Platform startup is isolated in `web/src/platform/`. Ordinary browser sessions mount directly; the native shell loads the Node.js plugin only while waiting for its loopback gateway. Startup errors, timeouts and page exit release polling and message listeners. Retry repeats the readiness handshake without restarting the embedded Node.js runtime.
- The local gateway serves the join page, public configuration, skin package, join-ticket endpoint, and voice WebSocket bridge.
- The admin console and server-side skin management are not available in the Android package.
- Mobile audio encoding uses the JavaScript/WASM Opus codec. The normal server build continues to use the native Opus codec.
- The embedded runtime supplied by the current Capacitor Node.js plugin is Node.js 18.20.4. The gateway, identity parsing, and Opus encode/decode paths have been smoke-checked on that runtime. The TeamSpeak SDK declares Node.js 20.19 or newer, so real TeamSpeak connectivity and two-way audio remain unverified on Android; the APKs are for sideload testing.
- Android WebView on the tested emulator does not expose `getDisplayMedia`; screen sharing needs a native MediaProjection integration. A persistent Android foreground service and real-device background audio behavior also remain to be implemented and verified.
+33
View File
@@ -0,0 +1,33 @@
const path = require("node:path");
const os = require("node:os");
let app;
let channel;
try {
({ app, channel } = require("bridge"));
} catch (error) {
if (error.code !== "MODULE_NOT_FOUND") throw error;
app = { datadir: () => path.join(os.tmpdir(), "webspeak-android-gateway-dev") };
channel = { on: () => {}, post: () => {} };
}
process.env.WEBSPEAK_MOBILE = "1";
process.env.WEBSPEAK_DATA_DIR = app.datadir();
process.env.WEBSPEAK_MOBILE_WWW = path.join(__dirname, "www");
process.env.WEBSPEAK_VERSION = require("./package.json").version;
let gatewayReady = false;
const gatewayPort = Number(process.env.WEBSPEAK_MOBILE_PORT || 3040);
channel.on("webspeak-health", () => {
channel.post("webspeak-health", { ready: gatewayReady, port: gatewayPort });
});
import("./dist/mobile/index.js")
.then(() => {
gatewayReady = true;
channel.post("webspeak-health", { ready: true, port: gatewayPort });
})
.catch((error) => {
const message = error instanceof Error ? error.stack || error.message : String(error);
console.error("WebSpeak mobile gateway failed:", message);
channel.post("webspeak-error", { message });
});
+29
View File
@@ -0,0 +1,29 @@
import { cp, mkdir, readdir, copyFile, stat, readFile, writeFile, rm } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
const mobileDir = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.resolve(mobileDir, "..");
const webDist = path.join(rootDir, "web", "dist");
const outputDir = path.join(webDist, "nodejs");
for (const required of [path.join(rootDir, "dist", "mobile", "index.js"), path.join(mobileDir, "node_modules"), path.join(webDist, "index.html")]) {
if (!(await stat(required).catch(() => null))) throw new Error(`Missing Android build input: ${required}`);
}
await rm(outputDir, { recursive: true, force: true });
await mkdir(path.join(outputDir, "www"), { recursive: true });
await cp(path.join(rootDir, "dist"), path.join(outputDir, "dist"), { recursive: true, force: true });
await cp(path.join(mobileDir, "node_modules"), path.join(outputDir, "node_modules"), { recursive: true, force: true });
await copyFile(path.join(mobileDir, "index.cjs"), path.join(outputDir, "index.cjs"));
const appPackage = JSON.parse(await readFile(path.join(rootDir, "package.json"), "utf8"));
const mobilePackage = JSON.parse(await readFile(path.join(mobileDir, "package.json"), "utf8"));
mobilePackage.version = appPackage.version;
await writeFile(path.join(outputDir, "package.json"), `${JSON.stringify(mobilePackage, null, 2)}\n`);
for (const entry of await readdir(webDist, { withFileTypes: true })) {
if (entry.name === "nodejs") continue;
await cp(path.join(webDist, entry.name), path.join(outputDir, "www", entry.name), { recursive: entry.isDirectory(), force: true });
}
console.log(`Android gateway assets prepared at ${outputDir}`);
+1564
View File
File diff suppressed because it is too large. Load diff
+15
View File
@@ -0,0 +1,15 @@
{
"name": "webspeak-android-gateway",
"version": "0.0.0",
"private": true,
"type": "module",
"main": "index.cjs",
"dependencies": {
"@echosixhiya/teamspeak-client": "git+https://github.com/EchoSixHIYA/teamspeak-js.git#56d426d24852c39439f7bfe1d5850b574a1b0811",
"express": "^4.21.2",
"opusscript": "^0.1.1",
"pino": "^10.3.1",
"werift": "0.24.4",
"ws": "^8.20.0"
}
}
+628 -10
View File
@@ -1,19 +1,22 @@
{
"name": "webspeak-webclient",
"version": "0.1.1",
"version": "0.2.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "webspeak-webclient",
"version": "0.1.1",
"hasInstallScript": true,
"version": "0.2.8",
"license": "AGPL-3.0-only",
"dependencies": {
"@discordjs/opus": "^0.10.0",
"@honeybbq/teamspeak-client": "^0.2.2",
"@echosixhiya/teamspeak-client": "git+https://github.com/EchoSixHIYA/teamspeak-js.git#758a0d7d9120b0f5777d9451fb6b134f0b606f65",
"express": "^5.2.1",
"pino": "^10.3.1",
"postcss": "^8.5.29",
"postcss-selector-parser": "^7.1.6",
"postcss-value-parser": "^4.2.0",
"werift": "0.24.4",
"ws": "^8.20.0"
},
"devDependencies": {
@@ -61,6 +64,17 @@
"node": ">=12.0.0"
}
},
"node_modules/@echosixhiya/teamspeak-client": {
"version": "0.2.5",
"resolved": "git+https://github.com/EchoSixHIYA/teamspeak-js.git#758a0d7d9120b0f5777d9451fb6b134f0b606f65",
"license": "MIT",
"dependencies": {
"@noble/curves": "^2.0.1"
},
"engines": {
"node": ">=20.19"
}
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.28.2",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz",
@@ -503,16 +517,26 @@
"node": ">=18"
}
},
"node_modules/@honeybbq/teamspeak-client": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/@honeybbq/teamspeak-client/-/teamspeak-client-0.2.2.tgz",
"integrity": "sha512-JQ4yHEUwAxK2kHmIxelEf3grzMM8lVeuf7RzxK1g24U6XH8ZJO28S477FUtSTRe68PwUBkAlsa1Z/7BhLKh+AA==",
"node_modules/@fidm/asn1": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@fidm/asn1/-/asn1-1.0.4.tgz",
"integrity": "sha512-esd1jyNvRb2HVaQGq2Gg8Z0kbQPXzV9Tq5Z14KNIov6KfFD6PTaRIO8UpcsYiTNzOqJpmyzWgVTrUwFV3UF4TQ==",
"license": "MIT",
"engines": {
"node": ">= 8"
}
},
"node_modules/@fidm/x509": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@fidm/x509/-/x509-1.2.1.tgz",
"integrity": "sha512-nwc2iesjyc9hkuzcrMCBXQRn653XuAUKorfWM8PZyJawiy1QzLj4vahwzaI25+pfpwOLvMzbJ0uKpWLDNmo16w==",
"license": "MIT",
"dependencies": {
"@noble/curves": "^2.0.1"
"@fidm/asn1": "^1.0.4",
"tweetnacl": "^1.0.1"
},
"engines": {
"node": ">=20.19"
"node": ">= 8"
}
},
"node_modules/@isaacs/fs-minipass": {
@@ -527,6 +551,12 @@
"node": ">=18.0.0"
}
},
"node_modules/@leichtgewicht/ip-codec": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz",
"integrity": "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==",
"license": "MIT"
},
"node_modules/@noble/curves": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-2.2.0.tgz",
@@ -554,12 +584,212 @@
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@peculiar/asn1-cms": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.9.4.tgz",
"integrity": "sha512-cben7oxmQsUGZqotus7yt0srYdncOT6RNWcTQ77T2RFOXejYVYkXadrfePdRcrVpO9K95IRLKKglG2k38jKXuw==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.9.4",
"@peculiar/asn1-x509": "^2.9.4",
"@peculiar/asn1-x509-attr": "^2.9.4",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-csr": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.9.4.tgz",
"integrity": "sha512-xd4YN4vpRjkDAQWVfZZkeu12IEND7DOpkqaHSIHxZl1uggUNa9Ju0QxY2jHvDAS9pP0zhRBytg8ifsnGo3V0jw==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.9.4",
"@peculiar/asn1-x509": "^2.9.4",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-ecc": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.9.4.tgz",
"integrity": "sha512-JJXefFshRAuVAjWQo/39bkg1ywc1VaiO44S8RRC+Ykvf/u2KDmYffoDb0ZBPCR5uJy4AGKQhl8mX+Q8ShcWaXQ==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.9.4",
"@peculiar/asn1-x509": "^2.9.4",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-pfx": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.9.4.tgz",
"integrity": "sha512-khuGzHTzNzk4GDlIBEILyIs6Lce0yn0ZBdoI9v93kmNncfZRhD+AQ5ODFqdhvoE8cMJF/JMTQ8yA+t1D14kqCw==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-cms": "^2.9.4",
"@peculiar/asn1-pkcs8": "^2.9.4",
"@peculiar/asn1-rsa": "^2.9.4",
"@peculiar/asn1-schema": "^2.9.4",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-pkcs8": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.9.4.tgz",
"integrity": "sha512-duRdotlUx9eDZe6QrQpQKl61RbWykCHBCkKayP8V8XdEFwlKHZ8qGGDMyS6Pye7OX7nLFttTTpRkJeet78ckwQ==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.9.4",
"@peculiar/asn1-x509": "^2.9.4",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-pkcs9": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.9.4.tgz",
"integrity": "sha512-kaL4cNxBpdQE2dKlyZBqz4ygCrwffO+8wfoxTEqM1Z8RadvCeELBRzcv0dzM8aY9azHMwODO5nxU65zXmhToOQ==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-cms": "^2.9.4",
"@peculiar/asn1-pfx": "^2.9.4",
"@peculiar/asn1-pkcs8": "^2.9.4",
"@peculiar/asn1-schema": "^2.9.4",
"@peculiar/asn1-x509": "^2.9.4",
"@peculiar/asn1-x509-attr": "^2.9.4",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-rsa": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.9.4.tgz",
"integrity": "sha512-pZ96eD1PptovcWQ/GSmuNFXd/7EQJNlKfDaNCyE2rx3W0v6QFelkzquVqRSRyyDXXCYD69ZXJDzZ8GhIiQzKoA==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.9.4",
"@peculiar/asn1-x509": "^2.9.4",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-schema": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.9.4.tgz",
"integrity": "sha512-GjzePcT9Iw8NzeOPf73iNS9xM+TBhd/FilAfP+RQGkTMQJTVWtytN3JHJACCjf/ABNau5S7mS3g+DcuxmRgYEg==",
"license": "MIT",
"dependencies": {
"@peculiar/utils": "^2.0.2",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-x509": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.9.4.tgz",
"integrity": "sha512-CxhBo/RdEbMMob7T31ZdQjGuoyRFLVwrDzTn25bihzBasRg9kRm/0IxIPvhgQtcK/9dNcO1XQL2fuPugwELL0Q==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.9.4",
"@peculiar/utils": "^2.0.2",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-x509-attr": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.9.4.tgz",
"integrity": "sha512-ehQXbpQaQYycgu8OrvigwSPTFfVRcu0ECNYCWw+yzBp02Lw5paRqzzhUpfOgO2K38+WfFZuEz/0RPtam5g0OMg==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.9.4",
"@peculiar/asn1-x509": "^2.9.4",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/utils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@peculiar/utils/-/utils-2.0.3.tgz",
"integrity": "sha512-+oL3HPFRIZ1St2K50lWCXiioIgSoxzz7R1J3uF6neO2yl1sgmpgY6XXJH4BdpoDkMWznQTeYF6oWNDZLCdQ4eQ==",
"license": "MIT",
"dependencies": {
"tslib": "^2.8.1"
}
},
"node_modules/@peculiar/x509": {
"version": "1.14.3",
"resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.14.3.tgz",
"integrity": "sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-cms": "^2.6.0",
"@peculiar/asn1-csr": "^2.6.0",
"@peculiar/asn1-ecc": "^2.6.0",
"@peculiar/asn1-pkcs9": "^2.6.0",
"@peculiar/asn1-rsa": "^2.6.0",
"@peculiar/asn1-schema": "^2.6.0",
"@peculiar/asn1-x509": "^2.6.0",
"pvtsutils": "^1.3.6",
"reflect-metadata": "^0.2.2",
"tslib": "^2.8.1",
"tsyringe": "^4.10.0"
},
"engines": {
"node": ">=20.0.0"
}
},
"node_modules/@pinojs/redact": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz",
"integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==",
"license": "MIT"
},
"node_modules/@shinyoshiaki/binary-data": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/@shinyoshiaki/binary-data/-/binary-data-0.6.1.tgz",
"integrity": "sha512-7HDb/fQAop2bCmvDIzU5+69i+UJaFgIVp99h1VzK1mpg1JwSODOkjbqD7ilTYnqlnadF8C4XjpwpepxDsGY6+w==",
"license": "MIT",
"dependencies": {
"generate-function": "^2.3.1",
"is-plain-object": "^2.0.3"
},
"engines": {
"node": ">=6"
}
},
"node_modules/@types/body-parser": {
"version": "1.19.6",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz",
@@ -581,6 +811,21 @@
"@types/node": "*"
}
},
"node_modules/@types/dom-mediacapture-transform": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/@types/dom-mediacapture-transform/-/dom-mediacapture-transform-0.1.12.tgz",
"integrity": "sha512-d7/QsLRwF864A5mgIM/YrfiglHoYn7zgCcAoJgW404r+2DwnNr7EBbLnCWpmOMgH8y0te73L1AV6H1bmauaWFw==",
"license": "MIT",
"dependencies": {
"@types/dom-webcodecs": "*"
}
},
"node_modules/@types/dom-webcodecs": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/@types/dom-webcodecs/-/dom-webcodecs-0.1.13.tgz",
"integrity": "sha512-O5hkiFIcjjszPIYyUSyvScyvrBoV3NOEEZx/pMlsu44TKzWNkLVBBxnxJz42in5n3QIolYOcBYFCPZZ0h8SkwQ==",
"license": "MIT"
},
"node_modules/@types/express": {
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.6.tgz",
@@ -728,6 +973,20 @@
"node": ">=10"
}
},
"node_modules/asn1js": {
"version": "3.0.10",
"resolved": "https://registry.npmjs.org/asn1js/-/asn1js-3.0.10.tgz",
"integrity": "sha512-S2s3aOytiKdFRdulw2qPE51MzjzVOisppcVv7jVFR+Kw0kxwvFrDcYA0h7Ndqbmj0HkMIXYWaoj7fli8kgx1eg==",
"license": "BSD-3-Clause",
"dependencies": {
"pvtsutils": "^1.3.6",
"pvutils": "^1.1.5",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/atomic-sleep": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz",
@@ -743,6 +1002,26 @@
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/body-parser": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz",
@@ -790,6 +1069,30 @@
"concat-map": "0.0.1"
}
},
"node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
@@ -898,6 +1201,18 @@
"node": ">=6.6.0"
}
},
"node_modules/cssesc": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
"integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
"license": "MIT",
"bin": {
"cssesc": "bin/cssesc"
},
"engines": {
"node": ">=4"
}
},
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
@@ -939,6 +1254,18 @@
"node": ">=8"
}
},
"node_modules/dns-packet": {
"version": "5.6.1",
"resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz",
"integrity": "sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==",
"license": "MIT",
"dependencies": {
"@leichtgewicht/ip-codec": "^2.0.1"
},
"engines": {
"node": ">=6"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
@@ -1194,6 +1521,15 @@
"node": ">=10"
}
},
"node_modules/generate-function": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
"integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==",
"license": "MIT",
"dependencies": {
"is-property": "^1.0.2"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
@@ -1343,6 +1679,26 @@
"url": "https://opencollective.com/express"
}
},
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "BSD-3-Clause"
},
"node_modules/inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@@ -1378,12 +1734,39 @@
"node": ">=8"
}
},
"node_modules/is-plain-object": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
"license": "MIT",
"dependencies": {
"isobject": "^3.0.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-promise": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
"license": "MIT"
},
"node_modules/is-property": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
"integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==",
"license": "MIT"
},
"node_modules/isobject": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
"integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@@ -1426,6 +1809,24 @@
"node": ">= 0.8"
}
},
"node_modules/mediabunny": {
"version": "1.55.5",
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.55.5.tgz",
"integrity": "sha512-m0v6y8FGXiK+HKOc3AZqU+kJPLYsSKaLitmQNQIIHZKIGlTwQ34OF+X6Ul0K8iV4b03oPse10apwuoqbvmKeAA==",
"license": "MPL-2.0",
"workspaces": [
".",
"packages/*"
],
"dependencies": {
"@types/dom-mediacapture-transform": "^0.1.11",
"@types/dom-webcodecs": "0.1.13"
},
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/Vanilagy"
}
},
"node_modules/merge-descriptors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
@@ -1502,6 +1903,37 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/multicast-dns": {
"version": "7.2.5",
"resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz",
"integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==",
"license": "MIT",
"dependencies": {
"dns-packet": "^5.2.2",
"thunky": "^1.0.2"
},
"bin": {
"multicast-dns": "cli.js"
}
},
"node_modules/nanoid": {
"version": "3.3.20",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
"integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"bin": {
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
"node_modules/negotiator": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
@@ -1647,6 +2079,12 @@
"url": "https://opencollective.com/express"
}
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
},
"node_modules/pino": {
"version": "10.3.1",
"resolved": "https://registry.npmjs.org/pino/-/pino-10.3.1.tgz",
@@ -1684,6 +2122,53 @@
"integrity": "sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==",
"license": "MIT"
},
"node_modules/postcss": {
"version": "8.5.29",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.29.tgz",
"integrity": "sha512-49cGhUbXj8Qenv0iTMxA1cFBzxXoctpC9Ujd77t1WcbJIr6nF/eI7g/8MgxrYldFRuAXvja7xQRwavoW7kgrxQ==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/postcss"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"nanoid": "^3.3.19",
"picocolors": "^1.1.1",
"source-map-js": "^1.2.2"
},
"engines": {
"node": "^10 || ^12 || >=14"
}
},
"node_modules/postcss-selector-parser": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.6.tgz",
"integrity": "sha512-7qASPzhKF2l2KLboRZux8CCTRMdGiV08vWmyKzPz22qZ7ZjQBOeY7rNzNoCLSUiftJ7HUq0GERHmxw/t0dCdMw==",
"license": "MIT",
"dependencies": {
"cssesc": "^3.0.0",
"util-deprecate": "^1.0.2"
},
"engines": {
"node": ">=4"
}
},
"node_modules/postcss-value-parser": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
"license": "MIT"
},
"node_modules/process-warning": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz",
@@ -1713,6 +2198,24 @@
"node": ">= 0.10"
}
},
"node_modules/pvtsutils": {
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.6.tgz",
"integrity": "sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==",
"license": "MIT",
"dependencies": {
"tslib": "^2.8.1"
}
},
"node_modules/pvutils": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.2.0.tgz",
"integrity": "sha512-BbubeCEyTuQjVMakvJQ/Sxbc93F2pwmbsxONT/ZRrwU7Ua38d8unYTwXpTVLAKJ4BDuH9IGztCjQcd/N/39Dvg==",
"license": "MIT",
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/qs": {
"version": "6.15.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz",
@@ -1781,6 +2284,12 @@
"node": ">= 12.13.0"
}
},
"node_modules/reflect-metadata": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
"license": "Apache-2.0"
},
"node_modules/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
@@ -2004,6 +2513,15 @@
"atomic-sleep": "^1.0.0"
}
},
"node_modules/source-map-js": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
"integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/split2": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
@@ -2091,6 +2609,12 @@
"integrity": "sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g==",
"license": "MIT"
},
"node_modules/thunky": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
"integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==",
"license": "MIT"
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@@ -2106,6 +2630,12 @@
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
"license": "MIT"
},
"node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
},
"node_modules/tsx": {
"version": "4.22.3",
"resolved": "https://registry.npmjs.org/tsx/-/tsx-4.22.3.tgz",
@@ -2125,6 +2655,30 @@
"fsevents": "~2.3.3"
}
},
"node_modules/tsyringe": {
"version": "4.10.0",
"resolved": "https://registry.npmjs.org/tsyringe/-/tsyringe-4.10.0.tgz",
"integrity": "sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw==",
"license": "MIT",
"dependencies": {
"tslib": "^1.9.3"
},
"engines": {
"node": ">= 6.0.0"
}
},
"node_modules/tsyringe/node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"license": "0BSD"
},
"node_modules/tweetnacl": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==",
"license": "Unlicense"
},
"node_modules/type-is": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz",
@@ -2207,6 +2761,70 @@
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
"license": "BSD-2-Clause"
},
"node_modules/werift": {
"version": "0.24.4",
"resolved": "https://registry.npmjs.org/werift/-/werift-0.24.4.tgz",
"integrity": "sha512-NoROZ11L/ZqAB5ombCB4VBuVNdIZfwI493zlxlIX7BlwfWRy55eDJdtWMC2VX35yBXFaWwA8NtYbmJ8qWtVk9Q==",
"license": "MIT",
"dependencies": {
"@fidm/x509": "^1.2.1",
"@noble/curves": "^1.8.1",
"@peculiar/x509": "^1.12.3",
"@shinyoshiaki/binary-data": "^0.6.1",
"buffer": "^6.0.3",
"debug": "4.4.0",
"mediabunny": "^1.45.2",
"multicast-dns": "^7.2.5",
"tweetnacl": "^1.0.3"
},
"engines": {
"node": ">=16"
}
},
"node_modules/werift/node_modules/@noble/curves": {
"version": "1.9.7",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz",
"integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==",
"license": "MIT",
"dependencies": {
"@noble/hashes": "1.8.0"
},
"engines": {
"node": "^14.21.3 || >=16"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/werift/node_modules/@noble/hashes": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz",
"integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==",
"license": "MIT",
"engines": {
"node": "^14.21.3 || >=16"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/werift/node_modules/debug": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
+21 -5
View File
@@ -1,6 +1,6 @@
{
"name": "webspeak-webclient",
"version": "0.1.1",
"version": "0.2.8",
"private": true,
"license": "AGPL-3.0-only",
"type": "module",
@@ -11,17 +11,33 @@
"scripts": {
"dev": "tsx src/index.ts",
"build": "tsc",
"test": "tsx --test \"test/**/*.test.ts\"",
"test": "node --import tsx --test web/src/voice/member-volume-preferences.test.ts web/src/services/voice-channel-tree.test.ts src/admin/skin-registry.test.ts web/test/admin-api.integration.test.ts web/test/admin-view.test.mjs web/src/services/admin-api.test.ts src/security/open-target-policy.test.ts scripts/acceleration-poc/target-guard-parity.test.mjs src/server/acceleration-relay.test.ts src/server/visitor-count.test.ts src/server/voice-protocol.test.ts src/server/teamspeak-resolver.test.ts src/server/ts-client.test.ts src/server/join-ticket.test.ts src/server/identity-lease.test.ts src/server/session-manager.test.ts src/server/directory-sync.test.ts src/server/session-events.test.ts src/server/reconnect-policy.test.ts src/server/voice-commands.test.ts src/server/voice-bridge.test.ts src/server/session-audio.test.ts src/server/voice-bridge.integration.test.ts src/server/webrtc-audio.test.ts src/server/webrtc-config.test.ts src/server/audio-stats.test.ts src/server/channel-capacity.test.ts src/server/directory-view.test.ts src/server/member-avatars.test.ts src/server/screen-share-coordinator.test.ts src/shared/client-commands.test.ts src/shared/skin-layout.test.ts src/shared/skin-plugin.test.ts src/shared/skin-runtime-plugin-context.test.ts src/shared/skin-runtime-plugins.test.ts src/shared/skin-runtime-plugin-approval.test.ts src/shared/server-messages.test.ts src/shared/webrtc.test.ts scripts/docker-healthcheck.test.mjs web/test/voice-session.test.mjs web/test/audio-controls.test.mjs web/test/connection-dialogs.test.mjs web/test/voice-performance.test.mjs web/test/screen-share.test.ts web/test/screen-share-ui.test.mjs web/test/android-gateway.test.ts web/src/services/skin-catalog.test.ts web/src/services/skin-content.test.ts web/src/services/skin-plugin-runtime.test.ts web/src/services/skin-plugin-authoring.test.ts web/src/services/skin-editor-mode.test.ts web/src/services/skin-plugin-approval.test.ts web/src/services/host-editor-top-layer.test.ts web/src/services/skin-extension-ui.test.ts web/src/services/member-menu-placement.test.ts web/src/services/audio-device-menu-placement.test.ts web/src/services/mobile-viewport.test.ts web/src/services/mobile-away.test.ts web/src/services/screen-wake-lock.test.ts web/src/services/microphone-start.test.ts web/src/services/skin-pack.test.ts web/src/services/skin-runtime-plugin-approval.test.ts web/src/services/skin-layout-storage.test.ts web/src/services/skin-layout-geometry.test.ts web/src/services/skin-layout-focus.test.ts web/test/skin-layout-runtime.test.mjs web/test/skin-plugin-editor.test.mjs web/src/services/identity-import.test.ts web/src/services/identity-provider.test.ts web/test/identity-dialog.test.mjs web/test/skin-lifecycle.test.mjs web/src/services/local-persistence.test.ts web/src/services/quick-servers.test.ts src/server/teamspeak-alias.test.ts src/server/teamspeak-alias-integration.test.ts web/src/services/teamspeak-target.test.ts web/src/services/skin-extension-sandbox.test.ts web/src/services/skin-extension-wasm-policy.test.ts web/src/services/skin-extension-wasm-sandbox.test.ts web/src/services/skin-runtime-plugin-wasm.test.ts web/src/services/skin-extension-wasm-ui-loop.test.ts web/src/services/skin-wasm-interpreter.test.ts",
"verify": "npm test && npm run build && npm run web:build",
"skin:harbor:build": "node web/scripts/build-harbor-voice-skin.mjs",
"skin:open-voice:build": "node web/scripts/build-open-voice-surface-skin.mjs",
"skin:kaak:build": "node web/scripts/build-kaak-voice-skin.mjs",
"skin:illusia:build": "node web/scripts/build-illusia-voice-skin.mjs",
"start": "node dist/index.js",
"postinstall": "node scripts/patch-teamspeak-sdk.mjs",
"web:dev": "cd web && npx vite --host",
"web:build": "cd web && npx vite build"
"web:build": "npm --prefix web run build",
"skin:wasm:build": "node scripts/build-skin-wasm-interpreter.mjs",
"android:prepare": "npm run build && npm --prefix web run build && node mobile/pack.mjs",
"android:sync": "npm run android:prepare && cd web && npx cap sync android",
"prepare:sdk": "node scripts/prepare-sdk.mjs",
"acceleration:poc": "node scripts/acceleration-poc/smoke.mjs",
"acceleration:ipv6-smoke": "node scripts/acceleration-poc/smoke-ipv6.mjs",
"acceleration:sdk-smoke": "node scripts/acceleration-poc/sdk-smoke.mjs",
"acceleration:relay": "node dist/relay.js"
},
"dependencies": {
"@discordjs/opus": "^0.10.0",
"@honeybbq/teamspeak-client": "^0.2.2",
"@echosixhiya/teamspeak-client": "git+https://github.com/EchoSixHIYA/teamspeak-js.git#758a0d7d9120b0f5777d9451fb6b134f0b606f65",
"express": "^5.2.1",
"pino": "^10.3.1",
"postcss": "^8.5.29",
"postcss-selector-parser": "^7.1.6",
"postcss-value-parser": "^4.2.0",
"werift": "0.24.4",
"ws": "^8.20.0"
},
"devDependencies": {
+65
View File
@@ -0,0 +1,65 @@
# WebSpeak 加速通道 PoC
这是第一版隔离测试 Demo,不属于 WebSpeak 生产运行链路,也不会被复制到 Docker 镜像或发布包中。
它验证以下核心能力:
- 客户端向远端中继发起认证;
- 每个会话动态指定 TeamSpeak 目标地址;
- 双向 UDP 数据报转发,并保持数据包边界;
- 会话之间按随机 ID 隔离;
- 错误密钥不能建立会话;
- 未开启 `allowPrivate` 时,解析到非公网地址的目标一律被拒绝;
- 不修改系统路由,因此不是 VPN。
## 本地冒烟
在仓库根目录运行:
```bash
npm run acceleration:poc
```
成功时会输出 `ACCELERATION_POC_OK`,并显示数据包数量、丢包率和往返延迟。除吞吐与错误密钥外,该冒烟还会用一个独立的 `allowPrivate: false` 中继断言私网目标防护生效:
```text
ssrf_guard_ok=true blocked=5/5 public_target_allowed=true
```
任一被禁目标未被拦截、或公网目标被误拦,都会输出 `LEAK` / 失败。
IPv6 回环验证:
```bash
npm run acceleration:ipv6-smoke
```
## 私网目标防护与主程序保持一致
中继的 `isRestrictedAddress()` 是 `src/security/open-target-policy.ts` 中同名函数的镜像。PoC 必须是可直接拷贝到远端运行的 `.mjs` 文件,不能 import 主程序的 TypeScript 模块,因此这段判断是**有意重复**的。`scripts/acceleration-poc/target-guard-parity.test.mjs` 会逐条比对两边的分类结果,任何一侧改动而另一侧未同步都会让 CI 失败。
该测试放在 PoC 目录内而非 `src/` 下:`.dockerignore` 把 `scripts/acceleration-poc` 排除在 Docker 构建上下文之外,而 Dockerfile 会对 `src/**` 执行 `tsc`,因此 `src/` 下任何 import 该目录的文件都会让镜像构建以 TS2307 失败。
## 通过隧道连接指定 TeamSpeak
必须先将下方示例域名替换为你获准测试的 TeamSpeak 地址;脚本不内置真实服务器默认值。下面的命令会让 SDK 连接本地代理端口,再由 PoC 中继把 UDP 数据转发到指定 TeamSpeak。它不进入指定频道,只验证 TeamSpeak 握手和断开:
```bash
$env:WEBSPEAK_ACCEL_TS_TARGET="ts.example.invalid#9987"
npm run acceleration:sdk-smoke
```
跨机器验证时,需要在目标服务器启动 `relay-server.mjs`,再把 `WEBSPEAK_ACCEL_RELAY` 指向中继地址。当前项目不会自动部署或启动该远程进程。
## 手动启动中继
仅用于实验,不要直接暴露到公网:
```bash
WEBSPEAK_ACCEL_TOKEN="change-this-to-a-long-random-token" \
WEBSPEAK_ACCEL_HOST="0.0.0.0" \
WEBSPEAK_ACCEL_PORT="39087" \
node scripts/acceleration-poc/relay-server.mjs
```
当前 Demo 的 UDP 帧协议是实验协议,尚未接入 SDK,也没有替代 GOST 的生产安全审计。正式接入前仍需验证 TeamSpeak 长时间语音、并发会话、IPv6、断线重连和目标地址安全策略。
+116
View File
@@ -0,0 +1,116 @@
import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
export const VERSION = 1;
export const HEADER_SIZE = 34;
export const MAX_PAYLOAD_SIZE = 60_000;
export const FrameType = Object.freeze({
OPEN: 1,
OPEN_OK: 2,
OPEN_ERR: 3,
DATA: 4,
CLOSE: 5,
PING: 6,
PONG: 7,
});
function asSecret(secret) {
if (typeof secret !== "string" || secret.length < 16) {
throw new Error("The PoC token must contain at least 16 characters");
}
return Buffer.from(secret, "utf8");
}
function signFrame(frame, secret, payload) {
return createHmac("sha256", asSecret(secret))
.update(frame.subarray(0, 18))
.update(payload)
.digest()
.subarray(0, 16);
}
export function encodeFrame(type, sessionId, sequence, payload = Buffer.alloc(0), secret) {
const body = Buffer.from(payload);
if (!Number.isInteger(type) || type < 1 || type > 255) throw new Error("Invalid frame type");
if (!Number.isInteger(sessionId) || sessionId < 0 || sessionId > 0xffffffff) throw new Error("Invalid session id");
if (!Number.isInteger(sequence) || sequence < 0 || sequence > 0xffffffff) throw new Error("Invalid sequence");
if (body.length > MAX_PAYLOAD_SIZE) throw new Error(`Payload exceeds ${MAX_PAYLOAD_SIZE} bytes`);
const frame = Buffer.alloc(HEADER_SIZE + body.length);
MAGIC.copy(frame, 0);
frame[4] = VERSION;
frame[5] = type;
frame.writeUInt16BE(0, 6);
frame.writeUInt32BE(sessionId >>> 0, 8);
frame.writeUInt32BE(sequence >>> 0, 12);
frame.writeUInt16BE(body.length, 16);
body.copy(frame, HEADER_SIZE);
signFrame(frame, secret, body).copy(frame, 18);
return frame;
}
export function decodeFrame(packet) {
const frame = Buffer.from(packet);
if (frame.length < HEADER_SIZE || !frame.subarray(0, 4).equals(MAGIC)) return null;
if (frame[4] !== VERSION) return null;
const payloadLength = frame.readUInt16BE(16);
if (frame.length !== HEADER_SIZE + payloadLength || payloadLength > MAX_PAYLOAD_SIZE) return null;
return {
type: frame[5],
sessionId: frame.readUInt32BE(8),
sequence: frame.readUInt32BE(12),
payload: frame.subarray(HEADER_SIZE),
auth: frame.subarray(18, HEADER_SIZE),
raw: frame,
};
}
export function verifyFrame(frame, secret) {
const expected = signFrame(frame.raw, secret, frame.payload);
return timingSafeEqual(expected, frame.auth);
}
export function randomSessionId() {
let id = randomBytes(4).readUInt32BE(0);
if (id === 0) id = 1;
return id;
}
export function jsonPayload(value) {
return Buffer.from(JSON.stringify(value), "utf8");
}
export function parseJsonPayload(payload) {
try {
return JSON.parse(Buffer.from(payload).toString("utf8"));
} catch {
return null;
}
}
export function parseEndpoint(value, defaultPort) {
if (typeof value !== "string" || !value.trim()) throw new Error("Endpoint is required");
const text = value.trim();
if (text.startsWith("[")) {
const end = text.indexOf("]");
if (end < 0) throw new Error(`Invalid endpoint: ${value}`);
const host = text.slice(1, end);
const portText = text.slice(end + 1).replace(/^[:#]/, "");
return { host, port: parsePort(portText || defaultPort, value) };
}
const hash = text.lastIndexOf("#");
if (hash > 0) return { host: text.slice(0, hash), port: parsePort(text.slice(hash + 1), value) };
const colon = text.lastIndexOf(":");
if (colon > 0 && text.indexOf(":") === colon) {
return { host: text.slice(0, colon), port: parsePort(text.slice(colon + 1), value) };
}
return { host: text, port: parsePort(defaultPort, value) };
}
function parsePort(value, original) {
const port = Number(value);
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error(`Invalid port in endpoint: ${original}`);
return port;
}
const MAGIC = Buffer.from("WSAT");
+106
View File
@@ -0,0 +1,106 @@
import { createSocket } from "node:dgram";
import { isIP } from "node:net";
import { decodeFrame, encodeFrame, FrameType, jsonPayload, randomSessionId, parseEndpoint, verifyFrame } from "./protocol.mjs";
export async function createRelayClient({
relayHost,
relayPort,
targetHost,
targetPort,
token,
localHost = "127.0.0.1",
localPort = 0,
timeoutMs = 5_000,
} = {}) {
if (!relayHost || !Number.isInteger(relayPort)) throw new Error("Relay endpoint is required");
if (!targetHost || !Number.isInteger(targetPort)) throw new Error("Target endpoint is required");
const relayFamily = isIP(relayHost) === 6 ? "udp6" : "udp4";
const localFamily = isIP(localHost) === 6 ? "udp6" : "udp4";
const relaySocket = createSocket(relayFamily);
const localSocket = createSocket(localFamily);
const sessionId = randomSessionId();
let sequence = 1;
let peer = null;
let ready = false;
let closed = false;
let resolveReady;
let rejectReady;
const readyPromise = new Promise((resolve, reject) => { resolveReady = resolve; rejectReady = reject; });
function sendFrame(type, payload = Buffer.alloc(0)) {
const packet = encodeFrame(type, sessionId, sequence++, payload, token);
relaySocket.send(packet, relayPort, relayHost);
}
function closeSockets() {
if (closed) return;
closed = true;
try { relaySocket.close(); } catch {}
try { localSocket.close(); } catch {}
}
relaySocket.on("message", (packet) => {
const frame = decodeFrame(packet);
if (!frame || frame.sessionId !== sessionId || !verifyFrame(frame, token)) return;
if (frame.type === FrameType.OPEN_OK) {
ready = true;
resolveReady();
} else if (frame.type === FrameType.OPEN_ERR) {
const detail = (() => { try { return JSON.parse(frame.payload.toString("utf8")); } catch { return {}; } })();
rejectReady(new Error(detail.code ?? "ACCELERATION_OPEN_FAILED"));
closeSockets();
} else if (frame.type === FrameType.DATA && peer) {
localSocket.send(frame.payload, peer.port, peer.address);
} else if (frame.type === FrameType.CLOSE) {
closeSockets();
}
});
const onSocketError = (error) => {
if (!ready) rejectReady(error);
closeSockets();
};
relaySocket.once("error", onSocketError);
localSocket.once("error", onSocketError);
await Promise.all([
new Promise((resolve) => relaySocket.bind(0, relayFamily === "udp6" ? "::" : "0.0.0.0", resolve)),
new Promise((resolve) => localSocket.bind(localPort, localHost, resolve)),
]);
localSocket.on("message", (payload, rinfo) => {
if (closed) return;
peer = { address: rinfo.address, port: rinfo.port };
if (ready) sendFrame(FrameType.DATA, payload);
});
const timer = setTimeout(() => {
rejectReady(new Error("ACCELERATION_OPEN_TIMEOUT"));
closeSockets();
}, timeoutMs);
sendFrame(FrameType.OPEN, jsonPayload({ targetHost, targetPort }));
try {
await readyPromise;
} finally {
clearTimeout(timer);
}
const localAddress = localSocket.address();
return {
sessionId,
localHost,
localPort: typeof localAddress === "object" ? localAddress.port : localPort,
waitReady: () => readyPromise,
close() {
if (closed) return;
if (ready) {
try { sendFrame(FrameType.CLOSE); } catch {}
}
closeSockets();
},
};
}
export function parseRelayEndpoint(value) {
return parseEndpoint(value, 39087);
}
+211
View File
@@ -0,0 +1,211 @@
import { createSocket } from "node:dgram";
import { lookup } from "node:dns/promises";
import { isIP } from "node:net";
import { decodeFrame, encodeFrame, FrameType, jsonPayload, parseJsonPayload, verifyFrame } from "./protocol.mjs";
function endpointKey(address, port) {
return `${address}/${port}`;
}
/**
* Mirror of `isRestrictedAddress()` in `src/security/open-target-policy.ts`.
*
* The PoC ships as a plain `.mjs` file that the README documents copying to a
* remote host without a build step, so it cannot import the TypeScript policy.
* The logic is duplicated rather than shared, and
* `scripts/acceleration-poc/target-guard-parity.test.mjs` fails the moment the two
* classifications disagree, so drift is caught in CI instead of in production.
*
* Keep this an exact mirror: fail closed on anything that is not a literal
* public address.
*/
export function isRestrictedAddress(host) {
const version = isIP(host);
if (version === 4) return isRestrictedIpv4(host);
if (version !== 6) return true;
const normalized = host.toLowerCase();
if (normalized === "::" || normalized === "::1") return true;
if (normalized.startsWith("::ffff:")) {
// IPv4-mapped addresses must be unwrapped before the IPv4 rules apply:
// ::ffff:10.0.0.1 is private traffic in IPv6 clothing.
const mapped = normalized.slice("::ffff:".length);
return isIP(mapped) !== 4 || isRestrictedIpv4(mapped);
}
if (normalized.startsWith("::")) return true; // IPv4-compatible and other special compressed forms
const first = Number.parseInt(normalized.split(":", 1)[0] || "0", 16);
if ((first & 0xfe00) === 0xfc00) return true; // unique-local fc00::/7
if ((first & 0xffc0) === 0xfe80) return true; // link-local fe80::/10
if ((first & 0xffc0) === 0xfec0) return true; // deprecated site-local fec0::/10
if ((first & 0xff00) === 0xff00) return true; // multicast ff00::/8
if (normalized.startsWith("2001:db8:")) return true; // documentation range
return false;
}
function isRestrictedIpv4(host) {
const parts = host.split(".").map(Number);
if (parts.length !== 4 || parts.some((part) => !Number.isInteger(part) || part < 0 || part > 255)) return true;
const [a, b, c] = parts;
return a === 0
|| a === 10
|| a === 127
|| (a === 100 && b >= 64 && b <= 127)
|| (a === 169 && b === 254)
|| (a === 172 && b >= 16 && b <= 31)
|| (a === 192 && b === 0)
|| (a === 192 && b === 168)
|| (a === 198 && (b === 18 || b === 19))
|| (a === 198 && b === 51 && c === 100)
|| (a === 203 && b === 0 && c === 113)
|| a >= 224;
}
async function resolveTarget(host) {
const family = isIP(host);
if (family) return { host, family, resolved: [host] };
const records = await lookup(host, { all: true, verbatim: true });
const record = records.find((item) => item.family === 4) ?? records[0];
if (!record) throw new Error("TARGET_DNS_EMPTY");
return { host: record.address, family: record.family, resolved: records.map((item) => item.address) };
}
export async function createRelayServer({
host = "127.0.0.1",
port = 0,
token,
allowPrivate = false,
idleTimeoutMs = 30_000,
} = {}) {
const serverFamily = isIP(host) === 6 ? "udp6" : "udp4";
const socket = createSocket(serverFamily);
const sessions = new Map();
let closed = false;
function sendToClient(session, type, payload = Buffer.alloc(0)) {
if (closed) return;
const packet = encodeFrame(type, session.id, session.outSequence++, payload, token);
socket.send(packet, session.client.port, session.client.address);
}
function cleanup(session) {
if (!session || session.closed) return;
session.closed = true;
sessions.delete(session.id);
session.targetSocket?.close();
}
async function openSession(frame, client) {
const request = parseJsonPayload(frame.payload);
if (!request || typeof request.targetHost !== "string" || !Number.isInteger(request.targetPort)) {
return;
}
const existing = sessions.get(frame.sessionId);
if (existing) cleanup(existing);
const session = {
id: frame.sessionId,
client,
clientKey: endpointKey(client.address, client.port),
outSequence: 1,
lastActivity: Date.now(),
targetSocket: null,
closed: false,
};
sessions.set(session.id, session);
try {
const target = await resolveTarget(request.targetHost);
// Validate the resolved addresses, not the caller-supplied name: a DNS
// answer can point any hostname at loopback or an internal address.
if (!allowPrivate && target.resolved.some((address) => isRestrictedAddress(address))) {
const error = { code: "PRIVATE_TARGET_BLOCKED" };
socket.send(encodeFrame(FrameType.OPEN_ERR, frame.sessionId, 0, jsonPayload(error), token), client.port, client.address);
cleanup(session);
return;
}
const targetSocket = createSocket(target.family === 6 ? "udp6" : "udp4");
session.targetSocket = targetSocket;
targetSocket.on("message", (payload) => {
session.lastActivity = Date.now();
sendToClient(session, FrameType.DATA, payload);
});
targetSocket.on("error", (error) => {
if (!session.closed) sendToClient(session, FrameType.OPEN_ERR, jsonPayload({ code: "TARGET_SOCKET_ERROR", message: error.message }));
cleanup(session);
});
targetSocket.connect(request.targetPort, target.host, () => {
session.lastActivity = Date.now();
sendToClient(session, FrameType.OPEN_OK, jsonPayload({ targetHost: target.host, targetPort: request.targetPort }));
});
} catch (error) {
cleanup(session);
socket.send(encodeFrame(FrameType.OPEN_ERR, frame.sessionId, 0, jsonPayload({ code: "TARGET_OPEN_FAILED", message: error.message }), token), client.port, client.address);
}
}
socket.on("message", (packet, rinfo) => {
const frame = decodeFrame(packet);
if (!frame || !verifyFrame(frame, token)) return;
const client = { address: rinfo.address, port: rinfo.port };
if (frame.type === FrameType.OPEN) {
void openSession(frame, client);
return;
}
const session = sessions.get(frame.sessionId);
if (!session || session.clientKey !== endpointKey(rinfo.address, rinfo.port)) return;
session.lastActivity = Date.now();
if (frame.type === FrameType.DATA && session.targetSocket) {
session.targetSocket.send(frame.payload);
} else if (frame.type === FrameType.CLOSE) {
sendToClient(session, FrameType.CLOSE);
cleanup(session);
} else if (frame.type === FrameType.PING) {
sendToClient(session, FrameType.PONG);
}
});
socket.on("error", (error) => {
for (const session of sessions.values()) cleanup(session);
if (!closed) throw error;
});
const sweep = setInterval(() => {
const now = Date.now();
for (const session of sessions.values()) {
if (now - session.lastActivity > idleTimeoutMs) cleanup(session);
}
}, Math.max(1000, Math.min(idleTimeoutMs, 5000)));
sweep.unref();
await new Promise((resolve, reject) => {
const onError = (error) => { socket.off("listening", onListening); reject(error); };
const onListening = () => { socket.off("error", onError); resolve(); };
socket.once("error", onError);
socket.once("listening", onListening);
socket.bind({ address: host, port });
});
const address = socket.address();
return {
host,
port: typeof address === "object" ? address.port : port,
family: serverFamily,
close() {
if (closed) return;
closed = true;
clearInterval(sweep);
for (const session of sessions.values()) cleanup(session);
socket.close();
},
};
}
if (import.meta.url === `file://${process.argv[1]?.replaceAll("\\", "/")}`) {
const token = process.env.WEBSPEAK_ACCEL_TOKEN;
if (!token) throw new Error("Set WEBSPEAK_ACCEL_TOKEN before starting the PoC relay");
const host = process.env.WEBSPEAK_ACCEL_HOST ?? "0.0.0.0";
const port = Number(process.env.WEBSPEAK_ACCEL_PORT ?? 39087);
const server = await createRelayServer({ host, port, token });
console.log(`ACCELERATION_RELAY_LISTEN ${server.host}:${server.port}`);
}
+54
View File
@@ -0,0 +1,54 @@
import { Client, generateIdentity } from "../../../teamspeak-js/dist/index.mjs";
import { createRelayClient } from "./relay-client.mjs";
import { createRelayServer } from "./relay-server.mjs";
import { parseEndpoint } from "./protocol.mjs";
const token = process.env.WEBSPEAK_ACCEL_TOKEN ?? "local-acceleration-poc-token";
const targetAddress = process.env.WEBSPEAK_ACCEL_TS_TARGET;
if (!targetAddress?.trim()) {
throw new Error("Set WEBSPEAK_ACCEL_TS_TARGET to your authorized TeamSpeak test endpoint");
}
const target = parseEndpoint(targetAddress, 9987);
const relayEndpoint = process.env.WEBSPEAK_ACCEL_RELAY;
let relayServer = null;
let relayClient = null;
let tsClient = null;
function withTimeout(promise, timeoutMs, label) {
return Promise.race([
promise,
new Promise((_, reject) => setTimeout(() => reject(new Error(`${label}_TIMEOUT`)), timeoutMs)),
]);
}
try {
let relay;
if (relayEndpoint) {
relay = parseEndpoint(relayEndpoint, 39087);
} else {
relayServer = await createRelayServer({ host: "127.0.0.1", port: 0, token, allowPrivate: true });
relay = { host: "127.0.0.1", port: relayServer.port };
}
relayClient = await createRelayClient({
relayHost: relay.host,
relayPort: relay.port,
targetHost: target.host,
targetPort: target.port,
token,
});
tsClient = new Client(generateIdentity(8), `127.0.0.1:${relayClient.localPort}`, "acceleration-sdk-smoke");
await withTimeout(tsClient.connect(), 15_000, "TS_CONNECT");
console.log(`TS_ACCEL_CONNECTED target=${target.host}#${target.port}`);
await new Promise((resolve) => setTimeout(resolve, 500));
await tsClient.disconnect();
console.log("TS_ACCEL_DISCONNECTED");
} catch (error) {
console.error("TS_ACCEL_SMOKE_FAILED", error);
process.exitCode = 1;
} finally {
try { await tsClient?.disconnect(); } catch {}
relayClient?.close();
relayServer?.close();
}
+60
View File
@@ -0,0 +1,60 @@
import { createSocket } from "node:dgram";
import { createRelayServer } from "./relay-server.mjs";
import { createRelayClient } from "./relay-client.mjs";
const TOKEN = "local-ipv6-acceleration-poc-token";
const PACKET_COUNT = 50;
function bind(socket, port = 0) {
return new Promise((resolve, reject) => {
socket.once("error", reject);
socket.bind(port, "::1", () => {
socket.off("error", reject);
resolve();
});
});
}
async function run() {
const target = createSocket("udp6");
target.on("message", (payload, rinfo) => target.send(payload, rinfo.port, rinfo.address));
await bind(target);
const targetPort = target.address().port;
const relay = await createRelayServer({ host: "::1", port: 0, token: TOKEN, allowPrivate: true });
const client = await createRelayClient({
relayHost: "::1",
relayPort: relay.port,
targetHost: "::1",
targetPort,
token: TOKEN,
localHost: "::1",
});
const sender = createSocket("udp6");
await bind(sender);
const pending = new Set(Array.from({ length: PACKET_COUNT }, (_, index) => index));
sender.on("message", (payload) => pending.delete(payload.readUInt32BE(0)));
for (let index = 0; index < PACKET_COUNT; index++) {
const payload = Buffer.alloc(512, index & 0xff);
payload.writeUInt32BE(index, 0);
sender.send(payload, client.localPort, "::1");
}
const deadline = Date.now() + 3000;
while (pending.size && Date.now() < deadline) await new Promise((resolve) => setTimeout(resolve, 10));
const received = PACKET_COUNT - pending.size;
sender.close();
client.close();
relay.close();
target.close();
console.log(`ipv6_packets=${PACKET_COUNT} received=${received} loss=${((pending.size / PACKET_COUNT) * 100).toFixed(2)}%`);
if (received !== PACKET_COUNT) throw new Error("IPV6_ACCELERATION_POC_FAILED");
console.log("IPV6_ACCELERATION_POC_OK");
}
run().catch((error) => {
console.error(error);
process.exitCode = 1;
});
+157
View File
@@ -0,0 +1,157 @@
import { createSocket } from "node:dgram";
import { createRelayServer } from "./relay-server.mjs";
import { createRelayClient } from "./relay-client.mjs";
const TOKEN = "local-acceleration-poc-token";
const PACKET_COUNT = 200;
const PACKET_SIZE = 1920;
function bind(socket, port = 0) {
return new Promise((resolve) => socket.bind(port, "127.0.0.1", resolve));
}
function close(socket) {
try { socket.close(); } catch {}
}
async function run() {
const target = createSocket("udp4");
target.on("message", (payload, rinfo) => {
target.send(payload, rinfo.port, rinfo.address);
});
await bind(target);
const targetAddress = target.address();
const relay = await createRelayServer({
host: "127.0.0.1",
port: 0,
token: TOKEN,
allowPrivate: true,
});
const client = await createRelayClient({
relayHost: "127.0.0.1",
relayPort: relay.port,
targetHost: "127.0.0.1",
targetPort: targetAddress.port,
token: TOKEN,
});
let rejectedBadToken = false;
try {
const badClient = await createRelayClient({
relayHost: "127.0.0.1",
relayPort: relay.port,
targetHost: "127.0.0.1",
targetPort: targetAddress.port,
token: "wrong-token-that-is-long-enough",
timeoutMs: 250,
});
badClient.close();
} catch {
rejectedBadToken = true;
}
// SSRF guard: a relay started without allowPrivate must refuse every request
// that resolves to a non-public address, and must still serve public ones.
// Asserting only the happy path would let the private-address guard regress
// unnoticed, since the throughput relay above runs with allowPrivate: true.
const guardedRelay = await createRelayServer({
host: "127.0.0.1",
port: 0,
token: TOKEN,
allowPrivate: false,
});
const blockedTargets = ["127.0.0.1", "10.0.0.1", "169.254.169.254", "192.168.1.1", "::ffff:127.0.0.1"];
const blockedResults = [];
for (const targetHost of blockedTargets) {
let allowed = false;
try {
const tunnel = await createRelayClient({
relayHost: "127.0.0.1",
relayPort: guardedRelay.port,
targetHost,
targetPort: 9987,
token: TOKEN,
timeoutMs: 1_000,
});
tunnel.close();
allowed = true;
} catch (error) {
// The relay answers OPEN_ERR(PRIVATE_TARGET_BLOCKED); any other failure
// (timeout, bad token) would not prove the guard fired.
allowed = !(error instanceof Error && error.message === "PRIVATE_TARGET_BLOCKED");
}
blockedResults.push({ targetHost, blocked: !allowed });
}
let publicTargetAllowed = false;
try {
const tunnel = await createRelayClient({
relayHost: "127.0.0.1",
relayPort: guardedRelay.port,
targetHost: "8.8.8.8",
targetPort: 9987,
token: TOKEN,
timeoutMs: 2_000,
});
publicTargetAllowed = true;
tunnel.close();
} catch {
publicTargetAllowed = false;
}
guardedRelay.close();
const guardFailures = blockedResults.filter((entry) => !entry.blocked);
const ssrfGuardOk = guardFailures.length === 0 && publicTargetAllowed;
const sender = createSocket("udp4");
await bind(sender);
const pending = new Map();
const samples = [];
sender.on("message", (payload) => {
const id = payload.readUInt32BE(0);
const sentAt = pending.get(id);
if (sentAt !== undefined) {
pending.delete(id);
samples.push(Number(process.hrtime.bigint() - sentAt) / 1_000_000);
}
});
for (let id = 0; id < PACKET_COUNT; id++) {
const payload = Buffer.alloc(PACKET_SIZE, id & 0xff);
payload.writeUInt32BE(id, 0);
pending.set(id, process.hrtime.bigint());
sender.send(payload, client.localPort, "127.0.0.1");
await new Promise((resolve) => setTimeout(resolve, 1));
}
const deadline = Date.now() + 5_000;
while (pending.size && Date.now() < deadline) await new Promise((resolve) => setTimeout(resolve, 10));
const received = samples.length;
const loss = ((PACKET_COUNT - received) / PACKET_COUNT) * 100;
const sorted = [...samples].sort((a, b) => a - b);
const percentile = (ratio) => sorted.length ? sorted[Math.min(sorted.length - 1, Math.floor(sorted.length * ratio))] : 0;
const average = sorted.length ? sorted.reduce((sum, value) => sum + value, 0) / sorted.length : 0;
sender.close();
client.close();
relay.close();
target.close();
console.log(`relay=127.0.0.1:${relay.port}`);
console.log(`packets=${PACKET_COUNT} received=${received} loss=${loss.toFixed(2)}%`);
console.log(`rtt_ms_avg=${average.toFixed(3)} p95=${Number(percentile(0.95)).toFixed(3)} max=${Number(percentile(0.99)).toFixed(3)}`);
console.log(`bad_token_rejected=${rejectedBadToken}`);
console.log(`ssrf_guard_ok=${ssrfGuardOk} blocked=${blockedResults.filter((entry) => entry.blocked).length}/${blockedResults.length} public_target_allowed=${publicTargetAllowed}`);
for (const entry of blockedResults) {
if (!entry.blocked) console.log(` LEAK: ${entry.targetHost} was not blocked by the private-target guard`);
}
if (received !== PACKET_COUNT || !rejectedBadToken || !ssrfGuardOk) throw new Error("ACCELERATION_POC_FAILED");
console.log("ACCELERATION_POC_OK");
}
run().catch((error) => {
console.error(error);
process.exitCode = 1;
});
@@ -0,0 +1,88 @@
import assert from "node:assert/strict";
import test from "node:test";
import { isRestrictedAddress } from "../../src/security/open-target-policy.js";
import { isRestrictedAddress as isPocRestrictedAddress } from "./relay-server.mjs";
/**
* The acceleration PoC relay keeps its own copy of the restricted-address
* predicate because it is a standalone `.mjs` file that the README documents
* copying to a remote host without a build step, so it cannot import the
* gateway's TypeScript module. Duplication is only safe while the two stay
* identical: these cases pin both classifications to the same answer, so a
* change to either side without the other fails here instead of silently
* widening the PoC's SSRF boundary.
*
* This test lives beside the PoC because `.dockerignore` excludes
* `scripts/acceleration-poc` from the Docker build context while the Dockerfile
* runs `tsc` over `src/**`; a copy under `src/` would make the image build fail
* with TS2307.
*/
const CASES = [
// Public addresses that must stay reachable.
["8.8.8.8", false],
["1.1.1.1", false],
["172.32.0.1", false],
["100.128.0.1", false],
["2001:4860:4860::8888", false],
["2606:4700:4700::1111", false],
// Private, loopback and link-local.
["10.0.0.1", true],
["172.16.0.1", true],
["172.31.255.255", true],
["192.168.1.1", true],
["127.0.0.1", true],
["169.254.169.254", true],
["0.0.0.0", true],
["0.1.2.3", true],
// Carrier-grade NAT.
["100.64.0.1", true],
["100.127.255.255", true],
// Special-use ranges: the PoC's first implementation missed every one of these.
["192.0.0.1", true],
["192.0.2.5", true],
["198.18.0.1", true],
["198.19.5.5", true],
["198.51.100.7", true],
["203.0.113.9", true],
["224.0.0.1", true],
["239.1.1.1", true],
["255.255.255.255", true],
// IPv6 loopback, unspecified, unique-local, link-local, site-local, multicast.
["::1", true],
["::", true],
["fc00::1", true],
["fd12::1", true],
["fe80::1", true],
["fec0::1", true],
["ff02::1", true],
["2001:db8::1", true],
// IPv4-mapped forms must unwrap before the IPv4 rules apply.
["::ffff:127.0.0.1", true],
["::ffff:10.0.0.1", true],
["::ffff:8.8.8.8", false],
// Anything that is not a literal address fails closed.
["localhost", true],
["public.example.invalid", true],
["", true],
];
test("the acceleration PoC relay classifies restricted addresses exactly like the gateway policy", () => {
const mismatches = [];
for (const [address, expected] of CASES) {
const policy = isRestrictedAddress(address);
const poc = isPocRestrictedAddress(address);
assert.equal(policy, expected, `gateway policy disagrees with the pinned expectation for ${address}`);
if (poc !== policy) {
mismatches.push(`${address}: policy=${policy} poc=${poc}`);
}
}
assert.deepEqual(mismatches, [], "the PoC relay's restricted-address guard drifted from the gateway policy");
});
test("the acceleration PoC relay fails closed on a non-literal address", () => {
// `isIP()` returns 0 for a hostname, so the guard must not treat an
// unresolved name as public just because it is not a literal address.
for (const hostname of ["localhost", "internal.example.invalid", "attacker.example.invalid", ""]) {
assert.equal(isPocRestrictedAddress(hostname), true, `${hostname} must fail closed`);
}
});
+32
View File
@@ -0,0 +1,32 @@
import { copyFile, mkdir, readFile, stat } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { spawnSync } from "node:child_process";
const repositoryRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const interpreterRoot = path.join(repositoryRoot, "web", "skin-wasm-interpreter");
const sourceArtifact = path.join(interpreterRoot, "target", "wasm32-unknown-unknown", "release", "webspeak_skin_wasm_interpreter.wasm");
const publicDirectory = path.join(repositoryRoot, "web", "public");
const publicArtifact = path.join(publicDirectory, "skin-wasm-interpreter.wasm");
const rustFlags = "-C link-arg=--max-memory=67108864 -C panic=abort";
const result = spawnSync("cargo", ["build", "--locked", "--release", "--target", "wasm32-unknown-unknown"], {
cwd: interpreterRoot,
env: { ...process.env, RUSTFLAGS: rustFlags },
stdio: "inherit",
});
if (result.error) throw result.error;
if (result.status !== 0) process.exit(result.status ?? 1);
const artifactInfo = await stat(sourceArtifact);
if (artifactInfo.size < 8 || artifactInfo.size > 8 * 1024 * 1024) {
throw new Error(`The Wasmi interpreter artifact has an unexpected size: ${artifactInfo.size} bytes.`);
}
const header = await readFile(sourceArtifact, { encoding: null, flag: "r" });
if (header[0] !== 0 || header[1] !== 0x61 || header[2] !== 0x73 || header[3] !== 0x6d) {
throw new Error("The Wasmi interpreter build did not produce a WebAssembly module.");
}
await mkdir(publicDirectory, { recursive: true });
await copyFile(sourceArtifact, publicArtifact);
console.log(`Built bounded Wasmi interpreter (${artifactInfo.size} bytes) at web/public/skin-wasm-interpreter.wasm.`);
+38
View File
@@ -0,0 +1,38 @@
import { existsSync } from "node:fs";
import http from "node:http";
import https from "node:https";
import path from "node:path";
import { fileURLToPath } from "node:url";
const scriptDirectory = path.dirname(fileURLToPath(import.meta.url));
const appRoot = path.resolve(scriptDirectory, "..");
const defaultCertDirectory = path.join(appRoot, "certs");
export function healthcheckUsesHttps(certDirectory = defaultCertDirectory) {
return existsSync(path.join(certDirectory, "cert.pem"));
}
export function runDockerHealthcheck({ mode = process.env.WEBSPEAK_MODE, certDirectory = defaultCertDirectory } = {}) {
if (mode?.trim().toLowerCase() === "relay") {
process.exitCode = 0;
return;
}
const secure = healthcheckUsesHttps(certDirectory);
const client = secure ? https : http;
const request = client.get({
hostname: "127.0.0.1",
port: 3040,
path: "/health",
...(secure ? { rejectUnauthorized: false } : {}),
}, (response) => {
response.resume();
process.exitCode = response.statusCode >= 200 && response.statusCode < 300 ? 0 : 1;
});
request.setTimeout(4_000, () => request.destroy(new Error("Healthcheck timed out")));
request.on("error", () => { process.exitCode = 1; });
}
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
runDockerHealthcheck();
}
+16
View File
@@ -0,0 +1,16 @@
import assert from "node:assert/strict";
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
import test from "node:test";
import { healthcheckUsesHttps } from "./docker-healthcheck.mjs";
test("Docker healthcheck selects HTTP or HTTPS from the same certificate marker as the server", (context) => {
const directory = mkdtempSync(path.join(tmpdir(), "webspeak-healthcheck-"));
context.after(() => rmSync(directory, { recursive: true, force: true }));
assert.equal(healthcheckUsesHttps(directory), false);
mkdirSync(directory, { recursive: true });
writeFileSync(path.join(directory, "cert.pem"), "test certificate marker");
assert.equal(healthcheckUsesHttps(directory), true);
});
+100
View File
@@ -0,0 +1,100 @@
Add-Type -AssemblyName System.Drawing
$width = 3200
$height = 116
$outputPath = Join-Path $PSScriptRoot "..\docs\examples\illusia-voice\assets\footer-wave.png"
$bitmap = [System.Drawing.Bitmap]::new($width, $height, [System.Drawing.Imaging.PixelFormat]::Format32bppArgb)
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
$graphics.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality
$graphics.CompositingQuality = [System.Drawing.Drawing2D.CompositingQuality]::HighQuality
$graphics.Clear([System.Drawing.Color]::Transparent)
$topEdge = [System.Drawing.Drawing2D.GraphicsPath]::new()
$topEdge.StartFigure()
$topEdge.AddBezier(
[System.Drawing.PointF]::new(0, 20),
[System.Drawing.PointF]::new(240, 4),
[System.Drawing.PointF]::new(460, 0),
[System.Drawing.PointF]::new(700, 10)
)
$topEdge.AddBezier(
[System.Drawing.PointF]::new(700, 10),
[System.Drawing.PointF]::new(1000, 26),
[System.Drawing.PointF]::new(1200, 36),
[System.Drawing.PointF]::new(1600, 36)
)
$topEdge.AddBezier(
[System.Drawing.PointF]::new(1600, 36),
[System.Drawing.PointF]::new(2000, 36),
[System.Drawing.PointF]::new(2200, 26),
[System.Drawing.PointF]::new(2500, 10)
)
$topEdge.AddBezier(
[System.Drawing.PointF]::new(2500, 10),
[System.Drawing.PointF]::new(2740, 0),
[System.Drawing.PointF]::new(2960, 4),
[System.Drawing.PointF]::new(3200, 20)
)
$surface = [System.Drawing.Drawing2D.GraphicsPath]::new()
$surface.AddPath($topEdge, $false)
$surface.AddLine(3200, 20, 3200, $height)
$surface.AddLine(3200, $height, 0, $height)
$surface.CloseFigure()
$brush = [System.Drawing.Drawing2D.LinearGradientBrush]::new(
[System.Drawing.Rectangle]::new(0, 0, $width, $height),
[System.Drawing.Color]::FromArgb(138, 244, 252, 254),
[System.Drawing.Color]::FromArgb(245, 252, 255, 255),
[System.Drawing.Drawing2D.LinearGradientMode]::Vertical
)
$blend = [System.Drawing.Drawing2D.ColorBlend]::new(3)
$blend.Colors = [System.Drawing.Color[]]@(
[System.Drawing.Color]::FromArgb(138, 244, 252, 254),
[System.Drawing.Color]::FromArgb(194, 248, 253, 254),
[System.Drawing.Color]::FromArgb(245, 252, 255, 255)
)
$blend.Positions = [single[]]@(0.0, 0.58, 1.0)
$brush.InterpolationColors = $blend
$pen = [System.Drawing.Pen]::new([System.Drawing.Color]::FromArgb(118, 103, 210, 221), 1.5)
$pen.LineJoin = [System.Drawing.Drawing2D.LineJoin]::Round
$accentBrush = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(150, 99, 216, 225))
$accentPath = [System.Drawing.Drawing2D.GraphicsPath]::new()
$leftDiamond = [System.Drawing.PointF[]]@(
[System.Drawing.PointF]::new(126, 47),
[System.Drawing.PointF]::new(136, 58),
[System.Drawing.PointF]::new(126, 69),
[System.Drawing.PointF]::new(116, 58)
)
$rightDiamond = [System.Drawing.PointF[]]@(
[System.Drawing.PointF]::new(3074, 47),
[System.Drawing.PointF]::new(3084, 58),
[System.Drawing.PointF]::new(3074, 69),
[System.Drawing.PointF]::new(3064, 58)
)
$accentPen = [System.Drawing.Pen]::new([System.Drawing.Color]::FromArgb(94, 91, 211, 223), 1.2)
$accentPen.StartCap = [System.Drawing.Drawing2D.LineCap]::Round
$accentPen.EndCap = [System.Drawing.Drawing2D.LineCap]::Round
$graphics.FillPath($brush, $surface)
$graphics.DrawPath($pen, $topEdge)
$graphics.DrawLine($accentPen, 82, 58, 116, 58)
$graphics.DrawLine($accentPen, 136, 58, 170, 58)
$graphics.DrawLine($accentPen, 3030, 58, 3064, 58)
$graphics.DrawLine($accentPen, 3084, 58, 3118, 58)
$accentPath.AddPolygon($leftDiamond)
$accentPath.AddPolygon($rightDiamond)
$graphics.FillPath($accentBrush, $accentPath)
[System.IO.Directory]::CreateDirectory((Split-Path -Parent $outputPath)) | Out-Null
$bitmap.Save($outputPath, [System.Drawing.Imaging.ImageFormat]::Png)
$accentPen.Dispose()
$accentBrush.Dispose()
$accentPath.Dispose()
$pen.Dispose()
$brush.Dispose()
$surface.Dispose()
$topEdge.Dispose()
$graphics.Dispose()
$bitmap.Dispose()
-183
View File
@@ -1,183 +0,0 @@
import { readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const packageRoot = path.join(root, "node_modules", "@honeybbq", "teamspeak-client");
const marker = "webspeak-directory-snapshot-v2";
const whisperMarker = "webspeak-team-whisper-v1";
const packageJson = JSON.parse(await readFile(path.join(packageRoot, "package.json"), "utf8"));
if (packageJson.version !== "0.2.2") {
throw new Error(`Unsupported @honeybbq/teamspeak-client version: ${packageJson.version}`);
}
const cjsPath = path.join(packageRoot, "dist", "index.cjs");
const mjsPath = path.join(packageRoot, "dist", "index.mjs");
const handlerCjsPath = path.join(packageRoot, "dist", "handler-CqCD93f0.cjs");
const handlerMjsPath = path.join(packageRoot, "dist", "handler-C_JhqGTd.js");
const [cjs, mjs, handlerCjs, handlerMjs] = await Promise.all([
readFile(cjsPath, "utf8"),
readFile(mjsPath, "utf8"),
readFile(handlerCjsPath, "utf8"),
readFile(handlerMjsPath, "utf8"),
]);
const patchedCjs = patchWhisperClient(patchCjs(cjs), "cjs");
const patchedMjs = patchWhisperClient(patchMjs(mjs), "mjs");
const patchedHandlerCjs = patchWhisperHandler(handlerCjs, "cjs");
const patchedHandlerMjs = patchWhisperHandler(handlerMjs, "mjs");
await Promise.all([
writeFile(cjsPath, patchedCjs, "utf8"),
writeFile(mjsPath, patchedMjs, "utf8"),
writeFile(handlerCjsPath, patchedHandlerCjs, "utf8"),
writeFile(handlerMjsPath, patchedHandlerMjs, "utf8"),
]);
function patchWhisperClient(source, format) {
if (source.includes(whisperMarker)) return source;
if (format === "cjs") {
const needle = "sendVoice(e,t){this.handler.sendVoicePacket(e,t)}";
if (!source.includes(needle)) throw new Error("Could not patch CJS SDK client whisper method");
return source.replace(needle, `${needle}sendWhisper(e,t,n){this.handler.sendWhisperPacket(e,t,n)}`) + `/* ${whisperMarker} */`;
}
const needle = "\tsendVoice(e, t) {\n\t\tthis.handler.sendVoicePacket(e, t);\n\t}\n";
if (!source.includes(needle)) throw new Error("Could not patch MJS SDK client whisper method");
return source.replace(needle, `${needle}\tsendWhisper(e, t, n) {\n\t\tthis.handler.sendWhisperPacket(e, t, n);\n\t}\n`) + `/* ${whisperMarker} */`;
}
function patchWhisperHandler(source, format) {
if (source.includes(whisperMarker)) return source;
if (format === "cjs") {
const needle = "this.#b(u)}close(){";
if (!source.includes(needle)) throw new Error("Could not patch CJS SDK whisper packet handler");
const method = `/* ${whisperMarker} */sendWhisperPacket(e,t,n){if(t.length>32)throw new Error(\`too many whisper targets\`);let a=this.#c[r.VoiceWhisper],o=this.#l[r.VoiceWhisper];this.#c[r.VoiceWhisper]=a+1&65535,this.#c[r.VoiceWhisper]===0&&this.#l[r.VoiceWhisper]++;let s=5+2*t.length+e.length,l=new Uint8Array(s),u=new DataView(l.buffer);u.setUint16(0,a,!1),l[2]=n,l[3]=0,l[4]=t.length;for(let n=0;n<t.length;n++)u.setUint16(5+2*n,t[n],!1);l.set(e,5+2*t.length);let c0=c({typeFlagged:r.VoiceWhisper|i.Unencrypted,id:a,clientID:this.#r,generationID:o,data:l,receivedAt:0}),d=new Uint8Array(x+b+s);d.set(this.#e.fakeSignature,0),d.set(c0,x),d.set(l,x+b),this.#b(d)}`;
return source.replace(needle, `this.#b(u)}${method}close(){`);
}
const needle = "this.#b(u);\n\t}\n\tclose() {";
if (!source.includes(needle)) throw new Error("Could not patch MJS SDK whisper packet handler");
const method = `\t/* ${whisperMarker} */\n\tsendWhisperPacket(e, t, n) {\n\t\tif (t.length > 32) throw new Error("too many whisper targets");\n\t\tlet a = this.#c[r.VoiceWhisper], o = this.#l[r.VoiceWhisper];\n\t\tthis.#c[r.VoiceWhisper] = a + 1 & 65535;\n\t\tif (this.#c[r.VoiceWhisper] === 0) this.#l[r.VoiceWhisper]++;\n\t\tconst s = 5 + 2 * t.length + e.length, l = new Uint8Array(s), u = new DataView(l.buffer);\n\t\tu.setUint16(0, a, false);\n\t\tl[2] = n;\n\t\tl[3] = 0;\n\t\tl[4] = t.length;\n\t\tfor (let n = 0; n < t.length; n++) u.setUint16(5 + 2 * n, t[n], false);\n\t\tl.set(e, 5 + 2 * t.length);\n\t\tconst c0 = c({ typeFlagged: r.VoiceWhisper | i.Unencrypted, id: a, clientID: this.#r, generationID: o, data: l, receivedAt: 0 });\n\t\tconst d = new Uint8Array(x + b + s);\n\t\td.set(this.#e.fakeSignature, 0);\n\t\td.set(c0, x);\n\t\td.set(l, x + b);\n\t\tthis.#b(d);\n\t}\n\tclose() {`;
return source.replace(needle, `this.#b(u);\n\t}\n${method}`);
}
function patchCjs(source) {
if (source.includes(marker) || source.includes("webspeak-directory-snapshot")) return source;
const helper = `/* ${marker} */
function webSpeakDirectoryBigInt(value){try{return BigInt(value??"0")}catch{return 0n}}
function webSpeakDirectoryChannel(params,decode){const id=webSpeakDirectoryBigInt(params.cid);if(id===0n)return null;return{id,parentID:webSpeakDirectoryBigInt(params.pid??params.cpid??"0"),name:decode(params.channel_name??""),description:decode(params.channel_topic??params.channel_description??"")}}
function webSpeakDirectoryClient(params,decode){const id=parseInt(params.clid??"0",10);if(!Number.isInteger(id)||id<=0)return null;const groups=params.client_servergroups??"";return{id,nickname:decode(params.client_nickname??""),uid:params.client_unique_identifier??"",channelID:webSpeakDirectoryBigInt(params.cid),type:parseInt(params.client_type??"0",10),serverGroups:groups?groups.split(","):[],away:params.client_away==="1",awayMessage:decode(params.client_away_message??""),inputMuted:params.client_input_muted==="1",outputMuted:params.client_output_muted==="1",channelCommander:params.client_is_channel_commander==="1"}}
function webSpeakDirectoryChannelNotification(name,params,decode,channels){const id=webSpeakDirectoryBigInt(params.cid);if(id===0n)return false;switch(name){case"notifychannelcreated":{const channel=webSpeakDirectoryChannel(params,decode);if(!channel)return false;channels.set(id,channel);return true}case"notifychanneledited":{const current=channels.get(id);if(!current)return false;const next={...current};if(params.channel_name!==undefined)next.name=decode(params.channel_name);if(params.channel_topic!==undefined)next.description=decode(params.channel_topic);if(params.cpid!==undefined||params.pid!==undefined)next.parentID=webSpeakDirectoryBigInt(params.cpid??params.pid);channels.set(id,next);return true}case"notifychannelmoved":{const current=channels.get(id);if(!current)return false;channels.set(id,{...current,parentID:webSpeakDirectoryBigInt(params.cpid??params.pid)});return true}case"notifychanneldeleted":return channels.delete(id);default:return false}}
`;
source = source.replace("var K=class", `${helper}var K=class`);
// TS6 reports a client that moved out of our current view as
// notifyclientleftview with a non-zero ctid. Preserve that client and apply
// the target channel; ctid=0 is the actual server leave case.
const replacements = [
[
"function L(e,t,n){let r=j(e.params.clid??``),i=M(e.params.reasonid??``),a=r===t;return r!==0&&n.delete(r),{kind:`clientLeave`,event:{id:r,reasonID:i,reasonMsg:e.params.reasonmsg??``,targetID:j(e.params.targetid??``)},isSelf:a}}",
"function L(e,t,n){let r=j(e.params.clid??``),i=M(e.params.reasonid??``),a=r===t,o=A(e.params.ctid??``),s=o!==0n;if(r!==0)if(s){let e=n.get(r);e&&n.set(r,{...e,channelID:o})}else n.delete(r);return s?{kind:`clientMoved`,event:{id:r,targetChannelID:o,reasonID:i,invokerID:j(e.params.invokerid??``),invokerName:e.params.invokername??``,invokerUID:e.params.invokeruid??``}}:{kind:`clientLeave`,event:{id:r,reasonID:i,reasonMsg:e.params.reasonmsg??``,targetID:j(e.params.targetid??``)},isSelf:a}}",
],
[
"var K=class{crypt;handler;logger;nickname;clid=0;#e;#t;#n;#r;#i=e.t.Disconnected;#a=new W;#o=new d;#s=new m;#c=new Map;#l=[];#u=[];#d=[];#f=[];#p=[];#m=[];#h=[];#g=[];#_=[];#v=[];#y=[];#b=[];#x;#S;constructor",
"var K=class{crypt;handler;logger;nickname;clid=0;#e;#t;#n;#r;#i=e.t.Disconnected;#a=new W;#o=new d;#s=new m;#c=new Map;#q=new Map;#R=[];#L=!1;#l=[];#u=[];#d=[];#f=[];#p=[];#m=[];#h=[];#g=[];#_=[];#v=[];#y=[];#b=[];#x;#S;constructor",
],
[
"case`voiceData`:this.#h.push(t);break;case`connected`:",
"case`voiceData`:this.#h.push(t);break;case`directorySnapshot`:this.#R.push(t);break;case`connected`:",
],
[
"this.#o.reset(),this.#s.reset(),this.#c.clear(),this.clid=0",
"this.#o.reset(),this.#s.reset(),this.#q.clear(),this.#c.clear(),this.#L=!1,this.clid=0",
],
[
"case`initserver`:w(this,t.params);break;case`error`:this.#A(t.params);break;default:{",
"case`initserver`:w(this,t.params);break;case`channellist`:{let e=webSpeakDirectoryChannel(t.params,a.i);e&&this.#q.set(e.id,e),this.#Y();break}case`channelclientlist`:{let e=webSpeakDirectoryClient(t.params,a.i);e&&this.#c.set(e.id,e),this.#Y();break}case`error`:this.#A(t.params);break;default:{",
],
[
"if(t.name.startsWith(`notify`)){let e=F(t,this.clid,this.#c,this.nickname);this.#j(e,t.params);return}",
"if(t.name.startsWith(`notify`)){let e=webSpeakDirectoryChannelNotification(t.name,t.params,a.i,this.#q),n=F(t,this.clid,this.#c,this.nickname);this.#j(n,t.params),e&&this.#Y();return}",
],
[
"case`clientEnter`:{let t=e.info;t.id!==0&&N(this.nickname,t.nickname)&&(this.clid=t.id,this.handler.setClientID(t.id),this.#o.signalWelcomeComplete()),this.#M(`clientEnter`,t);break}",
"case`clientEnter`:{let t=e.info,r=webSpeakDirectoryBigInt(arguments[1]?.cid??arguments[1]?.ctid??\"0\");r!==0n&&(t={...t,channelID:r},this.#c.set(t.id,t));let n=this.#c.get(t.id);n&&t.channelID===0n&&n.channelID!==0n&&(t={...t,channelID:n.channelID},this.#c.set(t.id,t));let i=t.id!==0&&N(this.nickname,t.nickname);i&&(this.clid=t.id,this.handler.setClientID(t.id),this.#o.signalWelcomeComplete(),this.#Y()),this.#M(`clientEnter`,t),!i&&this.#i===2&&this.#Y();break}",
],
[
"case`clientLeave`:if(this.#M(`clientLeave`,e.event),e.isSelf&&(e.event.reasonID===4||e.event.reasonID===5)){let t=e.event.reasonMsg;for(let e of this.#v)setImmediate(()=>e(t))}break;case`clientMoved`:this.#M(`clientMoved`,e.event);break;",
"case`clientLeave`:if(this.#M(`clientLeave`,e.event),this.#i===2&&this.#Y(),e.isSelf&&(e.event.reasonID===4||e.event.reasonID===5)){let t=e.event.reasonMsg;for(let e of this.#v)setImmediate(()=>e(t))}break;case`clientMoved`:this.#M(`clientMoved`,e.event),this.#i===2&&this.#Y();break;",
],
[
"#M(e,t){this.#S(t)}#N(e,t){",
"#Y(){if(this.#L)return;this.#L=!0,setImmediate(()=>{this.#L=!1;const e={channels:Array.from(this.#q.values()).map(e=>({...e})),clients:Array.from(this.#c.values()).map(e=>({...e,serverGroups:[...(e.serverGroups??[])]}))};for(const t of this.#R)setImmediate(()=>t(e))})}#M(e,t){this.#S(t)}#N(e,t){",
],
];
for (const [before, after] of replacements) {
if (!source.includes(before)) throw new Error(`Could not patch CJS SDK segment: ${before.slice(0, 80)}`);
source = source.replace(before, after);
}
return source;
}
function patchMjs(source) {
if (source.includes(marker) || source.includes("webspeak-directory-snapshot")) return source;
const helper = `/* ${marker} */
function webSpeakDirectoryBigInt(value){try{return BigInt(value??"0")}catch{return 0n}}
function webSpeakDirectoryChannel(params,decode){const id=webSpeakDirectoryBigInt(params.cid);if(id===0n)return null;return{id,parentID:webSpeakDirectoryBigInt(params.pid??params.cpid??"0"),name:decode(params.channel_name??""),description:decode(params.channel_topic??params.channel_description??"")}}
function webSpeakDirectoryClient(params,decode){const id=parseInt(params.clid??"0",10);if(!Number.isInteger(id)||id<=0)return null;const groups=params.client_servergroups??"";return{id,nickname:decode(params.client_nickname??""),uid:params.client_unique_identifier??"",channelID:webSpeakDirectoryBigInt(params.cid),type:parseInt(params.client_type??"0",10),serverGroups:groups?groups.split(","):[],away:params.client_away==="1",awayMessage:decode(params.client_away_message??""),inputMuted:params.client_input_muted==="1",outputMuted:params.client_output_muted==="1",channelCommander:params.client_is_channel_commander==="1"}}
function webSpeakDirectoryChannelNotification(name,params,decode,channels){const id=webSpeakDirectoryBigInt(params.cid);if(id===0n)return false;switch(name){case"notifychannelcreated":{const channel=webSpeakDirectoryChannel(params,decode);if(!channel)return false;channels.set(id,channel);return true}case"notifychanneledited":{const current=channels.get(id);if(!current)return false;const next={...current};if(params.channel_name!==undefined)next.name=decode(params.channel_name);if(params.channel_topic!==undefined)next.description=decode(params.channel_topic);if(params.cpid!==undefined||params.pid!==undefined)next.parentID=webSpeakDirectoryBigInt(params.cpid??params.pid);channels.set(id,next);return true}case"notifychannelmoved":{const current=channels.get(id);if(!current)return false;channels.set(id,{...current,parentID:webSpeakDirectoryBigInt(params.cpid??params.pid)});return true}case"notifychanneldeleted":return channels.delete(id);default:return false}}
`;
source = source.replace("var k = class", `${helper}var k = class`);
// Keep the readable ESM build behavior identical to the minified CJS build.
const replacements = [
[
"function ie(e, t, n) {\n\tlet r = Y(e.params.clid ?? \"\"), i = X(e.params.reasonid ?? \"\"), a = r === t;\n\treturn r !== 0 && n.delete(r), {\n\t\tkind: \"clientLeave\",\n\t\tevent: {\n\t\t\tid: r,\n\t\t\treasonID: i,\n\t\t\treasonMsg: e.params.reasonmsg ?? \"\",\n\t\t\ttargetID: Y(e.params.targetid ?? \"\")\n\t\t},\n\t\tisSelf: a\n\t};\n}",
"function ie(e, t, n) {\n\tlet r = Y(e.params.clid ?? \"\"), i = X(e.params.reasonid ?? \"\"), a = r === t, targetChannelID = J(e.params.ctid ?? \"\"), moved = targetChannelID !== 0n;\n\tif (r !== 0) {\n\t\tif (moved) {\n\t\t\tconst current = n.get(r);\n\t\t\tif (current) n.set(r, { ...current, channelID: targetChannelID });\n\t\t} else {\n\t\t\tn.delete(r);\n\t\t}\n\t}\n\treturn moved ? {\n\t\tkind: \"clientMoved\",\n\t\tevent: {\n\t\t\tid: r,\n\t\t\ttargetChannelID,\n\t\t\treasonID: i,\n\t\t\tinvokerID: Y(e.params.invokerid ?? \"\"),\n\t\t\tinvokerName: e.params.invokername ?? \"\",\n\t\t\tinvokerUID: e.params.invokeruid ?? \"\"\n\t\t}\n\t} : {\n\t\tkind: \"clientLeave\",\n\t\tevent: {\n\t\t\tid: r,\n\t\t\treasonID: i,\n\t\t\treasonMsg: e.params.reasonmsg ?? \"\",\n\t\t\ttargetID: Y(e.params.targetid ?? \"\")\n\t\t},\n\t\tisSelf: a\n\t};\n}",
],
[
"\t#c = /* @__PURE__ */ new Map();\n\t#l = [];",
"\t#c = /* @__PURE__ */ new Map();\n\t#q = /* @__PURE__ */ new Map();\n\t#R = [];\n\t#L = false;\n\t#l = [];",
],
[
"\t\t\tcase \"voiceData\":\n\t\t\t\tthis.#h.push(t);\n\t\t\t\tbreak;\n\t\t\tcase \"connected\":",
"\t\t\tcase \"voiceData\":\n\t\t\t\tthis.#h.push(t);\n\t\t\t\tbreak;\n\t\t\tcase \"directorySnapshot\":\n\t\t\t\tthis.#R.push(t);\n\t\t\t\tbreak;\n\t\t\tcase \"connected\":",
],
[
"this.#o.reset(), this.#s.reset(), this.#c.clear(), this.clid = 0",
"this.#o.reset(), this.#s.reset(), this.#q.clear(), this.#c.clear(), this.#L = false, this.clid = 0",
],
[
"\t\t\t\tcase \"initserver\":\n\t\t\t\t\tH(this, t.params);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"error\":",
"\t\t\t\tcase \"initserver\":\n\t\t\t\t\tH(this, t.params);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"channellist\": {\n\t\t\t\t\tconst e = webSpeakDirectoryChannel(t.params, S);\n\t\t\t\t\tif (e) this.#q.set(e.id, e);\n\t\t\t\t\tthis.#Y();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"channelclientlist\": {\n\t\t\t\t\tconst e = webSpeakDirectoryClient(t.params, S);\n\t\t\t\t\tif (e) this.#c.set(e.id, e);\n\t\t\t\t\tthis.#Y();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"error\":",
],
[
"\t\t\tif (t.name.startsWith(\"notify\")) {\n\t\t\t\tlet e = ne(t, this.clid, this.#c, this.nickname);\n\t\t\t\tthis.#j(e, t.params);\n\t\t\t\treturn;\n\t\t\t}",
"\t\t\tif (t.name.startsWith(\"notify\")) {\n\t\t\t\tconst directoryChanged = webSpeakDirectoryChannelNotification(t.name, t.params, S, this.#q);\n\t\t\t\tlet e = ne(t, this.clid, this.#c, this.nickname);\n\t\t\t\tthis.#j(e, t.params);\n\t\t\t\tif (directoryChanged) this.#Y();\n\t\t\t\treturn;\n\t\t\t}",
],
[
"\t\t\tcase \"clientEnter\": {\n\t\t\t\tlet t = e.info;\n\t\t\t\tt.id !== 0 && Z(this.nickname, t.nickname) && (this.clid = t.id, this.handler.setClientID(t.id), this.#o.signalWelcomeComplete()), this.#M(\"clientEnter\", t);\n\t\t\t\tbreak;\n\t\t\t}",
"\t\t\tcase \"clientEnter\": {\n\t\t\t\tlet t = e.info;\n\t\t\t\tconst rawChannelID = webSpeakDirectoryBigInt(arguments[1]?.cid ?? arguments[1]?.ctid ?? \"0\");\n\t\t\t\tif (rawChannelID !== 0n) {\n\t\t\t\t\tt = { ...t, channelID: rawChannelID };\n\t\t\t\t\tthis.#c.set(t.id, t);\n\t\t\t\t}\n\t\t\t\tconst cached = this.#c.get(t.id);\n\t\t\t\tif (cached && t.channelID === 0n && cached.channelID !== 0n) {\n\t\t\t\t\tt = { ...t, channelID: cached.channelID };\n\t\t\t\t\tthis.#c.set(t.id, t);\n\t\t\t\t}\n\t\t\t\tconst own = t.id !== 0 && Z(this.nickname, t.nickname);\n\t\t\t\tif (own) {\n\t\t\t\t\tthis.clid = t.id;\n\t\t\t\t\tthis.handler.setClientID(t.id);\n\t\t\t\t\tthis.#o.signalWelcomeComplete();\n\t\t\t\t\tthis.#Y();\n\t\t\t\t}\n\t\t\t\tthis.#M(\"clientEnter\", t);\n\t\t\t\tif (!own && this.#i === n.Connected) this.#Y();\n\t\t\t\tbreak;\n\t\t\t}",
],
[
"\t\t\tcase \"clientLeave\":\n\t\t\t\tif (this.#M(\"clientLeave\", e.event), e.isSelf && (e.event.reasonID === 4 || e.event.reasonID === 5)) {",
"\t\t\tcase \"clientLeave\":\n\t\t\t\tif (this.#M(\"clientLeave\", e.event), this.#i === n.Connected && this.#Y(), e.isSelf && (e.event.reasonID === 4 || e.event.reasonID === 5)) {",
],
[
"\t\t\tcase \"clientMoved\":\n\t\t\t\tthis.#M(\"clientMoved\", e.event);\n\t\t\t\tbreak;",
"\t\t\tcase \"clientMoved\":\n\t\t\t\tthis.#M(\"clientMoved\", e.event);\n\t\t\t\tif (this.#i === n.Connected) this.#Y();\n\t\t\t\tbreak;",
],
[
"\t#M(e, t) {\n\t\tthis.#S(t);\n\t}\n\t#N(e, t) {",
"\t#Y() {\n\t\tif (this.#L) return;\n\t\tthis.#L = true;\n\t\tsetImmediate(() => {\n\t\t\tthis.#L = false;\n\t\t\tconst e = {\n\t\t\t\tchannels: Array.from(this.#q.values()).map((item) => ({ ...item })),\n\t\t\t\tclients: Array.from(this.#c.values()).map((item) => ({ ...item, serverGroups: [...(item.serverGroups ?? [])] })),\n\t\t\t};\n\t\t\tfor (const handler of this.#R) setImmediate(() => handler(e));\n\t\t});\n\t}\n\t#M(e, t) {\n\t\tthis.#S(t);\n\t}\n\t#N(e, t) {",
],
];
for (const [before, after] of replacements) {
if (!source.includes(before)) throw new Error(`Could not patch MJS SDK segment: ${before.slice(0, 80)}`);
source = source.replace(before, after);
}
return source;
}
+48
View File
@@ -0,0 +1,48 @@
import { cpSync, existsSync, mkdtempSync, mkdirSync, readdirSync, readFileSync, rmSync } from "node:fs";
import { execFileSync } from "node:child_process";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import process from "node:process";
const root = process.cwd();
const sdkPackage = "@echosixhiya/teamspeak-client";
const packageJson = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
const dependency = packageJson.dependencies?.[sdkPackage];
const match = typeof dependency === "string" ? /^git\+(.+?)#(.+)$/.exec(dependency) : null;
if (!match) {
throw new Error(`${sdkPackage} must be pinned to a Git repository commit`);
}
const [, repository, commit] = match;
const temporaryRoot = mkdtempSync(join(tmpdir(), "webspeak-sdk-build-"));
const destination = join(root, "node_modules", "@echosixhiya", "teamspeak-client", "dist");
try {
execFileSync("git", ["clone", "--no-checkout", repository, temporaryRoot], { stdio: "inherit" });
execFileSync("git", ["checkout", "--detach", commit], { cwd: temporaryRoot, stdio: "inherit" });
const npmOptions = { cwd: temporaryRoot, stdio: "inherit" };
const runNpm = (args) => {
if (process.platform === "win32") {
execFileSync(process.env.ComSpec ?? "cmd.exe", ["/d", "/s", "/c", `npm.cmd ${args.join(" ")}`], npmOptions);
} else {
execFileSync("npm", args, npmOptions);
}
};
runNpm(["install", "--ignore-scripts", "--no-audit", "--no-fund"]);
runNpm(["run", "build"]);
const source = join(temporaryRoot, "dist");
if (!existsSync(join(source, "index.mjs"))) {
throw new Error(`SDK build did not produce ${join(source, "index.mjs")}`);
}
mkdirSync(dirname(destination), { recursive: true });
mkdirSync(destination, { recursive: true });
for (const entry of readdirSync(source)) {
cpSync(join(source, entry), join(destination, entry), { recursive: true, force: true });
}
console.log(`Prepared ${sdkPackage} from ${commit}`);
} finally {
rmSync(temporaryRoot, { recursive: true, force: true });
}
+298 -16
View File
@@ -1,11 +1,28 @@
import { Router, type NextFunction, type Request, type Response } from "express";
import { Router, raw as expressRaw, type NextFunction, type Request, type Response } from "express";
import { existsSync, readFileSync } from "node:fs";
import type { Logger } from "../logger.js";
import { AdminInputError, AdminService, type AdminSettingsInput } from "./admin-service.js";
import { AdminInputError, AdminService, type AdminSettingsInput, type RelayNodeInput } from "./admin-service.js";
import { AdminSessionStore, isSecureRequest } from "./admin-session.js";
import { AdminLoginRateLimiter, waitFor } from "./login-rate-limit.js";
import { TeamSpeakProbeError } from "../server/teamspeak-probe.js";
import type { AdminSessionSummary } from "../server/voice-bridge.js";
import { SkinRegistry, SkinRegistryError } from "./skin-registry.js";
export interface AdminConnectionRecord {
id: string;
nickname: string;
clientIp: string;
target: string;
relayName: string | null;
relayTarget: string | null;
startedAt: string;
connectedAt: string | null;
disconnectedAt: string | null;
durationSeconds: number | null;
status: "active" | "connecting" | "disconnected" | "failed";
reason: string | null;
failureDetail: string | null;
}
export interface AdminRouterOptions {
service: AdminService;
@@ -18,6 +35,7 @@ export interface AdminRouterOptions {
terminateSession?: (id: string) => Promise<boolean>;
version?: string;
logFile?: string;
skinRegistry?: SkinRegistry;
startedAt: number;
}
@@ -104,6 +122,81 @@ export function createAdminRouter(options: AdminRouterOptions): Router {
response.json(options.service.getAdminSettings());
});
router.get("/skins", async (_request, response) => {
response.json({
skins: await options.skinRegistry?.list() ?? [],
defaultSkinId: await options.skinRegistry?.getDefaultSkinId() ?? "builtin.light",
});
});
router.put("/skins/default", requireSameOrigin, requireCsrf(options.sessions), async (request, response) => {
try {
if (!options.skinRegistry) throw new SkinRegistryError("Skin storage is unavailable.", "SKIN_STORAGE_UNAVAILABLE");
const id = typeof asRecord(request.body).id === "string" ? (asRecord(request.body).id as string).trim() : "";
const settings = await options.skinRegistry.setDefaultSkin(id);
response.json({ ok: true, defaultSkinId: settings.defaultSkinId });
} catch (error: unknown) {
if (error instanceof SkinRegistryError) {
response.status(error.code === "SKIN_DEFAULT_INVALID" ? 400 : 409).json({ ok: false, code: error.code, message: error.message });
return;
}
sendAdminError(response, error);
}
});
router.put("/skins/:id/enabled", requireSameOrigin, requireCsrf(options.sessions), async (request, response) => {
try {
const id = typeof request.params.id === "string" ? request.params.id : "";
const body = asRecord(request.body);
if (!options.skinRegistry || typeof body.enabled !== "boolean") throw new SkinRegistryError("A skin and boolean enabled value are required.", "SKIN_ENABLE_INVALID");
const skin = await options.skinRegistry.setEnabled(id, body.enabled);
options.service.database.addAudit(body.enabled ? "ADMIN_SKIN_ENABLED" : "ADMIN_SKIN_DISABLED", { id });
response.json({ ok: true, skin, defaultSkinId: await options.skinRegistry.getDefaultSkinId() });
} catch (error: unknown) {
if (error instanceof SkinRegistryError) {
const status = error.code === "SKIN_NOT_FOUND" ? 404 : error.code === "SKIN_ENABLE_INVALID" ? 400 : 409;
response.status(status).json({ ok: false, code: error.code, message: error.message });
return;
}
sendAdminError(response, error);
}
});
router.put("/skins/:id", requireSameOriginBinary, requireCsrf(options.sessions), expressRaw({ type: "application/octet-stream", limit: "20mb" }), async (request, response) => {
try {
const id = typeof request.params.id === "string" ? request.params.id : "";
if (!options.skinRegistry || !Buffer.isBuffer(request.body)) throw new SkinRegistryError("Skin storage is unavailable.", "SKIN_STORAGE_UNAVAILABLE");
const skin = await options.skinRegistry.save(request.body, id);
options.service.database.addAudit("ADMIN_SKIN_INSTALLED", { id: skin.id, version: skin.version });
response.status(201).json({ ok: true, skin });
} catch (error: unknown) {
if (error instanceof SkinRegistryError) {
const status = error.code === "SKIN_LIMIT" || error.code === "SKIN_STORAGE_LIMIT" || error.code === "SKIN_BUILTIN_PROTECTED" ? 409 : 400;
response.status(status).json({ ok: false, code: error.code, message: error.message });
return;
}
sendAdminError(response, error);
}
});
router.delete("/skins/:id", requireSameOrigin, requireCsrf(options.sessions), async (request, response) => {
const id = typeof request.params.id === "string" ? request.params.id : "";
try {
if (!options.skinRegistry || !await options.skinRegistry.remove(id)) {
response.status(404).json({ ok: false, code: "SKIN_NOT_FOUND" });
return;
}
options.service.database.addAudit("ADMIN_SKIN_REMOVED", { id });
response.json({ ok: true });
} catch (error: unknown) {
if (error instanceof SkinRegistryError) {
response.status(error.code === "SKIN_BUILTIN_PROTECTED" ? 409 : 400).json({ ok: false, code: error.code, message: error.message });
return;
}
sendAdminError(response, error);
}
});
router.get("/sessions", (_request, response) => {
response.json({ sessions: options.getSessionSummaries?.() ?? [] });
});
@@ -155,7 +248,12 @@ export function createAdminRouter(options: AdminRouterOptions): Router {
});
router.get("/logs", (request, response) => {
response.json({ available: Boolean(options.logFile && existsSync(options.logFile)), entries: readRecentLogs(options.logFile, readLimit(request.query.limit, 100)) });
const limit = readLimit(request.query.limit, 100);
response.json({
available: Boolean(options.logFile && existsSync(options.logFile)),
entries: readRecentLogs(options.logFile, limit),
sessions: readConnectionHistory(options.logFile, limit),
});
});
router.get("/diagnostics", (_request, response) => {
@@ -163,7 +261,7 @@ export function createAdminRouter(options: AdminRouterOptions): Router {
options.getActiveSessions(),
options.getPeakSessions(),
options.startedAt,
) as unknown as AdminOverview;
);
response.json({
generatedAt: new Date().toISOString(),
gateway: {
@@ -190,7 +288,7 @@ export function createAdminRouter(options: AdminRouterOptions): Router {
options.getActiveSessions(),
options.getPeakSessions(),
options.startedAt,
) as unknown as AdminOverview;
);
const report = {
generatedAt: new Date().toISOString(),
gateway: {
@@ -208,7 +306,6 @@ export function createAdminRouter(options: AdminRouterOptions): Router {
},
teamSpeak: {
status: overview.teamSpeak.status,
protocol: overview.teamSpeak.protocol,
lastTestAt: overview.teamSpeak.lastTestAt,
latencyMs: overview.teamSpeak.latencyMs,
lastError: overview.teamSpeak.lastError,
@@ -307,6 +404,22 @@ function requireSameOrigin(request: Request, response: Response, next: NextFunct
next();
}
function requireSameOriginBinary(request: Request, response: Response, next: NextFunction): void {
if (!request.is("application/octet-stream")) {
response.status(415).json({ ok: false, code: "BINARY_REQUIRED" });
return;
}
const origin = request.header("origin");
const host = request.header("host");
try {
if (!origin || !host || new URL(origin).host !== host) throw new Error("origin mismatch");
} catch {
response.status(403).json({ ok: false, code: "ORIGIN_REJECTED" });
return;
}
next();
}
async function runProbe(
service: AdminService,
response: Response,
@@ -326,6 +439,19 @@ async function runProbe(
}
function readSettingsInput(body: Record<string, unknown>): AdminSettingsInput {
const relayNodes = Array.isArray(body.relayNodes)
? body.relayNodes.map((value): RelayNodeInput => {
const node = asRecord(value);
return {
id: typeof node.id === "string" ? node.id.slice(0, 110) : undefined,
name: typeof node.name === "string" ? node.name.slice(0, 80) : "",
target: typeof node.target === "string" ? node.target.slice(0, 300) : "",
enabled: node.enabled === true,
token: typeof node.token === "string" ? node.token.slice(0, 512) : undefined,
tokenAction: readPasswordAction(node.tokenAction),
};
})
: undefined;
return {
target: readString(body, "target", 300),
serverPassword: typeof body.serverPassword === "string" ? body.serverPassword.slice(0, 512) : undefined,
@@ -333,9 +459,30 @@ function readSettingsInput(body: Record<string, unknown>): AdminSettingsInput {
accessMode: body.accessMode === "open" ? "open" : body.accessMode === "fixed" ? "fixed" : body.accessMode as never,
siteName: readString(body, "siteName", 80),
welcomeText: readOptionalString(body, "welcomeText", 500),
welcomeTextEn: typeof body.welcomeTextEn === "string" ? body.welcomeTextEn.slice(0, 500) : undefined,
welcomeTextDe: typeof body.welcomeTextDe === "string" ? body.welcomeTextDe.slice(0, 500) : undefined,
welcomeTextRu: typeof body.welcomeTextRu === "string" ? body.welcomeTextRu.slice(0, 500) : undefined,
welcomeTextJa: typeof body.welcomeTextJa === "string" ? body.welcomeTextJa.slice(0, 500) : undefined,
webRtcEnabled: body.webRtcEnabled === true,
webRtcPublicHost: body.webRtcPublicHost as string | undefined,
webRtcIpv6Enabled: body.webRtcIpv6Enabled as boolean | undefined,
webRtcStunServer: body.webRtcStunServer as string | undefined,
webRtcUdpStart: readOptionalInteger(body, "webRtcUdpStart"),
webRtcUdpEnd: readOptionalInteger(body, "webRtcUdpEnd"),
relaySettingsAction: readRelaySettingsAction(body.relaySettingsAction),
relayEnabled: body.relayEnabled === true,
relayName: typeof body.relayName === "string" ? body.relayName.slice(0, 80) : undefined,
relayTarget: typeof body.relayTarget === "string" ? body.relayTarget.slice(0, 300) : undefined,
relayToken: typeof body.relayToken === "string" ? body.relayToken.slice(0, 512) : undefined,
relayTokenAction: readPasswordAction(body.relayTokenAction),
relayNodes,
};
}
function readRelaySettingsAction(value: unknown): "keep" | "replace" | "remove" {
return value === "replace" || value === "remove" ? value : "keep";
}
function readPasswordAction(value: unknown): "keep" | "replace" | "remove" {
return value === "replace" || value === "remove" ? value : "keep";
}
@@ -350,6 +497,14 @@ function readString(body: Record<string, unknown>, key: string, max: number): st
return body[key];
}
function readOptionalInteger(body: Record<string, unknown>, key: string): number | undefined {
if (body[key] === undefined) return undefined;
if (typeof body[key] !== "number" || !Number.isSafeInteger(body[key])) {
throw new AdminInputError("INVALID_REQUEST", `${key} is invalid`);
}
return body[key];
}
function readOptionalString(body: Record<string, unknown>, key: string, max: number): string {
return typeof body[key] === "string" ? body[key].slice(0, max) : "";
}
@@ -378,7 +533,7 @@ function readRecentLogs(logFile: string | undefined, limit: number): AdminLogEnt
try {
const raw = JSON.parse(line) as Record<string, unknown>;
const context: Record<string, string | number | boolean> = {};
for (const key of ["component", "entryId", "code", "reason", "attempt", "target", "nickname", "channel", "reconnect", "port"]) {
for (const key of ["component", "entryId", "code", "reason", "attempt", "target", "nickname", "clientIp", "relayName", "relayTarget", "channel", "reconnect", "port"]) {
const value = raw[key];
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") context[key] = value;
}
@@ -397,16 +552,143 @@ function readRecentLogs(logFile: string | undefined, limit: number): AdminLogEnt
}
}
interface AdminOverview {
gateway: { uptimeSeconds: number };
teamSpeak: {
interface StructuredLogEntry {
timestamp: string | null;
message: string;
raw: Record<string, unknown>;
}
export function readConnectionHistory(logFile: string | undefined, limit: number): AdminConnectionRecord[] {
if (!logFile) return [];
const records = new Map<string, {
id: string;
nickname: string;
clientIp: string;
target: string;
status: string;
protocol: string | null;
lastTestAt: string | null;
latencyMs: number | null;
lastError: string | null;
};
relayName: string;
relayTarget: string;
startedAt: string | null;
connectedAt: string | null;
disconnectedAt: string | null;
durationSeconds: number | null;
status: AdminConnectionRecord["status"];
reason: string | null;
failureDetail: string | null;
}>();
for (const log of readStructuredLogs(logFile)) {
const entryId = typeof log.raw.entryId === "string" ? log.raw.entryId : "";
if (!entryId || !log.timestamp) continue;
const current = records.get(entryId) ?? {
id: entryId,
nickname: "",
clientIp: "",
target: "",
relayName: "",
relayTarget: "",
startedAt: null,
connectedAt: null,
disconnectedAt: null,
durationSeconds: null,
status: "connecting" as const,
reason: null,
failureDetail: null,
};
const nickname = typeof log.raw.nickname === "string" ? log.raw.nickname : "";
const clientIp = typeof log.raw.clientIp === "string" ? log.raw.clientIp : "";
const target = typeof log.raw.target === "string" ? log.raw.target : "";
const relayName = typeof log.raw.relayName === "string" ? log.raw.relayName : "";
const relayTarget = typeof log.raw.relayTarget === "string" ? log.raw.relayTarget : "";
if (nickname) current.nickname = nickname;
if (clientIp) current.clientIp = clientIp;
if (target) current.target = target;
if (relayName) current.relayName = relayName;
if (relayTarget) current.relayTarget = relayTarget;
if (typeof log.raw.failureDetail === "string" && log.raw.failureDetail) current.failureDetail = log.raw.failureDetail;
if (log.message === "WebClient connecting") {
current.startedAt ??= log.timestamp;
current.status = "connecting";
} else if (log.message === "TS connect failed") {
current.reason = typeof log.raw.code === "string" ? log.raw.code : current.reason;
current.status = "failed";
} else if (log.message === "Web client connected to TeamSpeak") {
current.startedAt ??= log.timestamp;
current.connectedAt = log.timestamp;
current.status = "active";
} else if (log.message === "Client session torn down") {
current.startedAt ??= log.timestamp;
current.disconnectedAt = log.timestamp;
current.durationSeconds = current.connectedAt && typeof log.raw.durationSeconds === "number"
? Math.max(0, Math.floor(log.raw.durationSeconds))
: current.connectedAt
? Math.max(0, Math.floor((Date.parse(log.timestamp) - Date.parse(current.connectedAt)) / 1000))
: null;
current.status = current.connectedAt ? "disconnected" : "failed";
// `reason` is also used for ordinary lifecycle teardown (for example
// websocket-close when a user clicks Leave). Only preserve an explicit
// TeamSpeak failure code here; otherwise a normal disconnect would be
// rendered by the admin UI as the generic request-failed message.
current.reason = typeof log.raw.failureCode === "string" && log.raw.failureCode
? log.raw.failureCode
: current.reason;
}
records.set(entryId, current);
}
const now = Date.now();
return [...records.values()]
.filter((record): record is typeof record & { startedAt: string } => Boolean(record.startedAt))
.map((record) => {
const start = record.connectedAt ?? record.startedAt;
const end = record.disconnectedAt ? Date.parse(record.disconnectedAt) : now;
return {
id: record.id,
nickname: record.nickname || "—",
clientIp: record.clientIp || "—",
target: record.target || "—",
relayName: record.relayName || null,
relayTarget: record.relayTarget || null,
startedAt: record.startedAt,
connectedAt: record.connectedAt,
disconnectedAt: record.disconnectedAt,
durationSeconds: record.durationSeconds ?? (record.status === "active" || record.status === "connecting"
? Math.max(0, Math.floor((end - Date.parse(start)) / 1000))
: null),
status: record.status,
// Older sessions may only contain a teardown record without a
// structured failure code. Keep normal disconnects quiet, but make
// an untraceable failed connection explicitly visible as the generic
// request-failed message instead of implying a guessed cause.
reason: record.reason ?? (record.status === "failed" ? "CONNECTION_FAILED" : null),
failureDetail: record.failureDetail,
};
})
.sort((left, right) => Date.parse(right.disconnectedAt ?? right.startedAt) - Date.parse(left.disconnectedAt ?? left.startedAt))
.slice(0, limit);
}
function readStructuredLogs(logFile: string): StructuredLogEntry[] {
const paths = [logFile, `${logFile}.1`, `${logFile}.2`, `${logFile}.3`].filter((value, index, all) => value && all.indexOf(value) === index);
const entries: StructuredLogEntry[] = [];
for (const path of paths) {
if (!existsSync(path)) continue;
try {
for (const line of readFileSync(path, "utf8").split(/\r?\n/).filter(Boolean)) {
try {
const raw = JSON.parse(line) as Record<string, unknown>;
entries.push({
timestamp: typeof raw.time === "string" ? raw.time : null,
message: typeof raw.msg === "string" ? raw.msg : "",
raw,
});
} catch {
// Non-JSON lines are still shown by the normal log viewer, but cannot
// be associated with a user session safely.
}
}
} catch {
// A rotated file can disappear between existsSync and readFileSync.
}
}
return entries.sort((left, right) => Date.parse(left.timestamp ?? "") - Date.parse(right.timestamp ?? ""));
}
function logLevelName(level: unknown): string {
+356 -42
View File
@@ -1,34 +1,30 @@
import type { AdminSettingsInput, RelayNodeInput, ManagedInviteInput } from "../shared/admin-inputs.js";
export type { AdminSettingsInput, RelayNodeInput, ManagedInviteInput } from "../shared/admin-inputs.js";
import type { AdminOverview, AdminSettings } from "../shared/admin-responses.js";
import { createHash, randomBytes } from "node:crypto";
import { existsSync } from "node:fs";
import type { Logger } from "../logger.js";
import { loadConfig } from "../config.js";
import { formatTeamSpeakTarget, parseTeamSpeakTarget, type TeamSpeakTarget } from "../domain/teamspeak-target.js";
import { type AccessMode, type ManagedInviteRecord, type SettingsUpdate, WebSpeakDatabase } from "../persistence/database.js";
import { DEFAULT_TEAM_SPEAK_PORT, formatTeamSpeakTarget, parseTeamSpeakTarget, type TeamSpeakTarget } from "../domain/teamspeak-target.js";
import { formatTeamSpeakConnectionTarget, parseTeamSpeakConnectionTarget, type TeamSpeakConnectionTarget } from "../domain/teamspeak-connection-target.js";
import { resolveTeamSpeakTarget, TeamSpeakAliasLookupError } from "../server/teamspeak-alias.js";
import { type AccessMode, type ManagedInviteRecord, type PersistedRelayNode, type SettingsUpdate, WebSpeakDatabase } from "../persistence/database.js";
import { hashAdminPassword, validateAdminPassword, verifyAdminPassword } from "../security/admin-password.js";
import { decryptSecret, encryptSecret } from "../security/secret-crypto.js";
import { probeTeamSpeak, TeamSpeakProbeError, type TeamSpeakProbeResult } from "../server/teamspeak-probe.js";
export interface AdminSettingsInput {
target: string;
serverPassword?: string;
passwordAction?: "keep" | "replace" | "remove";
accessMode: AccessMode;
siteName: string;
welcomeText: string;
}
import { probeTeamSpeak, TeamSpeakProbeError } from "../server/teamspeak-probe.js";
import { pingTeamSpeakHost } from "../server/network-probe.js";
import { normalizeVoiceMediaHost, normalizeVoiceStunServer } from "../shared/voice-ice.js";
import type { WebRtcAudioOptions } from "../server/webrtc-audio.js";
import { DEFAULT_ACCELERATION_RELAY_PORT, type ConfiguredAccelerationRelay } from "../server/acceleration-relay.js";
import { DEFAULT_WEBRTC_UDP_PORT_RANGE, WEBRTC_UDP_PORT_MAX, WEBRTC_UDP_PORT_MIN } from "../server/webrtc-config.js";
import { DEFAULT_WELCOME_TEXTS, resolveWelcomeTexts } from "../site-copy.js";
export interface ConnectionPolicy {
defaultTarget: TeamSpeakTarget;
defaultTarget: string;
serverPassword: string;
accessMode: AccessMode;
}
export interface ManagedInviteInput {
channel: string;
expiresInHours: number;
maxUses: number;
}
export interface ManagedInviteView {
id: string;
target: string;
@@ -87,37 +83,100 @@ export class AdminService {
getPublicConfig(): Record<string, unknown> {
const settings = this.database.getSettings();
const welcomeTexts = resolveWelcomeTexts({
zh: settings.welcomeText,
en: settings.welcomeTextEn,
de: settings.welcomeTextDe,
ru: settings.welcomeTextRu,
ja: settings.welcomeTextJa,
});
return {
version: this.version,
initialized: this.isInitialized(),
siteName: settings.siteName,
welcomeText: settings.welcomeText,
// Keep the old fields for older clients, but return the complete,
// already-fallback-resolved map for current clients.
welcomeText: welcomeTexts.zh,
welcomeTextEn: welcomeTexts.en,
welcomeTexts,
accessMode: settings.accessMode,
target: formatTeamSpeakTarget({ host: settings.tsHost, port: settings.tsPort }),
target: settingsTarget(settings),
};
}
getAdminSettings(): Record<string, unknown> {
getAdminSettings(): AdminSettings {
const settings = this.database.getSettings();
return {
target: formatTeamSpeakTarget({ host: settings.tsHost, port: settings.tsPort }),
target: settingsTarget(settings),
hasPassword: Boolean(settings.tsPasswordEncrypted),
accessMode: settings.accessMode,
siteName: settings.siteName,
welcomeText: settings.welcomeText,
detectedProtocol: settings.detectedProtocol,
welcomeTextEn: settings.welcomeTextEn,
welcomeTextDe: settings.welcomeTextDe,
welcomeTextRu: settings.welcomeTextRu,
welcomeTextJa: settings.welcomeTextJa,
welcomeDefaults: DEFAULT_WELCOME_TEXTS,
lastTestAt: settings.lastTestAt,
lastTestLatencyMs: settings.lastTestLatencyMs,
lastTestError: settings.lastTestError,
webRtcEnabled: settings.webRtcEnabled,
webRtcPublicHost: settings.webRtcPublicHost,
webRtcIpv6Enabled: settings.webRtcIpv6Enabled,
webRtcStunServer: settings.webRtcStunServer,
webRtcUdpStart: settings.webRtcUdpStart,
webRtcUdpEnd: settings.webRtcUdpEnd,
relayConfigured: settings.relayConfigured,
relayEnabled: settings.relayEnabled,
relayName: settings.relayName,
relayTarget: settings.relayHost ? formatRelayTarget(settings.relayHost, settings.relayPort) : "",
hasRelayToken: Boolean(settings.relayTokenEncrypted),
relayNodes: this.getRelayNodeViews(),
internalPort: 3040,
updatedAt: settings.updatedAt,
};
}
getWebRtcAudioOptions(): WebRtcAudioOptions {
const settings = this.database.getSettings();
return {
enabled: settings.webRtcEnabled,
publicHost: settings.webRtcPublicHost,
ipv6Enabled: settings.webRtcIpv6Enabled,
stunServer: settings.webRtcStunServer,
udpPortRange: [settings.webRtcUdpStart, settings.webRtcUdpEnd],
};
}
getAccelerationRelayOptions(): ConfiguredAccelerationRelay[] {
const relays: ConfiguredAccelerationRelay[] = [];
for (const node of this.database.listRelayNodes()) {
if (!node.enabled || !node.host || !node.tokenEncrypted) continue;
try {
const token = decryptSecret(node.tokenEncrypted, this.masterSecret);
relays.push({ id: node.id, name: node.name, relayHost: node.host, relayPort: node.port, token });
} catch (error: unknown) {
this.logger.error({ err: error instanceof Error ? error.message : String(error), relayId: node.id }, "Stored acceleration relay token could not be decrypted");
}
}
return relays;
}
getAccelerationRelayName(): string | undefined {
return this.getAccelerationRelayOptions()[0]?.name;
}
updateSettings(input: AdminSettingsInput): void {
const current = this.database.getSettings();
const settings = this.normalizeSettings(input, current);
const targetChanged = current.tsHost !== settings.tsHost || current.tsPort !== settings.tsPort;
const relayNodes = input.relayNodes === undefined ? undefined : this.normalizeRelayNodes(input.relayNodes);
const settings = this.normalizeSettings(input, current, relayNodes);
const targetChanged = current.tsHost !== settings.tsHost || current.tsPort !== settings.tsPort || current.tsTarget !== settings.tsTarget;
this.database.updateSettings(settings);
if (relayNodes !== undefined) {
this.database.replaceRelayNodes(relayNodes);
} else if (input.relaySettingsAction && input.relaySettingsAction !== "keep") {
this.database.replaceRelayNodes(this.legacyRelayNodesFromSettings(settings));
}
if (targetChanged) this.database.clearConnectionTest();
}
@@ -130,30 +189,62 @@ export class AdminService {
this.logger.error({ err: error instanceof Error ? error.message : String(error) }, "Stored TeamSpeak password could not be decrypted");
}
return {
defaultTarget: { host: settings.tsHost, port: settings.tsPort },
defaultTarget: settingsTarget(settings),
serverPassword,
accessMode: settings.accessMode,
};
}
async testConnection(targetText: string, password: string, persistResult: boolean): Promise<TeamSpeakProbeResult> {
async testConnection(targetText: string, password: string, persistResult: boolean): Promise<{ ok: boolean; checkType: "network" | "protocol"; passwordVerified: boolean; latencyMs: number; serverName: string | null; requiresPassword: boolean; packetLossPercent?: number; attempts?: number; successfulAttempts?: number; errorCode?: string }> {
let target: TeamSpeakTarget;
try {
target = parseTeamSpeakTarget(targetText);
parseTeamSpeakConnectionTarget(targetText);
} catch {
throw new AdminInputError("INVALID_TARGET", "TeamSpeak target is invalid");
}
try {
target = await resolveTeamSpeakTarget(targetText);
// The admin connection test must not create a temporary TeamSpeak
// client: that client becomes visible in the target channel. Use the
// WebSpeak host's ICMP route measurement instead. The injected probe is
// retained for unit tests and explicit protocol-probe callers.
if (this.probe === probeTeamSpeak) {
const result = await pingTeamSpeakHost(target.host, { attempts: 4 });
const publicResult = {
ok: result.ok,
checkType: "network" as const,
passwordVerified: false,
latencyMs: result.latencyMs ?? 0,
serverName: null,
requiresPassword: false,
packetLossPercent: result.packetLossPercent,
attempts: result.attempts,
successfulAttempts: result.successfulAttempts,
...(result.errorCode ? { errorCode: result.errorCode } : {}),
};
if (persistResult) {
this.database.recordConnectionTest({ protocol: null, latencyMs: result.latencyMs, error: result.ok ? null : (result.errorCode ?? "UNREACHABLE") });
this.database.addAudit(result.ok ? "CONNECTION_TEST_SUCCEEDED" : "CONNECTION_TEST_FAILED", {
latencyMs: result.latencyMs,
packetLossPercent: result.packetLossPercent,
...(result.errorCode ? { code: result.errorCode } : {}),
});
}
return publicResult;
}
const result = await this.probe(target, password, this.logger);
if (persistResult) {
this.database.recordConnectionTest({ protocol: result.protocol, latencyMs: result.latencyMs, error: null });
this.database.addAudit("CONNECTION_TEST_SUCCEEDED", { protocol: result.protocol, latencyMs: result.latencyMs });
}
return result;
const { protocol: _protocol, ...publicResult } = result;
return { ...publicResult, checkType: "protocol", passwordVerified: true };
} catch (error: unknown) {
const probeError = error instanceof TeamSpeakProbeError
? error
: new TeamSpeakProbeError("INTERNAL_ERROR", "Connection test failed", error);
: error instanceof TeamSpeakAliasLookupError
? new TeamSpeakProbeError("HOST_NOT_FOUND", "TeamSpeak server nickname could not be resolved", error)
: new TeamSpeakProbeError("INTERNAL_ERROR", "Connection test failed", error);
if (persistResult) {
this.database.recordConnectionTest({ protocol: null, latencyMs: null, error: probeError.code });
this.database.addAudit("CONNECTION_TEST_FAILED", { code: probeError.code });
@@ -162,7 +253,7 @@ export class AdminService {
}
}
getOverview(activeSessions: number, peakSessions: number, startedAt: number): Record<string, unknown> {
getOverview(activeSessions: number, peakSessions: number, startedAt: number): AdminOverview {
const settings = this.database.getSettings();
return {
gateway: {
@@ -171,9 +262,8 @@ export class AdminService {
uptimeSeconds: Math.max(0, Math.floor((Date.now() - startedAt) / 1000)),
},
teamSpeak: {
target: formatTeamSpeakTarget({ host: settings.tsHost, port: settings.tsPort }),
target: settingsTarget(settings),
status: settings.lastTestError ? "unreachable" : settings.lastTestAt ? "reachable" : "unknown",
protocol: settings.detectedProtocol,
lastTestAt: settings.lastTestAt,
latencyMs: settings.lastTestLatencyMs,
lastError: settings.lastTestError,
@@ -200,6 +290,7 @@ export class AdminService {
tokenHash: hashInviteToken(token),
targetHost: settings.tsHost,
targetPort: settings.tsPort,
targetText: settings.tsTarget,
serverPasswordEncrypted: settings.tsPasswordEncrypted,
channel,
expiresAt: new Date(Date.now() + input.expiresInHours * 60 * 60 * 1000).toISOString(),
@@ -220,7 +311,17 @@ export class AdminService {
return revoked;
}
consumeManagedInvite(token: string): { target: TeamSpeakTarget; serverPassword: string; channel: string } | null {
getManagedInvite(token: string): { target: string; channel: string } | null {
if (!/^[A-Za-z0-9_-]{32,128}$/.test(token)) return null;
const record = this.database.getManagedInvite(hashInviteToken(token));
if (!record) return null;
return {
target: record.targetText ?? formatTeamSpeakTarget({ host: record.targetHost, port: record.targetPort }),
channel: record.channel,
};
}
consumeManagedInvite(token: string): { target: string; serverPassword: string; channel: string } | null {
if (!/^[A-Za-z0-9_-]{32,128}$/.test(token)) return null;
const record = this.database.consumeManagedInvite(hashInviteToken(token));
if (!record) return null;
@@ -231,49 +332,220 @@ export class AdminService {
this.logger.error({ err: error instanceof Error ? error.message : String(error), inviteId: record.id }, "Managed invite password could not be decrypted");
}
this.database.addAudit("INVITE_CONSUMED", { id: record.id });
return { target: { host: record.targetHost, port: record.targetPort }, serverPassword, channel: record.channel };
return { target: record.targetText ?? formatTeamSpeakTarget({ host: record.targetHost, port: record.targetPort }), serverPassword, channel: record.channel };
}
dismissLegacyImportNotice(): void {
this.database.setMeta("legacy_import_notice_pending", "0");
}
private normalizeSettings(input: AdminSettingsInput, current: ReturnType<WebSpeakDatabase["getSettings"]>): SettingsUpdate {
let target: TeamSpeakTarget;
private normalizeSettings(input: AdminSettingsInput, current: ReturnType<WebSpeakDatabase["getSettings"]>, relayNodes?: PersistedRelayNode[]): SettingsUpdate {
let target: TeamSpeakConnectionTarget;
try {
target = parseTeamSpeakTarget(input.target);
target = parseTeamSpeakConnectionTarget(input.target);
} catch {
throw new AdminInputError("INVALID_TARGET", "TeamSpeak target is invalid");
}
const siteName = input.siteName.trim();
const welcomeText = input.welcomeText.trim();
const welcomeTextEn = typeof input.welcomeTextEn === "string" ? input.welcomeTextEn.trim() : current.welcomeTextEn;
const welcomeTextDe = typeof input.welcomeTextDe === "string" ? input.welcomeTextDe.trim() : current.welcomeTextDe;
const welcomeTextRu = typeof input.welcomeTextRu === "string" ? input.welcomeTextRu.trim() : current.welcomeTextRu;
const welcomeTextJa = typeof input.welcomeTextJa === "string" ? input.welcomeTextJa.trim() : current.welcomeTextJa;
if (!siteName || siteName.length > 80) throw new AdminInputError("INVALID_SITE_NAME", "Site name must contain 1 to 80 characters");
if (welcomeText.length > 500) throw new AdminInputError("INVALID_WELCOME_TEXT", "Welcome text cannot exceed 500 characters");
if (welcomeTextEn.length > 500) throw new AdminInputError("INVALID_WELCOME_TEXT_EN", "English welcome text cannot exceed 500 characters");
if (welcomeTextDe.length > 500) throw new AdminInputError("INVALID_WELCOME_TEXT_DE", "German welcome text cannot exceed 500 characters");
if (welcomeTextRu.length > 500) throw new AdminInputError("INVALID_WELCOME_TEXT_RU", "Russian welcome text cannot exceed 500 characters");
if (welcomeTextJa.length > 500) throw new AdminInputError("INVALID_WELCOME_TEXT_JA", "Japanese welcome text cannot exceed 500 characters");
if (input.accessMode !== "fixed" && input.accessMode !== "open") {
throw new AdminInputError("INVALID_ACCESS_MODE", "Access mode is invalid");
}
if (typeof input.webRtcEnabled !== "boolean") {
throw new AdminInputError("INVALID_WEBRTC_ENABLED", "WebRTC enabled value is invalid");
}
const webRtcPublicHost = normalizeVoiceMediaHost(input.webRtcPublicHost === undefined ? current.webRtcPublicHost : input.webRtcPublicHost);
const webRtcStunServer = normalizeVoiceStunServer(input.webRtcStunServer === undefined ? current.webRtcStunServer : input.webRtcStunServer);
const webRtcIpv6Enabled = input.webRtcIpv6Enabled === undefined ? current.webRtcIpv6Enabled : input.webRtcIpv6Enabled;
if (webRtcPublicHost === null) throw new AdminInputError("INVALID_WEBRTC_PUBLIC_HOST", "Use an IP address or hostname without a scheme, path or port");
if (webRtcStunServer === null) throw new AdminInputError("INVALID_WEBRTC_STUN_SERVER", "Use a UDP STUN URL: stun:host:port");
if (typeof webRtcIpv6Enabled !== "boolean") throw new AdminInputError("INVALID_WEBRTC_IPV6", "WebRTC IPv6 value must be boolean");
const webRtcUdpStart = input.webRtcUdpStart ?? current.webRtcUdpStart ?? DEFAULT_WEBRTC_UDP_PORT_RANGE[0];
const webRtcUdpEnd = input.webRtcUdpEnd ?? current.webRtcUdpEnd ?? DEFAULT_WEBRTC_UDP_PORT_RANGE[1];
if (!Number.isInteger(webRtcUdpStart) || webRtcUdpStart < WEBRTC_UDP_PORT_MIN || webRtcUdpStart > WEBRTC_UDP_PORT_MAX) {
throw new AdminInputError("INVALID_WEBRTC_PORT_RANGE", "WebRTC UDP start port must be between 1024 and 65535");
}
if (!Number.isInteger(webRtcUdpEnd) || webRtcUdpEnd < WEBRTC_UDP_PORT_MIN || webRtcUdpEnd > WEBRTC_UDP_PORT_MAX) {
throw new AdminInputError("INVALID_WEBRTC_PORT_RANGE", "WebRTC UDP end port must be between 1024 and 65535");
}
if (webRtcUdpStart > webRtcUdpEnd) {
throw new AdminInputError("INVALID_WEBRTC_PORT_RANGE", "WebRTC UDP start port must not exceed the end port");
}
if (current.webRtcEnabled && (webRtcUdpStart !== current.webRtcUdpStart || webRtcUdpEnd !== current.webRtcUdpEnd)) {
throw new AdminInputError("WEBRTC_PORT_LOCKED", "Disable WebRTC and save before changing its UDP port range");
}
let encryptedPassword = current.tsPasswordEncrypted;
const action = input.passwordAction ?? (input.serverPassword === undefined ? "keep" : "replace");
if (action === "remove") encryptedPassword = null;
if (action === "replace") encryptedPassword = input.serverPassword ? encryptSecret(input.serverPassword, this.masterSecret) : null;
let relayConfigured = current.relayConfigured;
let relayEnabled = current.relayEnabled;
let relayName = current.relayName;
let relayHost = current.relayHost;
let relayPort = current.relayPort || DEFAULT_ACCELERATION_RELAY_PORT;
let relayTokenEncrypted = current.relayTokenEncrypted;
const relaySettingsAction = input.relaySettingsAction ?? "keep";
if (relaySettingsAction === "remove") {
relayConfigured = true;
relayEnabled = false;
relayName = "";
relayHost = "";
relayPort = DEFAULT_ACCELERATION_RELAY_PORT;
relayTokenEncrypted = null;
} else if (relaySettingsAction === "replace") {
const relayTarget = (input.relayTarget ?? "").trim();
relayEnabled = input.relayEnabled === true;
relayName = (input.relayName ?? "").trim();
if (relayName.length > 80) throw new AdminInputError("INVALID_RELAY_NAME", "Relay name must contain 80 characters or fewer");
if (relayEnabled && !relayName) throw new AdminInputError("INVALID_RELAY_NAME", "Relay name is required when the relay is enabled");
if (relayEnabled && !relayTarget) throw new AdminInputError("INVALID_RELAY_TARGET", "Relay target is required when the relay is enabled");
if (relayTarget) {
try {
const relay = parseTeamSpeakTarget(relayTarget, DEFAULT_ACCELERATION_RELAY_PORT);
relayHost = relay.host;
relayPort = relay.port;
} catch {
throw new AdminInputError("INVALID_RELAY_TARGET", "Relay target is invalid");
}
} else {
relayHost = "";
relayPort = DEFAULT_ACCELERATION_RELAY_PORT;
}
const relayTokenAction = input.relayTokenAction ?? (input.relayToken === undefined ? "keep" : "replace");
if (relayTokenAction === "remove") relayTokenEncrypted = null;
if (relayTokenAction === "replace") relayTokenEncrypted = input.relayToken ? encryptSecret(input.relayToken, this.masterSecret) : null;
if (relayEnabled && !relayTokenEncrypted) throw new AdminInputError("INVALID_RELAY_TOKEN", "Relay token is required when the relay is enabled");
relayConfigured = true;
}
if (relayNodes) {
const primary = relayNodes.find((node) => node.enabled) ?? relayNodes[0];
relayConfigured = relayNodes.length > 0;
relayEnabled = primary?.enabled === true;
relayName = primary?.name ?? "";
relayHost = primary?.host ?? "";
relayPort = primary?.port ?? DEFAULT_ACCELERATION_RELAY_PORT;
relayTokenEncrypted = primary?.tokenEncrypted ?? null;
}
return {
siteName,
welcomeText,
welcomeTextEn,
welcomeTextDe,
welcomeTextRu,
welcomeTextJa,
accessMode: input.accessMode,
tsHost: target.host,
tsPort: target.port,
tsHost: target.kind === "nickname" ? target.name : target.target.host,
tsPort: target.kind === "nickname" ? target.port ?? DEFAULT_TEAM_SPEAK_PORT : target.target.port,
tsTarget: target.kind === "nickname" ? formatTeamSpeakConnectionTarget(target) : null,
tsPasswordEncrypted: encryptedPassword,
webRtcEnabled: input.webRtcEnabled,
webRtcPublicHost, webRtcIpv6Enabled, webRtcStunServer,
webRtcUdpStart,
webRtcUdpEnd,
relayConfigured,
relayEnabled,
relayName,
relayHost,
relayPort,
relayTokenEncrypted,
};
}
private normalizeRelayNodes(inputs: RelayNodeInput[]): PersistedRelayNode[] {
if (!Array.isArray(inputs) || inputs.length > 16) throw new AdminInputError("INVALID_RELAY_NODES", "At most 16 relay nodes may be configured");
const current = new Map(this.database.listRelayNodes().map((node) => [node.id, node]));
const seen = new Set<string>();
const now = new Date().toISOString();
return inputs.map((input) => {
const name = typeof input.name === "string" ? input.name.trim() : "";
const targetText = typeof input.target === "string" ? input.target.trim() : "";
if (!name || name.length > 80) throw new AdminInputError("INVALID_RELAY_NAME", "Relay name must contain 1 to 80 characters");
if (!targetText || targetText.length > 300) throw new AdminInputError("INVALID_RELAY_TARGET", "Relay target is invalid");
let target: TeamSpeakTarget;
try { target = parseTeamSpeakTarget(targetText, DEFAULT_ACCELERATION_RELAY_PORT); }
catch { throw new AdminInputError("INVALID_RELAY_TARGET", "Relay target is invalid"); }
const id = typeof input.id === "string" && /^relay-[a-z0-9-]{1,100}$/i.test(input.id)
? input.id
: `relay-${randomBytes(8).toString("hex")}`;
if (seen.has(id)) throw new AdminInputError("INVALID_RELAY_ID", "Relay id must be unique");
seen.add(id);
const previous = current.get(id);
const tokenAction = input.tokenAction ?? (input.token === undefined ? "keep" : "replace");
let tokenEncrypted = previous?.tokenEncrypted ?? null;
if (tokenAction === "remove") tokenEncrypted = null;
if (tokenAction === "replace") {
const token = typeof input.token === "string" ? input.token.trim() : "";
tokenEncrypted = token ? encryptSecret(token, this.masterSecret) : null;
}
if (input.enabled === true && (!tokenEncrypted || !this.canDecryptToken(tokenEncrypted))) {
throw new AdminInputError("INVALID_RELAY_TOKEN", "A relay token of at least 16 characters is required when the relay is enabled");
}
return {
id,
name,
enabled: input.enabled === true,
host: target.host,
port: target.port,
tokenEncrypted,
createdAt: previous?.createdAt ?? now,
updatedAt: now,
};
});
}
private canDecryptToken(encrypted: string): boolean {
try {
return decryptSecret(encrypted, this.masterSecret).length >= 16;
} catch {
return false;
}
}
private getRelayNodeViews(): Array<{ id: string; name: string; enabled: boolean; target: string; hasToken: boolean }> {
return this.database.listRelayNodes().map((node) => ({
id: node.id,
name: node.name,
enabled: node.enabled,
target: formatRelayTarget(node.host, node.port),
hasToken: Boolean(node.tokenEncrypted),
}));
}
private legacyRelayNodesFromSettings(settings: SettingsUpdate): PersistedRelayNode[] {
if (!settings.relayConfigured || !settings.relayHost || !settings.relayTokenEncrypted) return [];
const previous = this.database.listRelayNodes()[0];
const now = new Date().toISOString();
return [{
id: previous?.id ?? "relay-default",
name: settings.relayName || "中继加速",
enabled: settings.relayEnabled,
host: settings.relayHost,
port: settings.relayPort || DEFAULT_ACCELERATION_RELAY_PORT,
tokenEncrypted: settings.relayTokenEncrypted,
createdAt: previous?.createdAt ?? now,
updatedAt: now,
}];
}
private toInviteView(record: ManagedInviteRecord): ManagedInviteView {
const now = Date.now();
const expired = Date.parse(record.expiresAt) <= now;
const exhausted = record.maxUses > 0 && record.useCount >= record.maxUses;
return {
id: record.id,
target: formatTeamSpeakTarget({ host: record.targetHost, port: record.targetPort }),
target: record.targetText ?? formatTeamSpeakTarget({ host: record.targetHost, port: record.targetPort }),
channel: record.channel,
expiresAt: record.expiresAt,
maxUses: record.maxUses,
@@ -288,10 +560,27 @@ export class AdminService {
return {
siteName: settings.siteName,
welcomeText: settings.welcomeText,
welcomeTextEn: settings.welcomeTextEn,
welcomeTextDe: settings.welcomeTextDe,
welcomeTextRu: settings.welcomeTextRu,
welcomeTextJa: settings.welcomeTextJa,
accessMode: settings.accessMode,
tsHost: settings.tsHost,
tsPort: settings.tsPort,
tsTarget: settings.tsTarget,
tsPasswordEncrypted: settings.tsPasswordEncrypted,
webRtcEnabled: settings.webRtcEnabled,
webRtcPublicHost: settings.webRtcPublicHost,
webRtcIpv6Enabled: settings.webRtcIpv6Enabled,
webRtcStunServer: settings.webRtcStunServer,
webRtcUdpStart: settings.webRtcUdpStart,
webRtcUdpEnd: settings.webRtcUdpEnd,
relayConfigured: settings.relayConfigured,
relayEnabled: settings.relayEnabled,
relayName: settings.relayName,
relayHost: settings.relayHost,
relayPort: settings.relayPort,
relayTokenEncrypted: settings.relayTokenEncrypted,
};
}
@@ -303,10 +592,27 @@ export class AdminService {
this.database.updateSettings({
siteName: current.siteName,
welcomeText: current.welcomeText,
welcomeTextEn: current.welcomeTextEn,
welcomeTextDe: current.welcomeTextDe,
welcomeTextRu: current.welcomeTextRu,
welcomeTextJa: current.welcomeTextJa,
accessMode: current.accessMode,
tsHost: legacy.tsHost,
tsPort: legacy.tsPort,
tsTarget: legacy.tsTarget ?? null,
tsPasswordEncrypted: legacy.tsServerPassword ? encryptSecret(legacy.tsServerPassword, this.masterSecret) : null,
webRtcEnabled: current.webRtcEnabled,
webRtcPublicHost: current.webRtcPublicHost,
webRtcIpv6Enabled: current.webRtcIpv6Enabled,
webRtcStunServer: current.webRtcStunServer,
webRtcUdpStart: current.webRtcUdpStart,
webRtcUdpEnd: current.webRtcUdpEnd,
relayConfigured: current.relayConfigured,
relayEnabled: current.relayEnabled,
relayName: current.relayName,
relayHost: current.relayHost,
relayPort: current.relayPort,
relayTokenEncrypted: current.relayTokenEncrypted,
}, "LEGACY_CONFIG_IMPORTED");
this.database.setMeta("legacy_config_imported", "1");
this.database.setMeta("legacy_import_notice_pending", "1");
@@ -320,6 +626,14 @@ function hashInviteToken(token: string): string {
return createHash("sha256").update(token).digest("hex");
}
function settingsTarget(settings: { tsHost: string; tsPort: number; tsTarget?: string | null }): string {
return settings.tsTarget ?? formatTeamSpeakTarget({ host: settings.tsHost, port: settings.tsPort });
}
function formatRelayTarget(host: string, port: number): string {
return `${host.includes(":") ? `[${host}]` : host}#${port}`;
}
export class AdminInputError extends Error {
constructor(readonly code: string, message: string) {
super(message);
+451
View File
@@ -0,0 +1,451 @@
import assert from "node:assert/strict";
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import test from "node:test";
import { SkinRegistry, SkinRegistryError } from "./skin-registry.js";
const manifest = {
schemaVersion: 1,
id: "sample-skin",
name: "Sample skin",
version: "1.0.0",
author: "WebSpeak test",
license: "MIT",
minAppVersion: "0.2.4",
entry: "skin.css",
content: "content.json",
preview: "assets/preview.png",
};
test("skin registry validates, lists, replaces, serves, and removes packages", async (context) => {
const directory = await mkdtemp(path.join(os.tmpdir(), "webspeak-skin-registry-"));
context.after(() => rm(directory, { recursive: true, force: true }));
const registry = new SkinRegistry(directory);
assert.equal(await registry.readArchive("sample-skin"), null);
const firstArchive = createZip([
["manifest.json", Buffer.from(JSON.stringify(manifest))],
["skin.css", Buffer.from('[data-ws-part="voice.member"] { background: url(assets/background.png); }')],
["content.json", Buffer.from(JSON.stringify({ defaultLocale: "en", locales: { en: { home: { title: "Hello" } } } }))],
["assets/background.png", Buffer.from([1, 2, 3, 4])],
["assets/preview.png", Buffer.from([5, 6, 7, 8])],
]);
const first = await registry.save(firstArchive, "sample-skin");
assert.equal(first.id, "sample-skin");
assert.equal(first.previewUrl, "/api/skins/sample-skin/preview");
assert.equal((await registry.list()).length, 1);
assert.deepEqual(await registry.readArchive("sample-skin"), firstArchive);
assert.deepEqual((await registry.readPreview("sample-skin"))?.bytes, Buffer.from([5, 6, 7, 8]));
await registry.setEnabled("sample-skin", false);
assert.equal(await registry.readArchive("sample-skin"), null);
assert.equal(await registry.readPreview("sample-skin"), null);
await registry.setEnabled("sample-skin", true);
const replacement = { ...manifest, version: "2.0.0", content: undefined, preview: undefined };
const secondArchive = createZip([
["manifest.json", Buffer.from(JSON.stringify(replacement))],
["skin.css", Buffer.from('[data-ws-part="voice.member"] { border-radius: 0; }')],
]);
const second = await registry.save(secondArchive, "sample-skin");
assert.equal(second.version, "2.0.0");
assert.equal(second.installedAt, first.installedAt);
assert.equal(await registry.readPreview("sample-skin"), null);
assert.deepEqual(await registry.readArchive("sample-skin"), secondArchive);
assert.equal(await registry.remove("sample-skin"), true);
assert.deepEqual(await registry.list(), []);
assert.equal(await registry.readArchive("sample-skin"), null);
assert.equal(await registry.remove("sample-skin"), false);
});
test("custom skins can be enabled, disabled, and selected as the instance default", async (context) => {
const directory = await mkdtemp(path.join(os.tmpdir(), "webspeak-skin-settings-"));
context.after(() => rm(directory, { recursive: true, force: true }));
const registry = new SkinRegistry(directory);
const archive = createZip([
["manifest.json", Buffer.from(JSON.stringify({ ...manifest, content: undefined, preview: undefined }))],
["skin.css", Buffer.from("[data-ws-part=\"demo.voice-card\"] { color: teal; }")],
]);
const skin = await registry.save(archive, "sample-skin");
assert.equal(skin.enabled, true);
assert.equal(await registry.getDefaultSkinId(), "builtin.light");
await registry.setDefaultSkin("sample-skin");
assert.equal(await registry.getDefaultSkinId(), "sample-skin");
const disabled = await registry.setEnabled("sample-skin", false);
assert.equal(disabled.enabled, false);
assert.equal(await registry.readArchive("sample-skin"), null);
assert.equal(await registry.getDefaultSkinId(), "builtin.light");
await assert.rejects(registry.setDefaultSkin("sample-skin"), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_DEFAULT_INVALID");
await registry.setEnabled("sample-skin", true);
assert.deepEqual(await registry.readArchive("sample-skin"), archive);
await registry.setDefaultSkin("sample-skin");
assert.equal(await registry.remove("sample-skin"), true);
assert.equal(await registry.getDefaultSkinId(), "builtin.light");
});
test("the bundled KAAK skin can be selected as the instance default without a custom installation", async (context) => {
const directory = await mkdtemp(path.join(os.tmpdir(), "webspeak-skin-kaak-default-"));
context.after(() => rm(directory, { recursive: true, force: true }));
const registry = new SkinRegistry(directory);
await registry.setDefaultSkin("community.kaak-voice");
assert.equal(await registry.getDefaultSkinId(), "community.kaak-voice");
assert.deepEqual(await registry.list(), []);
});
test("server accepts validated declarative v2 layouts and rejects permissions or unregistered components", async (context) => {
const directory = await mkdtemp(path.join(os.tmpdir(), "webspeak-skin-v2-"));
context.after(() => rm(directory, { recursive: true, force: true }));
const registry = new SkinRegistry(directory);
const manifestV2 = {
...manifest,
schemaVersion: 2,
packageType: "layout-skin",
permissions: [],
layout: "layout.json",
content: undefined,
preview: undefined,
};
const layout = {
schemaVersion: 1,
pages: { home: { desktop: { "home.header": { x: 24, visible: true, background: "#123456" } } } },
};
const archive = createZip([
["manifest.json", Buffer.from(JSON.stringify(manifestV2))],
["skin.css", Buffer.from('[data-ws-part="home.header"] { color: teal; }')],
["layout.json", Buffer.from(JSON.stringify(layout))],
]);
const saved = await registry.save(archive, "sample-skin");
assert.equal(saved.id, "sample-skin");
assert.deepEqual(await registry.readArchive("sample-skin"), archive);
const permissionsArchive = createZip([
["manifest.json", Buffer.from(JSON.stringify({ ...manifestV2, permissions: ["network.fetch"] }))],
["skin.css", Buffer.from("")],
["layout.json", Buffer.from(JSON.stringify(layout))],
]);
await assert.rejects(registry.save(permissionsArchive, "sample-skin"), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_PERMISSION_INVALID");
const unknownManifestField = createZip([
["manifest.json", Buffer.from(JSON.stringify({ ...manifestV2, capabilities: ["network.fetch"] }))],
["skin.css", Buffer.from('[data-ws-part="home.header"] { color: teal; }')],
["layout.json", Buffer.from(JSON.stringify({ schemaVersion: 1, pages: {} }))],
]);
await assert.rejects(registry.save(unknownManifestField, "sample-skin"), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_MANIFEST_INVALID");
const unknownComponentArchive = createZip([
["manifest.json", Buffer.from(JSON.stringify(manifestV2))],
["skin.css", Buffer.from('[data-ws-part="voice.member"] { color: teal; }')],
["layout.json", Buffer.from(JSON.stringify({ schemaVersion: 1, pages: { home: { desktop: { "home.unknown": { x: 1 } } } } }))],
]);
await assert.rejects(registry.save(unknownComponentArchive, "sample-skin"), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_LAYOUT_INVALID");
});
test("server accepts v3 declarative components and rejects unapproved capability declarations", async (context) => {
const directory = await mkdtemp(path.join(os.tmpdir(), "webspeak-skin-v3-"));
context.after(() => rm(directory, { recursive: true, force: true }));
const registry = new SkinRegistry(directory);
const manifestV3 = {
...manifest,
schemaVersion: 3,
packageType: "open-skin",
content: undefined,
preview: undefined,
components: "components.json",
};
const components = {
schemaVersion: 1,
components: [{
id: "channels",
name: "Channels",
page: "voice",
accessibleName: "TeamSpeak channels",
permissions: ["session.channels.read", "session.channel.join"],
actions: { join: { type: "voice.joinChannel", args: { channelId: "{{channel.id}}" } } },
root: { tag: "nav", repeat: { path: "session.channels", as: "channel" }, children: [{ tag: "button", events: { dblclick: "join" }, children: [{ text: "{{channel.name}}" }] }] },
}],
};
const archive = createZip([
["manifest.json", Buffer.from(JSON.stringify(manifestV3))],
["skin.css", Buffer.from('[data-ws-part="voice.channel-group"] { display: none; }')],
["components.json", Buffer.from(JSON.stringify(components))],
]);
const saved = await registry.save(archive, "sample-skin");
assert.equal(saved.id, "sample-skin");
assert.deepEqual(await registry.readArchive("sample-skin"), archive);
const unapproved = structuredClone(components) as typeof components;
unapproved.components[0].permissions = ["network.fetch"];
const unsafeArchive = createZip([
["manifest.json", Buffer.from(JSON.stringify(manifestV3))],
["skin.css", Buffer.from("[data-ws-part=app] { color: red; }")],
["components.json", Buffer.from(JSON.stringify(unapproved))],
]);
await assert.rejects(registry.save(unsafeArchive, "sample-skin"), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_PLUGIN_INVALID");
});
test("server accepts a v3 open visual skin without a components document", async (context) => {
const directory = await mkdtemp(path.join(os.tmpdir(), "webspeak-skin-v3-visual-only-"));
context.after(() => rm(directory, { recursive: true, force: true }));
const registry = new SkinRegistry(directory);
const archive = createZip([
["manifest.json", Buffer.from(JSON.stringify({ ...manifest, schemaVersion: 3, packageType: "open-skin", content: undefined, preview: undefined }))],
["skin.css", Buffer.from('[data-ws-part="app"] { position: fixed; }')],
]);
const saved = await registry.save(archive, "sample-skin");
assert.equal(saved.id, "sample-skin");
assert.deepEqual(await registry.readArchive("sample-skin"), archive);
});
test("server applies the browser CSS scope and package-only resource policy to every stylesheet", async (context) => {
const directory = await mkdtemp(path.join(os.tmpdir(), "webspeak-skin-css-policy-"));
context.after(() => rm(directory, { recursive: true, force: true }));
const registry = new SkinRegistry(directory);
const unsafeLegacySelector = createZip([
["manifest.json", Buffer.from(JSON.stringify({ ...manifest, content: undefined, preview: undefined }))],
["skin.css", Buffer.from(".private-class { color: teal; }")],
]);
await assert.rejects(registry.save(unsafeLegacySelector, "sample-skin"), (error: unknown) =>
error instanceof SkinRegistryError && error.code === "SKIN_CSS_SELECTOR");
const remoteSkinCss = createZip([
["manifest.json", Buffer.from(JSON.stringify({ ...manifest, content: undefined, preview: undefined }))],
["skin.css", Buffer.from('[data-ws-part="app"] { background-image: url("https://example.invalid/track.png"); }')],
]);
await assert.rejects(registry.save(remoteSkinCss, "sample-skin"), (error: unknown) =>
error instanceof SkinRegistryError && error.code === "SKIN_EXTERNAL_RESOURCE");
const manifestV4 = {
...manifest,
schemaVersion: 4,
packageType: "open-skin",
content: undefined,
preview: undefined,
plugins: "plugins.json",
};
const plugins = {
schemaVersion: 1,
plugins: [{
id: "voice-toolbar",
name: "Voice toolbar",
version: "1.0.0",
apiVersion: 1,
page: "voice",
mode: "widget",
entry: "plugins/voice-toolbar/index.js",
style: "plugins/voice-toolbar/style.css",
assets: [],
permissions: [],
}],
};
const remotePluginCss = createZip([
["manifest.json", Buffer.from(JSON.stringify(manifestV4))],
["skin.css", Buffer.from('[data-ws-part="app"] { color: teal; }')],
["plugins.json", Buffer.from(JSON.stringify(plugins))],
["plugins/voice-toolbar/index.js", Buffer.from("export {}; ")],
["plugins/voice-toolbar/style.css", Buffer.from('.toolbar { background-image: u\\72l("https://example.invalid/track.png"); }')],
]);
await assert.rejects(registry.save(remotePluginCss, "sample-skin"), (error: unknown) =>
error instanceof SkinRegistryError && error.code === "SKIN_EXTERNAL_RESOURCE");
});
test("server validates v4 plugin manifests and package files without executing author code", async (context) => {
const directory = await mkdtemp(path.join(os.tmpdir(), "webspeak-skin-v4-"));
context.after(() => rm(directory, { recursive: true, force: true }));
const registry = new SkinRegistry(directory);
const manifestV4 = {
...manifest,
schemaVersion: 4,
packageType: "open-skin",
content: undefined,
preview: undefined,
plugins: "plugins.json",
};
const plugins = {
schemaVersion: 1,
plugins: [{
id: "voice-toolbar",
name: "Voice toolbar",
version: "1.0.0",
apiVersion: 1,
page: "voice",
mode: "widget",
entry: "plugins/voice-toolbar/index.js",
style: "plugins/voice-toolbar/style.css",
assets: ["plugins/voice-toolbar/assets/icon.png"],
permissions: ["session.channels.read"],
}],
};
const archive = createZip([
["manifest.json", Buffer.from(JSON.stringify(manifestV4))],
["skin.css", Buffer.from('[data-ws-part="app"] { position: fixed; }')],
["plugins.json", Buffer.from(JSON.stringify(plugins))],
["plugins/voice-toolbar/index.js", Buffer.from("export const render = () => document.createElement('button');")],
["plugins/voice-toolbar/style.css", Buffer.from(".toolbar { color: teal; }")],
["plugins/voice-toolbar/assets/icon.png", Buffer.from([1, 2, 3, 4])],
]);
const saved = await registry.save(archive, "sample-skin");
assert.equal(saved.id, "sample-skin");
assert.deepEqual(await registry.readArchive("sample-skin"), archive);
const layout = {
schemaVersion: 1,
pages: { voice: { desktop: { "skin.voice.runtime_plugin_root_voice-toolbar": { order: 2, visible: true } } } },
};
const archiveWithLayout = createZip([
["manifest.json", Buffer.from(JSON.stringify({ ...manifestV4, layout: "layout.json" }))],
["skin.css", Buffer.from('[data-ws-part="app"] { position: fixed; }')],
["plugins.json", Buffer.from(JSON.stringify(plugins))],
["plugins/voice-toolbar/index.js", Buffer.from("export const render = () => document.createElement('button');")],
["plugins/voice-toolbar/style.css", Buffer.from(".toolbar { color: teal; }")],
["plugins/voice-toolbar/assets/icon.png", Buffer.from([1, 2, 3, 4])],
["layout.json", Buffer.from(JSON.stringify(layout))],
]);
const layoutSaved = await registry.save(archiveWithLayout, "sample-skin");
assert.equal(layoutSaved.id, "sample-skin");
assert.deepEqual(await registry.readArchive("sample-skin"), archiveWithLayout);
const invalidLayoutArchive = createZip([
["manifest.json", Buffer.from(JSON.stringify({ ...manifestV4, layout: "layout.json" }))],
["skin.css", Buffer.from('[data-ws-part="app"] { position: fixed; }')],
["plugins.json", Buffer.from(JSON.stringify(plugins))],
["plugins/voice-toolbar/index.js", Buffer.from("export {}; ")],
["plugins/voice-toolbar/style.css", Buffer.from(".toolbar { color: teal; }")],
["plugins/voice-toolbar/assets/icon.png", Buffer.from([1, 2, 3, 4])],
["layout.json", Buffer.from(JSON.stringify({ schemaVersion: 1, pages: { voice: { desktop: { "voice.not-registered": { order: 2 } } } } }))],
]);
await assert.rejects(registry.save(invalidLayoutArchive, "sample-skin"), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_LAYOUT_INVALID");
const wasmPlugins = {
schemaVersion: 1,
plugins: [{
id: "bounded-widget",
name: "Bounded widget",
version: "1.0.0",
apiVersion: 1,
runtime: "wasm",
page: "voice",
mode: "widget",
entry: "plugins/bounded-widget/index.wasm",
assets: [],
permissions: [],
}],
};
const wasmManifest = { ...manifestV4, id: "wasm-skin" };
const wasmArchive = createZip([
["manifest.json", Buffer.from(JSON.stringify(wasmManifest))],
["skin.css", Buffer.from('[data-ws-part="app"] { position: fixed; }')],
["plugins.json", Buffer.from(JSON.stringify(wasmPlugins))],
["plugins/bounded-widget/index.wasm", Buffer.from([0, 97, 115, 109, 1, 0, 0, 0])],
]);
const wasmSaved = await registry.save(wasmArchive, "wasm-skin");
assert.equal(wasmSaved.id, "wasm-skin");
assert.deepEqual(await registry.readArchive("wasm-skin"), wasmArchive);
const missingEntry = createZip([
["manifest.json", Buffer.from(JSON.stringify(manifestV4))],
["skin.css", Buffer.from("[data-ws-part=app] { color: teal; }")],
["plugins.json", Buffer.from(JSON.stringify(plugins))],
]);
await assert.rejects(registry.save(missingEntry, "sample-skin"), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_RUNTIME_PLUGIN_FILE_MISSING");
const unlistedScript = createZip([
["manifest.json", Buffer.from(JSON.stringify(manifestV4))],
["skin.css", Buffer.from("[data-ws-part=app] { color: teal; }")],
["plugins.json", Buffer.from(JSON.stringify(plugins))],
["plugins/voice-toolbar/index.js", Buffer.from("export {};")],
["plugins/voice-toolbar/style.css", Buffer.from(".toolbar { color: teal; }")],
["plugins/voice-toolbar/assets/icon.png", Buffer.from([1, 2, 3, 4])],
["plugins/other/rogue.js", Buffer.from("export {};")],
]);
await assert.rejects(registry.save(unlistedScript, "sample-skin"), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_FILE_UNSUPPORTED");
});
test("skin registry rejects path traversal and mismatched local ZIP headers", async (context) => {
const directory = await mkdtemp(path.join(os.tmpdir(), "webspeak-skin-invalid-"));
context.after(() => rm(directory, { recursive: true, force: true }));
const registry = new SkinRegistry(directory);
const goodFiles: Array<[string, Buffer]> = [
["manifest.json", Buffer.from(JSON.stringify({ ...manifest, content: undefined, preview: undefined }))],
["skin.css", Buffer.from('[data-ws-part="voice.member"] { color: teal; }')],
];
await assert.rejects(registry.save(createZip([["../escape.png", Buffer.from([1])], ...goodFiles]), "sample-skin"), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_PATH_INVALID");
const mismatched = createZip(goodFiles);
mismatched[30] ^= 1;
await assert.rejects(registry.save(mismatched, "sample-skin"), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_ZIP_INVALID");
await writeFile(path.join(directory, "orphan.wskin"), createZip(goodFiles));
assert.equal(await registry.readArchive("orphan"), null);
assert.deepEqual(await registry.list(), []);
});
test("the four bundled skins cannot be replaced or removed through the registry", async (context) => {
const directory = await mkdtemp(path.join(os.tmpdir(), "webspeak-skin-builtins-"));
context.after(() => rm(directory, { recursive: true, force: true }));
const registry = new SkinRegistry(directory);
for (const id of ["builtin.light", "builtin.dark", "community.illusia-voice", "community.kaak-voice"]) {
await assert.rejects(registry.save(Buffer.alloc(22), id), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_BUILTIN_PROTECTED");
await assert.rejects(registry.remove(id), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_BUILTIN_PROTECTED");
await assert.rejects(registry.setEnabled(id, false), (error: unknown) => error instanceof SkinRegistryError && error.code === "SKIN_BUILTIN_PROTECTED");
}
});
function createZip(files: Array<[string, Buffer]>): Buffer {
const localRecords: Buffer[] = [];
const centralRecords: Buffer[] = [];
let localOffset = 0;
for (const [name, bytes] of files) {
const filename = Buffer.from(name, "utf8");
const checksum = crc32(bytes);
const local = Buffer.alloc(30 + filename.length + bytes.length);
local.writeUInt32LE(0x04034b50, 0);
local.writeUInt16LE(20, 4);
local.writeUInt16LE(0, 6);
local.writeUInt16LE(0, 8);
local.writeUInt32LE(checksum, 14);
local.writeUInt32LE(bytes.length, 18);
local.writeUInt32LE(bytes.length, 22);
local.writeUInt16LE(filename.length, 26);
filename.copy(local, 30);
bytes.copy(local, 30 + filename.length);
localRecords.push(local);
const central = Buffer.alloc(46 + filename.length);
central.writeUInt32LE(0x02014b50, 0);
central.writeUInt16LE(0x0314, 4);
central.writeUInt16LE(20, 6);
central.writeUInt16LE(0, 8);
central.writeUInt16LE(0, 10);
central.writeUInt32LE(checksum, 16);
central.writeUInt32LE(bytes.length, 20);
central.writeUInt32LE(bytes.length, 24);
central.writeUInt16LE(filename.length, 28);
central.writeUInt32LE(0x81a40000, 38);
central.writeUInt32LE(localOffset, 42);
filename.copy(central, 46);
centralRecords.push(central);
localOffset += local.length;
}
const centralDirectory = Buffer.concat(centralRecords);
const end = Buffer.alloc(22);
end.writeUInt32LE(0x06054b50, 0);
end.writeUInt16LE(files.length, 8);
end.writeUInt16LE(files.length, 10);
end.writeUInt32LE(centralDirectory.length, 12);
end.writeUInt32LE(localOffset, 16);
return Buffer.concat([...localRecords, centralDirectory, end]);
}
function crc32(bytes: Buffer): number {
let crc = 0xffffffff;
for (const byte of bytes) {
crc ^= byte;
for (let bit = 0; bit < 8; bit += 1) crc = crc & 1 ? (crc >>> 1) ^ 0xedb88320 : crc >>> 1;
}
return (crc ^ 0xffffffff) >>> 0;
}
+578
View File
@@ -0,0 +1,578 @@
import type { SkinCatalogEntry as SharedSkinCatalogEntry } from "../shared/skin-catalog.js";
import { compileSkinCss, SkinCssValidationError, type SkinCssSchemaVersion } from "../shared/skin-css.js";
import { parseSkinLayoutJson } from "../shared/skin-layout.js";
import { listSkinPluginAssetPaths, parseSkinPluginJson, type SkinPluginDocument } from "../shared/skin-plugin.js";
import {
listSkinRuntimePluginFilePaths,
parseSkinRuntimePluginJson,
SKIN_RUNTIME_PLUGIN_DOCUMENT_LIMIT_BYTES,
SKIN_RUNTIME_PLUGIN_SOURCE_LIMIT_BYTES,
SKIN_RUNTIME_PLUGIN_STYLE_LIMIT_BYTES,
type SkinRuntimePluginDocument,
} from "../shared/skin-runtime-plugins.js";
import { randomBytes } from "node:crypto";
import { mkdir, readFile, readdir, rename, stat, unlink, writeFile } from "node:fs/promises";
import path from "node:path";
import { inflateRawSync } from "node:zlib";
const MAX_ARCHIVE_BYTES = 20 * 1024 * 1024;
const MAX_EXPANDED_BYTES = 50 * 1024 * 1024;
const MAX_FILE_COUNT = 128;
const MAX_CSS_BYTES = 512 * 1024;
const MAX_CONTENT_BYTES = 256 * 1024;
const MAX_IMAGE_BYTES = 16 * 1024 * 1024;
const MAX_FONT_BYTES = 4 * 1024 * 1024;
const MAX_SKINS = 50;
const MAX_TOTAL_ARCHIVES = 200 * 1024 * 1024;
export const BUILTIN_SKIN_IDS = ["builtin.light", "builtin.dark", "community.illusia-voice", "community.kaak-voice"] as const;
const BUILTIN_SKIN_ID_SET = new Set<string>(BUILTIN_SKIN_IDS);
const EOCD_SIGNATURE = 0x06054b50;
const CENTRAL_SIGNATURE = 0x02014b50;
const LOCAL_SIGNATURE = 0x04034b50;
export interface SkinCatalogEntry extends SharedSkinCatalogEntry {
enabled: boolean;
}
export interface SkinRegistrySettings {
defaultSkinId: string;
}
interface SkinArchiveEntry {
path: string;
compressedSize: number;
expandedSize: number;
compression: number;
crc: number;
localOffset: number;
flags: number;
isDirectory: boolean;
unixFileType: number;
}
type ParsedSkinManifest = Omit<SkinCatalogEntry, "installedAt" | "previewUrl" | "previewMimeType" | "enabled"> & {
schemaVersion: 1 | 2 | 3 | 4;
packageType?: "layout-skin" | "open-skin";
entry: string;
layout?: string;
content?: string;
components?: string;
plugins?: string;
preview?: string;
};
export class SkinRegistryError extends Error {
constructor(message: string, readonly code: string) {
super(message);
this.name = "SkinRegistryError";
}
}
export function isBuiltinSkinId(id: string): boolean {
return BUILTIN_SKIN_ID_SET.has(id);
}
export class SkinRegistry {
constructor(private readonly directory: string) {}
async list(): Promise<SkinCatalogEntry[]> {
await mkdir(this.directory, { recursive: true });
const names = await readdir(this.directory);
const entries: SkinCatalogEntry[] = [];
for (const filename of names.filter((item) => item.endsWith(".json"))) {
try {
const value: unknown = JSON.parse(await readFile(path.join(this.directory, filename), "utf8"));
if (!isCatalogEntry(value) || filename !== `${value.id}.json`) continue;
const archiveInfo = await stat(path.join(this.directory, `${value.id}.wskin`)).catch(() => null);
if (!archiveInfo?.isFile() || archiveInfo.size < 22 || archiveInfo.size > MAX_ARCHIVE_BYTES) continue;
entries.push({ ...value, enabled: value.enabled !== false });
} catch {
// Ignore incomplete or stale metadata. The archive itself remains untouched.
}
}
return entries.sort((left, right) => left.name.localeCompare(right.name));
}
async save(bytes: Buffer, expectedId: string): Promise<SkinCatalogEntry> {
if (isBuiltinSkinId(expectedId)) throw new SkinRegistryError("Built-in skins cannot be replaced.", "SKIN_BUILTIN_PROTECTED");
if (!isSafeSkinId(expectedId)) throw new SkinRegistryError("Skin ID is invalid.", "SKIN_ID_INVALID");
const parsed = validateSkinArchive(bytes, expectedId);
await mkdir(this.directory, { recursive: true });
const current = await this.list();
const replacing = current.some((entry) => entry.id === expectedId);
if (!replacing && current.length >= MAX_SKINS) throw new SkinRegistryError("The instance already has the maximum number of skins.", "SKIN_LIMIT");
const archivePaths = await Promise.all(current.map(async (entry) => ({ id: entry.id, size: (await stat(path.join(this.directory, `${entry.id}.wskin`)).catch(() => ({ size: 0 }))).size })));
const totalBytes = archivePaths.reduce((sum, entry) => sum + (entry.id === expectedId ? 0 : entry.size), bytes.byteLength);
if (totalBytes > MAX_TOTAL_ARCHIVES) throw new SkinRegistryError("The total skin storage limit is 200 MiB.", "SKIN_STORAGE_LIMIT");
const previous = current.find((entry) => entry.id === expectedId);
const installedAt = previous?.installedAt ?? Date.now();
const catalog: SkinCatalogEntry = {
...parsed.manifest,
installedAt,
enabled: previous?.enabled ?? true,
...(parsed.previewMime ? { previewUrl: `/api/skins/${expectedId}/preview`, previewMimeType: parsed.previewMime } : {}),
};
const nonce = randomBytes(6).toString("hex");
const archiveTemp = path.join(this.directory, `.${expectedId}.${nonce}.tmp`);
const catalogTemp = path.join(this.directory, `.${expectedId}.${nonce}.json.tmp`);
const previewTemp = path.join(this.directory, `.${expectedId}.${nonce}.preview.tmp`);
try {
await writeFile(archiveTemp, bytes, { flag: "wx", mode: 0o600 });
await writeFile(catalogTemp, JSON.stringify(catalog), { flag: "wx", mode: 0o600 });
if (parsed.previewBytes) await writeFile(previewTemp, parsed.previewBytes, { flag: "wx", mode: 0o600 });
await rename(archiveTemp, path.join(this.directory, `${expectedId}.wskin`));
await rename(catalogTemp, path.join(this.directory, `${expectedId}.json`));
const previewPath = path.join(this.directory, `${expectedId}.preview`);
if (parsed.previewBytes) await rename(previewTemp, previewPath);
else await unlink(previewPath).catch(() => undefined);
} catch (error) {
await Promise.all([archiveTemp, catalogTemp, previewTemp].map((file) => unlink(file).catch(() => undefined)));
throw error;
}
return catalog;
}
async readArchive(id: string): Promise<Buffer | null> {
if (!isSafeSkinId(id)) return null;
if (!(await this.list()).some((entry) => entry.id === id && entry.enabled)) return null;
try { return await readFile(path.join(this.directory, `${id}.wskin`)); }
catch { return null; }
}
async readPreview(id: string): Promise<{ bytes: Buffer; mimeType: string } | null> {
if (!isSafeSkinId(id)) return null;
const catalog = (await this.list()).find((entry) => entry.id === id);
if (!catalog?.enabled || !catalog.previewUrl) return null;
const mimeType = catalog.previewMimeType || "application/octet-stream";
try {
const bytes = await readFile(path.join(this.directory, `${id}.preview`));
return { bytes, mimeType };
} catch { return null; }
}
async remove(id: string): Promise<boolean> {
if (isBuiltinSkinId(id)) throw new SkinRegistryError("Built-in skins cannot be removed.", "SKIN_BUILTIN_PROTECTED");
if (!isSafeSkinId(id)) return false;
const wasDefault = await this.getDefaultSkinId() === id;
const archive = path.join(this.directory, `${id}.wskin`);
const catalog = path.join(this.directory, `${id}.json`);
const preview = path.join(this.directory, `${id}.preview`);
const present = await Promise.all([archive, catalog, preview].map((file) => stat(file).then(() => true).catch(() => false))).then((items) => items.some(Boolean));
if (!present) return false;
await Promise.all([archive, catalog, preview].map((file) => unlink(file).catch((error: unknown) => {
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
})));
if (wasDefault) await this.setDefaultSkin("builtin.light");
return true;
}
async setEnabled(id: string, enabled: boolean): Promise<SkinCatalogEntry> {
if (isBuiltinSkinId(id)) throw new SkinRegistryError("Built-in skins cannot be disabled.", "SKIN_BUILTIN_PROTECTED");
const entry = (await this.list()).find((item) => item.id === id);
if (!entry) throw new SkinRegistryError("The skin was not found.", "SKIN_NOT_FOUND");
const wasDefault = await this.getDefaultSkinId() === id;
const updated = { ...entry, enabled };
await writeAtomicJson(path.join(this.directory, `${id}.json`), updated);
if (!enabled && wasDefault) await this.setDefaultSkin("builtin.light");
return updated;
}
async getDefaultSkinId(): Promise<string> {
try {
const value: unknown = JSON.parse(await readFile(path.join(this.directory, "settings.json"), "utf8"));
const id = value && typeof value === "object" ? (value as Record<string, unknown>).defaultSkinId : null;
if (typeof id !== "string") return "builtin.light";
if (isBuiltinSkinId(id)) return id;
const entry = (await this.list()).find((skin) => skin.id === id && skin.enabled);
return entry ? id : "builtin.light";
} catch {
return "builtin.light";
}
}
async setDefaultSkin(id: string): Promise<SkinRegistrySettings> {
if (!isBuiltinSkinId(id)) {
const entry = (await this.list()).find((skin) => skin.id === id && skin.enabled);
if (!entry) throw new SkinRegistryError("The default skin must be enabled and installed.", "SKIN_DEFAULT_INVALID");
}
await mkdir(this.directory, { recursive: true });
const settings = { defaultSkinId: id };
await writeAtomicJson(path.join(this.directory, "settings.json"), settings);
return settings;
}
}
async function writeAtomicJson(filename: string, value: unknown): Promise<void> {
const temporary = `${filename}.${randomBytes(6).toString("hex")}.tmp`;
try {
await writeFile(temporary, JSON.stringify(value), { flag: "wx", mode: 0o600 });
await rename(temporary, filename);
} catch (error) {
await unlink(temporary).catch(() => undefined);
throw error;
}
}
function validateSkinArchive(bytes: Buffer, expectedId?: string): { manifest: ParsedSkinManifest; previewBytes?: Buffer; previewMime?: string } {
const entries = inspectArchive(bytes);
const regularEntries = entries.filter((entry) => !entry.isDirectory);
const rootPrefix = singleRootPrefix(regularEntries.map((entry) => entry.path));
const fileBytes = new Map<string, Buffer>();
for (const entry of regularEntries) {
const packagePath = rootPrefix ? entry.path.slice(rootPrefix.length) : entry.path;
if (!isSafePackagePath(packagePath)) throw new SkinRegistryError("The package contains an unsafe path.", "SKIN_PATH_INVALID");
const content = extractEntry(bytes, entry);
if (content.byteLength !== entry.expandedSize || crc32(content) !== entry.crc) throw new SkinRegistryError("The package has a damaged file entry.", "SKIN_ZIP_INVALID");
if (fileBytes.has(packagePath.toLowerCase())) throw new SkinRegistryError("The package contains duplicate paths.", "SKIN_PATH_DUPLICATE");
fileBytes.set(packagePath, content);
}
const manifestBytes = fileBytes.get("manifest.json");
if (!manifestBytes || manifestBytes.byteLength > 32 * 1024) throw new SkinRegistryError("The package needs a small root-level manifest.json.", "SKIN_MANIFEST_MISSING");
const manifest = parseManifest(manifestBytes);
if (expectedId && manifest.id !== expectedId) throw new SkinRegistryError("The skin ID does not match the upload target.", "SKIN_ID_MISMATCH");
const cssBytes = fileBytes.get(manifest.entry);
if (!cssBytes || !cssBytes.byteLength || cssBytes.byteLength > MAX_CSS_BYTES) throw new SkinRegistryError("The CSS entry is missing or exceeds 512 KiB.", "SKIN_CSS_SIZE");
const cssSource = decodeUtf8(cssBytes, "The CSS entry is not valid UTF-8.");
let runtimePlugins: SkinRuntimePluginDocument | undefined;
if (manifest.plugins) {
const pluginsBytes = fileBytes.get(manifest.plugins);
if (!pluginsBytes || pluginsBytes.byteLength > SKIN_RUNTIME_PLUGIN_DOCUMENT_LIMIT_BYTES) {
throw new SkinRegistryError("plugins.json is missing or exceeds 256 KiB.", "SKIN_RUNTIME_PLUGIN_SIZE");
}
try { runtimePlugins = parseSkinRuntimePluginJson(decodeUtf8(pluginsBytes, "plugins.json is not valid UTF-8.")); }
catch (error) { throw new SkinRegistryError("plugins.json is invalid: " + (error instanceof Error ? error.message : "unknown plugin error"), "SKIN_RUNTIME_PLUGIN_INVALID"); }
}
const runtimePluginPaths = runtimePlugins ? listSkinRuntimePluginFilePaths(runtimePlugins) : [];
const runtimePluginPathSet = new Set(runtimePluginPaths.map((packagePath) => packagePath.toLowerCase()));
const manifestPathSet = ["manifest.json", manifest.entry, manifest.layout, manifest.content, manifest.components, manifest.plugins, manifest.preview]
.filter((packagePath): packagePath is string => Boolean(packagePath)).map((packagePath) => packagePath.toLowerCase());
if (runtimePluginPaths.some((packagePath) => manifestPathSet.includes(packagePath))) {
throw new SkinRegistryError("Plugin files cannot reuse skin manifest, CSS, content, component, or preview paths.", "SKIN_RUNTIME_PLUGIN_FILE_DUPLICATE");
}
for (const pluginPath of runtimePluginPaths) {
const data = fileBytes.get(pluginPath);
if (!data) throw new SkinRegistryError(`A declared plugin file is missing: ${pluginPath}`, "SKIN_RUNTIME_PLUGIN_FILE_MISSING");
const lowerPath = pluginPath.toLowerCase();
if (lowerPath.endsWith(".js")) {
if (data.byteLength > SKIN_RUNTIME_PLUGIN_SOURCE_LIMIT_BYTES) throw new SkinRegistryError("Plugin entry files must be smaller than 256 KiB.", "SKIN_RUNTIME_PLUGIN_SOURCE_SIZE");
decodeUtf8(data, "Plugin entry files must contain valid UTF-8.");
} else if (lowerPath.endsWith(".wasm")) {
if (data.byteLength > SKIN_RUNTIME_PLUGIN_SOURCE_LIMIT_BYTES) throw new SkinRegistryError("Wasm plugin entry files must be smaller than 256 KiB.", "SKIN_RUNTIME_PLUGIN_SOURCE_SIZE");
} else if (lowerPath.endsWith(".css")) {
if (data.byteLength > SKIN_RUNTIME_PLUGIN_STYLE_LIMIT_BYTES) throw new SkinRegistryError("Plugin style files must be smaller than 512 KiB.", "SKIN_RUNTIME_PLUGIN_STYLE_SIZE");
decodeUtf8(data, "Plugin style files must contain valid UTF-8.");
} else {
const mimeType = imageMime(pluginPath) ?? (lowerPath.endsWith(".woff2") ? "font/woff2" : null);
if (!mimeType) throw new SkinRegistryError(`Unsupported plugin asset: ${pluginPath}`, "SKIN_RUNTIME_PLUGIN_ASSET_INVALID");
if (mimeType.startsWith("image/") && data.byteLength > MAX_IMAGE_BYTES) throw new SkinRegistryError("Plugin images must be smaller than 16 MiB.", "SKIN_IMAGE_SIZE");
if (mimeType.startsWith("font/") && data.byteLength > MAX_FONT_BYTES) throw new SkinRegistryError("Plugin fonts must be smaller than 4 MiB.", "SKIN_FONT_SIZE");
}
}
let previewBytes: Buffer | undefined;
let previewMime: string | undefined;
for (const [packagePath, data] of fileBytes) {
if (["manifest.json", manifest.entry, manifest.layout, manifest.content, manifest.components, manifest.plugins, manifest.preview].includes(packagePath)
|| runtimePluginPathSet.has(packagePath.toLowerCase())) continue;
const mimeType = imageMime(packagePath) ?? (packagePath.toLowerCase().endsWith(".woff2") ? "font/woff2" : null);
if (!mimeType) throw new SkinRegistryError(`Unsupported package file: ${packagePath}`, "SKIN_FILE_UNSUPPORTED");
if (mimeType.startsWith("image/") && data.byteLength > MAX_IMAGE_BYTES) throw new SkinRegistryError("Each image must be smaller than 16 MiB.", "SKIN_IMAGE_SIZE");
if (mimeType.startsWith("font/") && data.byteLength > MAX_FONT_BYTES) throw new SkinRegistryError("Fonts must be smaller than 4 MiB.", "SKIN_FONT_SIZE");
}
const cssAssets = new Set([...fileBytes.keys()].filter((packagePath) =>
imageMime(packagePath) !== null || packagePath.toLowerCase().endsWith(".woff2")));
validateSkinCss(cssSource, manifest.id, cssAssets, manifest.schemaVersion);
for (const plugin of runtimePlugins?.plugins ?? []) {
if (!plugin.style) continue;
const styleBytes = fileBytes.get(plugin.style);
if (!styleBytes) throw new SkinRegistryError(`A declared plugin style is missing: ${plugin.style}`, "SKIN_RUNTIME_PLUGIN_FILE_MISSING");
const pluginCssAssets = new Set([...cssAssets].filter((packagePath) =>
packagePath.startsWith("assets/") || packagePath.startsWith(`plugins/${plugin.id}/assets/`)));
validateSkinCss(
decodeUtf8(styleBytes, "Plugin style files must contain valid UTF-8."),
manifest.id,
pluginCssAssets,
manifest.schemaVersion,
plugin.id,
);
}
if (manifest.content) {
const content = fileBytes.get(manifest.content);
if (!content || content.byteLength > MAX_CONTENT_BYTES) throw new SkinRegistryError("content.json is missing or exceeds 256 KiB.", "SKIN_CONTENT_SIZE");
decodeUtf8(content, "content.json is not valid UTF-8.");
try { JSON.parse(content.toString("utf8")); }
catch { throw new SkinRegistryError("content.json is not valid JSON.", "SKIN_CONTENT_INVALID"); }
}
if (manifest.layout) {
const layout = fileBytes.get(manifest.layout);
if (!layout || layout.byteLength > 128 * 1024) throw new SkinRegistryError("layout.json is missing or exceeds 128 KiB.", "SKIN_LAYOUT_SIZE");
try { parseSkinLayoutJson(decodeUtf8(layout, "layout.json is not valid UTF-8.")); }
catch (error) { throw new SkinRegistryError("layout.json is invalid: " + (error instanceof Error ? error.message : "unknown layout error"), "SKIN_LAYOUT_INVALID"); }
}
if (manifest.components) {
const components = fileBytes.get(manifest.components);
if (!components || components.byteLength > MAX_CONTENT_BYTES) throw new SkinRegistryError("components.json is missing or exceeds 256 KiB.", "SKIN_PLUGIN_SIZE");
let document: SkinPluginDocument;
try { document = parseSkinPluginJson(decodeUtf8(components, "components.json is not valid UTF-8.")); }
catch (error) { throw new SkinRegistryError("components.json is invalid: " + (error instanceof Error ? error.message : "unknown plugin error"), "SKIN_PLUGIN_INVALID"); }
for (const assetPath of listSkinPluginAssetPaths(document)) {
if (!fileBytes.has(assetPath) || !imageMime(assetPath)) throw new SkinRegistryError(`Component image asset is missing or unsupported: ${assetPath}`, "SKIN_PLUGIN_ASSET_INVALID");
}
}
if (manifest.preview) {
previewBytes = fileBytes.get(manifest.preview);
previewMime = imageMime(manifest.preview) ?? undefined;
if (!previewBytes || !previewMime || previewBytes.byteLength > MAX_IMAGE_BYTES) throw new SkinRegistryError("The preview must be a supported image inside the package.", "SKIN_PREVIEW_INVALID");
}
return { manifest, ...(previewBytes ? { previewBytes, previewMime } : {}) };
}
function validateSkinCss(
source: string,
skinId: string,
assets: Set<string>,
schemaVersion: SkinCssSchemaVersion,
pluginId?: string,
): void {
try { compileSkinCss(source, skinId, assets, schemaVersion, pluginId); }
catch (error) {
const cssError = error instanceof SkinCssValidationError
? error
: new SkinCssValidationError(error instanceof Error ? error.message : "The CSS file is invalid.", "SKIN_CSS_INVALID");
throw new SkinRegistryError(cssError.message, cssError.code);
}
}
function inspectArchive(bytes: Buffer): SkinArchiveEntry[] {
if (bytes.byteLength < 22 || bytes.byteLength > MAX_ARCHIVE_BYTES) throw new SkinRegistryError("A skin package must be smaller than 20 MiB.", "SKIN_ARCHIVE_SIZE");
const minOffset = Math.max(0, bytes.byteLength - 22 - 0xffff);
let endOffset = -1;
for (let offset = bytes.byteLength - 22; offset >= minOffset; offset -= 1) {
if (bytes.readUInt32LE(offset) === EOCD_SIGNATURE) { endOffset = offset; break; }
}
if (endOffset < 0) throw new SkinRegistryError("The upload is not a valid ZIP package.", "SKIN_ZIP_INVALID");
const disk = bytes.readUInt16LE(endOffset + 4);
const centralDisk = bytes.readUInt16LE(endOffset + 6);
const entriesOnDisk = bytes.readUInt16LE(endOffset + 8);
const entryCount = bytes.readUInt16LE(endOffset + 10);
const centralSize = bytes.readUInt32LE(endOffset + 12);
const centralOffset = bytes.readUInt32LE(endOffset + 16);
const commentLength = bytes.readUInt16LE(endOffset + 20);
if (disk !== 0 || centralDisk !== 0 || entriesOnDisk !== entryCount || entryCount === 0xffff || centralSize === 0xffffffff || centralOffset === 0xffffffff || endOffset + 22 + commentLength !== bytes.byteLength) {
throw new SkinRegistryError("Multi-disk and ZIP64 packages are not supported.", "SKIN_ZIP_FORMAT");
}
if (!entryCount || entryCount > MAX_FILE_COUNT || centralOffset + centralSize !== endOffset) throw new SkinRegistryError("The ZIP directory is invalid or contains too many files.", "SKIN_FILE_COUNT");
const decoder = new TextDecoder("utf-8", { fatal: true });
const entries: SkinArchiveEntry[] = [];
const seenPaths = new Set<string>();
let offset = centralOffset;
let totalExpanded = 0;
for (let index = 0; index < entryCount; index += 1) {
if (offset + 46 > endOffset || bytes.readUInt32LE(offset) !== CENTRAL_SIGNATURE) throw new SkinRegistryError("The ZIP directory entry is invalid.", "SKIN_ZIP_INVALID");
const madeBy = bytes.readUInt16LE(offset + 4);
const flags = bytes.readUInt16LE(offset + 8);
const compression = bytes.readUInt16LE(offset + 10);
const crc = bytes.readUInt32LE(offset + 16);
const compressedSize = bytes.readUInt32LE(offset + 20);
const expandedSize = bytes.readUInt32LE(offset + 24);
const nameLength = bytes.readUInt16LE(offset + 28);
const extraLength = bytes.readUInt16LE(offset + 30);
const fileCommentLength = bytes.readUInt16LE(offset + 32);
const diskStart = bytes.readUInt16LE(offset + 34);
const externalAttributes = bytes.readUInt32LE(offset + 38);
const localOffset = bytes.readUInt32LE(offset + 42);
const recordEnd = offset + 46 + nameLength + extraLength + fileCommentLength;
if (recordEnd > endOffset || diskStart !== 0 || flags & ~0x0800 || (compression !== 0 && compression !== 8) || compressedSize === 0xffffffff || expandedSize === 0xffffffff || localOffset === 0xffffffff) {
throw new SkinRegistryError("Encrypted, multi-disk, and unsupported ZIP entries are not allowed.", "SKIN_ZIP_FORMAT");
}
let entryPath: string;
try { entryPath = decoder.decode(bytes.subarray(offset + 46, offset + 46 + nameLength)); }
catch { throw new SkinRegistryError("ZIP filenames must be valid UTF-8.", "SKIN_PATH_INVALID"); }
if (!(flags & 0x800) && /[^\x00-\x7f]/.test(entryPath)) throw new SkinRegistryError("Non-ASCII ZIP filenames must be encoded as UTF-8.", "SKIN_PATH_INVALID");
if (!isSafePackagePath(entryPath, entryPath.endsWith("/"))) throw new SkinRegistryError("The package contains an unsafe path.", "SKIN_PATH_INVALID");
const normalizedPath = entryPath.toLowerCase();
if (seenPaths.has(normalizedPath)) throw new SkinRegistryError("The package contains duplicate or case-conflicting paths.", "SKIN_PATH_DUPLICATE");
seenPaths.add(normalizedPath);
const unixFileType = madeBy >> 8 === 3 ? (externalAttributes >>> 16) & 0xf000 : 0;
if (unixFileType !== 0 && unixFileType !== 0x8000 && unixFileType !== 0x4000) throw new SkinRegistryError("Only regular files and directories are allowed in a skin package.", "SKIN_FILE_TYPE");
const isDirectory = entryPath.endsWith("/");
if ((unixFileType === 0x4000) !== isDirectory && unixFileType !== 0) throw new SkinRegistryError("ZIP file type does not match its path.", "SKIN_FILE_TYPE");
if (isDirectory && (compressedSize !== 0 || expandedSize !== 0)) throw new SkinRegistryError("ZIP directory entries cannot contain data.", "SKIN_ZIP_INVALID");
if (compression === 0 && compressedSize !== expandedSize) throw new SkinRegistryError("A stored ZIP entry has inconsistent sizes.", "SKIN_ZIP_INVALID");
if (!isDirectory) {
totalExpanded += expandedSize;
if (totalExpanded > MAX_EXPANDED_BYTES) throw new SkinRegistryError("The expanded package exceeds 50 MiB.", "SKIN_EXPANDED_SIZE");
if (expandedSize > 1024 * 1024 && expandedSize > Math.max(compressedSize, 1) * 250) throw new SkinRegistryError("The package has an abnormal compression ratio.", "SKIN_COMPRESSION_RATIO");
}
entries.push({ path: entryPath, compressedSize, expandedSize, compression, crc, localOffset, flags, isDirectory, unixFileType });
offset = recordEnd;
}
if (offset !== centralOffset + centralSize) throw new SkinRegistryError("The ZIP directory length is inconsistent.", "SKIN_ZIP_INVALID");
validateLocalEntries(bytes, entries, centralOffset, decoder);
return entries;
}
function validateLocalEntries(bytes: Buffer, entries: SkinArchiveEntry[], centralOffset: number, decoder: TextDecoder): void {
const spans: Array<{ start: number; end: number }> = [];
for (const entry of entries) {
const offset = entry.localOffset;
if (offset + 30 > centralOffset || bytes.readUInt32LE(offset) !== LOCAL_SIGNATURE) throw new SkinRegistryError("A ZIP local file header is invalid.", "SKIN_ZIP_INVALID");
const flags = bytes.readUInt16LE(offset + 6);
const compression = bytes.readUInt16LE(offset + 8);
const crc = bytes.readUInt32LE(offset + 14);
const compressedSize = bytes.readUInt32LE(offset + 18);
const expandedSize = bytes.readUInt32LE(offset + 22);
const nameLength = bytes.readUInt16LE(offset + 26);
const extraLength = bytes.readUInt16LE(offset + 28);
const headerEnd = offset + 30 + nameLength + extraLength;
if (headerEnd > centralOffset || flags !== entry.flags || compression !== entry.compression || crc !== entry.crc || compressedSize !== entry.compressedSize || expandedSize !== entry.expandedSize) {
throw new SkinRegistryError("ZIP local and central headers disagree.", "SKIN_ZIP_INVALID");
}
let localPath: string;
try { localPath = decoder.decode(bytes.subarray(offset + 30, offset + 30 + nameLength)); }
catch { throw new SkinRegistryError("ZIP filenames must be valid UTF-8.", "SKIN_PATH_INVALID"); }
if (localPath !== entry.path) throw new SkinRegistryError("ZIP local and central filenames disagree.", "SKIN_ZIP_INVALID");
const end = headerEnd + entry.compressedSize;
if (end > centralOffset) throw new SkinRegistryError("A ZIP entry overlaps the central directory.", "SKIN_ZIP_INVALID");
spans.push({ start: offset, end });
}
spans.sort((left, right) => left.start - right.start);
for (let index = 1; index < spans.length; index += 1) {
if (spans[index].start < spans[index - 1].end) throw new SkinRegistryError("ZIP local file entries overlap.", "SKIN_ZIP_INVALID");
}
}
function extractEntry(archive: Buffer, entry: SkinArchiveEntry): Buffer {
const offset = entry.localOffset;
if (offset + 30 > archive.byteLength || archive.readUInt32LE(offset) !== LOCAL_SIGNATURE) throw new SkinRegistryError("A ZIP local file header is invalid.", "SKIN_ZIP_INVALID");
const flags = archive.readUInt16LE(offset + 6);
const compression = archive.readUInt16LE(offset + 8);
const nameLength = archive.readUInt16LE(offset + 26);
const extraLength = archive.readUInt16LE(offset + 28);
if (flags !== entry.flags || compression !== entry.compression) throw new SkinRegistryError("ZIP headers disagree about file compression.", "SKIN_ZIP_INVALID");
const dataStart = offset + 30 + nameLength + extraLength;
const dataEnd = dataStart + entry.compressedSize;
if (dataEnd > archive.byteLength) throw new SkinRegistryError("A ZIP entry extends past the archive.", "SKIN_ZIP_INVALID");
const compressed = archive.subarray(dataStart, dataEnd);
if (entry.compression === 0) return Buffer.from(compressed);
try { return inflateRawSync(compressed, { maxOutputLength: entry.expandedSize + 1 }); }
catch { throw new SkinRegistryError("A ZIP entry could not be safely decompressed.", "SKIN_ZIP_INVALID"); }
}
function parseManifest(bytes: Buffer): ParsedSkinManifest {
let raw: unknown;
try { raw = JSON.parse(decodeUtf8(bytes, "manifest.json is not valid UTF-8.")); }
catch { throw new SkinRegistryError("manifest.json must contain valid JSON.", "SKIN_MANIFEST_INVALID"); }
if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new SkinRegistryError("manifest.json must be an object.", "SKIN_MANIFEST_INVALID");
const value = raw as Record<string, unknown>;
const schemaVersion = value.schemaVersion;
if (schemaVersion !== 1 && schemaVersion !== 2 && schemaVersion !== 3 && schemaVersion !== 4) throw new SkinRegistryError("The skin schema version or ID is unsupported.", "SKIN_SCHEMA_VERSION");
if (schemaVersion >= 2) {
const fields = new Set(["schemaVersion", "packageType", "id", "name", "version", "author", "license", "description", "entry", "layout", "permissions", "content", "minAppVersion", "preview"]);
if (schemaVersion >= 3) { fields.delete("permissions"); fields.add("components"); }
if (schemaVersion === 4) fields.add("plugins");
const unknown = Object.keys(value).find((key) => !fields.has(key));
if (unknown) throw new SkinRegistryError(`Version 2 skin manifest contains an unsupported field: ${unknown}.`, "SKIN_MANIFEST_INVALID");
}
const read = (key: string, max: number): string => {
const item = value[key];
if (typeof item !== "string" || !item.trim() || item.length > max) throw new SkinRegistryError(`manifest.json has an invalid ${key} field.`, "SKIN_MANIFEST_INVALID");
return item.trim();
};
const id = read("id", 80);
if (!isSafeSkinId(id)) throw new SkinRegistryError("The skin schema version or ID is unsupported.", "SKIN_SCHEMA_VERSION");
if (schemaVersion === 2 && (value.packageType !== "layout-skin" || !Array.isArray(value.permissions) || value.permissions.length !== 0)) {
throw new SkinRegistryError("Layout skin packages must declare the layout-skin type and no executable permissions.", "SKIN_PERMISSION_INVALID");
}
if (schemaVersion === 3 && value.packageType !== "open-skin") throw new SkinRegistryError("Version 3 skin packages must declare the open-skin type.", "SKIN_MANIFEST_INVALID");
if (schemaVersion === 4 && value.packageType !== "open-skin") throw new SkinRegistryError("Version 4 skin packages must declare the open-skin type.", "SKIN_MANIFEST_INVALID");
if (schemaVersion === 1 && (value.layout !== undefined || value.packageType !== undefined || value.permissions !== undefined || value.components !== undefined || value.plugins !== undefined)) {
throw new SkinRegistryError("Version 1 skin packages cannot declare layout or plugin fields.", "SKIN_SCHEMA_VERSION");
}
const version = read("version", 32);
const minAppVersion = read("minAppVersion", 32);
if (!/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(version) || !/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(minAppVersion)) throw new SkinRegistryError("Skin and minimum app versions must use semantic version format.", "SKIN_MANIFEST_INVALID");
const entry = read("entry", 120);
const readOptional = (key: string, max: number): string | undefined => value[key] == null ? undefined : read(key, max);
const layout = schemaVersion === 2 ? read("layout", 120) : schemaVersion >= 3 ? readOptional("layout", 120) : undefined;
const content = readOptional("content", 120);
const components = schemaVersion >= 3 && value.components != null ? read("components", 120) : undefined;
const plugins = schemaVersion === 4 ? read("plugins", 120) : undefined;
const preview = readOptional("preview", 120);
for (const candidate of [entry, layout, content, components, plugins, preview].filter((item): item is string => Boolean(item))) if (!isSafePackagePath(candidate)) throw new SkinRegistryError("The manifest references an unsafe path.", "SKIN_PATH_INVALID");
if (!entry.toLowerCase().endsWith(".css") || (layout && !layout.toLowerCase().endsWith(".json")) || (content && !content.toLowerCase().endsWith(".json")) || (components && !components.toLowerCase().endsWith(".json")) || (plugins && !plugins.toLowerCase().endsWith(".json")) || (preview && !imageMime(preview))) throw new SkinRegistryError("The CSS entry, layout, content, plugin, or preview path is invalid.", "SKIN_MANIFEST_INVALID");
const declaredFiles = ["manifest.json", entry, ...(layout ? [layout] : []), ...(content ? [content] : []), ...(components ? [components] : []), ...(plugins ? [plugins] : []), ...(preview ? [preview] : [])].map((item) => item.toLowerCase());
if (new Set(declaredFiles).size !== declaredFiles.length) throw new SkinRegistryError("Manifest files must use separate package paths.", "SKIN_MANIFEST_INVALID");
const description = readOptional("description", 400);
return { schemaVersion, ...(schemaVersion === 2 ? { packageType: "layout-skin" as const } : schemaVersion >= 3 ? { packageType: "open-skin" as const } : {}), id, name: read("name", 80), version, author: read("author", 80), license: read("license", 80), minAppVersion, entry, ...(layout ? { layout } : {}), ...(content ? { content } : {}), ...(components ? { components } : {}), ...(plugins ? { plugins } : {}), ...(preview ? { preview } : {}), ...(description ? { description } : {}) };
}
function singleRootPrefix(paths: string[]): string {
if (!paths.length) return "";
const firstSlash = paths[0].indexOf("/");
if (firstSlash < 1) return "";
const prefix = paths[0].slice(0, firstSlash + 1);
return paths.every((item) => item.startsWith(prefix)) ? prefix : "";
}
function isSafePackagePath(value: string, allowDirectory = false): boolean {
const candidate = allowDirectory ? value.slice(0, -1) : value;
return Boolean(candidate) && !candidate.startsWith("/") && !candidate.includes("\\") && !candidate.includes("\0") && !/^[a-z]:/i.test(candidate)
&& candidate.split("/").every((part) => Boolean(part) && part !== "." && part !== ".." && !part.includes(":"));
}
function isSafeSkinId(value: unknown): value is string {
return typeof value === "string" && value.length <= 80 && /^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/.test(value) && !value.startsWith("builtin.");
}
function imageMime(filename: string): string | null {
switch (path.extname(filename).toLowerCase()) {
case ".png": return "image/png";
case ".jpg": case ".jpeg": return "image/jpeg";
case ".webp": return "image/webp";
case ".avif": return "image/avif";
case ".gif": return "image/gif";
default: return null;
}
}
function decodeUtf8(bytes: Buffer, message: string): string {
try { return new TextDecoder("utf-8", { fatal: true }).decode(bytes); }
catch { throw new SkinRegistryError(message, "SKIN_ENCODING_INVALID"); }
}
function isCatalogEntry(value: unknown): value is SkinCatalogEntry {
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
const item = value as Record<string, unknown>;
const semver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
if (!isSafeSkinId(item.id) || !isShortText(item.name, 80) || !isShortText(item.author, 80) || !isShortText(item.license, 80)) return false;
if (typeof item.version !== "string" || !semver.test(item.version) || typeof item.minAppVersion !== "string" || !semver.test(item.minAppVersion)) return false;
if (!Number.isSafeInteger(item.installedAt) || (item.installedAt as number) < 0) return false;
if (item.enabled !== undefined && typeof item.enabled !== "boolean") return false;
if (item.description !== undefined && (typeof item.description !== "string" || item.description.length > 400)) return false;
const hasPreview = item.previewUrl !== undefined || item.previewMimeType !== undefined;
return !hasPreview || (item.previewUrl === `/api/skins/${item.id}/preview` && ["image/png", "image/jpeg", "image/webp", "image/avif", "image/gif"].includes(String(item.previewMimeType)));
}
function isShortText(value: unknown, limit: number): value is string {
return typeof value === "string" && value.trim().length > 0 && value.length <= limit;
}
const crcTable = (() => {
const table = new Uint32Array(256);
for (let index = 0; index < table.length; index += 1) {
let value = index;
for (let bit = 0; bit < 8; bit += 1) value = value & 1 ? 0xedb88320 ^ (value >>> 1) : value >>> 1;
table[index] = value >>> 0;
}
return table;
})();
function crc32(bytes: Buffer): number {
let value = 0xffffffff;
for (const byte of bytes) value = crcTable[(value ^ byte) & 0xff] ^ (value >>> 8);
return (value ^ 0xffffffff) >>> 0;
}
+18 -1
View File
@@ -3,12 +3,15 @@ import { dirname } from "node:path";
import {
DEFAULT_TEAM_SPEAK_PORT,
parseTeamSpeakTargetParts,
parseTeamSpeakPort,
} from "./domain/teamspeak-target.js";
import { formatTeamSpeakConnectionTarget, parseTeamSpeakConnectionTarget } from "./domain/teamspeak-connection-target.js";
/** The only TeamSpeak state still read from the legacy JSON config. */
export interface AppConfig {
tsHost: string;
tsPort: number;
tsTarget?: string;
tsServerPassword: string;
}
@@ -34,8 +37,21 @@ export function migrateConfig(input: unknown): AppConfig {
: defaults.tsHost;
const rawPort = input.tsPort === undefined ? undefined : input.tsPort;
let target;
let tsTarget: string | undefined;
try {
target = parseTeamSpeakTargetParts(rawHost, toPortValue(rawPort), defaults.tsPort);
const connection = /^[0-9a-f:]+$/i.test(rawHost) && rawHost.indexOf(":") !== rawHost.lastIndexOf(":") && input.tsTarget === undefined
? { kind: "address" as const, target: parseTeamSpeakTargetParts(rawHost, toPortValue(rawPort), defaults.tsPort) }
: parseTeamSpeakConnectionTarget(typeof input.tsTarget === "string" ? input.tsTarget : rawHost);
if (connection.kind === "nickname") {
const port = toPortValue(rawPort);
if (input.tsTarget === undefined && port !== undefined && String(port).trim()) {
connection.port = parseTeamSpeakPort(port);
}
target = { host: connection.name, port: connection.port ?? defaults.tsPort };
tsTarget = formatTeamSpeakConnectionTarget(connection);
} else {
target = parseTeamSpeakTargetParts(rawHost, toPortValue(rawPort), defaults.tsPort);
}
} catch {
target = { host: defaults.tsHost, port: defaults.tsPort };
}
@@ -43,6 +59,7 @@ export function migrateConfig(input: unknown): AppConfig {
return {
tsHost: target.host,
tsPort: target.port,
...(tsTarget ? { tsTarget } : {}),
tsServerPassword: typeof input.tsServerPassword === "string" ? input.tsServerPassword : defaults.tsServerPassword,
};
}
+74
View File
@@ -0,0 +1,74 @@
import {
InvalidTeamSpeakTargetError,
formatTeamSpeakTarget,
parseTeamSpeakTarget,
parseTeamSpeakPort,
type TeamSpeakTarget,
} from "./teamspeak-target.js";
export const TEAM_SPEAK_NICKNAME_LOOKUP = "https://named.myteamspeak.com/lookup";
export type TeamSpeakConnectionTarget =
| { kind: "address"; target: TeamSpeakTarget }
| { kind: "nickname"; name: string; port?: number; lookupOnly?: true };
/** Single-label names follow the TeamSpeak nickname convention; localhost stays local. */
export function parseTeamSpeakConnectionTarget(value: string): TeamSpeakConnectionTarget {
const input = value.trim();
if (!input) throw new InvalidTeamSpeakTargetError("TeamSpeak server address is required");
if (/^https?:\/\//i.test(input)) {
let url: URL;
try { url = new URL(input); }
catch { throw new InvalidTeamSpeakTargetError("Invalid TeamSpeak nickname lookup URL"); }
if (url.origin !== "https://named.myteamspeak.com" || url.pathname !== "/lookup" || url.username || url.password) {
throw new InvalidTeamSpeakTargetError("Invalid TeamSpeak nickname lookup URL");
}
const names = url.searchParams.getAll("name");
if (names.length !== 1) throw new InvalidTeamSpeakTargetError("One TeamSpeak nickname is required");
// URLSearchParams decodes the query once, including form-encoded spaces.
const target = nicknameTarget(names[0]!, url.hash ? parseTeamSpeakPort(url.hash.slice(1)) : undefined);
// Keep an explicit registry lookup distinct from a local service name
// when the target is saved or split into the address and port fields.
if (/^[a-z0-9_-]+$/i.test(target.name)) target.lookupOnly = true;
return target;
}
if (input.startsWith("[") || input.indexOf(":") !== input.lastIndexOf(":")) {
return { kind: "address", target: parseTeamSpeakTarget(input) };
}
const separator = Math.max(input.indexOf("#"), input.indexOf(":"));
const host = (separator >= 0 ? input.slice(0, separator) : input).trim();
const port = separator >= 0 ? parseTeamSpeakPort(input.slice(separator + 1)) : undefined;
if (host.toLowerCase() === "localhost" || /^[a-z0-9._-]+\.[a-z0-9._-]*$/i.test(host)) {
return { kind: "address", target: parseTeamSpeakTarget(input) };
}
if (/[\/\\?#@\[\]:]/.test(host)) throw new InvalidTeamSpeakTargetError();
return nicknameTarget(host, port);
}
export function formatTeamSpeakConnectionTarget(target: TeamSpeakConnectionTarget): string {
if (target.kind === "address") return formatTeamSpeakTarget(target.target);
// A lookup URL preserves names that could otherwise be mistaken for a host or port.
if (target.lookupOnly || /[.\/\\?#@\[\]:]/.test(target.name) || target.name.toLowerCase() === "localhost") {
const url = createTeamSpeakNicknameLookup(target.name);
if (target.port !== undefined) url.hash = String(target.port);
return url.href;
}
return target.port === undefined ? target.name : `${target.name}:${target.port}`;
}
export function createTeamSpeakNicknameLookup(name: string): URL {
const url = new URL(TEAM_SPEAK_NICKNAME_LOOKUP);
url.searchParams.set("name", name);
return url;
}
function nicknameTarget(nameValue: string, port?: number): Extract<TeamSpeakConnectionTarget, { kind: "nickname" }> {
const name = nameValue.trim();
if (!name || name.length > 255 || /[\u0000-\u001f\u007f]/.test(name)) {
throw new InvalidTeamSpeakTargetError("Invalid TeamSpeak server nickname");
}
return { kind: "nickname", name, ...(port === undefined ? {} : { port }) };
}
+5 -1
View File
@@ -89,11 +89,15 @@ function createTarget(hostValue: string, portValue: string | number): TeamSpeakT
throw new InvalidTeamSpeakTargetError("Invalid TeamSpeak server address");
}
return { host, port: parseTeamSpeakPort(portValue) };
}
export function parseTeamSpeakPort(portValue: string | number): number {
const portText = String(portValue).trim();
if (!/^\d+$/.test(portText)) throw new InvalidTeamSpeakTargetError("TeamSpeak port must be a number");
const port = Number(portText);
if (!Number.isInteger(port) || port < 1 || port > 65535) {
throw new InvalidTeamSpeakTargetError("TeamSpeak port must be between 1 and 65535");
}
return { host, port };
return port;
}
+386 -15
View File
@@ -1,45 +1,416 @@
export type WebSpeakErrorCode =
| "invalid_target"
| "invalid_nickname"
| "nickname_in_use"
| "host_not_found"
| "unreachable"
| "connection_refused"
| "connection_reset"
| "timeout"
| "authentication_failed"
| "protocol_negotiation_failed"
| "channel_password_required"
| "identity_security_level_too_low"
| "identity_limit_reached"
| "client_version_outdated"
| "flooding"
| "banned"
| "kicked"
| "server_shutting_down"
| "server_full"
| "invalid_parameter_size"
| "connection_initialisation_failed"
| "protocol_negotiation_failed"
| "unknown";
export type ClientConnectionFailureCode =
| "INVALID_TARGET"
| "INVALID_NICKNAME"
| "NICKNAME_IN_USE"
| "HOST_NOT_FOUND"
| "UNREACHABLE"
| "CONNECTION_REFUSED"
| "CONNECTION_RESET"
| "TIMEOUT"
| "SERVER_PASSWORD_REQUIRED"
| "INVALID_SERVER_PASSWORD"
| "CHANNEL_PASSWORD_REQUIRED"
| "IDENTITY_SECURITY_LEVEL_TOO_LOW"
| "IDENTITY_LIMIT_REACHED"
| "CLIENT_VERSION_OUTDATED"
| "FLOOD_PROTECTION"
| "BANNED"
| "KICKED"
| "SERVER_SHUTTING_DOWN"
| "SERVER_FULL"
| "INVALID_PARAMETER"
| "PROTOCOL_NEGOTIATION_FAILED"
| "CONNECTION_INITIALISATION_FAILED"
| "CONNECTION_FAILED";
export interface TeamSpeakErrorDiagnostics {
name?: string;
code?: string;
id?: string;
serverMessage?: string;
message?: string;
syscall?: string;
address?: string;
port?: number | string;
cause?: string;
}
export class WebSpeakError extends Error {
readonly code: WebSpeakErrorCode;
readonly retryable: boolean;
readonly cause?: unknown;
readonly diagnostics: TeamSpeakErrorDiagnostics;
constructor(code: WebSpeakErrorCode, message: string, retryable: boolean, cause?: unknown) {
constructor(code: WebSpeakErrorCode, message: string, retryable: boolean, cause?: unknown, diagnostics: TeamSpeakErrorDiagnostics = {}) {
super(message);
this.name = "WebSpeakError";
this.code = code;
this.retryable = retryable;
this.cause = cause;
this.diagnostics = diagnostics;
}
}
/**
* TeamSpeak server error ids (SDK `public_errors.h`, shared by TS3 and TS6) that
* the gateway can name precisely. Ids that are absent on purpose fall through to
* the text heuristics below and finally to `unknown`, which still carries the raw
* server detail to the browser.
*/
export const TEAMSPEAK_SERVER_ERROR_IDS: Readonly<Record<string, WebSpeakErrorCode>> = {
// Client (0x02xx): nickname, capacity, identity, password, version, flooding.
"513": "nickname_in_use",
"515": "server_full",
"519": "identity_security_level_too_low",
"520": "authentication_failed",
"521": "identity_limit_reached",
"522": "client_version_outdated",
"524": "flooding",
// Parameter (0x06xx). 1541 is the generic "invalid parameter size" error;
// connection-specific classification decides whether that means a nickname.
"1536": "invalid_parameter_size",
"1537": "invalid_parameter_size",
"1538": "invalid_parameter_size",
"1539": "invalid_parameter_size",
"1540": "invalid_parameter_size",
"1541": "invalid_parameter_size",
"1542": "invalid_parameter_size",
"1543": "protocol_negotiation_failed",
// Connection (0x07xx). Keep only ids whose official meaning matches the
// normalized code; unrelated SDK operation errors must not be relabelled.
"1797": "connection_initialisation_failed",
"1798": "host_not_found",
"1805": "protocol_negotiation_failed",
"1806": "protocol_negotiation_failed",
// Server (0x04xx).
"1026": "server_shutting_down",
"1027": "server_full",
"1028": "authentication_failed",
"781": "channel_password_required",
// Accounting (0x0bxx): the slot and virtual-server limits both surface as a
// full server from the user's point of view.
"2816": "server_full",
"2817": "server_full",
// Ban (0x0dxx).
"3329": "banned",
"3330": "banned",
"3331": "flooding",
};
/**
* Default (English) message per normalized code. The browser translates these
* strings for zh/en/de, so keep them stable and never embed a raw server id here:
* the raw detail travels separately in `diagnostics`.
*/
export const WEBSPEAK_ERROR_MESSAGES: Readonly<Record<WebSpeakErrorCode, string>> = {
invalid_target: "The TeamSpeak server address is invalid",
invalid_nickname: "TeamSpeak refused the nickname: it must be 3-30 characters long",
nickname_in_use: "This nickname is already used by another user on the TeamSpeak server",
host_not_found: "TeamSpeak server hostname could not be resolved",
unreachable: "TeamSpeak server is unreachable",
connection_refused: "TeamSpeak server refused the connection",
connection_reset: "TeamSpeak connection was reset",
timeout: "TeamSpeak connection timed out",
authentication_failed: "TeamSpeak authentication failed",
channel_password_required: "The TeamSpeak channel requires a password",
identity_security_level_too_low: "This TeamSpeak identity's security level is below the server requirement",
identity_limit_reached: "This TeamSpeak identity already holds the maximum number of connections",
client_version_outdated: "The TeamSpeak server requires a newer client version",
flooding: "The TeamSpeak server's flood protection refused the connection",
banned: "You are banned from this TeamSpeak server",
kicked: "You were kicked from the TeamSpeak server",
server_shutting_down: "The TeamSpeak server is shutting down",
connection_initialisation_failed: "The TeamSpeak server refused the connection during initialisation",
server_full: "The TeamSpeak server is full",
invalid_parameter_size: "TeamSpeak refused a parameter because its length or value is out of range",
protocol_negotiation_failed: "TeamSpeak protocol negotiation failed",
unknown: "TeamSpeak connection failed",
};
// 不可重连的错误码集合:这些错误原样重连必然失败(如被封禁、昵称被占用等),
// 集合与消息表相邻存放便于审计重连决策;unknown 保持不可重连,防止未映射的
// 服务器拒绝演变成无限重连循环。
/**
* Codes for which reconnecting unchanged cannot succeed. Keeping the list next to
* the messages makes the retry decision auditable; `unknown` stays non-retryable
* so an unmapped server refusal can never turn into a reconnect loop.
*/
const NON_RETRYABLE_CODES: ReadonlySet<WebSpeakErrorCode> = new Set<WebSpeakErrorCode>([
"invalid_target",
"invalid_nickname",
"nickname_in_use",
"authentication_failed",
"channel_password_required",
"identity_security_level_too_low",
"identity_limit_reached",
"client_version_outdated",
"banned",
"kicked",
"invalid_parameter_size",
"connection_initialisation_failed",
"unknown",
]);
function createTeamSpeakError(code: WebSpeakErrorCode, cause: unknown, diagnostics: TeamSpeakErrorDiagnostics): WebSpeakError {
return new WebSpeakError(code, WEBSPEAK_ERROR_MESSAGES[code], !NON_RETRYABLE_CODES.has(code), cause, diagnostics);
}
/**
* Resolve a raw TeamSpeak server error id to a normalized code. Accepts the
* decimal form the SDK forwards (`err.id`, `id=515`) and the hex form used by the
* official headers (`0x0203`), because both shapes show up in logs.
*/
export function teamSpeakServerErrorCode(id: unknown): WebSpeakErrorCode | null {
if (id === undefined || id === null) return null;
const text = String(id).trim().toLocaleLowerCase();
if (/^\d{1,6}$/.test(text)) return TEAMSPEAK_SERVER_ERROR_IDS[String(Number(text))] ?? null;
const hexMatch = /^(?:0x)?([0-9a-f]{4,6})$/.exec(text);
if (hexMatch) return TEAMSPEAK_SERVER_ERROR_IDS[String(parseInt(hexMatch[1], 16))] ?? null;
return null;
}
// 归一化入口:按「服务器错误ID → 关键词启发式 → 异常类名 → 传输层特征」的
// 优先级,把 SDK/Node 抛出的原始错误收敛为带稳定错误码的 WebSpeakError。
export function normalizeTeamSpeakError(error: unknown): WebSpeakError {
if (error instanceof WebSpeakError) return error;
const candidate = error as { code?: unknown; message?: unknown } | null;
const code = typeof candidate?.code === "string" ? candidate.code : "";
const message = typeof candidate?.message === "string" ? candidate.message : String(error);
const text = `${code} ${message}`.toLocaleLowerCase();
const diagnostics = collectDiagnostics(error);
const text = diagnosticText(error).toLocaleLowerCase();
if (/password|authenticate|authentication|not authorized|invalid.*(credential|password)/.test(text)) {
return new WebSpeakError("authentication_failed", "TeamSpeak authentication failed", false, error);
// 1) A TeamSpeak server error id names the exact reason, so it outranks every
// keyword heuristic below. The inline scan keeps the `id=515` shape
// working even when the SDK does not attach the id as a structured field.
const inlineId = /\bid[\s=:]*(\d{3,5})\b/.exec(text)?.[1];
const serverErrorCode =
teamSpeakServerErrorCode(diagnostics.id) ?? teamSpeakServerErrorCode(diagnostics.code) ?? teamSpeakServerErrorCode(inlineId);
if (serverErrorCode) return createTeamSpeakError(serverErrorCode, error, diagnostics);
// 2) Explicit refusals that arrive without a stable id. Every pattern stays
// narrow on purpose: bare words such as "password", "network", "socket",
// "crypto" or "denied" also appear in unrelated Teamspeak messages and used
// to steal the classification from the real cause.
if (/nickname.{0,20}(length|size)/.test(text)) {
return createTeamSpeakError("invalid_nickname", error, diagnostics);
}
if (/timeout|timed out|ack timeout|idle timeout/.test(text)) {
return new WebSpeakError("timeout", "TeamSpeak connection timed out", true, error);
if (/invalid[\s_-]*parameter[\s_-]*size|parameter.{0,20}(size|out of range)/.test(text)) {
return createTeamSpeakError("invalid_parameter_size", error, diagnostics);
}
if (/econnrefused|enotfound|ehostunreach|enetunreach|network|socket|dns/.test(text)) {
return new WebSpeakError("unreachable", "TeamSpeak server is unreachable", true, error);
if (/nickname.{0,30}(in use|already (in )?use|taken|exists)|nickname_in_use/.test(text)) {
return createTeamSpeakError("nickname_in_use", error, diagnostics);
}
if (/protocol|handshake|crypto|init1/.test(text)) {
return new WebSpeakError("protocol_negotiation_failed", "TeamSpeak protocol negotiation failed", true, error);
if (/channel.{0,30}password|password.{0,30}channel|i_channel_password/.test(text)) {
return createTeamSpeakError("channel_password_required", error, diagnostics);
}
return new WebSpeakError("unknown", "TeamSpeak connection failed", false, error);
if (/security ?level|insufficient security|could not validate identity/.test(text)) {
return createTeamSpeakError("identity_security_level_too_low", error, diagnostics);
}
if (/too many clones|clone.{0,20}(limit|connected)|identity.{0,20}(limit|maximum|max).{0,20}connection/.test(text)) {
return createTeamSpeakError("identity_limit_reached", error, diagnostics);
}
if (/version.{0,25}(outdated|out of date|too old|not allowed|unsupported)|outdated.{0,25}version/.test(text)) {
return createTeamSpeakError("client_version_outdated", error, diagnostics);
}
if (/flood/.test(text)) {
return createTeamSpeakError("flooding", error, diagnostics);
}
if (/\bban(ned)?\b|blacklist|you may retry in/.test(text)) {
return createTeamSpeakError("banned", error, diagnostics);
}
if (/kicked/.test(text)) {
return createTeamSpeakError("kicked", error, diagnostics);
}
if (/server.{0,20}shut ?down|server_shutdown|server is shutting down/.test(text)) {
return createTeamSpeakError("server_shutting_down", error, diagnostics);
}
if (/failed[\s_-]*connection[\s_-]*initiali[sz]ation|connection initiali[sz]ation failed|failed to (initialise|initialize) the connection/.test(text)) {
return createTeamSpeakError("connection_initialisation_failed", error, diagnostics);
}
if (/server.{0,25}full|server is full|maximum (number of )?(clients|slots)|slot limit|client protocol limit/.test(text)) {
return createTeamSpeakError("server_full", error, diagnostics);
}
if (/invalid (server )?password|wrong (server )?password|password (is )?(invalid|incorrect|wrong)|password required|i_server_password|authentication failed|not authorized|invalid credential|login (failed|refused)/.test(text)) {
return createTeamSpeakError("authentication_failed", error, diagnostics);
}
// 3) SDK handshake/crypto error classes carry no numeric id at all, so match
// the class name before falling back to the message text.
const errorName = (diagnostics.name ?? "").toLocaleLowerCase();
if (/eaxtagmismatch|fakesignaturemismatch|cryptoinit|invalididentity|license/.test(errorName)) {
return createTeamSpeakError("protocol_negotiation_failed", error, diagnostics);
}
if (/alreadyconnected/.test(errorName)) {
return createTeamSpeakError("identity_limit_reached", error, diagnostics);
}
if (/timeout/.test(errorName)) {
return createTeamSpeakError("timeout", error, diagnostics);
}
// 4) Transport level failures reported by Node or the TLS layer.
if (/enotfound|eai_again|host not found|name or service not known|getaddrinfo/.test(text)) {
return createTeamSpeakError("host_not_found", error, diagnostics);
}
if (/econnrefused|connection refused/.test(text)) {
return createTeamSpeakError("connection_refused", error, diagnostics);
}
if (/econnreset|econnaborted|connection reset|connection aborted|socket hang up/.test(text)) {
return createTeamSpeakError("connection_reset", error, diagnostics);
}
if (/timeout|timed out|ack timeout|idle timeout|etimedout/.test(text)) {
return createTeamSpeakError("timeout", error, diagnostics);
}
if (/ehostunreach|enetunreach|network is unreachable|no route to host|unable to connect|transport error|unexpected eof/.test(text)) {
return createTeamSpeakError("unreachable", error, diagnostics);
}
if (/handshake|protocol|eax|crypto ?(init|handshake|setup)|init1|signature|license/.test(text)) {
return createTeamSpeakError("protocol_negotiation_failed", error, diagnostics);
}
return createTeamSpeakError("unknown", error, diagnostics);
}
export function clientConnectionFailureCode(error: WebSpeakError, serverPassword = ""): ClientConnectionFailureCode {
if (error.code === "authentication_failed") {
return serverPassword.trim() ? "INVALID_SERVER_PASSWORD" : "SERVER_PASSWORD_REQUIRED";
}
const mapping: Record<WebSpeakErrorCode, ClientConnectionFailureCode> = {
invalid_target: "INVALID_TARGET",
invalid_nickname: "INVALID_NICKNAME",
nickname_in_use: "NICKNAME_IN_USE",
host_not_found: "HOST_NOT_FOUND",
unreachable: "UNREACHABLE",
connection_refused: "CONNECTION_REFUSED",
connection_reset: "CONNECTION_RESET",
timeout: "TIMEOUT",
authentication_failed: "SERVER_PASSWORD_REQUIRED",
channel_password_required: "CHANNEL_PASSWORD_REQUIRED",
identity_security_level_too_low: "IDENTITY_SECURITY_LEVEL_TOO_LOW",
identity_limit_reached: "IDENTITY_LIMIT_REACHED",
client_version_outdated: "CLIENT_VERSION_OUTDATED",
flooding: "FLOOD_PROTECTION",
banned: "BANNED",
kicked: "KICKED",
server_shutting_down: "SERVER_SHUTTING_DOWN",
connection_initialisation_failed: "CONNECTION_INITIALISATION_FAILED",
server_full: "SERVER_FULL",
// During the initial connect handshake this generic TeamSpeak id is most
// commonly emitted for an invalid nickname length/format. Operation errors
// still retain the generic invalid_parameter_size message.
invalid_parameter_size: "INVALID_NICKNAME",
protocol_negotiation_failed: "PROTOCOL_NEGOTIATION_FAILED",
unknown: "CONNECTION_FAILED",
};
return mapping[error.code];
}
/**
* Normalize the SDK `kicked` event. TeamSpeak reports a kick/ban as a
* `clientleftview` whose reason id is 4 (kicked) or 5 (kicked with ban) and whose
* `reasonMsg` is written by the admin, e.g. "Slow down!" or "you may retry in
* 300 seconds". Before this helper existed the reason text was dropped and the
* browser only showed a generic connection failure, which is exactly the
* experience this translation layer removes. The ban/kick split prefers the
* server text and falls back to reason id 5.
*/
export function normalizeTeamSpeakKickedReason(reasonMsg: unknown, reasonId?: unknown): WebSpeakError {
const text = typeof reasonMsg === "string" ? reasonMsg.trim() : "";
const numericReasonId = typeof reasonId === "number" ? reasonId : Number(reasonId);
const isBan = /\bban(ned)?\b|blacklist|you may retry in/i.test(text) || numericReasonId === 5;
const diagnostics: TeamSpeakErrorDiagnostics = { name: isBan ? "TeamSpeakBan" : "TeamSpeakKick" };
if (text) diagnostics.serverMessage = text;
if (Number.isFinite(numericReasonId)) diagnostics.id = String(numericReasonId);
return createTeamSpeakError(isBan ? "banned" : "kicked", reasonMsg, diagnostics);
}
/** Format useful SDK/Node details for a safe operational log field. */
export function describeTeamSpeakError(error: WebSpeakError): string {
const details = error.diagnostics;
const parts = [
details.name,
details.code,
details.id ? `id=${details.id}` : "",
details.serverMessage,
details.syscall,
details.address ? `address=${details.address}` : "",
details.port !== undefined ? `port=${details.port}` : "",
details.cause,
details.message,
].filter(Boolean);
return parts.length ? parts.join("; ") : error.message;
}
function diagnosticText(error: unknown): string {
const values: string[] = [];
let current: unknown = error;
const seen = new Set<unknown>();
for (let depth = 0; depth < 4 && current && !seen.has(current); depth += 1) {
seen.add(current);
if (current instanceof Error) values.push(current.name, current.message);
else values.push(String(current));
if (typeof current === "object") {
const candidate = current as { code?: unknown; id?: unknown; serverMessage?: unknown; cause?: unknown };
for (const value of [candidate.code, candidate.id, candidate.serverMessage]) if (value !== undefined) values.push(String(value));
current = candidate.cause;
} else break;
}
return values.join(" ");
}
function collectDiagnostics(error: unknown): TeamSpeakErrorDiagnostics {
const result: TeamSpeakErrorDiagnostics = {};
let current: unknown = error;
const seen = new Set<unknown>();
for (let depth = 0; depth < 4 && current && !seen.has(current); depth += 1) {
seen.add(current);
if (current instanceof Error) {
result.name ??= current.name;
result.message ??= current.message;
const errorRecord = current as Error & Record<string, unknown>;
if (typeof errorRecord.code === "string" || typeof errorRecord.code === "number") result.code ??= String(errorRecord.code);
if (typeof errorRecord.id === "string" || typeof errorRecord.id === "number") result.id ??= String(errorRecord.id);
if (typeof errorRecord.serverMessage === "string") result.serverMessage ??= errorRecord.serverMessage;
if (typeof errorRecord.syscall === "string") result.syscall ??= errorRecord.syscall;
if (typeof errorRecord.address === "string") result.address ??= errorRecord.address;
if (typeof errorRecord.port === "string" || typeof errorRecord.port === "number") result.port ??= errorRecord.port;
const cause = current.cause;
if (cause && cause !== current) { current = cause; continue; }
break;
}
if (typeof current !== "object") { result.cause ??= String(current); break; }
const candidate = current as Record<string, unknown>;
if (typeof candidate.name === "string") result.name ??= candidate.name;
if (typeof candidate.code === "string" || typeof candidate.code === "number") result.code ??= String(candidate.code);
if (typeof candidate.id === "string" || typeof candidate.id === "number") result.id ??= String(candidate.id);
if (typeof candidate.serverMessage === "string") result.serverMessage ??= candidate.serverMessage;
if (typeof candidate.message === "string") result.message ??= candidate.message;
if (typeof candidate.syscall === "string") result.syscall ??= candidate.syscall;
if (typeof candidate.address === "string") result.address ??= candidate.address;
if (typeof candidate.port === "string" || typeof candidate.port === "number") result.port ??= candidate.port;
const cause = candidate.cause;
if (cause && cause !== current) { current = cause; continue; }
break;
}
return result;
}
Loaded 100 of 466 files, more files were not shown because too many files have changed in this diff. Show more