From 32d84435ce1f84ac711300411be44e4e55c89e87 Mon Sep 17 00:00:00 2001 From: illusia <64828020+EchoSixHIYA@users.noreply.github.com> Date: Sun, 18 Oct 2026 11:10:54 +0800 Subject: [PATCH 1/4] fix(screen-share): correct fullscreen dimensions --- .../web-client/ScreenSharePlayer.vue | 27 ++++++++++++++++--- web/src/styles/web-client.css | 10 ++++++- web/test/screen-share-ui.test.mjs | 10 +++++++ 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/web/src/components/web-client/ScreenSharePlayer.vue b/web/src/components/web-client/ScreenSharePlayer.vue index 4c9ed8c..c9674b0 100644 --- a/web/src/components/web-client/ScreenSharePlayer.vue +++ b/web/src/components/web-client/ScreenSharePlayer.vue @@ -138,18 +138,35 @@ function updateStageSize(): void { const stage = stageElement.value; const player = playerElement.value ?? stage?.parentElement ?? null; if (!stage || !player) return; - if (screenShareFullscreen.value) { + // Read the browser's fullscreen element directly. The Vue state is updated + // by a separate fullscreenchange listener and can lag the layout transition. + if (typeof document !== "undefined" && document.fullscreenElement === player) { + const fullscreenHeight = typeof CSS !== "undefined" && CSS.supports("height", "100dvh") ? "100dvh" : "100vh"; + setInlineStyle(player, "position", "fixed"); + setInlineStyle(player, "inset", "0"); setInlineStyle(player, "width", "100vw"); - setInlineStyle(player, "height", "100vh"); + setInlineStyle(player, "height", fullscreenHeight); + setInlineStyle(player, "max-width", "none"); + setInlineStyle(player, "max-height", "none"); + setInlineStyle(player, "margin", "0"); setInlineStyle(stage, "width", "100%"); setInlineStyle(stage, "height", "100%"); + setInlineStyle(stage, "min-height", "0"); + setInlineStyle(stage, "max-height", "none"); setInlineStyle(stage, "aspect-ratio", "auto"); return; } + setInlineStyle(player, "position", null); + setInlineStyle(player, "inset", null); setInlineStyle(player, "width", null); setInlineStyle(player, "height", null); + setInlineStyle(player, "max-width", null); + setInlineStyle(player, "max-height", null); + setInlineStyle(player, "margin", null); setInlineStyle(stage, "width", null); setInlineStyle(stage, "height", null); + setInlineStyle(stage, "min-height", null); + setInlineStyle(stage, "max-height", null); setInlineStyle(stage, "aspect-ratio", "auto"); } @@ -168,9 +185,13 @@ function setStageElement(element: unknown): void { updateStageSize(); } -onMounted(() => window.addEventListener("resize", updateStageSize)); +onMounted(() => { + window.addEventListener("resize", updateStageSize); + document.addEventListener("fullscreenchange", updateStageSize); +}); watch(screenShareFullscreen, updateStageSize); onBeforeUnmount(() => { window.removeEventListener("resize", updateStageSize); + document.removeEventListener("fullscreenchange", updateStageSize); }); diff --git a/web/src/styles/web-client.css b/web/src/styles/web-client.css index dc1e33a..85c3c7a 100644 --- a/web/src/styles/web-client.css +++ b/web/src/styles/web-client.css @@ -7388,15 +7388,23 @@ } :deep(.screen-share-player:fullscreen) { + position: fixed; + inset: 0; width: 100vw; height: 100vh; + height: 100dvh; + max-width: none; + max-height: none; + margin: 0; border: 0; border-radius: 0; - background: var(--surface-0); + background: #000; } :deep(.screen-share-player:fullscreen .screen-share-player-stage) { + width: 100%; height: 100%; + min-height: 0; max-height: none; aspect-ratio: auto; } diff --git a/web/test/screen-share-ui.test.mjs b/web/test/screen-share-ui.test.mjs index c90d552..67fc5aa 100644 --- a/web/test/screen-share-ui.test.mjs +++ b/web/test/screen-share-ui.test.mjs @@ -48,6 +48,8 @@ test("screen-share player fills the content width, limits height, and letterboxe const playerRule = css.match(/:deep\(\.screen-share-player\)\s*\{([^}]*)\}/)?.[1] ?? ""; const stageRule = css.match(/:deep\(\.screen-share-player-stage\)\s*\{([^}]*)\}/)?.[1] ?? ""; const videoRule = css.match(/:deep\(\.screen-share-player-video\)\s*\{([^}]*)\}/)?.[1] ?? ""; + const fullscreenRule = css.match(/:deep\(\.screen-share-player:fullscreen\)\s*\{([^}]*)\}/)?.[1] ?? ""; + const fullscreenStageRule = css.match(/:deep\(\.screen-share-player:fullscreen \.screen-share-player-stage\)\s*\{([^}]*)\}/)?.[1] ?? ""; assert.match(playerRule, /width:\s*100%/); assert.doesNotMatch(playerRule, /width:\s*fit-content/); assert.match(stageRule, /width:\s*100%/); @@ -55,6 +57,14 @@ test("screen-share player fills the content width, limits height, and letterboxe assert.match(stageRule, /background:\s*#000/); assert.match(videoRule, /object-fit:\s*contain/); assert.match(videoRule, /background:\s*#000/); + assert.match(fullscreenRule, /position:\s*fixed/); + assert.match(fullscreenRule, /inset:\s*0/); + assert.match(fullscreenRule, /height:\s*100dvh/); + assert.match(fullscreenRule, /background:\s*#000/); + assert.match(fullscreenStageRule, /height:\s*100%/); + assert.match(fullscreenStageRule, /min-height:\s*0/); + assert.match(component, /document\.addEventListener\("fullscreenchange", updateStageSize\)/); + assert.match(component, /document\.fullscreenElement === player/); assert.doesNotMatch(component, /video\.video(?:Width|Height)/, "source dimensions must not resize the player stage"); assert.doesNotMatch(component, /ResizeObserver/, "player sizing must not create a resize-feedback loop while video starts"); assert.match(component, /if \(playerElement\.value === next\) return;/, "stable function refs must not rewrite player styles on every render"); From bcecf4fed4698d56e0b4fab89aacce89443feffe Mon Sep 17 00:00:00 2001 From: yumi Date: Wed, 21 Oct 2026 15:31:19 +0800 Subject: [PATCH 2/4] fix(kook): keep returning users in the voice workspace --- package.json | 2 +- web/src/composables/useKookWorkspace.ts | 31 ++++++++++ web/src/services/local-persistence.ts | 1 + web/src/styles/web-client.css | 31 ++++++++++ web/src/views/WebClient.vue | 43 +++++++++++--- web/test/kook-workspace.test.mjs | 79 +++++++++++++++++++++++++ 6 files changed, 179 insertions(+), 8 deletions(-) create mode 100644 web/src/composables/useKookWorkspace.ts create mode 100644 web/test/kook-workspace.test.mjs diff --git a/package.json b/package.json index d618d42..c428d28 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "scripts": { "dev": "tsx src/index.ts", "build": "tsc", - "test": "node --import tsx --test web/src/voice/member-volume-preferences.test.ts web/src/services/voice-channel-tree.test.ts src/admin/skin-registry.test.ts web/test/admin-api.integration.test.ts web/test/admin-view.test.mjs web/src/services/admin-api.test.ts src/security/open-target-policy.test.ts scripts/acceleration-poc/target-guard-parity.test.mjs src/server/acceleration-relay.test.ts src/server/visitor-count.test.ts src/server/voice-protocol.test.ts src/server/teamspeak-resolver.test.ts src/server/teamspeak-adapter.test.ts src/server/ts-client.test.ts src/server/join-ticket.test.ts src/server/identity-lease.test.ts src/server/session-manager.test.ts src/server/directory-sync.test.ts src/server/session-events.test.ts src/server/reconnect-policy.test.ts src/server/voice-commands.test.ts src/server/voice-bridge.test.ts src/server/session-audio.test.ts src/server/voice-bridge.integration.test.ts src/server/webrtc-audio.test.ts src/server/webrtc-config.test.ts src/server/audio-stats.test.ts src/server/channel-capacity.test.ts src/server/directory-view.test.ts src/server/member-avatars.test.ts src/server/screen-share-coordinator.test.ts src/shared/client-commands.test.ts src/shared/skin-layout.test.ts src/shared/skin-plugin.test.ts src/shared/skin-runtime-plugin-context.test.ts src/shared/skin-runtime-plugins.test.ts src/shared/skin-runtime-plugin-approval.test.ts src/shared/server-messages.test.ts src/shared/webrtc.test.ts scripts/docker-healthcheck.test.mjs web/test/voice-session.test.mjs web/test/audio-controls.test.mjs web/test/connection-dialogs.test.mjs web/test/voice-performance.test.mjs web/test/screen-share.test.ts web/test/screen-share-ui.test.mjs web/test/android-gateway.test.ts web/src/services/skin-catalog.test.ts web/src/services/skin-content.test.ts web/src/services/skin-plugin-runtime.test.ts web/src/services/skin-plugin-authoring.test.ts web/src/services/skin-editor-mode.test.ts web/src/services/skin-plugin-approval.test.ts web/src/services/host-editor-top-layer.test.ts web/src/services/skin-extension-ui.test.ts web/src/services/member-menu-placement.test.ts web/src/services/audio-device-menu-placement.test.ts web/src/services/mobile-viewport.test.ts web/src/services/mobile-away.test.ts web/src/services/screen-wake-lock.test.ts web/src/services/microphone-start.test.ts web/src/services/skin-pack.test.ts web/src/services/skin-runtime-plugin-approval.test.ts web/src/services/skin-layout-storage.test.ts web/src/services/skin-layout-geometry.test.ts web/src/services/skin-layout-focus.test.ts web/test/skin-layout-runtime.test.mjs web/test/skin-plugin-editor.test.mjs web/src/services/identity-import.test.ts web/src/services/identity-provider.test.ts web/test/identity-dialog.test.mjs web/test/skin-lifecycle.test.mjs web/src/services/local-persistence.test.ts web/src/services/quick-servers.test.ts src/server/teamspeak-alias.test.ts src/server/teamspeak-alias-integration.test.ts web/src/services/teamspeak-target.test.ts web/src/services/skin-extension-sandbox.test.ts web/src/services/skin-extension-wasm-policy.test.ts web/src/services/skin-extension-wasm-sandbox.test.ts web/src/services/skin-runtime-plugin-wasm.test.ts web/src/services/skin-extension-wasm-ui-loop.test.ts web/src/services/skin-wasm-interpreter.test.ts", + "test": "node --import tsx --test web/src/voice/member-volume-preferences.test.ts web/src/services/voice-channel-tree.test.ts src/admin/skin-registry.test.ts web/test/admin-api.integration.test.ts web/test/admin-view.test.mjs web/src/services/admin-api.test.ts src/security/open-target-policy.test.ts scripts/acceleration-poc/target-guard-parity.test.mjs src/server/acceleration-relay.test.ts src/server/visitor-count.test.ts src/server/voice-protocol.test.ts src/server/teamspeak-resolver.test.ts src/server/teamspeak-adapter.test.ts src/server/ts-client.test.ts src/server/join-ticket.test.ts src/server/identity-lease.test.ts src/server/session-manager.test.ts src/server/directory-sync.test.ts src/server/session-events.test.ts src/server/reconnect-policy.test.ts src/server/voice-commands.test.ts src/server/voice-bridge.test.ts src/server/session-audio.test.ts src/server/voice-bridge.integration.test.ts src/server/webrtc-audio.test.ts src/server/webrtc-config.test.ts src/server/audio-stats.test.ts src/server/channel-capacity.test.ts src/server/directory-view.test.ts src/server/member-avatars.test.ts src/server/screen-share-coordinator.test.ts src/shared/client-commands.test.ts src/shared/skin-layout.test.ts src/shared/skin-plugin.test.ts src/shared/skin-runtime-plugin-context.test.ts src/shared/skin-runtime-plugins.test.ts src/shared/skin-runtime-plugin-approval.test.ts src/shared/server-messages.test.ts src/shared/webrtc.test.ts scripts/docker-healthcheck.test.mjs web/test/voice-session.test.mjs web/test/audio-controls.test.mjs web/test/connection-dialogs.test.mjs web/test/kook-workspace.test.mjs web/test/voice-performance.test.mjs web/test/screen-share.test.ts web/test/screen-share-ui.test.mjs web/test/android-gateway.test.ts web/src/services/skin-catalog.test.ts web/src/services/skin-content.test.ts web/src/services/skin-plugin-runtime.test.ts web/src/services/skin-plugin-authoring.test.ts web/src/services/skin-editor-mode.test.ts web/src/services/skin-plugin-approval.test.ts web/src/services/host-editor-top-layer.test.ts web/src/services/skin-extension-ui.test.ts web/src/services/member-menu-placement.test.ts web/src/services/audio-device-menu-placement.test.ts web/src/services/mobile-viewport.test.ts web/src/services/mobile-away.test.ts web/src/services/screen-wake-lock.test.ts web/src/services/microphone-start.test.ts web/src/services/skin-pack.test.ts web/src/services/skin-runtime-plugin-approval.test.ts web/src/services/skin-layout-storage.test.ts web/src/services/skin-layout-geometry.test.ts web/src/services/skin-layout-focus.test.ts web/test/skin-layout-runtime.test.mjs web/test/skin-plugin-editor.test.mjs web/src/services/identity-import.test.ts web/src/services/identity-provider.test.ts web/test/identity-dialog.test.mjs web/test/skin-lifecycle.test.mjs web/src/services/local-persistence.test.ts web/src/services/quick-servers.test.ts src/server/teamspeak-alias.test.ts src/server/teamspeak-alias-integration.test.ts web/src/services/teamspeak-target.test.ts web/src/services/skin-extension-sandbox.test.ts web/src/services/skin-extension-wasm-policy.test.ts web/src/services/skin-extension-wasm-sandbox.test.ts web/src/services/skin-runtime-plugin-wasm.test.ts web/src/services/skin-extension-wasm-ui-loop.test.ts web/src/services/skin-wasm-interpreter.test.ts", "verify": "npm test && npm run build && npm run web:build", "skin:harbor:build": "node web/scripts/build-harbor-voice-skin.mjs", "skin:open-voice:build": "node web/scripts/build-open-voice-surface-skin.mjs", diff --git a/web/src/composables/useKookWorkspace.ts b/web/src/composables/useKookWorkspace.ts new file mode 100644 index 0000000..6a6eec8 --- /dev/null +++ b/web/src/composables/useKookWorkspace.ts @@ -0,0 +1,31 @@ +import { computed, ref, watch, type Ref } from "vue"; +import { BUILTIN_KAAK_SKIN_ID } from "../services/skin-catalog.js"; +import { saveLocalPreferences, type LocalPreferences, type RecentServer } from "../services/local-persistence.js"; + +/** Keep the KOOK workspace available after the first successful connection. */ +export function useKookWorkspace(options: { + skinId: Readonly>; + connected: Readonly>; +}) { + const hasConnected = ref(false); + const active = computed(() => options.skinId.value === BUILTIN_KAAK_SKIN_ID + && hasConnected.value); + + watch(options.connected, (connected) => { + if (!connected) return; + hasConnected.value = true; + void saveLocalPreferences({ schemaVersion: 1, hasConnected: true }); + }, { flush: "sync", immediate: true }); + + function restore(preferences: LocalPreferences, recent: readonly RecentServer[]): void { + // Recent servers were already recorded only after successful connections, + // so existing users do not need to repeat onboarding after this update. + hasConnected.value ||= preferences.hasConnected === true || recent.length > 0; + } + + function reset(): void { + hasConnected.value = false; + } + + return { active, restore, reset }; +} diff --git a/web/src/services/local-persistence.ts b/web/src/services/local-persistence.ts index 44848e6..77bf493 100644 --- a/web/src/services/local-persistence.ts +++ b/web/src/services/local-persistence.ts @@ -154,6 +154,7 @@ export interface LocalPreferences { outputVolume?: number; notificationVolume?: number; lastNickname?: string; + hasConnected?: boolean; inputDeviceId?: string; volumesByUid?: Record; } diff --git a/web/src/styles/web-client.css b/web/src/styles/web-client.css index 85c3c7a..673d6ac 100644 --- a/web/src/styles/web-client.css +++ b/web/src/styles/web-client.css @@ -27,6 +27,37 @@ visibility: hidden; } +.kook-connection-status { + position: fixed; + z-index: 40; + top: 12px; + left: 50%; + transform: translateX(-50%); + display: flex; + align-items: center; + gap: 12px; + max-width: calc(100% - 100px); + padding: 10px 14px; + border: 1px solid #424448; + border-radius: 10px; + color: #fff; + background: #252629; +} + +.kook-connection-status button { + flex-shrink: 0; + padding: 7px 10px; + border-radius: 6px; + color: #fff; + background: #477f00; + cursor: pointer; +} + +.kook-connection-status button:disabled { + opacity: .5; + cursor: default; +} + :global(html[data-ws-route="webclient"] .web-client .rail-avatar), :global(html[data-ws-route="webclient"] .web-client .server-avatar), :global(html[data-ws-route="webclient"] .web-client .profile-avatar), diff --git a/web/src/views/WebClient.vue b/web/src/views/WebClient.vue index 465c097..128e801 100644 --- a/web/src/views/WebClient.vue +++ b/web/src/views/WebClient.vue @@ -55,6 +55,19 @@ @restore-skin="switchToBuiltIn" /> +
voiceState.connected), +}); const showVoiceShell = computed(() => Boolean( + kookWorkspace.active.value || voiceState.connected || voiceState.reconnecting || voiceState.reconnectFailed || favoriteSwitchPending.value || favoriteSwitchFailed.value, )); @@ -1455,6 +1475,7 @@ const quickServersForDisplay = computed(() => quickServers.value.map((server) => })); function connectQuickServer(server: QuickServer): void { + if (serverConfigLoading.value || !identityReady.value) return; if ((voiceState.connecting || voiceState.connected) && isQuickServerTarget(server)) return; if (accessMode.value !== "open") { showToast(t("serverSwitchRestricted")); @@ -1483,8 +1504,11 @@ function beginFavoriteConnection(): void { favoriteSwitchPending.value = true; favoriteSwitchFailed.value = false; favoriteSwitchError.value = ""; + if (!canJoin.value) { + failFavoriteConnection(t("quickConnectFailed")); + return; + } doConnect(); - if (!voiceState.connecting && !voiceState.connected) failFavoriteConnection(t("quickConnectFailed")); } function failFavoriteConnection(message: string): void { @@ -1514,12 +1538,12 @@ function openFavoriteServerDialog(): void { showToast(t("serverFeatureAdminDisabled")); return; } - if (!showVoiceShell.value || voiceState.connecting || favoriteDialogBusy.value) return; + if (!showVoiceShell.value || serverConfigLoading.value || !identityReady.value || voiceState.connecting || favoriteDialogBusy.value) return; favoriteServerDialogOpen.value = true; } async function submitFavoriteServerDraft(draft: FavoriteServerDraft): Promise { - if (favoriteDialogBusy.value || voiceState.connecting || accessMode.value !== "open") return; + if (favoriteDialogBusy.value || serverConfigLoading.value || !identityReady.value || voiceState.connecting || accessMode.value !== "open") return; const port = draft.port || DEFAULT_TEAM_SPEAK_PORT; if (!draft.address || !draft.nickname || !isValidTeamSpeakPort(port)) { showToast(t("quickConnectFailed")); @@ -2102,10 +2126,15 @@ onMounted(() => { // The selected skin is applied to this public root, never to the admin DOM. applyTheme(themeMode.value); browserError.value = checkSupport() ?? ""; - void loadPublicConfig(); - void initializeSkin(); - void loadLocalPreferences().then((preferences) => { + void Promise.all([loadPublicConfig(), initializeSkin(), loadSavedServers(), loadLocalPreferences()]).then(([, , , preferences]) => { if (!localStorage.getItem("webspeak:language") && (preferences.language === "zh" || preferences.language === "en" || preferences.language === "de" || preferences.language === "ru" || preferences.language === "ja")) language.value = preferences.language; + if (!nickname.value.trim() && preferences.lastNickname) nickname.value = preferences.lastNickname; + kookWorkspace.restore(preferences, recentServers.value); + const hasInvite = ["invite", "server", "target", "tsHost", "tsPort", "channel"].some((key) => query.has(key)); + if (kookWorkspace.active.value && !hasInvite && accessMode.value === "open" && !voiceState.connected && !voiceState.connecting) { + const latest = recentServers.value[0]; + if (latest) selectLocalServer(latest.address, latest.nickname, latest.lastChannelHint?.name); + } }); void restoreIdentity(async () => { const stored = await loadStoredIdentity(); @@ -2113,7 +2142,6 @@ onMounted(() => { }).finally(() => { identityReady.value = true; }); - void loadSavedServers(); deviceChangeHandler = () => { void refreshAudioDevices().catch(() => undefined); }; navigator.mediaDevices?.addEventListener("devicechange", deviceChangeHandler); viewportMediaQuery = window.matchMedia("(max-width: 740px)"); @@ -2162,6 +2190,7 @@ async function clearBrowserData(): Promise { resetIdentityOperations(); publicSkin.cancel(); await clearStoredLocalData(); + kookWorkspace.reset(); for (const key of ["webspeak:nickname", "webspeak:language", "webspeak:theme", "webspeak:active-skin", "webspeak:skin-choice", "webspeak:input-device", "webspeak:output-device", "webspeak:remember-identity"]) localStorage.removeItem(key); await publicSkin.reset(); identityMaterial.value = ""; diff --git a/web/test/kook-workspace.test.mjs b/web/test/kook-workspace.test.mjs new file mode 100644 index 0000000..84a48f6 --- /dev/null +++ b/web/test/kook-workspace.test.mjs @@ -0,0 +1,79 @@ +import assert from "node:assert/strict"; +import { after, before, test } from "node:test"; +import { fileURLToPath } from "node:url"; +import { createServer } from "vite"; +import { effectScope, ref } from "vue"; + +let vite, useKookWorkspace; +before(async () => { + vite = await createServer({ configFile: false, root: fileURLToPath(new URL("../", import.meta.url)), + server: { middlewareMode: true, hmr: false, ws: false, watch: null }, + optimizeDeps: { noDiscovery: true, include: [] }, appType: "custom" }); + ({ useKookWorkspace } = await vite.ssrLoadModule("/src/composables/useKookWorkspace.ts")); +}); +after(async () => { await vite?.close(); }); + +function mount(t) { + const scope = effectScope(); + const skinId = ref("community.kaak-voice"), connected = ref(false); + const workspace = scope.run(() => useKookWorkspace({ skinId, connected })); + t.after(() => scope.stop()); + return { ...workspace, skinId, connected }; +} + +test("first-time and failed connections stay on onboarding until a successful connection", t => { + const workspace = mount(t); + workspace.restore({ schemaVersion: 1 }, []); + assert.equal(workspace.active.value, false); + workspace.connected.value = true; + assert.equal(workspace.active.value, true); + workspace.connected.value = false; + assert.equal(workspace.active.value, true, "disconnecting keeps the server rail and add button available"); +}); + +test("returning users go directly to the workspace even without saved servers", t => { + const workspace = mount(t); + workspace.restore({ schemaVersion: 1, hasConnected: true }, []); + assert.equal(workspace.active.value, true); + assert.equal(workspace.connected.value, false, "entering the workspace does not silently start voice capture"); +}); + +test("existing recent-server history migrates returning users", t => { + const workspace = mount(t); + workspace.restore({ schemaVersion: 1 }, [{ id: "server.invalid", address: "server.invalid", lastConnectedAt: 1 }]); + assert.equal(workspace.active.value, true); +}); + +test("other skins retain their original flow and switching back restores KOOK", t => { + const workspace = mount(t); + workspace.restore({ schemaVersion: 1, hasConnected: true }, []); + for (const id of ["builtin.light", "builtin.dark", "community.illusia-voice"]) { + workspace.skinId.value = id; + assert.equal(workspace.active.value, false); + } + workspace.skinId.value = "community.kaak-voice"; + assert.equal(workspace.active.value, true); +}); + +test("a saved nickname alone is not evidence of a successful connection", t => { + const workspace = mount(t); + workspace.restore({ schemaVersion: 1, lastNickname: "Previous failed attempt" }, []); + assert.equal(workspace.active.value, false); +}); + +test("late preference loading cannot undo a successful connection", t => { + const workspace = mount(t); + workspace.connected.value = true; + workspace.connected.value = false; + workspace.restore({ schemaVersion: 1 }, []); + assert.equal(workspace.active.value, true); +}); + +test("clearing local data resets onboarding", t => { + const workspace = mount(t); + workspace.restore({ schemaVersion: 1, hasConnected: true }, []); + workspace.reset(); + assert.equal(workspace.active.value, false); + workspace.connected.value = true; + assert.equal(workspace.active.value, true); +}); From dacc4a143fd10e459da50575f2a678b01d6ebafb Mon Sep 17 00:00:00 2001 From: illusia <64828020+EchoSixHIYA@users.noreply.github.com> Date: Sat, 24 Oct 2026 18:28:03 +0800 Subject: [PATCH 3/4] release: prepare v0.2.9 --- .github/workflows/build-release.yml | 30 +++++++++++++++++++++-------- docs/README.de.md | 26 +++++++++++++++++++++++-- docs/README.en.md | 26 +++++++++++++++++++++++-- docs/README.ja.md | 26 +++++++++++++++++++++++-- docs/README.ru.md | 26 +++++++++++++++++++++++-- docs/README.zh-CN.md | 26 +++++++++++++++++++++++-- package-lock.json | 4 ++-- package.json | 2 +- web/android/app/build.gradle | 4 ++-- 9 files changed, 147 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 12c6747..e6fc3ef 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -9,7 +9,7 @@ on: version: description: Release version without the v prefix required: true - default: 0.2.8 + default: 0.2.9 type: string permissions: @@ -299,15 +299,29 @@ jobs: cd release-assets sha256sum * > SHA256SUMS.txt - name: Publish GitHub release + env: + RELEASE_REF: ${{ github.ref_name }} + run: | + node --input-type=module <<'NODE' + import { readFileSync, writeFileSync } from 'node:fs'; + import { join } from 'node:path'; + const tag = process.env.RELEASE_REF; + const languages = [['简体中文', 'zh-CN'], ['English', 'en'], ['Deutsch', 'de'], ['Русский', 'ru'], ['日本語', 'ja']]; + const sections = languages.map(([label, locale]) => { + const source = readFileSync(`docs/README.${locale}.md`, 'utf8'); + const start = source.indexOf(`### [${tag}](`); + if (start < 0) throw new Error(`Missing ${tag} release notes for ${locale}`); + const remaining = source.slice(start); + const next = remaining.indexOf('\n### [v', 1); + const notes = (next < 0 ? remaining : remaining.slice(0, next)).trim(); + return `## ${label}\n\n${notes}\n\n[Project documentation](https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${tag}/docs/README.${locale}.md)`; + }); + writeFileSync(join(process.env.RUNNER_TEMP, 'webspeak-release-notes.md'), sections.join('\n\n---\n\n') + '\n'); + NODE + - name: Upload GitHub release uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} name: WebSpeak ${{ github.ref_name }} - body: | - Release notes are maintained in each language's project documentation: - - [简体中文](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.zh-CN.md#latest-release-notes) - - [English](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.en.md#latest-release-notes) - - [Deutsch](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.de.md#latest-release-notes) - - [Русский](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.ru.md#latest-release-notes) - - [日本語](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/blob/master/docs/README.ja.md#latest-release-notes) + body_path: ${{ runner.temp }}/webspeak-release-notes.md files: release-assets/* diff --git a/docs/README.de.md b/docs/README.de.md index 5b111e0..3418e2d 100644 --- a/docs/README.de.md +++ b/docs/README.de.md @@ -4,7 +4,7 @@ WebSpeak ist ein selbst gehosteter Webclient und ein Sprach-Gateway für TeamSpeak 3 und TeamSpeak 6. Nutzer können ohne Desktop-Client im Browser Kanälen beitreten; Administratoren verwalten Zielserver, Zugriff und Laufzeitstatus über die Webkonsole. -Aktuelle Version: [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8). +Aktuelle Version: [v0.2.9](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.9). ## Live-Demo @@ -179,12 +179,34 @@ Relay deaktivieren und speichern, um die Option von der Willkommensseite zu entf - Der Relay-Dienst ist Bestandteil von WebSpeak und verwendet Node.js-Standardbibliotheken; GOST, sing-box oder ein anderes Proxy-Framework werden nicht verwendet. - WebRTC verwendet [werift](https://github.com/shinyoshiaki/werift-webrtc) `0.24.4`; das Upstream-Projekt steht unter MIT-Lizenz. -- Die TeamSpeak-Protokollverbindung verwendet den projektgepflegten [EchoSixHIYA/teamspeak-js](https://github.com/EchoSixHIYA/teamspeak-js)-SDK-Fork. +- Die TeamSpeak-Verbindung verwendet das Upstream-SDK [HoneyBBQ/teamspeak-js](https://github.com/HoneyBBQ/teamspeak-js), veröffentlicht als `@honeybbq/teamspeak@1.0.0-beta.19`; der SDK-Fork des Projekts muss nicht mehr gebaut werden. ## 🧾 Änderungsprotokoll +### [v0.2.9](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.9) · 2026-10-24 + +#### Erweiterungen + +- Umstellung auf das Upstream-SDK 1.0.0-beta.19. Normale Sprachverbindungen verwenden das Live-Clientverzeichnis ohne Query-Listenberechtigungen. +- Neuer GitHub-Skin-Store mit Installation, Updates und Freigabe pro Instanz. Discord Voice wird als eigenständiges standardkonformes `.wskin`-Beispiel verteilt. +- Optionale TS-Verwaltung im Modus mit festem Server: WebQuery-, TCP- oder SSH-Query-Zugangsdaten ermöglichen die Verwaltung von Server, Kanälen, Mitgliedern, Servergruppen und Sperren. +- Relays können einen direkten Sprachendpunkt für Browser bereitstellen und die Sprachsitzung übernehmen; eine zusätzliche Weiterleitung zwischen Gateways entfällt. +- Allgemeine Schnittstellen zum Beibehalten des Arbeitsbereichs und zur Wiederverbindung; KAAK nutzt diese und bietet Zugänge zur Administration, zum Projekt-GitHub und zur QQ-Gruppe. +- Unterstützung für TeamSpeak-Kanaltrenner mit Ausrichtung, Wiederholung, Leerzeilen und Standardlinien sowie öffentlichen Darstellungsdaten für Skins. + +#### Fehlerbehebungen + +- Vollbildgröße der Bildschirmfreigabe und Bereinigung von Status und Wiedergaberessourcen ausgeschiedener Mitglieder korrigiert. +- Erfolgreiche Sperren werden nicht mehr als Fehler gemeldet; Query-Verbindungen zählen nicht als Mitglieder, und das Kanalpasswort ist korrekt beschriftet. +- Berechtigungs-, Ratenlimit- und Zeitüberschreitungsfehler werden unterschieden. Schlägt nur die Aktualisierung nach einer erfolgreichen Aktion fehl, erscheint eine eigene Warnung gegen doppelte Ausführung. +- Verhindert, dass das SDK fehlgeschlagene HTTP-Antworten als erfolgreiche WebQuery-Ergebnisse behandelt; Layoutfehler auf der DC-Startseite, im Chat und bei schmalen Ansichten behoben. + +#### Bekannte Probleme + +- Die in [PR #48](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/48) beschriebene Sicherheitsabsicherung ist nicht enthalten; das Schließen des PRs bedeutet nicht, dass die gemeldeten Probleme behoben sind. + ### [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8) · 2026-10-17 #### Bildschirmfreigabe und Verbindungsstabilität diff --git a/docs/README.en.md b/docs/README.en.md index 811464d..5d7a9ac 100644 --- a/docs/README.en.md +++ b/docs/README.en.md @@ -4,7 +4,7 @@ WebSpeak is a self-hosted browser client and voice gateway for TeamSpeak 3 and TeamSpeak 6. Visitors can join channels without installing a desktop client, while administrators manage the target servers, access policy, and runtime state from the web console. -Latest release: [read the 0.2.8 changelog on this page](#latest-release-notes). +Latest release: [read the 0.2.9 changelog on this page](#latest-release-notes). Skin authors should start with the [current skin development guide](./SKIN_DEVELOPMENT.md), which combines the `.wskin` package format, current runtime APIs, permission boundaries, and authoring workflow. The repository also includes the [WebSpeak skin development skill for agents](../.agents/skills/webspeak-skin-development/SKILL.md). @@ -189,12 +189,34 @@ Disable and save the relay configuration to remove the relay option from the wel - The relay service is built into WebSpeak with Node.js standard libraries; it does not use GOST, sing-box, or another proxy framework. - WebRTC uses [werift](https://github.com/shinyoshiaki/werift-webrtc) `0.24.4`, whose upstream project is licensed under MIT. -- TeamSpeak protocol connectivity uses the project-maintained [EchoSixHIYA/teamspeak-js](https://github.com/EchoSixHIYA/teamspeak-js) SDK fork. +- TeamSpeak connectivity uses upstream [HoneyBBQ/teamspeak-js](https://github.com/HoneyBBQ/teamspeak-js), published as `@honeybbq/teamspeak@1.0.0-beta.19`; building the project's SDK fork is no longer required. ## 🧾 Changelog +### [v0.2.9](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.9) · 2026-10-24 + +#### Enhancements + +- Migrated to upstream SDK 1.0.0-beta.19. Ordinary voice connections use the live client directory without Query list permissions. +- Added a GitHub skin store and instance-level installation, updates and availability controls. Discord Voice is distributed independently as a standard `.wskin` example. +- Added optional TS administration in fixed-instance mode, with WebQuery, TCP or SSH Query credentials for managing the server, channels, members, server groups and bans. +- Relays can advertise a direct browser voice endpoint and own the voice session, avoiding an extra gateway forwarding hop. +- Added generic persistent-workspace and reconnect APIs, adopted by KAAK alongside administrator, project GitHub and QQ group shortcuts. +- Added TeamSpeak channel spacers with alignment, repeated fill, blank rows and standard line patterns, including public presentation data for skins. + +#### Fixes + +- Fixed screen-share fullscreen sizing and cleanup of departed members' state and playback resources. +- Fixed successful bans being reported as failures, Query connections appearing in member counts and the channel-password label. +- Distinguished permission, rate-limit and timeout errors. A refresh failure after a successful action now has its own warning to prevent duplicate actions. +- Guarded against the SDK treating failed HTTP responses as successful WebQuery results, and fixed DC home, chat and narrow-screen control layouts. + +#### Known issues + +- The security hardening described in [PR #48](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/48) is not included in this release; closing that PR does not mean the reported issues are fixed. + ### [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8) · 2026-10-17 #### Screen sharing and connection reliability diff --git a/docs/README.ja.md b/docs/README.ja.md index 68fd695..a091743 100644 --- a/docs/README.ja.md +++ b/docs/README.ja.md @@ -4,7 +4,7 @@ ## プロジェクト概要 -最新リリース:[v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8)。 +最新リリース:[v0.2.9](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.9)。 | 観点 | 説明 | | --- | --- | @@ -103,7 +103,7 @@ TURN を設定した場合、メディアは外部 TURN サービスを経由す 中継は現在の WebSpeak セッションの TeamSpeak 通信だけを転送し、VPN ではありません。管理コンソールで複数のノードに名前、アドレス、トークンを設定すると、ユーザーは直接接続または中継を選択できます。中継モードは専用の転送サービスとして動作し、ゲスト画面や管理コンソールを提供しません。 -中継サービスは WebSpeak に組み込まれており、Node.js の標準ライブラリを使用します。GOST や sing-box などのプロキシフレームワークは不要です。WebRTC は [werift](https://github.com/shinyoshiaki/werift-webrtc)、TeamSpeak 接続はプロジェクトが保守する [EchoSixHIYA/teamspeak-js](https://github.com/EchoSixHIYA/teamspeak-js) SDK を使用します。 +中継サービスは WebSpeak に組み込まれており、Node.js の標準ライブラリを使用します。GOST や sing-box などのプロキシフレームワークは不要です。WebRTC は [werift](https://github.com/shinyoshiaki/werift-webrtc)、TeamSpeak 接続は上流の [HoneyBBQ/teamspeak-js](https://github.com/HoneyBBQ/teamspeak-js) が公開する `@honeybbq/teamspeak@1.0.0-beta.19` を使用します。SDK フォークのビルドは不要になりました。 ## 🚀 デプロイ @@ -159,6 +159,28 @@ npm start +### [v0.2.9](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.9) · 2026-10-24 + +#### 機能追加 + +- 上流 SDK 1.0.0-beta.19 へ移行しました。通常の音声接続はクライアントのライブ一覧を使用し、Query の一覧取得権限を必要としません。 +- GitHub スキンストアと、インスタンスごとのインストール、更新、有効化の管理を追加しました。Discord Voice は標準 `.wskin` の独立したサンプルとして配布します。 +- 固定サーバーモードに任意の TS 管理パネルを追加しました。WebQuery、TCP または SSH Query の認証情報を設定し、サーバー、チャンネル、メンバー、サーバーグループ、BAN を管理できます。 +- 中継ノードがブラウザー向けの音声接続先を公開し、音声セッションを担当できるようになりました。ゲートウェイ間の余分な転送を減らせます。 +- ワークスペース保持と再接続の共通 API を追加し、KAAK に適用しました。管理画面、プロジェクトの GitHub、QQ グループへの入口も追加しました。 +- TeamSpeak のチャンネル区切りに対応しました。配置、繰り返し、空白行、標準線種を扱い、表示データをスキンにも公開します。 + +#### 修正 + +- 画面共有の全画面サイズと、退出したメンバーの状態および再生リソースの解放を修正しました。 +- BAN 成功時の誤った失敗表示、Query 接続の人数への混入、チャンネルパスワードのラベルを修正しました。 +- 権限不足、レート制限、タイムアウトを区別します。操作成功後の更新だけが失敗した場合は別の警告を表示し、重複操作を防ぎます。 +- SDK が失敗した HTTP 応答を WebQuery 成功とみなすことを防止し、DC のホーム、チャット、狭い画面の操作部品の配置を修正しました。 + +#### 既知の問題 + +- [PR #48](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/48) のセキュリティ強化は本リリースに含まれません。PR のクローズは、報告された問題の修正完了を意味しません。 + ### [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8) · 2026-10-17 #### 画面共有と接続の安定性 diff --git a/docs/README.ru.md b/docs/README.ru.md index ead9099..b5ce00e 100644 --- a/docs/README.ru.md +++ b/docs/README.ru.md @@ -4,7 +4,7 @@ ## О проекте -Последний выпуск: [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8). +Последний выпуск: [v0.2.9](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.9). | Логика | Описание | | --- | --- | @@ -105,7 +105,7 @@ Ретранслятор передаёт только TeamSpeak-трафик текущей сессии и не является VPN. В панели администратора добавьте один или несколько узлов, задайте имя, адрес и токен. Пользователь сможет выбрать прямое подключение или настроенный ретранслятор. Режим ретранслятора запускается отдельно и не предоставляет страницу посетителя или панель администратора. -Сервис ретрансляции встроен в WebSpeak и использует стандартные библиотеки Node.js; GOST, sing-box и другие прокси-фреймворки не требуются. WebRTC использует [werift](https://github.com/shinyoshiaki/werift-webrtc), а TeamSpeak — поддерживаемый проектом [SDK EchoSixHIYA/teamspeak-js](https://github.com/EchoSixHIYA/teamspeak-js). +Сервис ретрансляции встроен в WebSpeak и использует стандартные библиотеки Node.js; GOST, sing-box и другие прокси-фреймворки не требуются. WebRTC использует [werift](https://github.com/shinyoshiaki/werift-webrtc), а TeamSpeak — upstream [HoneyBBQ/teamspeak-js](https://github.com/HoneyBBQ/teamspeak-js), пакет `@honeybbq/teamspeak@1.0.0-beta.19`. Сборка форка SDK больше не требуется. ## 🚀 Развертывание @@ -161,6 +161,28 @@ npm start +### [v0.2.9](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.9) · 2026-10-24 + +#### Новые возможности + +- Переход на upstream SDK 1.0.0-beta.19. Обычные голосовые подключения используют актуальный каталог клиентов без разрешений Query на получение списков. +- Добавлен магазин скинов GitHub с установкой, обновлением и управлением доступностью для экземпляра. Discord Voice распространяется отдельно как стандартный пример `.wskin`. +- В режиме фиксированного сервера доступна необязательная панель TS: учётные данные WebQuery, TCP или SSH Query позволяют управлять сервером, каналами, участниками, серверными группами и блокировками. +- Ретрансляторы могут предоставлять браузеру прямую голосовую точку подключения и обслуживать голосовую сессию без лишнего перехода через основной шлюз. +- Добавлены общие интерфейсы сохранения рабочего пространства и переподключения; KAAK использует их и предлагает вход в администрирование, GitHub проекта и группу QQ. +- Поддержаны разделители каналов TeamSpeak: выравнивание, повторяемое заполнение, пустые строки и стандартные линии. Данные оформления доступны скинам. + +#### Исправления + +- Исправлены размер полноэкранного показа экрана и очистка состояния и ресурсов воспроизведения ушедших участников. +- Успешная блокировка больше не отображается как ошибка; Query-подключения исключены из числа участников, исправлена подпись пароля канала. +- Разделены ошибки разрешений, ограничения частоты и тайм-аута. Ошибка обновления после успешной операции показывается отдельно, чтобы избежать повторного выполнения. +- Добавлена защита от ошибочного распознавания SDK неуспешных HTTP-ответов как успешных результатов WebQuery; исправлена компоновка DC на главной странице, в чате и на узких экранах. + +#### Известные проблемы + +- Усиление безопасности из [PR #48](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/48) не вошло в выпуск; закрытие PR не означает исправления описанных проблем. + ### [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8) · 2026-10-17 #### Демонстрация экрана и стабильность соединения diff --git a/docs/README.zh-CN.md b/docs/README.zh-CN.md index 48262da..e976d87 100644 --- a/docs/README.zh-CN.md +++ b/docs/README.zh-CN.md @@ -13,7 +13,7 @@ WebSpeak 是一个可自行部署的 TeamSpeak 3 / TeamSpeak 6 网页客户端 演示站点的网络和负载可能不稳定;延迟、断线或暂时不可用不代表自行部署后的实际表现。 -最新版本:[查看本页的 0.2.8 更新日志](#latest-release-notes)。 +最新版本:[查看本页的 0.2.9 更新日志](#latest-release-notes)。 ## ✨ 特性 @@ -193,12 +193,34 @@ relay.example.com { - 中继服务是 WebSpeak 自带实现,使用 Node.js 标准库,不依赖 GOST、sing-box 或其他代理框架。 - WebRTC 使用 [werift](https://github.com/shinyoshiaki/werift-webrtc) `0.24.4`,上游采用 MIT 许可证。 -- TeamSpeak 协议使用项目维护的 [EchoSixHIYA/teamspeak-js](https://github.com/EchoSixHIYA/teamspeak-js) SDK fork。 +- TeamSpeak 协议使用上游 [HoneyBBQ/teamspeak-js](https://github.com/HoneyBBQ/teamspeak-js) 发布的 `@honeybbq/teamspeak@1.0.0-beta.19`,不再需要构建项目 SDK fork。 ## 🧾 更新日志 +### [v0.2.9](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.9) · 2026-10-24 + +#### 功能增强 + +- 接入上游 SDK 1.0.0-beta.19,普通语音连接使用客户端实时目录,不再依赖 Query 列表权限。 +- 管理员控制台新增 GitHub 皮肤商店,以及按实例管理、更新和启停皮肤的入口;Discord Voice 作为标准 `.wskin` 示例独立分发。 +- 指定实例模式支持可选 TS 管理面板,可配置 WebQuery、TCP 或 SSH Query 凭据,管理服务器、频道、成员、服务器组和封禁。 +- 中继可配置浏览器直连的语音入口,将语音会话交给中继节点处理,减少网关间的额外转发。 +- 提供通用工作区保留与重连接口,KAAK 同步接入,并新增管理员、项目 GitHub 和 QQ 群入口。 +- 支持 TeamSpeak 频道分隔栏,包括左中右对齐、重复填充、空白及标准线型;向皮肤开放格式化数据。 + +#### 问题修复 + +- 修复屏幕共享播放器的全屏尺寸,以及断线成员的状态、播放资源清理。 +- 修复 TS 管理中封禁成功却报错、Query 连接混入成员统计和频道密码标签错误的问题。 +- 区分权限、限流和超时提示;操作完成后的刷新失败单独提示,避免用户重复执行操作。 +- 防止 SDK 将 HTTP 失败响应误判为 WebQuery 成功;修复 DC 首页、聊天区与窄屏控件布局。 + +#### 已知问题 + +- [PR #48](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/pull/48) 记录的安全加固尚未纳入本版本,关闭该 PR 不代表相关问题已修复。 + ### [v0.2.8](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/releases/tag/v0.2.8) · 2026-10-17 #### 屏幕共享与连接稳定性 diff --git a/package-lock.json b/package-lock.json index 62843d1..4e6cd8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "webspeak-webclient", - "version": "0.2.8", + "version": "0.2.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "webspeak-webclient", - "version": "0.2.8", + "version": "0.2.9", "license": "AGPL-3.0-only", "dependencies": { "@discordjs/opus": "^0.10.0", diff --git a/package.json b/package.json index d094158..9ddbce7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webspeak-webclient", - "version": "0.2.8", + "version": "0.2.9", "private": true, "license": "AGPL-3.0-only", "type": "module", diff --git a/web/android/app/build.gradle b/web/android/app/build.gradle index 5ba7799..9793399 100644 --- a/web/android/app/build.gradle +++ b/web/android/app/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.application' -def appVersion = project.hasProperty('appVersion') ? project.property('appVersion').toString() : '0.2.6' -def appVersionCode = project.hasProperty('appVersionCode') ? project.property('appVersionCode').toString().toInteger() : 206 +def appVersion = project.hasProperty('appVersion') ? project.property('appVersion').toString() : '0.2.9' +def appVersionCode = project.hasProperty('appVersionCode') ? project.property('appVersionCode').toString().toInteger() : 209 android { namespace = "io.webspeak.client" From 37f5b86b52884266d3fd1dfe576dc48c7f4cc181 Mon Sep 17 00:00:00 2001 From: illusia <64828020+EchoSixHIYA@users.noreply.github.com> Date: Sun, 25 Oct 2026 18:49:21 +0800 Subject: [PATCH 4/4] fix(skins): use build version during initial activation --- .../composables/useWebClientPublicConfig.ts | 3 +- web/src/services/app-version.ts | 4 ++ web/src/services/skin-runtime.ts | 3 +- web/test/skin-lifecycle.test.mjs | 51 ++++++++++++++++++- 4 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 web/src/services/app-version.ts diff --git a/web/src/composables/useWebClientPublicConfig.ts b/web/src/composables/useWebClientPublicConfig.ts index 01a56f6..6c6ba76 100644 --- a/web/src/composables/useWebClientPublicConfig.ts +++ b/web/src/composables/useWebClientPublicConfig.ts @@ -1,5 +1,6 @@ import { computed, reactive, ref, type Ref } from "vue"; import { DEFAULT_TEAM_SPEAK_PORT, splitTeamSpeakTarget } from "../services/teamspeak-target.js"; +import { APP_VERSION } from "../services/app-version.js"; import type { Language } from "../i18n/web-client.js"; interface RelayOption { @@ -28,7 +29,7 @@ export function useWebClientPublicConfig({ const initialized = ref(false); const mobileMode = ref(false); const siteName = ref("WebSpeak"); - const appVersion = ref("0.2.7"); + const appVersion = ref(APP_VERSION); const visitorNumber = ref(null); const visitorTotal = ref(null); const accelerationRelays = ref([]); diff --git a/web/src/services/app-version.ts b/web/src/services/app-version.ts new file mode 100644 index 0000000..93f1448 --- /dev/null +++ b/web/src/services/app-version.ts @@ -0,0 +1,4 @@ +import appPackage from "../../../package.json"; + +// Available before the public config request completes, including on the demo page. +export const APP_VERSION = appPackage.version; diff --git a/web/src/services/skin-runtime.ts b/web/src/services/skin-runtime.ts index 2792188..79ba756 100644 --- a/web/src/services/skin-runtime.ts +++ b/web/src/services/skin-runtime.ts @@ -1,4 +1,5 @@ import { getInstalledSkin, saveInstalledSkin } from "./local-persistence.js"; +import { APP_VERSION } from "./app-version.js"; import type { InstalledSkin } from "./skin-pack.js"; import { applyTheme, getBuiltinSkinCss, getStoredTheme, isDarkTheme } from "./theme.js"; import { scopeBuiltinThemeForCustomSkin } from "./skin-cascade.js"; @@ -34,7 +35,7 @@ export async function activateStoredSkin(): Promise { return activateSkin(selectedId); } -export async function activateSkin(id: string, expectedVersion?: string, appVersion = "0.2.7", options: SkinLoadOptions = {}): Promise { +export async function activateSkin(id: string, expectedVersion?: string, appVersion = APP_VERSION, options: SkinLoadOptions = {}): Promise { // An already retired page must not cancel a newer page's activation. options.signal?.throwIfAborted(); pendingActivation?.cancel(); diff --git a/web/test/skin-lifecycle.test.mjs b/web/test/skin-lifecycle.test.mjs index d54cda8..25ba1f3 100644 --- a/web/test/skin-lifecycle.test.mjs +++ b/web/test/skin-lifecycle.test.mjs @@ -2,10 +2,12 @@ import assert from "node:assert/strict"; import { before, after, beforeEach, afterEach, test } from "node:test"; import { setImmediate as nextTurn } from "node:timers/promises"; import { fileURLToPath } from "node:url"; +import { readFile } from "node:fs/promises"; import { createServer } from "vite"; import { effectScope, ref } from "vue"; -let vite, runtime, catalog, handler, installed, writes, storage, elements, root, usePublicSkin, scope; +let vite, runtime, catalog, handler, installed, writes, storage, elements, root, usePublicSkin, useWebClientPublicConfig, scope; +const { version: appVersion } = JSON.parse(await readFile(new URL("../../package.json", import.meta.url), "utf8")); const globals = new Map(); function global(name, value) { if (!globals.has(name)) globals.set(name, Object.getOwnPropertyDescriptor(globalThis, name)); @@ -42,6 +44,7 @@ before(async () => { runtime = await vite.ssrLoadModule("/src/services/skin-runtime.ts"); catalog = await vite.ssrLoadModule("/src/services/skin-catalog.ts"); ({ usePublicSkin } = await vite.ssrLoadModule("/src/composables/usePublicSkin.ts")); + ({ useWebClientPublicConfig } = await vite.ssrLoadModule("/src/composables/useWebClientPublicConfig.ts")); }); beforeEach(async () => { installed = new Map(); writes = []; storage = new Map(); elements = new Map(); root = new Element(); @@ -201,6 +204,52 @@ test("normal initialization uses the instance default and cached custom content" assert.equal(storage.has("webspeak:skin-choice"), false); assert.equal(root.dataset.wsSkin, item.id); }); +test("first entry activates a compatible remembered skin before public config arrives", async () => { + const item = { ...skin("sample.current"), minAppVersion: appVersion, author: "test", license: "MIT" }; + installed.set(item.id, item); + storage.set("webspeak:skin-choice", item.id); + const response = deferred(); + global("location", { search: "" }); + handler = async url => url === "/api/public-config" ? response.promise + : json({ skins: [item], defaultSkinId: "builtin.light" }); + const config = useWebClientPublicConfig({ serverHost: ref(""), serverPort: ref("9987"), + accelerationRelayId: ref(""), language: ref("en"), t: key => key }); + const loading = config.loadPublicConfig(); + const view = page({ timeoutMs: 1_000, appVersion: () => config.appVersion.value }); + try { + await view.initialize(); + assert.equal(config.serverConfigLoading.value, true, "the config response is still pending"); + assert.equal(view.activeSkinId.value, item.id); + assert.equal(view.skinLoadError.value, null); + assert.equal(root.dataset.wsSkin, item.id); + await view.select("builtin.dark"); + await view.select(item.id); + assert.equal(view.activeSkinId.value, item.id, "initial entry and manual selection use the same version"); + } finally { + response.resolve(json({ version: appVersion })); + await loading; + } +}); +test("demo initialization uses the running build version without a public config provider", async () => { + const item = { ...skin("sample.current"), minAppVersion: appVersion, author: "test", license: "MIT" }; + installed.set(item.id, item); + handler = async () => json({ skins: [item], defaultSkinId: item.id }); + const view = page({ timeoutMs: 1_000 }); + await view.initialize(); + assert.equal(view.activeSkinId.value, item.id); + assert.equal(view.skinLoadError.value, null); +}); +test("using the running build version still rejects a skin requiring a newer runtime", async () => { + const item = { ...skin("sample.future"), minAppVersion: "999.0.0", author: "test", license: "MIT" }; + installed.set(item.id, item); + storage.set("webspeak:skin-choice", item.id); + handler = async () => json({ skins: [item], defaultSkinId: item.id }); + const view = page({ timeoutMs: 1_000 }); + await view.initialize(); + assert.equal(view.activeSkinId.value, "builtin.light"); + assert.equal(view.skinLoadError.value.skinId, item.id); + assert.equal(storage.get("webspeak:skin-choice"), item.id); +}); test("reset prevents outstanding choices from restoring cleared state", async () => { const read = deferred(); globalThis.skinStorage.get = () => read.promise; const view = page(), old = view.select("sample.a");