mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-06 21:42:50 +08:00
feat(skins): bundle the Classic 4.1.16 skin with the client
Add Classic (community.ts3-classic-console) as a bundled skin next to KAAK: example sources under docs/examples/ts3-classic-console, a reproducible skin:classic:build script that also packs chrome.json and writes identical archives to docs/examples/ and web/public/skins/, a built-in catalog entry and bundled package URL, and admin registry protection against replace, disable and delete. Classic stays outside the official consent-free skin list, so visitors without instance consent still see only Day, Night and ILLUSIA.
This commit is contained in:
1 parent
001457d004
commit
25b0a01ae7
24 files changed
+3590
-20
No files matched your search
@@ -30,10 +30,11 @@ test('malformed or inaccessible storage never grants access; explicit choices su
|
||||
assert.equal(unavailable.allowed.value, false); unavailable.set(true); assert.equal(unavailable.allowed.value, true);
|
||||
unavailable.set(false); assert.equal(unavailable.allowed.value, false);
|
||||
});
|
||||
test('only the three official IDs bypass consent, including when KAAK is shipped as built-in', () => {
|
||||
test('only the three official IDs bypass consent, including when KAAK or Classic is shipped as built-in', () => {
|
||||
setInstanceAuthorization(false);
|
||||
for (const id of ['builtin.light', 'builtin.dark', 'community.illusia-voice']) assert.equal(canUseSkin(id), true);
|
||||
for (const id of ['community.kaak-voice', 'community.discord-voice', 'builtin.other']) assert.equal(canUseSkin(id), false);
|
||||
setInstanceAuthorization(true); assert.equal(canUseSkin('community.kaak-voice'), true);
|
||||
for (const id of ['community.kaak-voice', 'community.ts3-classic-console', 'community.discord-voice', 'builtin.other']) assert.equal(canUseSkin(id), false);
|
||||
setInstanceAuthorization(true);
|
||||
for (const id of ['community.kaak-voice', 'community.ts3-classic-console']) assert.equal(canUseSkin(id), true);
|
||||
setInstanceAuthorization(false);
|
||||
});
|
||||
@@ -2,7 +2,9 @@ import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import test from "node:test";
|
||||
import {
|
||||
BUILTIN_CLASSIC_SKIN_ID,
|
||||
BUILTIN_SKIN_CATALOG,
|
||||
getBundledSkinPackageUrl,
|
||||
getPublicDefaultSkinId,
|
||||
isPublicSkinEnabled,
|
||||
listPublicSkins,
|
||||
@@ -42,6 +44,7 @@ test("skin catalog always includes protected built-ins and exposes only enabled
|
||||
{ id: "disabled-skin", name: "Disabled", version: "1.0.0", author: "Test", license: "MIT", minAppVersion: "0.2.6", installedAt: 2, enabled: false },
|
||||
{ id: "community.illusia-voice", name: "Spoofed", version: "9.9.9", author: "Other", license: "MIT", minAppVersion: "0.0.1", installedAt: 3 },
|
||||
{ id: "community.kaak-voice", name: "Spoofed KAAK", version: "9.9.9", author: "Other", license: "MIT", minAppVersion: "0.0.1", installedAt: 4 },
|
||||
{ id: "community.ts3-classic-console", name: "Spoofed Classic", version: "9.9.9", author: "Other", license: "MIT", minAppVersion: "0.0.1", installedAt: 5 },
|
||||
],
|
||||
}), { status: 200, headers: { "content-type": "application/json" } });
|
||||
|
||||
@@ -52,14 +55,17 @@ test("skin catalog always includes protected built-ins and exposes only enabled
|
||||
"builtin.dark",
|
||||
"community.illusia-voice",
|
||||
"community.kaak-voice",
|
||||
"community.ts3-classic-console",
|
||||
"sample-skin",
|
||||
]);
|
||||
assert.deepEqual(BUILTIN_SKIN_CATALOG.map((skin) => skin.id), skins.slice(0, 4).map((skin) => skin.id));
|
||||
assert.deepEqual(BUILTIN_SKIN_CATALOG.map((skin) => skin.id), skins.slice(0, 5).map((skin) => skin.id));
|
||||
assert.equal(getPublicDefaultSkinId(), "sample-skin");
|
||||
assert.equal(isPublicSkinEnabled("sample-skin"), true);
|
||||
assert.equal(isPublicSkinEnabled("disabled-skin"), false);
|
||||
assert.equal(isPublicSkinEnabled("community.illusia-voice"), true);
|
||||
assert.equal(isPublicSkinEnabled("community.kaak-voice"), true);
|
||||
assert.equal(isPublicSkinEnabled("community.ts3-classic-console"), true);
|
||||
assert.equal(skins.find((skin) => skin.id === "community.ts3-classic-console")?.name, "Classic");
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
@@ -74,9 +80,23 @@ test("invalid or disabled instance defaults safely fall back to the protected da
|
||||
|
||||
try {
|
||||
const skins = await listPublicSkins();
|
||||
assert.equal(skins.length, 4);
|
||||
assert.equal(skins.length, 5);
|
||||
assert.equal(getPublicDefaultSkinId(), "builtin.light");
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
|
||||
test("the bundled Classic skin is listed after KAAK and loads from its own bundled package", () => {
|
||||
const ids = BUILTIN_SKIN_CATALOG.map((skin) => skin.id);
|
||||
assert.equal(ids.indexOf(BUILTIN_CLASSIC_SKIN_ID), ids.indexOf("community.kaak-voice") + 1);
|
||||
const classic = BUILTIN_SKIN_CATALOG.find((skin) => skin.id === BUILTIN_CLASSIC_SKIN_ID);
|
||||
assert.equal(classic?.name, "Classic");
|
||||
assert.equal(classic?.version, "4.1.16");
|
||||
assert.equal(classic?.author, "WebSpeak Community");
|
||||
assert.equal(classic?.license, "CC-BY-4.0");
|
||||
assert.equal(classic?.builtIn, true);
|
||||
assert.equal(classic?.previewUrl, undefined, "Classic ships without a preview image");
|
||||
assert.equal(getBundledSkinPackageUrl(BUILTIN_CLASSIC_SKIN_ID), "/skins/ts3-classic-console.wskin");
|
||||
assert.equal(getBundledSkinPackageUrl("community.kaak-voice"), "/skins/kaak-voice.wskin");
|
||||
});
|
||||
@@ -4,6 +4,7 @@ export type { SkinCatalogEntry } from "../../../src/shared/skin-catalog.js";
|
||||
|
||||
export const BUILTIN_ILLUSIA_SKIN_ID = "community.illusia-voice";
|
||||
export const BUILTIN_KAAK_SKIN_ID = "community.kaak-voice";
|
||||
export const BUILTIN_CLASSIC_SKIN_ID = "community.ts3-classic-console";
|
||||
|
||||
export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [
|
||||
{
|
||||
@@ -54,10 +55,22 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [
|
||||
installedAt: 0,
|
||||
builtIn: true,
|
||||
},
|
||||
{
|
||||
id: BUILTIN_CLASSIC_SKIN_ID,
|
||||
name: "Classic",
|
||||
version: "4.1.16",
|
||||
author: "WebSpeak Community",
|
||||
license: "CC-BY-4.0",
|
||||
description: "A community visual homage to the classic TeamSpeak 3 light desktop client for both the connection page and the voice workspace: a classic group-box connect window, a compact icon toolbar, a full-height server tree with members, a SERVER INFORMATION facts pane and a bottom SERVER LOG with chat.",
|
||||
minAppVersion: "0.3.3",
|
||||
installedAt: 0,
|
||||
builtIn: true,
|
||||
},
|
||||
];
|
||||
|
||||
const BUILTIN_ILLUSIA_PACKAGE_URL = "/skins/illusia-voice.wskin";
|
||||
const BUILTIN_KAAK_PACKAGE_URL = "/skins/kaak-voice.wskin";
|
||||
const BUILTIN_CLASSIC_PACKAGE_URL = "/skins/ts3-classic-console.wskin";
|
||||
let publicDirectoryLoaded = false;
|
||||
let publicEnabledSkinIds = new Set<string>(BUILTIN_SKIN_CATALOG.map((skin) => skin.id));
|
||||
let publicDefaultSkinId = "builtin.light";
|
||||
@@ -75,6 +88,7 @@ export function isPublicSkinEnabled(id: string): boolean {
|
||||
export function getBundledSkinPackageUrl(id: string): string | null {
|
||||
if (id === BUILTIN_ILLUSIA_SKIN_ID) return BUILTIN_ILLUSIA_PACKAGE_URL;
|
||||
if (id === BUILTIN_KAAK_SKIN_ID) return BUILTIN_KAAK_PACKAGE_URL;
|
||||
if (id === BUILTIN_CLASSIC_SKIN_ID) return BUILTIN_CLASSIC_PACKAGE_URL;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { createHash } from "node:crypto";
|
||||
import { readFile, readdir } from "node:fs/promises";
|
||||
import test from "node:test";
|
||||
import { strToU8, zipSync } from "fflate";
|
||||
import { strToU8, unzipSync, zipSync } from "fflate";
|
||||
import { importSkinPack, resolveSkinCssAssets, SkinPackError } from "./skin-pack.js";
|
||||
import { scopeBuiltinThemeForCustomSkin } from "./skin-cascade.js";
|
||||
import { BUILTIN_SKIN_CATALOG } from "./skin-catalog.js";
|
||||
@@ -911,6 +912,40 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
|
||||
assert.ok(skin.css.includes("@media (max-width: 820px)"));
|
||||
});
|
||||
|
||||
|
||||
test("the bundled Classic package matches the published 4.1.16 release and keeps its chrome.json", async () => {
|
||||
const archive = await readFile(new URL("../../../docs/examples/ts3-classic-console.wskin", import.meta.url));
|
||||
const bundledArchive = await readFile(new URL("../../public/skins/ts3-classic-console.wskin", import.meta.url));
|
||||
assert.deepEqual(archive, bundledArchive, "the downloadable example and bundled skin stay in sync");
|
||||
assert.equal(createHash("sha256").update(archive).digest("hex"), "1e5b6ef0f41d7afc644f4f16938b439493ebb8c8bb076efd154157d42b635711");
|
||||
const entries = unzipSync(new Uint8Array(archive));
|
||||
assert.deepEqual(Object.keys(entries), ["manifest.json", "skin.css", "content.json", "components.json", "chrome.json"]);
|
||||
for (const name of Object.keys(entries)) {
|
||||
const source = await readFile(new URL(`../../../docs/examples/ts3-classic-console/${name}`, import.meta.url));
|
||||
assert.deepEqual(Buffer.from(entries[name]), source, `${name} in the archive matches the example source`);
|
||||
}
|
||||
const skin = await importSkinPack(new File([archive], "ts3-classic-console.wskin", { type: "application/octet-stream" }));
|
||||
assert.equal(skin.id, "community.ts3-classic-console");
|
||||
assert.equal(skin.name, "Classic");
|
||||
assert.equal(skin.version, "4.1.16");
|
||||
assert.equal(skin.author, "WebSpeak Community");
|
||||
assert.equal(skin.license, "CC-BY-4.0");
|
||||
assert.equal(skin.minAppVersion, "0.3.3");
|
||||
assert.equal(skin.schemaVersion, 3);
|
||||
assert.equal(BUILTIN_SKIN_CATALOG.find((entry) => entry.id === skin.id)?.version, skin.version);
|
||||
assert.deepEqual(skin.chromeData?.hiddenParts, ["host.plugins.launcher"]);
|
||||
assert.deepEqual(skin.chromeData?.slots?.["host.recovery"], {
|
||||
mode: "toolbar",
|
||||
appearance: "icon",
|
||||
anchor: [
|
||||
"skin.home.ts3-home-console.part-ts-recovery-slot",
|
||||
"skin.voice.ts3-voice-console.part-ts-recovery-slot",
|
||||
],
|
||||
align: "end",
|
||||
compact: false,
|
||||
});
|
||||
});
|
||||
|
||||
test("v4 skin packages validate Wasm entry ABI and cache it as application/wasm", async () => {
|
||||
const wasmPlugin = {
|
||||
schemaVersion: 1,
|
||||
|
||||
Reference in new issue
Block a user