mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
feat(skins): refine KAAK voice channel chat
This commit is contained in:
1 parent
7b31c9106a
commit
f6ef471960
13 files changed
+300
-333
No files matched your search
@@ -163,6 +163,18 @@ test("schema v3 host audio controls require read and control permissions while v
|
||||
assert.equal(parseSkinPluginDocument(legacyDocument).components[0].root.children?.[0].widget, "voice.audio-controls");
|
||||
});
|
||||
|
||||
test("schema v3 member cards require a separate permission to display cached profile pictures", () => {
|
||||
const document = validDocument();
|
||||
document.schemaVersion = 3;
|
||||
document.components[0].actions = {};
|
||||
document.components[0].permissions = ["session.members.read", "voice.screenShare.read", "voice.screenShare.control"];
|
||||
document.components[0].root = { tag: "main", children: [{ widget: "voice.member-cards" }] };
|
||||
errorCode(() => parseSkinPluginDocument(document), "SKIN_PLUGIN_PERMISSION_MISSING");
|
||||
|
||||
document.components[0].permissions.push("session.memberAvatars.read");
|
||||
assert.equal(parseSkinPluginDocument(document).components[0].root.children?.[0].widget, "voice.member-cards");
|
||||
});
|
||||
|
||||
test("KAAK v3 example declares the connection home and complete voice workspace", async () => {
|
||||
const source = await readFile(new URL("../../docs/examples/kaak-voice/components.json", import.meta.url), "utf8");
|
||||
const parsed = parseSkinPluginJson(source);
|
||||
@@ -179,6 +191,7 @@ test("KAAK v3 example declares the connection home and complete voice workspace"
|
||||
assert.equal(workspace.mode, "surface");
|
||||
assert.ok(workspace.permissions.includes("session.channels.read"));
|
||||
assert.ok(workspace.permissions.includes("session.members.read"));
|
||||
assert.ok(workspace.permissions.includes("session.memberAvatars.read"));
|
||||
assert.ok(workspace.permissions.includes("chat.channel.send"));
|
||||
assert.ok(workspace.permissions.includes("audio.microphone.control"));
|
||||
assert.equal(workspace.actions["join-channel"].type, "voice.joinChannel");
|
||||
@@ -191,9 +204,10 @@ test("KAAK v3 example declares the connection home and complete voice workspace"
|
||||
};
|
||||
visit(workspace.root);
|
||||
assert.ok(nodes.some((node) => node.widget === "voice.audio-controls"));
|
||||
assert.ok(nodes.some((node) => node.widget === "voice.member-cards"));
|
||||
assert.ok(nodes.some((node) => node.widget === "voice.screen-share-start"));
|
||||
assert.ok(nodes.some((node) => node.repeat?.path === "session.channels" && node.children?.[0].events?.dblclick === "join-channel"));
|
||||
assert.ok(nodes.some((node) => node.repeat?.path === "session.members"));
|
||||
assert.ok(!nodes.some((node) => node.repeat?.path === "session.members"), "member imagery stays inside the trusted host widget");
|
||||
assert.ok(nodes.some((node) => node.tag === "input" && node.bindValue === "message"));
|
||||
});
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ export const SKIN_PLUGIN_PERMISSIONS = Object.freeze({
|
||||
"session.status.read": Object.freeze({ policyVersion: 1, description: "Read the current connection and channel summary." }),
|
||||
"session.channels.read": Object.freeze({ policyVersion: 1, description: "Read the public TeamSpeak channel tree; the demo page uses synthetic sample data." }),
|
||||
"session.members.read": Object.freeze({ policyVersion: 1, description: "Read visible member names, initials derived from those names, and speaking states; the demo page uses synthetic sample data." }),
|
||||
"session.memberAvatars.read": Object.freeze({ policyVersion: 1, description: "Display cached TeamSpeak profile pictures for visible members inside the trusted host member-card widget. Images are not exposed to skin markup or plugin runtimes." }),
|
||||
"chat.channel.read": Object.freeze({ policyVersion: 1, description: "Read the current public text channel; the demo page uses synthetic sample data." }),
|
||||
"chat.channel.send": Object.freeze({ policyVersion: 1, description: "Send to the current public text channel; the demo page only simulates this action." }),
|
||||
"favorites.read": Object.freeze({ policyVersion: 1, description: "Read favorite labels and opaque local identifiers, without server addresses or credentials." }),
|
||||
@@ -61,7 +62,7 @@ export const SKIN_PLUGIN_HOST_WIDGET_PERMISSIONS: Partial<Record<SkinPluginHostW
|
||||
"voice.chat-panel": widgetPermissions("chat.channel.read", "chat.channel.send"),
|
||||
"voice.connection-controls": widgetPermissions("voice.disconnect"),
|
||||
"voice.disconnect-control": widgetPermissions("voice.disconnect"),
|
||||
"voice.member-cards": widgetPermissions("session.members.read", "voice.screenShare.read", "voice.screenShare.control"),
|
||||
"voice.member-cards": widgetPermissions("session.members.read", "session.memberAvatars.read", "voice.screenShare.read", "voice.screenShare.control"),
|
||||
"voice.screen-share-player": widgetPermissions("voice.screenShare.read", "voice.screenShare.control"),
|
||||
"voice.screen-share-start": widgetPermissions("voice.screenShare.control"),
|
||||
"voice.whisper-controls": widgetPermissions("voice.whisper.status.read", "voice.whisper.control"),
|
||||
|
||||
@@ -50,6 +50,24 @@ test("runtime context redacts connection targets from quick-list labels and drop
|
||||
assert.equal(JSON.stringify(projected).includes("2001:db8::1"), false);
|
||||
});
|
||||
|
||||
test("profile-picture display permission does not expose image data to declarative or Wasm contexts", () => {
|
||||
const context = {
|
||||
session: {
|
||||
members: [{ id: "member-1", name: "Visible member", channelId: "channel-1", status: "online", speaking: false, self: false, avatar: "data:image/png;base64,cHJpdmF0ZQ==" }],
|
||||
},
|
||||
};
|
||||
const displayOnly = projectSkinRuntimePluginContext(["session.memberAvatars.read"], context);
|
||||
assert.deepEqual(JSON.parse(JSON.stringify(displayOnly)), {});
|
||||
|
||||
const readableMembers = projectSkinRuntimePluginContext(["session.members.read", "session.memberAvatars.read"], context);
|
||||
assert.deepEqual(JSON.parse(JSON.stringify(readableMembers)), {
|
||||
session: {
|
||||
members: [{ id: "member-1", name: "Visible member", channelId: "channel-1", status: "online", speaking: false, self: false }],
|
||||
},
|
||||
});
|
||||
assert.equal(JSON.stringify(readableMembers).includes("data:image"), false);
|
||||
});
|
||||
|
||||
test("large runtime context is capped across separately bounded collections", () => {
|
||||
const projected = projectSkinRuntimePluginContext(["session.channels.read", "chat.channel.read"], {
|
||||
session: {
|
||||
|
||||
Reference in new issue
Block a user