mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +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
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,27 @@
|
||||
import { readdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { zipSync } from "fflate";
|
||||
|
||||
const sourceDirectory = new URL("../../docs/examples/illusia-voice/", import.meta.url);
|
||||
|
||||
async function collectFiles(directory, prefix = "") {
|
||||
const entries = await readdir(new URL(prefix, directory), { withFileTypes: true });
|
||||
const files = [];
|
||||
for (const entry of entries) {
|
||||
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
||||
if (entry.isDirectory()) files.push(...await collectFiles(directory, relativePath));
|
||||
else if (entry.isFile()) files.push(relativePath);
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
const files = Object.fromEntries(await Promise.all((await collectFiles(sourceDirectory)).map(async (name) => [
|
||||
name,
|
||||
await readFile(new URL(name, sourceDirectory)),
|
||||
])));
|
||||
const archive = zipSync(files, { level: 9 });
|
||||
|
||||
await Promise.all([
|
||||
writeFile(fileURLToPath(new URL("../../docs/examples/illusia-voice.wskin", import.meta.url)), archive),
|
||||
writeFile(fileURLToPath(new URL("../public/skins/illusia-voice.wskin", import.meta.url)), archive),
|
||||
]);
|
||||
@@ -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; }"));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"schemaVersion": 1,
|
||||
"id": "builtin.dark",
|
||||
"name": "WebSpeak Dark",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"author": "WebSpeak",
|
||||
"license": "AGPL-3.0-only",
|
||||
"description": "The built-in dark appearance for public WebSpeak pages.",
|
||||
|
||||
@@ -276,6 +276,30 @@
|
||||
}
|
||||
.ws-skin-root[data-ws-skin="builtin.dark"] *::-webkit-scrollbar-thumb:hover { background: #69c7bc; }
|
||||
|
||||
/* Keep live screen sharing obvious in the built-in dark voice roster. */
|
||||
.ws-skin-root[data-ws-skin="builtin.dark"] .screen-share-live-indicator {
|
||||
color: #bdfff1;
|
||||
border-color: rgba(105, 210, 199, .48);
|
||||
background: #172321;
|
||||
box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
|
||||
}
|
||||
.ws-skin-root[data-ws-skin="builtin.dark"] .screen-share-live-indicator::before {
|
||||
background: #78e489;
|
||||
box-shadow: 0 0 0 3px rgba(120, 228, 137, .17);
|
||||
}
|
||||
.ws-skin-root[data-ws-skin="builtin.dark"] .screen-share-wave { color: #69d2c7; }
|
||||
.ws-skin-root[data-ws-skin="builtin.dark"] .screen-share-card-button {
|
||||
color: #a9eee3;
|
||||
border-color: rgba(105, 210, 199, .4);
|
||||
background: #20342f;
|
||||
}
|
||||
.ws-skin-root[data-ws-skin="builtin.dark"] .screen-share-card-button:hover { background: #29443e; }
|
||||
.ws-skin-root[data-ws-skin="builtin.dark"] .screen-share-card-button.viewing {
|
||||
color: #10201d;
|
||||
border-color: #69d2c7;
|
||||
background: #69d2c7;
|
||||
}
|
||||
|
||||
@keyframes join-accent-breathe-dark {
|
||||
0%, 100% { transform: translateY(0); text-shadow: 0 0 8px rgba(125, 255, 174, .28), 0 0 18px rgba(105, 210, 199, .14); }
|
||||
50% { transform: translateY(-2px); text-shadow: 0 0 13px rgba(125, 255, 174, .5), 0 0 26px rgba(105, 210, 199, .22); }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"schemaVersion": 1,
|
||||
"id": "builtin.light",
|
||||
"name": "WebSpeak Light",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"author": "WebSpeak",
|
||||
"license": "AGPL-3.0-only",
|
||||
"description": "The built-in light appearance for public WebSpeak pages.",
|
||||
|
||||
@@ -148,3 +148,27 @@
|
||||
.ws-skin-root[data-ws-skin="builtin.light"] *::-webkit-scrollbar-thumb:hover {
|
||||
background: #6bbab1;
|
||||
}
|
||||
|
||||
/* Keep live screen sharing obvious in the built-in light voice roster. */
|
||||
.ws-skin-root[data-ws-skin="builtin.light"] .screen-share-live-indicator {
|
||||
color: #075f56;
|
||||
border-color: #a9d8d0;
|
||||
background: #f5fffc;
|
||||
box-shadow: 0 4px 12px rgba(21, 72, 65, .14);
|
||||
}
|
||||
.ws-skin-root[data-ws-skin="builtin.light"] .screen-share-live-indicator::before {
|
||||
background: #16a875;
|
||||
box-shadow: 0 0 0 3px rgba(22, 168, 117, .16);
|
||||
}
|
||||
.ws-skin-root[data-ws-skin="builtin.light"] .screen-share-wave { color: #087e86; }
|
||||
.ws-skin-root[data-ws-skin="builtin.light"] .screen-share-card-button {
|
||||
color: #006a64;
|
||||
border-color: #a9d8d0;
|
||||
background: #eaf8f5;
|
||||
}
|
||||
.ws-skin-root[data-ws-skin="builtin.light"] .screen-share-card-button:hover { background: #d9f1ec; }
|
||||
.ws-skin-root[data-ws-skin="builtin.light"] .screen-share-card-button.viewing {
|
||||
color: #fff;
|
||||
border-color: #006a64;
|
||||
background: #006a64;
|
||||
}
|
||||
Reference in new issue
Block a user