Skip to content

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

Python

Phase 1 PWA fixes: beforeunload protection and iOS wake lock alternative

Murtaza Nasir42efcbf32627
diff --git a/README.md b/README.md
index dfaf840d..19c94996 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
<a href="https://www.gnu.org/licenses/agpl-3.0"><img alt="AGPL v3" src="https://img.shields.io/badge/License-AGPL_v3-blue.svg"></a>
<a href="https://github.com/murtaza-nasir/speakr/actions/workflows/docker-publish.yml"><img alt="Docker Build" src="https://github.com/murtaza-nasir/speakr/actions/workflows/docker-publish.yml/badge.svg"></a>
<a href="https://hub.docker.com/r/learnedmachine/speakr"><img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/learnedmachine/speakr"></a>
- <a href="https://github.com/murtaza-nasir/speakr/releases/latest"><img alt="Latest Version" src="https://img.shields.io/badge/version-0.5.9-brightgreen.svg"></a>
+ <a href="https://github.com/murtaza-nasir/speakr/releases/latest"><img alt="Latest Version" src="https://img.shields.io/badge/version-0.5.10-brightgreen.svg"></a>
</p>
<p align="center">
@@ -145,11 +145,23 @@ Complete documentation is available at **[murtaza-nasir.github.io/speakr](https:
- [Troubleshooting](https://murtaza-nasir.github.io/speakr/troubleshooting) - Common issues and solutions
- [FAQ](https://murtaza-nasir.github.io/speakr/faq) - Frequently asked questions
-## Latest Release (v0.5.9)
+## Latest Release (v0.5.10)
+
+**Patch Release** - Bug fixes and UX improvements
+
+- **iOS File Upload Fix** - Resolved issue preventing iOS users from uploading audio/video files
+- **Click-Outside Menus** - Dropdown menus now close when clicking outside them
+- **PWA i18n** - Added internationalization for PWA install button
+
+Fully backward compatible with v0.5.9. No configuration changes required.
+
+**[View Full Release Notes →](RELEASE_NOTES_v0.5.10.md)**
+
+### Previous Release (v0.5.9)
> **⚠️ IMPORTANT - Major Release Warning:**
>
-> This is a **major release** with significant architectural changes and new features. Before upgrading:
+> v0.5.9 was a **major release** with significant architectural changes and new features. Before upgrading from earlier versions:
>
> - **BACKUP YOUR DATA** - Database schema changes require migration
> - **Review new environment variables** - Many features require `.env` configuration
@@ -166,7 +178,7 @@ Complete documentation is available at **[murtaza-nasir.github.io/speakr](https:
>
> See [configuration guide](https://murtaza-nasir.github.io/speakr/getting-started/installation#configuration-updates) for complete setup instructions.
-### Highlights
+#### Highlights
- **Complete Internal Sharing System** - Share recordings with users with granular permissions (view/edit/reshare)
- **Group Management & Collaboration** - Create groups with auto-sharing via group tags and custom retention policies
- **Speaker Voice Profiles** - AI-powered speaker identification with 256-dimensional voice embeddings
@@ -178,11 +190,6 @@ Complete documentation is available at **[murtaza-nasir.github.io/speakr](https:
- **UI/UX Enhancements** - Compact controls, inline editing, unified toast notifications, improved badges
- **Enhanced Internationalization** - 29 new tooltip translations across all supported languages
-### Previous Release (v0.5.8)
-- **Inline Transcript Editing** - Edit speaker assignments and text directly within the speaker identification modal
-- **Add Speaker Functionality** - Dynamically add new speakers during transcript review
-- **Enhanced Speaker Modal** - Improved UX with hover-based edit controls and real-time updates
-
## Screenshots
<table align="center" border="0">
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index 716ef1ad..d444a8a1 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -1307,6 +1307,15 @@ document.addEventListener('DOMContentLoaded', async () => {
// Visibility change handler for wake lock
document.addEventListener('visibilitychange', audioComposable.handleVisibilityChange);
+
+ // Prevent data loss on tab close/refresh during recording
+ window.addEventListener('beforeunload', (e) => {
+ if (audioComposable.hasUnsavedRecording()) {
+ e.preventDefault();
+ e.returnValue = ''; // Chrome requires this
+ return 'You have an unsaved recording. Are you sure you want to leave?';
+ }
+ });
});
// =========================================================================
diff --git a/static/js/modules/composables/audio.js b/static/js/modules/composables/audio.js
index de9c9e52..f86fc9c0 100644
--- a/static/js/modules/composables/audio.js
+++ b/static/js/modules/composables/audio.js
@@ -18,8 +18,57 @@ export function useAudio(state, utils) {
const { showToast, setGlobalError, formatFileSize, startUploadQueue } = utils;
+ // iOS detection
+ const isiOS = () => {
+ return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
+ };
+
+ // Silent audio for iOS wake lock alternative
+ let silentAudio = null;
+
+ // Create silent audio using data URL (1 second of silence)
+ const createSilentAudio = () => {
+ if (!silentAudio) {
+ // Base64 encoded 1-second silent MP3
+ const silentMp3 = 'data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAADhAC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7v////////////////////////////////////////////////////////////AAAAAExhdmM1OC4xMwAAAAAAAAAAAAAAACQCgAAAAAAAAAOEfxVqYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//sQZAAP8AAAaQAAAAgAAA0gAAABAAABpAAAACAAADSAAAAETEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//sQZDwP8AAAaQAAAAgAAA0gAAABAAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=';
+ silentAudio = new Audio(silentMp3);
+ silentAudio.loop = true;
+ silentAudio.volume = 0.01; // Very low volume, almost silent
+ }
+ return silentAudio;
+ };
+
+ // Start iOS wake lock (play silent audio)
+ const startiOSWakeLock = async () => {
+ try {
+ const audio = createSilentAudio();
+ await audio.play();
+ console.log('[iOS Wake Lock] Silent audio playing to prevent sleep');
+ return true;
+ } catch (error) {
+ console.warn('[iOS Wake Lock] Failed to start silent audio:', error);
+ showToast('iOS wake lock may not work - keep screen active', 'warning');
+ return false;
+ }
+ };
+
+ // Stop iOS wake lock (stop silent audio)
+ const stopiOSWakeLock = () => {
+ if (silentAudio) {
+ silentAudio.pause();
+ silentAudio.currentTime = 0;
+ console.log('[iOS Wake Lock] Silent audio stopped');
+ }
+ };
+
// Acquire wake lock to prevent screen from sleeping during recording
const acquireWakeLock = async () => {
+ // iOS doesn't support Wake Lock API - use silent audio instead
+ if (isiOS()) {
+ return await startiOSWakeLock();
+ }
+
+ // Android/Desktop: use native Wake Lock API
try {
if ('wakeLock' in navigator) {
wakeLock.value = await navigator.wakeLock.request('screen');
@@ -49,6 +98,13 @@ export function useAudio(state, utils) {
// Release wake lock
const releaseWakeLock = async () => {
+ // iOS: stop silent audio
+ if (isiOS()) {
+ stopiOSWakeLock();
+ return;
+ }
+
+ // Android/Desktop: release native wake lock
if (wakeLock.value) {
try {
await wakeLock.value.release();