diff --git a/web/src/App.css b/web/src/App.css
index e8a3533..0fef4d3 100644
--- a/web/src/App.css
+++ b/web/src/App.css
@@ -3457,6 +3457,42 @@
max-width: 90vw;
}
+.ts-update-toast {
+ position: fixed;
+ left: 50%;
+ bottom: 1.25rem;
+ transform: translateX(-50%);
+ z-index: 600;
+ display: flex;
+ align-items: center;
+ gap: 0.6rem;
+ background: var(--panel-bg, #23262e);
+ color: var(--text, #eee);
+ border: 1px solid var(--border);
+ border-radius: 0.5rem;
+ padding: 0.6rem 0.7rem 0.6rem 0.9rem;
+ font-size: 13px;
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
+}
+
+.ts-update-toast button {
+ border: 1px solid var(--border);
+ border-radius: 0.35rem;
+ background: var(--accent, #4a7dfc);
+ color: #fff;
+ font-size: 12px;
+ padding: 0.3rem 0.6rem;
+ cursor: pointer;
+}
+
+.ts-update-toast-dismiss {
+ background: transparent !important;
+ color: var(--text-muted, #999) !important;
+ border: none !important;
+ padding: 0 0.2rem !important;
+ font-size: 12px;
+}
+
.ts-feedback-fab-wrap {
position: fixed;
right: 1.25rem;
diff --git a/web/src/App.tsx b/web/src/App.tsx
index ac90d9a..dbf1c47 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -1,4 +1,5 @@
import { useEffect, useMemo, useRef, useState } from "react";
+import { useRegisterSW } from "virtual:pwa-register/react";
import "./App.css";
/** Only dismiss on a genuine backdrop click, not a text-selection drag that
@@ -1566,6 +1567,38 @@ function ChannelPasswordDialog({
);
}
+function UpdatePrompt() {
+ const t = useT();
+ const {
+ needRefresh: [needRefresh, setNeedRefresh],
+ updateServiceWorker,
+ } = useRegisterSW({
+ onRegisteredSW(_url, registration) {
+ // Poll for a new service worker in the background — otherwise an app
+ // left open for hours/days only checks for updates on next full load.
+ if (!registration) return;
+ const CHECK_INTERVAL_MS = 60 * 60 * 1000;
+ window.setInterval(() => {
+ registration.update().catch(() => {});
+ }, CHECK_INTERVAL_MS);
+ },
+ });
+
+ if (!needRefresh) return null;
+
+ return (
+
+ {t("pwa.updateAvailable")}
+
+
+
+ );
+}
+
const FEEDBACK_BUBBLE_STORAGE_KEY = "webspeak3.feedbackBubble.lastShown";
const FEEDBACK_BUBBLE_MIN_INTERVAL_MS = 3 * 24 * 60 * 60 * 1000; // don't nag more than every 3 days
const FEEDBACK_BUBBLE_INITIAL_DELAY_MS = 45_000;
@@ -8642,6 +8675,8 @@ function AppInner() {
/>
)}
+
+
{IS_OWN_HOSTED_INSTANCE && !feedbackOpen && (
setFeedbackOpen(true)} />
)}
diff --git a/web/src/i18n.tsx b/web/src/i18n.tsx
index 2759f95..0972873 100644
--- a/web/src/i18n.tsx
+++ b/web/src/i18n.tsx
@@ -48,6 +48,9 @@ const translations: Record> = {
"menu.extras.feedback": "Feedback geben",
"feedback.fab.nudge": "Was denkst du über WebSpeak3? Feedback ist willkommen!",
+ "pwa.updateAvailable": "Neue Version verfügbar",
+ "pwa.reload": "Neu laden",
+
"feedback.dialog.title": "Feedback",
"feedback.dialog.intro": "Melde einen Fehler oder teile eine Idee zur Weiterentwicklung von WebSpeak3 mit.",
"feedback.dialog.category": "Kategorie",
@@ -634,6 +637,9 @@ const translations: Record> = {
"menu.extras.feedback": "Send Feedback",
"feedback.fab.nudge": "What do you think of WebSpeak3? Feedback welcome!",
+ "pwa.updateAvailable": "New version available",
+ "pwa.reload": "Reload",
+
"feedback.dialog.title": "Feedback",
"feedback.dialog.intro": "Report a bug or share an idea to help improve WebSpeak3.",
"feedback.dialog.category": "Category",
diff --git a/web/src/vite-env.d.ts b/web/src/vite-env.d.ts
new file mode 100644
index 0000000..36411c5
--- /dev/null
+++ b/web/src/vite-env.d.ts
@@ -0,0 +1,3 @@
+///
+///
+///
diff --git a/web/vite.config.ts b/web/vite.config.ts
index 52f8f0c..aab13dd 100644
--- a/web/vite.config.ts
+++ b/web/vite.config.ts
@@ -7,7 +7,14 @@ export default defineConfig({
plugins: [
react(),
VitePWA({
- registerType: 'autoUpdate',
+ registerType: 'prompt',
+ // We register the service worker ourselves (see useSwUpdatePrompt in
+ // App.tsx) via the virtual:pwa-register/react module so we can show a
+ // "new version available" toast instead of updating silently — a
+ // stale-cache tab would otherwise keep running old JS/CSS until the
+ // user manually reloads (or worse, clears storage), which bit us
+ // repeatedly while verifying deploys.
+ injectRegister: false,
// Dev-time Workbox would sit in front of Vite's own HMR/WS traffic and
// stale-cache the app shell while iterating — only ever ship the SW in
// production builds.