Files
client/docs/themes.md
T

7.8 KiB

Theme extensions (local, account-free)

The native client imports TeamSpeak 6 extension packages as data, not as an executable stylesheet or browser page. native/src/services/themes.rs owns scanning/selection; themes/package.rs, themes/css.rs and themes/resources.rs validate packages, import supported tokens and confine resources. Rust/Slint has no DOM, JavaScript engine, extension store, download service, account or Remote Apps API.

Where themes go

<native-profile>/extensions/<identifier>/. The native profile is separate from historical profiles; an absolute TEAMSPEACH_PROFILE_DIR selects an explicit root. First-run profile import copies extensions without modifying the source. Appearance exposes installed packages/variants, selection, diagnostics and reload. Opening a directory or external package link requires an explicit authorized platform action; isolated smoke must not open either.

Each extension is a lowercase-identifier folder with its own package.json, CSS variants and declared local previews/fonts/images:

extensions/
  org.example.purple/
    package.json
    preview.png
    purple.css
    purple-preview.svg
    fonts/inter.woff2

This package metadata filename is part of the third-party theme format, not a repository build dependency.

Package and resource contract

The original TS6 draft-07 extension schema was observed in the installed client's docs/extensions.json. Its constraints are independently expressed in the native validator: strict properties/required fields, identifier and SemVer constraints, HTTPS/room patterns, Unicode-scalar length bounds, uniqueness, at most 20 variants and integer engines.teamspeak >= 1. The source schema rejects a $schema property. Invalid folders must be reported individually, not prevent valid packages from loading.

Additional confinement and determinism requirements remain:

Rule Reason
Folder equals identifier; variant names are unique Stable <identifier>//<name> selection, no ambiguous first match
Variant source ends in .css Only supported stylesheet data is imported
Resource paths are relative and confined; no traversal, backslashes, colon or absolute paths; at most 8 levels/512 characters Package previews are untrusted input
No symlinks/junctions in roots, packages or resource paths; repeat validation during access Cached directory replacement cannot escape confinement
Metadata 64 KiB, CSS 2 MiB, image/font 4 MiB, at most 64 folders and 1024 examined root entries Bounded parsing/scanning; ignored entries count too
Image/font signatures checked; SVG rejects scripts, handlers, foreign objects, XML entities and external references Never execute extension content

ThemeService::asset authorizes selected-extension resources and declared previews, not arbitrary files in installed folders. Package links are validated metadata; they do not authorize opening a destination without the privacy confirmation policy.

Selection, fallback and reload

prefs.userStyle retains <identifier>//<variant> or null. The older selection object {extensionIdentifier, name} is normalized by the native service. Selection persistence uses the same atomic preferences transaction as other settings.

The service caches scans for 300 seconds and supports forced reload. A saved variant missing from a valid scan returns stock theme and a diagnostic and clears selection through the persistence callback. CSS/resource failure must show an error and stock presentation rather than silently claiming the selected theme works. Preview resolution does not select/persist a theme or grant selected-theme access. Reload/restart must re-resolve the saved selection before it is presented as active.

These are observable contracts, not an assertion that every target's picker/reload failure case has passed native acceptance.

Supported CSS subset, not a browser engine

cssparser imports custom-property data into a resolved native theme. The importer preserves approved declaration order/specificity and !important, variable references and supported color/length/font values. Stock values are in native/src/services/themes/stock.css; Slint presentation is in native/ui/theme.slint. Native font bytes pass the confined resource policy before registration. CSS Color 4 colors are converted to the UI's sRGB surface.

Remote URLs and @import are rejected, including escaped spellings; local references are confined. Unsupported selectors, component rules, transforms or animations require diagnostics, never an invented claim of support. The supported subset is defined by themes/css.rs, not by a browser fallback.

Official Vue/DOM component selectors do not apply to Slint. Package identity and supported --tsv-* token overrides are retained, but full CSS/layout compatibility is not promised. A token accepted by the importer is not proof that every native component consumes it; rendered consumer acceptance is separate. Display Size, tree/chat style and other appearance choices retain their behavioral requirements without a DOM root or browser zoom.

Historical source observations

The installed 6.0.0.5232 bundle (SHA-256 in the visual source map) still resolves a variant by splitting its key at the first // (getThemeForIdentifier, byte 1165264), clears missing selections (applyUserStyle, 1164894), and caches installed metadata for 300 seconds unless forced (refreshAvailableUserStyles, 1165673). Its picker sorts variant names by JavaScript string order (getter following byte 4625402). The Windows Slint picker uses the same UTF-16 ordering; its rendered selection test includes variants declared in reverse order. The official client installs a stylesheet link, whereas the native client imports only supported values into Slint.

The installed TS6 6.0.0.5163 html/client_ui/main.js (SHA-256 9d6bea2e…9b82c39) supplied the original contract:

  • applyUserStyle @1369504 inserted the selected stylesheet and reset missing selection to stock.
  • getThemeForIdentifier @1369874 split selection at the first //.
  • refreshAvailableUserStyles @1370283 / getInstalledThemes @2726754 used a 300,000 ms cache and accepted older object selection.
  • disableUserStyle @1370144 and Appearance @4814713 cleared selection on disable.
  • Picker @4804791 / @4804972 provided extension/variant cards, name sorting, author tooltip, directory and homepage/repository/e-mail actions.

Those browser mechanisms are historical reference, not native APIs. The removed TeamsPeach browser client had isolated consumer/smoke checks for schema constraints, path/junction replacement, active SVG refusal, escaped CSS, selected-resource access, fallback, cache, reload, restart, real local font/image use and denied remote content. Those cases remain native acceptance requirements in native/compatibility.json; their old results do not become native passes.

Licences and evidence

The original format documents Extensions.md (e962fd29…a7431bd6) and extensions.json (fca0ae73…b5358633) were read from the local installation, not redistributed. Theme-format documentation is separate from the retained client sound/font/artwork provenance in LICENSES/. Each third-party package retains its own declared licence, and TeamsPeach does not redistribute third-party themes.

native/src/services/themes_tests.rs and the service modules contain native coverage. Use the Cargo workspace and isolated xtask workflow from README; no browser harness is required. Relevant acceptance includes every confinement limit above, invalid-package isolation, supported/unsupported token diagnostics, real rendered color/font/size consumption, preview authorization, denied remote access, selection rollback on save failure, missing-resource fallback and restart/reload behavior. No new execution or theme parity is claimed here.