Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Keep incognito recordings fully in-browser: never open a server chunk-streaming session for them, clear the incognito toggle when resuming a streamed session, and delete server-side chunks before incognito processing

Murtaza Nasir15e5a14d8724
diff --git a/docs/admin-guide/recording-sessions.md b/docs/admin-guide/recording-sessions.md
index 5e1ff7e6..57f8cd4d 100644
--- a/docs/admin-guide/recording-sessions.md
+++ b/docs/admin-guide/recording-sessions.md
@@ -18,6 +18,13 @@ Off by default; opt in with `ENABLE_SERVER_RECORDING_CHUNKS=true`. It is planned
| Finalize | Single-shot `POST /upload` | `POST /upload/session/{id}/finalize`; backend ffmpeg concat demux stitches chunks |
| Reverse-proxy chunk POSTs | One big upload (subject to body-size + read-timeout) | Many small POSTs per recording, plus a longer finalize call |
+Incognito recordings are the exception: they never open a server session,
+regardless of this flag. Audio from an incognito recording stays in the
+browser (RAM + IndexedDB) until the explicit process-without-saving upload,
+so the legacy 200 MB cap and its warning still apply to them. If a recording
+did stream to the server and the user switches it to incognito in the review
+pane afterwards, the server-side chunks are deleted before processing.
+
## Configuration
Environment variables, all optional:
diff --git a/docs/user-guide/recording.md b/docs/user-guide/recording.md
index 087385fe..1360ad24 100644
--- a/docs/user-guide/recording.md
+++ b/docs/user-guide/recording.md
@@ -250,7 +250,7 @@ If a selected tag, folder, or your account default summary prompt contains `{{na
The sticky modal footer holds **Cancel** (dismisses without uploading) and **Upload N files** (begins transcription immediately with your selected settings). The recording appears in your library with a processing indicator while transcription runs in the background. If you started a recording from inside the modal and the upload completes, Speakr auto-navigates to the new recording's detail view; bulk drag-drop uploads of multiple files leave you on whatever you were viewing.
-If incognito mode is enabled at the server, a toggle in the upload modal lets you process recordings without saving them to your account. Incognito uploads accept one file at a time.
+If incognito mode is enabled at the server, a toggle in the upload modal lets you process recordings without saving them to your account. Incognito uploads accept one file at a time. In-app recordings made with incognito on are captured entirely in the browser — even when server-side chunk streaming is enabled, no audio reaches the server until you explicitly process the recording — so the 200 MB in-browser recording cap applies to them.
### Mobile Upload Experience
diff --git a/static/js/modules/composables/audio.js b/static/js/modules/composables/audio.js
index c67980da..ee4e4693 100644
--- a/static/js/modules/composables/audio.js
+++ b/static/js/modules/composables/audio.js
@@ -400,6 +400,21 @@ export function useAudio(state, utils) {
estimatedFileSize.value = serverResumePriorBytes;
fileSizeWarningShown.value = false;
+ // A resumed recording already has chunks on the server, so it
+ // cannot become incognito: processing it in incognito would send
+ // only the locally-held new segment (silent partial audio) and
+ // discard the prior one. Force the toggle off — relevant when
+ // INCOGNITO_MODE_DEFAULT is on or the user flipped it earlier.
+ if (resumeContext && resumeContext.sessionId && incognitoMode && incognitoMode.value) {
+ incognitoMode.value = false;
+ showToast(
+ (utils.t && utils.t('toasts.resumedRecordingNotIncognito'))
+ || 'Incognito was turned off: this resumed recording was already streaming to the server.',
+ 'fa-user-secret',
+ 7000
+ );
+ }
+
// Initialize IndexedDB session
currentChunkIndex = 0;
@@ -713,7 +728,15 @@ export function useAudio(state, utils) {
// straight to the server. A failure here logs and falls back to
// local-only recording — the user's audio is never blocked on
// a network round-trip.
- if (_serverRecordingChunksEnabled()) {
+ //
+ // Incognito recordings never open a session: the whole point of
+ // incognito is that audio does not touch server storage until the
+ // explicit process-without-saving upload, so they stay on the
+ // in-browser path (RAM + IndexedDB, 200 MB cap) regardless of the
+ // streaming flag. The resume guard above already cleared the
+ // toggle for resumed server sessions, so this cannot strand a
+ // half-uploaded session.
+ if (_serverRecordingChunksEnabled() && !(incognitoMode && incognitoMode.value)) {
try {
let startIndex = 1;
if (resumeContext && resumeContext.sessionId) {
@@ -1139,6 +1162,29 @@ export function useAudio(state, utils) {
return;
}
+ // The recording may have streamed to a server session before the user
+ // chose incognito in the review pane (incognito recordings never OPEN
+ // a session, but the toggle can be flipped after a normal recording
+ // finishes). Honor the choice: delete the server-side chunks up front,
+ // before processing, rather than only after success via
+ // discardRecording. Refuse outright if part of the audio exists ONLY
+ // on the server (resumed session) — incognito-processing just the
+ // local segment would silently truncate the recording. That state
+ // should be unreachable (the resume path clears the toggle), so this
+ // is defense-in-depth.
+ if (serverSessionId) {
+ if (serverResumePriorBytes > 0) {
+ setGlobalError('This resumed recording cannot be processed in incognito because its earlier audio exists only on the server. Use the normal upload instead.');
+ return;
+ }
+ try {
+ await ServerSessions.abortSession(serverSessionId);
+ } catch (e) {
+ console.warn('[Incognito] Could not abort server session before incognito processing:', e);
+ }
+ _resetServerSessionState();
+ }
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
const recordedMime = (currentRecordingMimeType || 'audio/webm').split(';')[0];
const recordedExt = recordedMime === 'video/mp4' ? 'mp4' : 'webm';
diff --git a/static/locales/de.json b/static/locales/de.json
index c613498a..b3679586 100644
--- a/static/locales/de.json
+++ b/static/locales/de.json
@@ -1774,6 +1774,7 @@
"processingFailed": "Verarbeitung fehlgeschlagen",
"recordingFinalized": "Aufnahme zur Verarbeitung hochgeladen",
"recordingMaxDurationApproaching": "Die Aufnahme wird in etwa {{minutes}} Minuten automatisch gestoppt (Höchstdauer).",
+ "resumedRecordingNotIncognito": "Inkognito wurde deaktiviert: Diese fortgesetzte Aufnahme wurde bereits zum Server übertragen.",
"recordingMaxDurationReached": "Aufnahme hat die Höchstdauer erreicht und wurde automatisch gestoppt.",
"recordingResumeFound": "Eine laufende Aufnahme aus diesem Browser wurde auf dem Server gefunden. Fortsetzen?",
"recordingSizeSoftWarning": "Aufnahme ist {{size}}. Erwägen Sie, sie bei Gelegenheit zu stoppen.",
diff --git a/static/locales/en.json b/static/locales/en.json
index d8522ac5..fa13fe47 100644
--- a/static/locales/en.json
+++ b/static/locales/en.json
@@ -1774,6 +1774,7 @@
"processingFailed": "Processing failed",
"recordingFinalized": "Recording uploaded for processing",
"recordingMaxDurationApproaching": "Recording will stop automatically in about {{minutes}} minutes (maximum duration).",
+ "resumedRecordingNotIncognito": "Incognito was turned off: this resumed recording was already streaming to the server.",
"recordingMaxDurationReached": "Recording reached the maximum duration and was stopped automatically.",
"recordingResumeFound": "An in-progress recording from this browser was detected on the server. Resume?",
"recordingSizeSoftWarning": "Recording is {{size}}. Consider stopping when convenient.",
diff --git a/static/locales/es.json b/static/locales/es.json
index 8328e3af..7c9cac9c 100644
--- a/static/locales/es.json
+++ b/static/locales/es.json
@@ -1774,6 +1774,7 @@
"processingFailed": "Error en el procesamiento",
"recordingFinalized": "Grabación subida para procesamiento",
"recordingMaxDurationApproaching": "La grabación se detendrá automáticamente en unos {{minutes}} minutos (duración máxima).",
+ "resumedRecordingNotIncognito": "El modo incógnito se desactivó: esta grabación reanudada ya se estaba transmitiendo al servidor.",
"recordingMaxDurationReached": "La grabación alcanzó la duración máxima y se detuvo automáticamente.",
"recordingResumeFound": "Se detectó una grabación en curso de este navegador en el servidor. ¿Reanudar?",
"recordingSizeSoftWarning": "La grabación ocupa {{size}}. Considere detenerla cuando le convenga.",
diff --git a/static/locales/fr.json b/static/locales/fr.json
index 965ea3b8..87d009b1 100644
--- a/static/locales/fr.json
+++ b/static/locales/fr.json
@@ -1774,6 +1774,7 @@
"processingFailed": "Échec du traitement",
"recordingFinalized": "Enregistrement envoyé pour traitement",
"recordingMaxDurationApproaching": "L'enregistrement s'arrêtera automatiquement dans environ {{minutes}} minutes (durée maximale).",
+ "resumedRecordingNotIncognito": "Le mode incognito a été désactivé : cet enregistrement repris était déjà transmis au serveur.",
"recordingMaxDurationReached": "L'enregistrement a atteint la durée maximale et s'est arrêté automatiquement.",
"recordingResumeFound": "Un enregistrement en cours dans ce navigateur a été détecté sur le serveur. Reprendre ?",
"recordingSizeSoftWarning": "L'enregistrement fait {{size}}. Pensez à l'arrêter quand vous pourrez.",
diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.json
index 664370eb..2a1d2b59 100644
--- a/static/locales/pt-BR.json
+++ b/static/locales/pt-BR.json
@@ -1774,6 +1774,7 @@
"processingFailed": "Falha no processamento",
"recordingFinalized": "Gravação enviada para processamento",
"recordingMaxDurationApproaching": "A gravação será interrompida automaticamente em cerca de {{minutes}} minutos (duração máxima).",
+ "resumedRecordingNotIncognito": "O modo anônimo foi desativado: esta gravação retomada já estava sendo transmitida ao servidor.",
"recordingMaxDurationReached": "A gravação atingiu a duração máxima e foi parada automaticamente.",
"recordingResumeFound": "Uma gravação em andamento deste navegador foi detectada no servidor. Retomar?",
"recordingSizeSoftWarning": "A gravação tem {{size}}. Considere parar quando for conveniente.",
diff --git a/static/locales/ru.json b/static/locales/ru.json
index 3a01147c..e1374917 100644
--- a/static/locales/ru.json
+++ b/static/locales/ru.json
@@ -1774,6 +1774,7 @@
"processingFailed": "Обработка не удалась",
"recordingFinalized": "Запись отправлена на обработку",
"recordingMaxDurationApproaching": "Запись будет автоматически остановлена примерно через {{minutes}} минут (максимальная длительность).",
+ "resumedRecordingNotIncognito": "Режим инкогнито отключён: возобновлённая запись уже передавалась на сервер.",
"recordingMaxDurationReached": "Запись достигла максимальной длительности и была остановлена автоматически.",
"recordingResumeFound": "На сервере обнаружена незавершённая запись из этого браузера. Возобновить?",
"recordingSizeSoftWarning": "Размер записи {{size}}. Подумайте об остановке при удобном случае.",
diff --git a/static/locales/zh.json b/static/locales/zh.json
index c06636a0..9253eaae 100644
--- a/static/locales/zh.json
+++ b/static/locales/zh.json
@@ -1774,6 +1774,7 @@
"processingFailed": "处理失败",
"recordingFinalized": "录音已上传等待处理",
"recordingMaxDurationApproaching": "录音将在约 {{minutes}} 分钟后自动停止(已接近最长时长)。",
+ "resumedRecordingNotIncognito": "隐身模式已关闭:此恢复的录音已在向服务器传输。",
"recordingMaxDurationReached": "录音已达到最长时长,已自动停止。",
"recordingResumeFound": "在服务器上检测到此浏览器的未完成录音。是否继续?",
"recordingSizeSoftWarning": "录音大小为 {{size}},可在方便时停止。",