Document accumulated interoperability findings and current source-backed design. Record build-specific visual results, matched acceleration policy, passing packaged behavior checks, and explicit native/ARM and strict visual acceptance limits. No complete 1:1 claim.
11 KiB
Theme extensions (local, account-free)
TeamsPeach reads third-party themes in the TeamSpeak 6 extension format and applies them like the official client's "User Theme" setting. Everything is local. There is no store, no download, no account and no Remote Apps API (the Remote Apps API is excluded on purpose).
Where themes go
<profile>/extensions/<identifier>/. <profile> is Electron's userData directory (the same folder as
prefs.json; disposable test profiles use TEAMSPEACH_PROFILE_DIR). Settings → Appearance → User Theme
shows this path. When the toggle is on it also has Open Extension Directory (opens the folder in the OS
file manager after a click) and Reload themes.
Each extension is one folder named exactly like its lowercase identifier, containing a package.json,
the variant stylesheets, the preview images and any fonts or images the CSS uses:
extensions/
org.example.purple/
package.json
preview.png ← package "image"
purple.css ← content.themes[].source
purple-preview.svg ← content.themes[].image
fonts/inter.woff2 ← referenced from purple.css as url(fonts/inter.woff2)
Format: same as the official one
package.json is checked against the official schema docs/extensions.json, which ships with TS6
(JSON Schema draft-07). The check in app/main/themes.js validatePackage is a complete hand transcription
of that schema: additionalProperties: false everywhere, every required list, the identifier, SemVer,
https:// and room patterns, all length limits counted in code points, uniqueItems, at most 20 variants,
and engines.teamspeak as an integer ≥ 1. One consequence: a "$schema" key is rejected, because the
official schema does not allow it either. Each rejected folder is listed under "Skipped folders" with its
reason; it does not stop the other extensions from loading.
Checks TeamsPeach adds on top of the schema, and why:
| Rule | Reason |
|---|---|
The folder name must equal identifier (this one is official, Extensions.md "Naming conventions") |
— |
| Variant names must be unique within an extension | The selection key is <identifier>//<name>; the official filter(...)[0] would silently take the first match |
source must end in .css |
Only the stylesheet MIME type is served |
image and every referenced file must be a relative path inside the extension folder (no .., \, : or absolute paths; at most 8 levels, 512 characters) |
The schema leaves the package image unconstrained |
| No symbolic links or junctions: neither the extensions root, an extension folder nor any file on the resource path | Root and extension directories are checked again on every serve; replacing a cached directory with a junction is refused |
Size limits: package.json 64 KiB, CSS 2 MiB, each image or font 4 MiB; at most 64 extension folders and 1024 root entries are examined |
Reads are bounded; the scan counts ignored files as well. File-handle identity and size are checked during reads |
| Content must match the type: PNG/JPEG/GIF/WebP magic bytes, SVG UTF-8, WOFF/WOFF2/TTF/OTF signatures | Served with nosniff; SVG scripts, event handlers, foreign objects, XML entities and external references are additionally rejected. Image context and resource CSP remain the security boundary |
Selection, fallback, reload: same as the official client
Observed in the installed TS6 6.0.0.5163 html/client_ui/main.js (SHA-256 9d6bea2e…9b82c39; character
offsets):
applyUserStyle@1369504: inserts or updates<link rel="stylesheet" id="userStyle" href=source>in<head>. A selection that no installed extension provides resets the saveduser_styleto null, i.e. the stock theme.getThemeForIdentifier@1369874: the selection string is"<identifier>//<variant name>", split at the first//.refreshAvailableUserStyles@1370283: readsgetInstalledThemes(@2726754) at most once every 300,000 ms unless the refresh is forced. It also accepts the older object form{extensionIdentifier, name}.disableUserStyle@1370144 and AppearanceonChatUserStyles@4814713: turning off the "User Theme" toggle removes the sheet and clears the selection.- Picker component
ts-settings-theme-picker@4804791 /.ts-user-style-container@4804972: the extension cards, then the variant cards sorted by name, the tooltip "Theme: … Author: …", the open-folder action (tsdlf:extension/<id>@4803573,tsdlf:extensionInstallDir@4799042) and the homepage/repository/e-mail actions.
TeamsPeach does the same:
prefs.userStylestores"<identifier>//<variant>"ornull; a value that fails validation loads asnull.- On startup, before Settings is ever opened, the renderer asks main for the list. If the saved variant is
installed, its stylesheet is appended as the last
<link id="userStyle">in<head>. If it is not installed, main clearsuserStyleand the user gets a notice. - The list is cached for 5 minutes. It is re-read when the picker becomes visible and the cache has
expired, or immediately with Reload themes. Resource URLs carry a
?v=<mtime>stamp, and responses are sent withCache-Control: no-store. - The object form
{extensionIdentifier, name}is accepted when a selection is made. TeamsPeach itself never stored that form, so no data migration is needed. - Switching variants keeps the previous sheet until the new one has loaded, so the stock theme does not flash in between.
- If the selected sheet fails to load, because the file is missing or the loader refused it (see below),
the link is removed and the stock theme is shown with an error. The selection is kept, so fixing the
file and pressing Reload themes brings the theme back. The official client would instead keep a
broken
<link>. - Homepage, repository and e-mail links are taken in main from the validated
package.json:https://only, ormailto:built from the author's e-mail. The renderer asks for an inline confirmation that shows the exact URL before main opens it. In offscreen test sessions folders and links are never opened.
Security boundary (no scripts, no remote content)
Extensions.md says: "remote content is not allowed to be loaded or accessed by extensions". TeamsPeach enforces that as follows:
- Files are served only through the custom
tsext://<identifier>/<path>scheme (standard, secure, corsEnabled; no fetch API, no service workers, no CSP bypass). The app page CSP changes only by addingtsext:tostyle-src,img-srcandfont-src.script-src 'self'andconnect-src 'none'are untouched, so the page can neither run norfetchextension files. Navigation totsext:is blocked like any other non-app URL. - What the scheme handler serves: the selected variant's stylesheet, plus fonts and images from the
selected extension's folder. For every other installed extension it serves only the declared preview
images. Every other request gets 403 or 404. Responses carry
Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; img-src data:; sandbox,nosniff, andAccess-Control-Allow-Originfor the app origin only (needed because@font-faceloads are CORS requests). - Before serving, the CSS is tokenized with escapes decoded and comments removed, so
@\69mportoru\72l(cannot hide anything. Any@importrejects the whole file. So does anyurl(),src()orimage-set()reference that is not a fragment, adata:URI or a relative path inside the extension. Even if the scanner missed something, the page CSP blocks remote images, fonts and stylesheets. - CSS is never executed as script. SVG previews load as images, where scripts never run.
Compatibility with existing TS6 themes
TS6 themes restyle the client by overriding --tsv-* custom properties and by targeting the official
Vue DOM classes. TeamsPeach declares the official stock token names at the same specificity as the official
:root,::after,::before{…} (plain :root, with light values in @media (prefers-color-scheme: light)).
Since the user sheet comes last, theme overrides of those tokens take effect. The exact token list is in
DESIGN.md (owned by the visual layer).
TeamsPeach's DOM does not use the official component class names. Rules that target official classes
such as .tsv-activity-primary or .ts-widget therefore match nothing. So a third-party theme is
format-compatible and token-compatible only: it loads, and its --tsv-* colour, font and size
overrides apply, but layout or component rules written for the official DOM do not. The settings picker
itself uses the official ts-user-style-* class names.
Display Size uses the installed client's Small/Large token overrides (main.js modules 53225/68865),
not browser zoom; Medium uses stock tokens. displaySize, treeStyle and chatStyle persist locally,
with Medium and Detailed defaults. The renderer applies data-display-size, data-tree-style and
data-chat-style to the root; compact chat/tree use their own structural/layout rules. User-theme CSS
is still loaded after stock styles and can deliberately override those variables.
Licences
- No official TeamSpeak theme assets, CSS or images are copied into this repository. The two official
documents
docs/Extensions.md(SHA-256e962fd29…a7431bd6) anddocs/extensions.json(fca0ae73…b5358633) were read from the local installation and are cited here, not redistributed. The validator re-expresses the schema's constraints in code. - Test fixtures are generated at run time (
test/fixtures/themes-fixture.cjs: 1×1 PNGs, a rectangle SVG, a WOFF2-signature stub). The offscreen smoke copies a TrueType font that is already installed on the host (Arial/Segoe UI/DejaVu) into its disposable profile, uses it, and deletes it; the font is never committed. - Each third-party theme keeps its own licence (
licensein itspackage.json, shown in the picker). TeamsPeach does not redistribute themes.
Tests
node --test test/themes.test.jscovers: the schema (including the official Extensions.md example); the selection format; the CSS policy (including escaped@import/url); scanning with traversal, link, junction, size, JSON, folder-name and duplicate-name cases; the 64-folder limit; persistence and the fallback to stock when a theme is missing; the 5-minute cache and forced refresh; the scheme handler's serving policy and headers; shell actions disabled in test mode; and the IPC sender check. Root-junction and cached-extension replacement regressions also cover request-time confinement; active SVG regressions cover script, event-handler, external-reference and XML-entity refusal.node scripts/smoke-user-styles.mjs --out <dir> [--exe <packaged.exe>]runs the real app through the hidden, non-focusable, offscreen, muted harness with a disposable profile and generated extensions. It covers the stock first run; picker previews decoded fromtsext:; the selected variant's custom property and rule actually computed; extension font and image loaded, while another extension's image, a remote image andfetch(tsext:)are blocked; a variant switch; refresh discovering a new extension; a refused stylesheet falling back to stock with the selection kept; restart re-applying the saved variant before Settings opens; and a removed extension falling back to stock and clearing the selection.