mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-02 19:42:51 +08:00
fix(skins): show active screen sharing across bundled themes
This commit is contained in:
1 parent
d9749ac12f
commit
df2ff79e15
20 files changed
+180
-20
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import test from "node:test";
|
||||
import {
|
||||
BUILTIN_SKIN_CATALOG,
|
||||
@@ -7,6 +8,27 @@ import {
|
||||
listPublicSkins,
|
||||
} from "./skin-catalog.js";
|
||||
|
||||
test("built-in appearance manifests and catalog versions match the bundled share treatments", async () => {
|
||||
const [lightManifestText, darkManifestText, lightCss, darkCss] = await Promise.all([
|
||||
readFile(new URL("../skins/builtin/light/manifest.json", import.meta.url), "utf8"),
|
||||
readFile(new URL("../skins/builtin/dark/manifest.json", import.meta.url), "utf8"),
|
||||
readFile(new URL("../skins/builtin/light/skin.css", import.meta.url), "utf8"),
|
||||
readFile(new URL("../skins/builtin/dark/skin.css", import.meta.url), "utf8"),
|
||||
]);
|
||||
const lightManifest = JSON.parse(lightManifestText) as { id: string; version: string };
|
||||
const darkManifest = JSON.parse(darkManifestText) as { id: string; version: string };
|
||||
|
||||
for (const manifest of [lightManifest, darkManifest]) {
|
||||
assert.equal(BUILTIN_SKIN_CATALOG.find((skin) => skin.id === manifest.id)?.version, manifest.version);
|
||||
}
|
||||
assert.equal(lightManifest.version, "1.0.1");
|
||||
assert.equal(darkManifest.version, "1.0.1");
|
||||
assert.match(lightCss, /\.screen-share-live-indicator\s*\{[^}]*background:/s);
|
||||
assert.match(lightCss, /\.screen-share-card-button\.viewing\s*\{[^}]*background:/s);
|
||||
assert.match(darkCss, /\.screen-share-live-indicator\s*\{[^}]*background:/s);
|
||||
assert.match(darkCss, /\.screen-share-card-button\.viewing\s*\{[^}]*background:/s);
|
||||
});
|
||||
|
||||
test("skin catalog always includes protected built-ins and exposes only enabled custom skins", async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = async () => new Response(JSON.stringify({
|
||||
|
||||
@@ -9,7 +9,7 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [
|
||||
{
|
||||
id: "builtin.light",
|
||||
name: "Day mode",
|
||||
version: "1.0.0",
|
||||
version: "1.0.1",
|
||||
author: "WebSpeak",
|
||||
license: "AGPL-3.0-only",
|
||||
description: "The default light appearance.",
|
||||
@@ -21,7 +21,7 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [
|
||||
{
|
||||
id: "builtin.dark",
|
||||
name: "Night mode",
|
||||
version: "1.0.0",
|
||||
version: "1.0.1",
|
||||
author: "WebSpeak",
|
||||
license: "AGPL-3.0-only",
|
||||
description: "The default dark appearance.",
|
||||
@@ -33,7 +33,7 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [
|
||||
{
|
||||
id: BUILTIN_ILLUSIA_SKIN_ID,
|
||||
name: "ILLUSIA风",
|
||||
version: "2.0.0",
|
||||
version: "2.0.1",
|
||||
author: "WebSpeak Project",
|
||||
license: "All rights reserved",
|
||||
description: "A bright original-character art skin with a safe declarative live-channel badge.",
|
||||
@@ -46,7 +46,7 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [
|
||||
{
|
||||
id: BUILTIN_KAAK_SKIN_ID,
|
||||
name: "KAAK",
|
||||
version: "3.1.72",
|
||||
version: "3.1.73",
|
||||
author: "WebSpeak Project",
|
||||
license: "AGPL-3.0-only",
|
||||
description: "A KOOK-inspired voice-room workspace with a searchable server header, TeamSpeak banner and welcome message, nested channel members, attached channel chat, and a compact WebSpeak audio dock.",
|
||||
|
||||
@@ -141,7 +141,7 @@ test("the ILLUSIA v3 example and bundled package import without replacing WebSpe
|
||||
const skin = await importSkinPack(new File([exampleBytes], "illusia-voice.wskin", { type: "application/octet-stream" }));
|
||||
assert.equal(skin.id, "community.illusia-voice");
|
||||
assert.equal(skin.name, "ILLUSIA风");
|
||||
assert.equal(skin.version, "2.0.0");
|
||||
assert.equal(skin.version, "2.0.1");
|
||||
assert.equal(skin.schemaVersion, 3);
|
||||
assert.equal(skin.packageType, "open-skin");
|
||||
assert.equal(skin.layoutData, undefined);
|
||||
@@ -168,7 +168,9 @@ test("the ILLUSIA v3 example and bundled package import without replacing WebSpe
|
||||
assert.match(skin.css, /language\.option/);
|
||||
assert.match(skin.css, /data-ws-skin-id="community\.illusia-voice"/);
|
||||
assert.match(skin.css, /data-ws-part="voice\.favorite-servers\.rail"/);
|
||||
assert.match(skin.css, /data-ws-plugin-part="illusia-now-playing\.channel-name"/);
|
||||
assert.match(skin.css, /data-ws-plugin-part="illusia-now-playing\.channel-name"/);
|
||||
assert.match(skin.css, /data-ws-part="voice\.member\.live-indicator"\]\s*\{[^}]*border-color:[^}]*background:/s);
|
||||
assert.match(skin.css, /data-ws-part="voice\.member\.share-actions"\] \.screen-share-card-button\.viewing\s*\{[^}]*background:/s);
|
||||
assert.match(skin.css, /data-ws-part="home\.server-history\.item"/);
|
||||
assert.match(skin.css, /data-ws-part="home\.server-history\.favorite-toggle"\]\[data-ws-state="saved"\]/);
|
||||
assert.match(skin.css, /data-ws-part="voice\.favorite-servers\.favorite-toggle"\]\[data-ws-state="saved"\]/);
|
||||
@@ -464,7 +466,7 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
|
||||
const file = new File([archive], "kaak-voice.wskin", { type: "application/octet-stream" });
|
||||
const skin = await importSkinPack(file);
|
||||
assert.equal(skin.id, "community.kaak-voice");
|
||||
assert.equal(skin.version, "3.1.72");
|
||||
assert.equal(skin.version, "3.1.73");
|
||||
assert.equal(BUILTIN_SKIN_CATALOG.find((entry) => entry.id === skin.id)?.version, skin.version);
|
||||
assert.equal(skin.schemaVersion, 3);
|
||||
const home = skin.pluginData?.components.find((component) => component.page === "home");
|
||||
@@ -489,15 +491,16 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
|
||||
assert.equal(voice?.permissions.includes("voice.screenShare.read"), true);
|
||||
assert.equal(voice?.permissions.includes("voice.screenShare.control"), true);
|
||||
assert.equal(voice?.permissions.includes("voice.screenShare.status.read"), true);
|
||||
function findPart(node: SkinPluginNode | undefined, part: string): SkinPluginNode | undefined {
|
||||
function findPart(node: SkinPluginNode | undefined, part: string): SkinPluginNode | undefined {
|
||||
if (!node) return undefined;
|
||||
if (node.part === part) return node;
|
||||
for (const child of node.children ?? []) {
|
||||
const found = findPart(child, part);
|
||||
if (found) return found;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
assert.deepEqual(findPart(voice?.root, "member-cards")?.options, { screenShare: true, memberActions: true });
|
||||
assert.equal(findPart(voice?.root, "server-summary")?.widget, "voice.server-header");
|
||||
assert.equal(findPart(voice?.root, "server-banner")?.widget, "voice.server-banner");
|
||||
assert.equal(findPart(voice?.root, "record-placeholder"), undefined, "the KAAK voice dock has no recording control");
|
||||
@@ -689,7 +692,9 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
|
||||
assert.match(skin.css, /kaak-workspace\.conversation[\s\S]*?grid-column: 4;/);
|
||||
assert.match(skin.css, /conversation[\s\S]*?grid-template-rows: 58px minmax\(0, 1fr\) auto/);
|
||||
assert.match(skin.css, /chat-send[\s\S]*?::after \{ content: "➤";/);
|
||||
assert.match(skin.css, /kaak-workspace\.member-cards[\s\S]*?\.voice-card[\s\S]*?aspect-ratio: 1\.82;/);
|
||||
assert.match(skin.css, /kaak-workspace\.member-cards[\s\S]*?\.voice-card[\s\S]*?aspect-ratio: 1\.82;/);
|
||||
assert.match(skin.css, /kaak-workspace\.member-cards[\s\S]*?\.screen-share-live-indicator[\s\S]*?background: #20251e;/);
|
||||
assert.match(skin.css, /kaak-workspace\.member-cards[\s\S]*?\.screen-share-card-button\.viewing[\s\S]*?background: #8be31e;/);
|
||||
assert.match(skin.css, /@keyframes ws-community-kaak-voice-kaak-member-speaking-wave/);
|
||||
assert.ok(skin.css.includes("animation: ws-community-kaak-voice-kaak-performance-refresh-spin .72s linear infinite;"));
|
||||
assert.ok(skin.css.includes("performance-refresh:disabled .ui-icon { animation: none; }"));
|
||||
|
||||
Reference in new issue
Block a user