mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
feat(skins): add persistent voice workspace API and align KAAK
This commit is contained in:
1 parent
0af3236c30
commit
452e6f09ca
24 files changed
+451
-21
No files matched your search
@@ -239,6 +239,10 @@ const PUBLIC_PART_IDS = new Set<string>([
|
||||
"voice.chat.tab",
|
||||
"voice.chat.tabs",
|
||||
"voice.connection-status",
|
||||
"voice.connection-status.message",
|
||||
"voice.connection-status.nickname",
|
||||
"voice.connection-status.nickname.input",
|
||||
"voice.connection-status.reconnect",
|
||||
"voice.content",
|
||||
"voice.context-menu",
|
||||
"voice.context-menu-backdrop",
|
||||
@@ -370,6 +374,7 @@ const ACTION_PART_IDS = new Set([
|
||||
"voice.channel-tree.expander", "voice.channel-tree.row", "demo.skin-switcher", "demo.language-switcher",
|
||||
]);
|
||||
const INTERACTIVE_PART_IDS = new Set([
|
||||
"voice.connection-status.nickname.input", "voice.connection-status.reconnect",
|
||||
"demo.action.poke", "demo.action.reconnect", "demo.action.speaking", "demo.channel.select",
|
||||
"demo.chat.input", "demo.chat.send", "demo.chat.tab", "demo.home-link", "demo.poke.dismiss",
|
||||
"demo.reconnect.restore", "home.connect", "home.favorite-toggle", "home.identity-export.button",
|
||||
|
||||
@@ -32,6 +32,7 @@ export const SKIN_PLUGIN_PERMISSIONS = Object.freeze({
|
||||
"audio.settings.open": Object.freeze({ policyVersion: 1, description: "Open WebSpeak's trusted audio device and processing settings." }),
|
||||
"voice.presence.write": Object.freeze({ policyVersion: 1, description: "Set the user's own away status through the connected TeamSpeak session." }),
|
||||
"voice.whisper.control": Object.freeze({ policyVersion: 1, description: "Enable or disable the user's existing TeamSpeak whisper target selection." }),
|
||||
"voice.connect": Object.freeze({ policyVersion: 1, description: "Connect to the host-selected TeamSpeak target after an explicit user action; the skin cannot provide addresses or credentials." }),
|
||||
"voice.disconnect": Object.freeze({ policyVersion: 1, description: "Disconnect the user's current TeamSpeak voice session." }),
|
||||
"voice.whisper.status.read": Object.freeze({ policyVersion: 1, description: "Read whether whisper is active and how many existing targets are selected." }),
|
||||
"voice.screenShare.status.read": Object.freeze({ policyVersion: 1, description: "Read the user's own screen-share state." }),
|
||||
@@ -63,6 +64,7 @@ export const SKIN_PLUGIN_HOST_WIDGETS = Object.freeze([
|
||||
"voice.screen-share-start",
|
||||
"voice.whisper-controls",
|
||||
"voice.performance-panel",
|
||||
"voice.connection-status",
|
||||
"voice.connection-controls",
|
||||
"voice.disconnect-control",
|
||||
] as const);
|
||||
@@ -90,6 +92,7 @@ export const SKIN_PLUGIN_HOST_WIDGET_PERMISSIONS: Partial<Record<SkinPluginHostW
|
||||
"voice.server-banner": widgetPermissions("session.status.read"),
|
||||
"voice.audio-controls": widgetPermissions("audio.status.read", "audio.microphone.control", "audio.output.control"),
|
||||
"voice.chat-panel": widgetPermissions("chat.channel.read", "chat.channel.send"),
|
||||
"voice.connection-status": widgetPermissions("session.status.read", "voice.connect"),
|
||||
"voice.connection-controls": widgetPermissions("voice.disconnect"),
|
||||
"voice.disconnect-control": widgetPermissions("voice.disconnect"),
|
||||
"voice.member-cards": widgetPermissions("session.members.read", "session.memberAvatars.read", "voice.screenShare.read", "voice.screenShare.control"),
|
||||
@@ -123,7 +126,7 @@ export type SkinPluginAction =
|
||||
| "voice.joinChannel" | "favorites.switch" | "quickServers.switch" | "chat.sendMessage" | "chat.togglePanel"
|
||||
| "voice.toggleMicrophone" | "voice.toggleOutputMute" | "voice.setOutputVolume" | "audio.openSettings"
|
||||
| "audio.toggleNoiseSuppression" | "audio.toggleAccompaniment"
|
||||
| "voice.disconnect" | "voice.setAway" | "voice.setWhisperActive"
|
||||
| "voice.connect" | "voice.disconnect" | "voice.setAway" | "voice.setWhisperActive"
|
||||
| "voice.startScreenShare" | "voice.stopScreenShare" | "voice.joinScreenShare" | "voice.leaveScreenShare";
|
||||
|
||||
export interface SkinPluginActionDefinition {
|
||||
@@ -204,11 +207,11 @@ const V3_EVENTS = new Set<string>([
|
||||
const PASSIVE_EVENTS = new Set<string>(["focus", "blur", "pointerenter", "pointerleave", "dragstart", "dragover"]);
|
||||
const ACTIONS = new Set<string>([
|
||||
"ui.setState", "ui.toggleState", "session.copyInviteLink", "voice.joinChannel", "favorites.switch", "quickServers.switch", "chat.sendMessage", "chat.togglePanel",
|
||||
"voice.toggleMicrophone", "voice.toggleOutputMute", "voice.setOutputVolume", "audio.openSettings", "audio.toggleNoiseSuppression", "audio.toggleAccompaniment", "voice.disconnect", "voice.setAway", "voice.setWhisperActive",
|
||||
"voice.toggleMicrophone", "voice.toggleOutputMute", "voice.setOutputVolume", "audio.openSettings", "audio.toggleNoiseSuppression", "audio.toggleAccompaniment", "voice.connect", "voice.disconnect", "voice.setAway", "voice.setWhisperActive",
|
||||
"voice.startScreenShare", "voice.stopScreenShare", "voice.joinScreenShare", "voice.leaveScreenShare",
|
||||
]);
|
||||
const V3_ACTIONS = new Set<string>([
|
||||
"ui.toggleState", "session.copyInviteLink", "chat.togglePanel", "voice.toggleMicrophone", "voice.toggleOutputMute", "voice.setOutputVolume", "audio.openSettings", "audio.toggleNoiseSuppression", "audio.toggleAccompaniment", "voice.disconnect", "voice.setAway",
|
||||
"ui.toggleState", "session.copyInviteLink", "chat.togglePanel", "voice.toggleMicrophone", "voice.toggleOutputMute", "voice.setOutputVolume", "audio.openSettings", "audio.toggleNoiseSuppression", "audio.toggleAccompaniment", "voice.connect", "voice.disconnect", "voice.setAway",
|
||||
"voice.setWhisperActive", "voice.startScreenShare", "voice.stopScreenShare", "voice.joinScreenShare", "voice.leaveScreenShare",
|
||||
]);
|
||||
const PERMISSIONS = new Set<string>(Object.keys(SKIN_PLUGIN_PERMISSIONS));
|
||||
@@ -228,6 +231,7 @@ const ACTION_ARGS: Record<SkinPluginAction, ReadonlySet<string>> = {
|
||||
"audio.openSettings": new Set([]),
|
||||
"audio.toggleNoiseSuppression": new Set([]),
|
||||
"audio.toggleAccompaniment": new Set([]),
|
||||
"voice.connect": new Set([]),
|
||||
"voice.disconnect": new Set([]),
|
||||
"voice.setAway": new Set(["away", "message"]),
|
||||
"voice.setWhisperActive": new Set(["active"]),
|
||||
@@ -251,6 +255,7 @@ const ACTION_PERMISSION: Record<SkinPluginAction, SkinPluginPermission | null> =
|
||||
"audio.openSettings": "audio.settings.open",
|
||||
"audio.toggleNoiseSuppression": "audio.microphone.control",
|
||||
"audio.toggleAccompaniment": "audio.output.control",
|
||||
"voice.connect": "voice.connect",
|
||||
"voice.disconnect": "voice.disconnect",
|
||||
"voice.setAway": "voice.presence.write",
|
||||
"voice.setWhisperActive": "voice.whisper.control",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/** Public workspace API v1. No skin IDs or connection credentials belong here. */
|
||||
export interface SkinWorkspacePolicy {
|
||||
apiVersion: 1;
|
||||
mode: "persistent";
|
||||
}
|
||||
|
||||
export function parseSkinWorkspacePolicy(value: unknown, schemaVersion: number): SkinWorkspacePolicy | undefined {
|
||||
if (value === undefined) return undefined;
|
||||
if (schemaVersion < 3 || !value || typeof value !== "object" || Array.isArray(value)) throw new Error("Workspace policy requires an open-skin package.");
|
||||
const policy = value as Record<string, unknown>;
|
||||
if (Object.keys(policy).some(key => key !== "apiVersion" && key !== "mode") || policy.apiVersion !== 1 || policy.mode !== "persistent") {
|
||||
throw new Error("Unsupported workspace policy or API version.");
|
||||
}
|
||||
return { apiVersion: 1, mode: "persistent" };
|
||||
}
|
||||
Reference in new issue
Block a user