fix: expose server identity and refine KAAK client

This commit is contained in:
illusia committed 2026-10-11 17:14:56 +08:00
1 parent e8164abafe
commit 17fb27b89a
28 files changed
+1504 -334

No files matched your search

Binary file not shown.
+11
View File
@@ -43,6 +43,11 @@ export interface VoiceState {
channelSwitchedChannelId: string;
}
export interface VoiceServerInfo {
name: string;
icon?: string | null;
}
export interface AudioInputDevice {
deviceId: string;
label: string;
@@ -190,6 +195,7 @@ class CancelledMediaOperation extends Error {
export function useVoiceWebSocket() {
const ws = shallowRef<WebSocket | null>(null);
const serverInfo = shallowRef<VoiceServerInfo | null>(null);
const state = reactive<VoiceState>({ connected: false, connecting: false, reconnecting: false, reconnectAttempt: 0, reconnectFailed: false, tsClientId: 0, error: "", errorCode: "", microphoneError: "", microphoneErrorCode: "", audioNotice: "", audioNoticeCode: "", channelSwitchedChannelId: "" });
const sessionState = createVoiceSessionState({
selfId: () => state.tsClientId,
@@ -993,6 +999,7 @@ export function useVoiceWebSocket() {
}
function disconnect(preserveConnection = false): void {
serverInfo.value = null;
const keepRememberedIdentity = lastConnection?.rememberIdentity === true;
if (!preserveConnection) lastConnection = null;
voiceConnection.stop(() => releaseSessionResources(!preserveConnection));
@@ -1036,6 +1043,9 @@ export function useVoiceWebSocket() {
const msg = parseServerMessage(raw);
if (!msg || screenShare.handleMessage(msg) || sessionState.receive(msg)) return;
switch (msg.type) {
case "serverInfo":
serverInfo.value = { name: msg.name, icon: msg.icon ?? null };
break;
case "connected":
const wasReconnecting = state.reconnecting;
state.connected = true;
@@ -1401,6 +1411,7 @@ export function useVoiceWebSocket() {
...screenShare.api,
ws,
state,
serverInfo,
sessionEpoch: sessionState.epoch,
memberConversationKey: sessionState.memberConversationKey,
members,
@@ -49,12 +49,15 @@ export function useWebClientServerHistory({
function recordCurrentServer(): void {
const address = currentTarget.value;
if (!address) return;
const savedServer = quickServers.value.find((server) => server.id === serverKey(address));
const recent: RecentServer = {
id: serverKey(address),
address,
...(nickname.value.trim() ? { nickname: nickname.value.trim() } : {}),
...(rememberIdentity.value && identityMaterial.value ? { identityId: "current" } : {}),
lastConnectedAt: Date.now(),
...(savedServer?.serverName ? { serverName: savedServer.serverName } : {}),
...(savedServer?.serverIcon ? { serverIcon: savedServer.serverIcon } : {}),
...(channel.value.trim() ? { lastChannelHint: { name: channel.value.trim() } } : {}),
};
void recordRecentServer(recent).then(() => listRecentServers().then((items) => { recentServers.value = items; }));
@@ -77,12 +80,15 @@ export function useWebClientServerHistory({
const normalizedAddress = address.trim();
if (!normalizedAddress) return;
const id = serverKey(normalizedAddress);
const existing = quickServers.value.find((server) => server.id === id);
const favorite: FavoriteServer = {
id,
label: label.trim() || normalizedAddress,
address: normalizedAddress,
...(savedNickname ? { nickname: savedNickname } : {}),
...(rememberIdentity.value && identityMaterial.value ? { identityId: "current" } : {}),
...(existing?.serverName ? { serverName: existing.serverName } : {}),
...(existing?.serverIcon ? { serverIcon: existing.serverIcon } : {}),
...(channelHint ? { lastChannelHint: { name: channelHint } } : {}),
};
await saveFavorite(favorite);
@@ -124,6 +130,37 @@ export function useWebClientServerHistory({
showToast(t("savedFavoriteToast"));
}
async function updateCurrentServerIdentity(serverName: string, serverIcon: string | null): Promise<void> {
const address = currentTarget.value;
const name = serverName.trim().slice(0, 256);
if (!address || !name) return;
const id = serverKey(address);
const existingRecent = recentServers.value.find((server) => server.id === id);
const recent: RecentServer = {
...(existingRecent ?? {}),
id,
address,
lastConnectedAt: existingRecent?.lastConnectedAt ?? Date.now(),
serverName: name,
...(nickname.value.trim() ? { nickname: nickname.value.trim() } : {}),
...(channel.value.trim() ? { lastChannelHint: { name: channel.value.trim() } } : {}),
};
if (serverIcon) recent.serverIcon = serverIcon;
else delete recent.serverIcon;
recentServers.value = [recent, ...recentServers.value.filter((server) => server.id !== id)]
.sort((left, right) => right.lastConnectedAt - left.lastConnectedAt).slice(0, 10);
await recordRecentServer(recent);
const favorite = favoriteServers.value.find((server) => server.id === id);
if (favorite) {
const updated: FavoriteServer = { ...favorite, serverName: name };
if (serverIcon) updated.serverIcon = serverIcon;
else delete updated.serverIcon;
favoriteServers.value = favoriteServers.value.map((server) => server.id === id ? updated : server);
await saveFavorite(updated);
}
}
function clearServerHistory(): void {
favoriteServers.value = [];
recentServers.value = [];
@@ -136,6 +173,7 @@ export function useWebClientServerHistory({
isFavorite,
loadSavedServers,
recordCurrentServer,
updateCurrentServerIdentity,
selectLocalServer,
saveFavoriteServer,
removeFavoriteServer,
+4
View File
@@ -31,6 +31,8 @@ export interface FavoriteServer {
nickname?: string;
identityId?: string;
lastChannelHint?: { id?: string; name?: string };
serverName?: string;
serverIcon?: string;
}
export interface RecentServer {
@@ -40,6 +42,8 @@ export interface RecentServer {
identityId?: string;
lastConnectedAt: number;
lastChannelHint?: { id?: string; name?: string };
serverName?: string;
serverIcon?: string;
}
export interface LocalPreferences {
+32
View File
@@ -46,3 +46,35 @@ test("quick server addresses are trimmed, normalized, and empty targets are skip
assert.equal(quickServers[0].id, "voice.example:9987");
assert.equal(quickServers[0].address, "Voice.Example:9987");
});
test("server-provided name and image replace address placeholders while custom favorite names stay intact", () => {
const icon = "data:image/png;base64,iVBORw0KGgo=";
const quickServers = mergeQuickServers(
[
{ id: "shanghai", label: "shanghai.example:9987", address: "shanghai.example:9987" },
{ id: "custom", label: "My room", address: "custom.example:9987" },
],
[
{ id: "recent-shanghai", address: "shanghai.example:9987", serverName: "兄弟们的teamspeak", serverIcon: icon, lastConnectedAt: 2 },
{ id: "recent-custom", address: "custom.example:9987", serverName: "Original TeamSpeak name", lastConnectedAt: 1 },
],
);
const shanghai = quickServers.find((server) => server.address === "shanghai.example:9987");
const custom = quickServers.find((server) => server.address === "custom.example:9987");
assert.equal(shanghai?.label, "兄弟们的teamspeak");
assert.equal(shanghai?.serverIcon, icon);
assert.equal(custom?.label, "My room");
assert.equal(custom?.serverName, "Original TeamSpeak name");
});
test("unsafe or non-image server icon URLs are ignored", () => {
const quickServers = mergeQuickServers([], [{
id: "recent",
address: "voice.example:9987",
serverName: "Voice",
serverIcon: "https://tracking.example/image.png",
lastConnectedAt: 1,
}]);
assert.equal(quickServers[0].serverIcon, undefined);
});
+27 -2
View File
@@ -1,4 +1,5 @@
import type { FavoriteServer, RecentServer } from "./local-persistence.js";
import { splitTeamSpeakTarget } from "./teamspeak-target.js";
export interface QuickServer {
id: string;
@@ -9,6 +10,20 @@ export interface QuickServer {
lastChannelHint?: { id?: string; name?: string };
isFavorite: boolean;
lastConnectedAt?: number;
serverName?: string;
serverIcon?: string;
}
export function isSafeQuickServerIcon(value: unknown): value is string {
return typeof value === "string" && value.length <= 180_000
&& /^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(value);
}
export function isQuickServerAddressLabel(label: string, address: string): boolean {
const normalizedLabel = label.trim().toLocaleLowerCase();
const candidates = new Set([address.trim()]);
try { candidates.add(splitTeamSpeakTarget(address).address.trim()); } catch { /* Persisted targets are validated on write. */ }
return [...candidates].some((candidate) => candidate.length >= 3 && normalizedLabel.includes(candidate.toLocaleLowerCase()));
}
/**
@@ -33,11 +48,19 @@ export function mergeQuickServers(
if (!key || seen.has(key)) continue;
seen.add(key);
const recent = recentByAddress.get(key);
const serverName = recent?.serverName?.trim() || favorite.serverName?.trim() || "";
const serverIcon = isSafeQuickServerIcon(recent?.serverIcon) ? recent.serverIcon
: isSafeQuickServerIcon(favorite.serverIcon) ? favorite.serverIcon : "";
const savedLabel = favorite.label.trim();
result.push({
id: key,
address: favorite.address.trim(),
label: favorite.label.trim() || favorite.address.trim(),
label: serverName && (!savedLabel || isQuickServerAddressLabel(savedLabel, favorite.address))
? serverName
: savedLabel || favorite.address.trim(),
isFavorite: true,
...(serverName ? { serverName } : {}),
...(serverIcon ? { serverIcon } : {}),
...(recent?.nickname || favorite.nickname ? { nickname: recent?.nickname || favorite.nickname } : {}),
...(recent?.identityId || favorite.identityId ? { identityId: recent?.identityId || favorite.identityId } : {}),
...(recent?.lastChannelHint || favorite.lastChannelHint ? { lastChannelHint: recent?.lastChannelHint ?? favorite.lastChannelHint } : {}),
@@ -52,8 +75,10 @@ export function mergeQuickServers(
result.push({
id: key,
address: recent.address.trim(),
label: recent.address.trim(),
label: recent.serverName?.trim() || recent.address.trim(),
isFavorite: false,
...(recent.serverName?.trim() ? { serverName: recent.serverName.trim() } : {}),
...(isSafeQuickServerIcon(recent.serverIcon) ? { serverIcon: recent.serverIcon } : {}),
...(recent.nickname ? { nickname: recent.nickname } : {}),
...(recent.identityId ? { identityId: recent.identityId } : {}),
...(recent.lastChannelHint ? { lastChannelHint: recent.lastChannelHint } : {}),
+1 -1
View File
@@ -46,7 +46,7 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [
{
id: BUILTIN_KAAK_SKIN_ID,
name: "KAAK",
version: "3.1.62",
version: "3.1.64",
author: "WebSpeak Project",
license: "AGPL-3.0-only",
description: "A KOOK-inspired voice-room workspace with collapsible voice groups, channel chat, TeamSpeak profile cards, accessible host-owned member controls, and WebSpeak screen sharing.",
+24 -6
View File
@@ -464,7 +464,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.62");
assert.equal(skin.version, "3.1.64");
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");
@@ -517,8 +517,11 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
assert.equal(chatExpand?.attributes?.["aria-expanded"], "{{state.chatopen}}");
assert.deepEqual(findPart(voice?.root, "chat")?.when, { path: "state.chatopen", equals: true });
assert.equal(voice?.root.attributes?.["data-chat-open"], "{{state.chatopen}}");
assert.equal(findPart(voice?.root, "server-monogram")?.children?.[0]?.text, "{{server.monogram}}");
assert.equal(findPart(voice?.root, "server-icon")?.attributes?.src, "{{server.icon}}");
assert.equal(findPart(voice?.root, "server-monogram-initial")?.children?.[0]?.text, "{{server.monogram}}");
assert.equal(findPart(voice?.root, "server-monogram")?.attributes?.["data-tone"], "{{server.tone}}");
assert.deepEqual(findPart(voice?.root, "identity-online")?.when, { path: "session.status.connected", equals: true });
assert.equal(findPart(voice?.root, "identity-online")?.attributes?.role, "img");
const voiceStageHeadingItem = findPart(voice?.root, "voice-stage-heading-item");
assert.equal(voiceStageHeadingItem?.repeat?.path, "session.channels");
const voiceStageHeading = findPart(voiceStageHeadingItem, "voice-stage-heading");
@@ -617,14 +620,29 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
assert.match(skin.css, /kaak-workspace\.voice-channel-group-toggle/);
assert.match(skin.css, /voice-channel-list[\s\S]*?grid-template-rows: 1fr;[\s\S]*?transition: grid-template-rows \.18s ease/);
assert.match(skin.css, /data-voice-group-open="false"[\s\S]*?voice-channel-list[\s\S]*?grid-template-rows: 0fr;[\s\S]*?visibility: hidden;[\s\S]*?visibility 0s linear \.18s/);
assert.match(skin.css, /kaak-workspace\.server-monogram"\]\[data-tone="0"\]/);
assert.match(skin.css, /voice-stage-heading[\s\S]*?flex: 0 0 46px;/);
assert.doesNotMatch(skin.css, /aria-expanded="true"\]\s*[^\n]*voice-stage-heading[^\n]*display: none;/);
assert.match(skin.css, /kaak-workspace"\]:has\(\[data-ws-plugin-part="kaak-workspace\.chat-panel-toggle"\]\[aria-expanded="false"\]\)[\s\S]*?grid-template-columns: 80px 290px minmax\(280px, 1fr\) 0;/);
assert.match(skin.css, /grid-template-columns: 80px 290px/);
assert.match(skin.css, /kaak-workspace"\]:has\(\[data-ws-plugin-part="kaak-workspace\.chat-panel-toggle"\]\[aria-expanded="false"\]\)[\s\S]*?grid-template-columns: 86px 290px minmax\(280px, 1fr\) 0;/);
assert.match(skin.css, /grid-template-columns: 86px 290px/);
assert.match(skin.css, /minmax\(340px, min\(38vw, 520px\)\)/);
assert.match(skin.css, /grid-template-rows: 40px/);
assert.match(skin.css, /kaak-workspace\.server-monogram[\s\S]*?width: 48px;[\s\S]*?height: 48px;/);
assert.match(skin.css, /kaak-workspace\.server-rail"\]\s*\{[\s\S]*?--skin-kaak-rail-bg: #191a1d;[\s\S]*?--skin-kaak-rail-item-bg: #2b2d32;[\s\S]*?--skin-kaak-rail-accent: #75c900;[\s\S]*?gap: 18px;[\s\S]*?padding: 14px 0 96px;[\s\S]*?background: var\(--skin-kaak-rail-bg\);/);
assert.match(skin.css, /kaak-workspace\.quick-server-item"\]\s*\{[\s\S]*?width: 58px;[\s\S]*?height: 58px;/);
assert.match(skin.css, /kaak-workspace\.quick-server"\]\s*\{[\s\S]*?width: 58px;[\s\S]*?height: 58px;[\s\S]*?border: 2px solid transparent;[\s\S]*?border-radius: 18px;/);
assert.match(skin.css, /quick-server\"\]\:hover[\s\S]*?background: #383a40;/);
assert.match(skin.css, /quick-server\"\]\:not\(\[aria-current=\"true\"\]\):hover[\s\S]*?server-monogram[\s\S]*?background: #383a40;/);
assert.match(skin.css, /quick-server\"\]\[aria-current=\"true\"\] \{[\s\S]*?border-color: var\(--skin-kaak-rail-accent\);[\s\S]*?background: var\(--skin-kaak-rail-item-bg\);/);
assert.match(skin.css, /quick-server\"\]\[aria-current=\"true\"\][\s\S]*?server-monogram[\s\S]*?background: var\(--skin-kaak-rail-item-bg\);/);
assert.match(skin.css, /quick-server\"\]\[aria-current=\"true\"\]::before[\s\S]*?left: -16px;[\s\S]*?top: 10px;[\s\S]*?width: 4px;[\s\S]*?height: 34px;/);
assert.match(skin.css, /kaak-workspace\.identity-entry\"\]\s*\{[\s\S]*?width: 86px;[\s\S]*?background: #191a1d;/);
assert.match(skin.css, /kaak-workspace\.server-monogram[\s\S]*?width: 100%;[\s\S]*?height: 100%;[\s\S]*?border-radius: 16px;[\s\S]*?font-size: 23px;[\s\S]*?font-weight: 600;/);
assert.match(skin.css, /kaak-workspace\.server-icon[\s\S]*?width: 100%;[\s\S]*?height: 100%;[\s\S]*?border-radius: inherit;[\s\S]*?object-fit: cover;/);
assert.doesNotMatch(skin.css, /server-monogram\"\]\[data-tone=/);
assert.match(skin.css, /kaak-workspace\.identity-monogram\"\]\s*\{[\s\S]*?width: 54px;[\s\S]*?height: 54px;[\s\S]*?border-radius: 50%;[\s\S]*?background: #176a9e;[\s\S]*?font-size: 17px;/);
assert.match(skin.css, /kaak-workspace\.identity-online\"\]\s*\{[\s\S]*?right: -2px;[\s\S]*?bottom: -2px;[\s\S]*?width: 17px;[\s\S]*?height: 17px;[\s\S]*?border: 3px solid #191a1d;[\s\S]*?background: #75c900;/);
assert.match(skin.css, /kaak-workspace\.identity-name\"\]\s*\{\s*display: none;/);
assert.match(skin.css, /@media \(max-width: 820px\)[\s\S]*?grid-template-columns: 86px minmax\(0, 1fr\);[\s\S]*?grid-template-columns: 86px minmax\(0, 1fr\);/);
assert.match(skin.css, /@media \(max-height: 620px\)[\s\S]*?server-rail[\s\S]*?padding-bottom: 76px;/);
assert.match(skin.css, /voice-grid[\s\S]*?grid-template-columns: repeat\(auto-fit/);
assert.match(skin.css, /voice-card[\s\S]*?aspect-ratio: 1\.82;/);
assert.match(skin.css, /\.voice-card\s*\{[\s\S]*?transition: border-color \.18s ease, background-color \.18s ease, box-shadow \.18s ease;/);
+8 -3
View File
@@ -1,10 +1,11 @@
import type { QuickServer } from "./quick-servers.js";
import { isSafeQuickServerIcon, type QuickServer } from "./quick-servers.js";
import { splitTeamSpeakTarget } from "./teamspeak-target.js";
export interface SkinPluginQuickServer {
id: string;
label: string;
monogram: string;
icon: string;
tone: number;
current: boolean;
kind: "favorite" | "recent";
@@ -47,13 +48,17 @@ export function createSkinPluginQuickServerProjection(createId: () => string = r
}
targetByOpaqueId.set(opaqueId, server);
const label = server.label.trim();
const serverName = server.serverName?.trim() ?? "";
const safeLabel = !label || containsConnectionTarget(label, server.address)
? `${server.isFavorite ? "Favorite" : "Recent"} ${index + 1}`
? serverName && !containsConnectionTarget(serverName, server.address)
? serverName
: `${server.isFavorite ? "Favorite" : "Recent"} ${index + 1}`
: label;
return {
id: opaqueId,
label: safeLabel,
monogram: Array.from(safeLabel)[0] ?? "?",
monogram: Array.from(serverName || safeLabel)[0] ?? "?",
icon: isSafeQuickServerIcon(server.serverIcon) ? server.serverIcon : "",
tone: safeLabelTone(safeLabel),
current: isCurrent(server),
kind: server.isFavorite ? "favorite" : "recent",
@@ -83,3 +83,21 @@ test("skin quick-server data redacts connection targets and resolves only host-g
assert.equal(projection.resolve("opaque-1")?.address, "192.0.2.10:9987");
assert.equal(projection.resolve("192.0.2.10:9987"), undefined);
});
test("skin quick-server projection uses the TeamSpeak name and public icon while keeping its target private", () => {
const icon = "data:image/png;base64,iVBORw0KGgo=";
const projection = createSkinPluginQuickServerProjection(() => "opaque-server");
const [server] = projection.project([{
id: "shanghai.example:9987",
address: "shanghai.example:9987",
label: "shanghai.example:9987",
serverName: "兄弟们的teamspeak",
serverIcon: icon,
isFavorite: false,
}], () => true);
assert.equal(server.label, "兄弟们的teamspeak");
assert.equal(server.monogram, "兄");
assert.equal(server.icon, icon);
assert.equal(JSON.stringify(server).includes("shanghai.example"), false);
});
+6
View File
@@ -7900,6 +7900,12 @@
text-transform: uppercase;
}
.favorite-server-avatar img {
width: 100%;
height: 100%;
object-fit: cover;
}
.favorite-server-tooltip {
position: absolute;
z-index: 45;
+28 -7
View File
@@ -347,7 +347,7 @@
<div class="ws-skin-mount-slot" data-ws-skin-mount="voice.server-rail.before"></div>
<div class="favorite-server-rail-list" data-ws-part="voice.favorite-servers.rail.list">
<div
v-for="server in quickServers"
v-for="server in quickServersForDisplay"
:key="server.id"
class="favorite-server-rail-item"
data-ws-part="voice.favorite-servers.rail.item"
@@ -365,7 +365,7 @@
:disabled="voiceState.connecting"
@click.stop="connectQuickServer(server)"
>
<span class="favorite-server-avatar" data-ws-part="voice.favorite-servers.avatar" :style="avatarStyle(server.label)">{{ avatarInitial(server.label) }}</span>
<span class="favorite-server-avatar" data-ws-part="voice.favorite-servers.avatar" :style="avatarStyle(server.label)"><img v-if="server.serverIcon" :src="server.serverIcon" alt="" aria-hidden="true" /><template v-else>{{ avatarInitial(server.serverName || server.label) }}</template></span>
<span class="favorite-server-tooltip" data-ws-part="voice.favorite-servers.tooltip"><strong>{{ server.label }}</strong><small>{{ server.address }}</small></span>
</button>
<button
@@ -400,7 +400,7 @@
:aria-label="t('quickServers')"
>
<div
v-for="server in quickServers"
v-for="server in quickServersForDisplay"
:key="server.id"
class="favorite-server-strip-item"
data-ws-part="voice.favorite-servers.strip.item"
@@ -415,7 +415,7 @@
:aria-pressed="isQuickServerTarget(server)"
:disabled="voiceState.connecting"
@click="connectQuickServer(server)"
><span class="favorite-server-avatar" data-ws-part="voice.favorite-servers.avatar" :style="avatarStyle(server.label)">{{ avatarInitial(server.label) }}</span><span>{{ server.label }}</span></button
><span class="favorite-server-avatar" data-ws-part="voice.favorite-servers.avatar" :style="avatarStyle(server.label)"><img v-if="server.serverIcon" :src="server.serverIcon" alt="" aria-hidden="true" /><template v-else>{{ avatarInitial(server.serverName || server.label) }}</template></span><span>{{ server.label }}</span></button
><button
type="button"
:class="['favorite-server-strip-toggle', { active: server.isFavorite }]"
@@ -1011,7 +1011,7 @@ import { useWebClientPublicConfig } from "../composables/useWebClientPublicConfi
import { useWebClientServerHistory } from "../composables/useWebClientServerHistory.js";
import { getInitialLanguage, type Language } from "../i18n/web-client.js";
import { clearLocalData as clearStoredLocalData, isLocalPersistenceAvailable, loadLocalPreferences, loadStoredIdentity, removeStoredIdentity, saveLocalPreferences, saveStoredIdentity, type FavoriteServer } from "../services/local-persistence.js";
import type { QuickServer } from "../services/quick-servers.js";
import { isQuickServerAddressLabel, type QuickServer } from "../services/quick-servers.js";
import type { InstalledSkin, SkinHomeCopy } from "../services/skin-pack.js";
import { isPublicSkinEnabled } from "../services/skin-catalog.js";
import { BUILTIN_DARK_SKIN, BUILTIN_LIGHT_SKIN } from "../services/skin-runtime.js";
@@ -1025,6 +1025,7 @@ import { combineTeamSpeakTarget, DEFAULT_TEAM_SPEAK_PORT, isValidTeamSpeakPort,
const {
state: voiceState,
serverInfo: voiceServerInfo,
sessionEpoch,
memberConversationKey,
members,
@@ -1180,6 +1181,7 @@ const {
isFavorite,
loadSavedServers,
recordCurrentServer,
updateCurrentServerIdentity,
selectLocalServer,
saveFavoriteServer,
toggleFavorite,
@@ -1444,6 +1446,20 @@ function isQuickServerTarget(server: QuickServer): boolean {
return server.id === currentServerTarget().toLocaleLowerCase();
}
const quickServersForDisplay = computed(() => quickServers.value.map((server) => {
const liveInfo = isQuickServerTarget(server) ? voiceServerInfo.value : null;
const serverName = liveInfo?.name.trim() || server.serverName;
const label = serverName && (!server.label.trim() || isQuickServerAddressLabel(server.label, server.address))
? serverName
: server.label;
return {
...server,
label,
...(serverName ? { serverName } : {}),
serverIcon: liveInfo ? (liveInfo.icon || undefined) : server.serverIcon,
};
}));
function connectQuickServer(server: QuickServer): void {
if (accessMode.value !== "open" || voiceState.connecting || (voiceState.connected && isQuickServerTarget(server))) return;
const target = splitTeamSpeakTarget(server.address);
@@ -1527,7 +1543,7 @@ async function submitFavoriteServerDraft(draft: FavoriteServerDraft): Promise<vo
const visiblePokes = computed(() => pokeNotifications.slice(-3));
const skinPluginQuickServers = createSkinPluginQuickServerProjection();
const skinPluginQuickList = computed(() => skinPluginQuickServers.project(quickServers.value, isQuickServerTarget));
const skinPluginQuickList = computed(() => skinPluginQuickServers.project(quickServersForDisplay.value, isQuickServerTarget));
const skinPluginFavorites = computed(() => skinPluginQuickList.value
.filter((server) => server.favorite)
.map(({ favorite: _favorite, ...server }) => server));
@@ -1697,7 +1713,7 @@ const skinPluginWidgets = {
accessMode: accessMode.value,
openTargetPrefillBlocked: openTargetPrefillBlocked.value,
accelerationRelays: accelerationRelays.value,
quickServers: quickServers.value,
quickServers: quickServersForDisplay.value,
isFavorite: isFavorite.value,
identityExportBusy: identityExportBusy.value,
hasIdentity: Boolean(identityMaterial.value),
@@ -1888,6 +1904,11 @@ watch(() => voiceState.connected, (connected) => {
playNotification("connected");
recordCurrentServer();
});
watch(voiceServerInfo, (server) => {
if (server && voiceState.connected && server.name.trim()) {
void updateCurrentServerIdentity(server.name, server.icon ?? null);
}
});
watch(() => voiceState.errorCode, (code) => {
if (!favoriteSwitchPending.value || !code || code === "SERVER_PASSWORD_REQUIRED" || code === "INVALID_SERVER_PASSWORD") return;
failFavoriteConnection(localizedMessage(voiceState.error) || t("quickConnectFailed"));
File diff suppressed because it is too large. Load diff