Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Two settings UX improvements — (1) AJAX save: the four settings forms (Account info, Preferences, Custom Prompts) now submit via fetch instead of the browser's default form action, so the page no longer reloads and the active tab is preserved on save; new settingsToast() helper shows a transient success / failure banner at the bottom of the screen; on network failure the handler falls back to the native form.submit() so the user never loses an edit; backend response is left untouched (still re-renders the page) — the JS just ignores the body since 2xx is success enough; (2) merge the Display tab into the Preferences tab: the only setting Display carried was the audio player position (a display preference), and a single-setting tab was hard to find; moved the radio cards into the right column of Preferences below the editor toggles, dropped the standalone tab + its switching JS + the displayForm wire-up; preferences form now also carries audio_player_position so the unified save handler covers it; new account.savedSuccess i18n key across all 7 locales for the toast
Murtaza Nasirf3b3827fe060
diff --git a/static/locales/de.json b/static/locales/de.jsonindex 323ff470..179e47a8 100644--- a/static/locales/de.json+++ b/static/locales/de.json@@ -106,7 +106,8 @@"userDetails": "Benutzerdetails","username": "Benutzername","signInSecurity": "Anmeldung & Sicherheit",- "password": "Passwort"+ "password": "Passwort",+ "savedSuccess": "Einstellungen gespeichert"},"accountTabs": {"about": "Über",diff --git a/static/locales/en.json b/static/locales/en.jsonindex e7cbc90d..61b4534b 100644--- a/static/locales/en.json+++ b/static/locales/en.json@@ -106,7 +106,8 @@"userDetails": "User Details","username": "Username","signInSecurity": "Sign-in & Security",- "password": "Password"+ "password": "Password",+ "savedSuccess": "Settings saved"},"accountTabs": {"about": "About",diff --git a/static/locales/es.json b/static/locales/es.jsonindex 64161c40..f848dbc2 100644--- a/static/locales/es.json+++ b/static/locales/es.json@@ -106,7 +106,8 @@"userDetails": "Detalles del Usuario","username": "Nombre de Usuario","signInSecurity": "Inicio de sesión y seguridad",- "password": "Contraseña"+ "password": "Contraseña",+ "savedSuccess": "Configuración guardada"},"accountTabs": {"about": "Acerca de",diff --git a/static/locales/fr.json b/static/locales/fr.jsonindex 8a5c56e5..ad0fbc92 100644--- a/static/locales/fr.json+++ b/static/locales/fr.json@@ -106,7 +106,8 @@"userDetails": "Détails de l'Utilisateur","username": "Nom d'Utilisateur","signInSecurity": "Connexion et sécurité",- "password": "Mot de passe"+ "password": "Mot de passe",+ "savedSuccess": "Paramètres enregistrés"},"accountTabs": {"about": "À Propos",diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.jsonindex 617860aa..49f29f0a 100644--- a/static/locales/pt-BR.json+++ b/static/locales/pt-BR.json@@ -106,7 +106,8 @@"userDetails": "Detalhes do Usuário","username": "Nome de Usuário","signInSecurity": "Acesso e segurança",- "password": "Senha"+ "password": "Senha",+ "savedSuccess": "Configurações salvas"},"accountTabs": {"about": "Sobre",diff --git a/static/locales/ru.json b/static/locales/ru.jsonindex a8c77923..fb4f8ab7 100644--- a/static/locales/ru.json+++ b/static/locales/ru.json@@ -106,7 +106,8 @@"userDetails": "Данные пользователя","username": "Имя пользователя","signInSecurity": "Вход и безопасность",- "password": "Пароль"+ "password": "Пароль",+ "savedSuccess": "Настройки сохранены"},"accountTabs": {"about": "О продукте",diff --git a/static/locales/zh.json b/static/locales/zh.jsonindex 4c46309c..c6f83416 100644--- a/static/locales/zh.json+++ b/static/locales/zh.json@@ -106,7 +106,8 @@"userDetails": "用户详情","username": "用户名","signInSecurity": "登录与安全",- "password": "密码"+ "password": "密码",+ "savedSuccess": "设置已保存"},"accountTabs": {"about": "关于",diff --git a/templates/account.html b/templates/account.htmlindex 5ac73e67..bd96f8fa 100644--- a/templates/account.html+++ b/templates/account.html@@ -484,9 +484,6 @@<a href="#" id="tab-preferences" class="tab"><i class="fas fa-sliders-h"></i><span data-i18n="accountTabs.preferences">Preferences</span></a>- <a href="#" id="tab-display" class="tab">- <i class="fas fa-desktop"></i><span data-i18n="accountTabs.display">Display</span>- </a><a href="#" id="tab-prompts" class="tab"><i class="fas fa-cog"></i><span data-i18n="accountTabs.promptOptions">Prompts</span></a>@@ -983,69 +980,28 @@<span class="block text-xs text-[var(--text-muted)] mt-0.5" data-i18n="preferences.editorAutosaveHelp">When enabled, edits in the transcript editor are saved automatically a couple of seconds after you stop typing. When disabled (default), you save explicitly via the Save buttons or <code>Ctrl+S</code>.</span></span></label>- </div>-- </form>- </div>- <div class="tab-footer">- <button type="submit" form="preferencesForm" class="btn btn--primary">- <i class="fas fa-save"></i> <span data-i18n="buttons.saveSettings">Save Settings</span>- </button>- </div>- </div>-- <!-- Display tab — layout-level UI choices that change how- the recording-detail screen is composed (player- position now; future room for sidebar width,- column ratio defaults, etc.). Lives in its own- tab to keep the Preferences tab focused on- transcript/editor behaviour. -->- <div id="content-display" class="hidden tab-content">- <div class="tab-scroll">- <h2 class="text-2xl font-semibold text-[var(--text-primary)] mb-6" data-i18n="accountTabs.display">Display</h2>- <form id="displayForm" method="POST" action="{{ url_for('auth.account') }}" class="space-y-6 max-w-2xl">- <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>- <input type="hidden" name="preferences_form" value="1"/>- <!-- Preserve other preference fields so saving the- Display form doesn't reset them. IMPORTANT:- the backend uses key presence (`name in- request.form`) to decide checkbox state, so- these hidden inputs must only be emitted- when the corresponding pref is currently- TRUE — emitting an always-present input- with value="" would silently flip the- checkbox on every save. Language fields- always carry a value so they're always- emitted. -->- {% if current_user.show_timestamps_simple_view %}- <input type="hidden" name="show_timestamps_simple_view" value="on">- {% endif %}- {% if current_user.editor_autosave %}- <input type="hidden" name="editor_autosave" value="on">- {% endif %}- <input type="hidden" name="ui_language" value="{{ current_user.ui_language or 'en' }}">- <input type="hidden" name="transcription_language" value="{{ current_user.transcription_language or '' }}">- <input type="hidden" name="output_language" value="{{ current_user.output_language or '' }}">-- <div>- <h3 class="text-sm font-semibold text-[var(--text-secondary)] uppercase tracking-wide mb-3" data-i18n="display.audioPlayerSection">Audio player</h3>- <label class="block text-sm font-medium text-[var(--text-secondary)] mb-2" data-i18n="display.audioPlayerPositionLabel">Player position in the recording-detail screen</label>- <p class="t-meta mb-3" data-i18n="display.audioPlayerPositionHelp">Choose whether the audio player sits at the bottom of the screen (default) or at the top, just under the recording's title and metadata.</p>- <div class="grid grid-cols-1 sm:grid-cols-2 gap-3">- {% set apos = current_user.audio_player_position or 'bottom' %}- <label class="flex items-start gap-3 p-3 bg-[var(--bg-tertiary)] border border-[var(--border-secondary)] rounded-md cursor-pointer hover:bg-[var(--bg-accent-hover)]" :class="audioPlayerPosition === 'bottom' ? 'border-[var(--border-accent)]' : ''">+ <!-- Audio player position (was the Display+ tab; merged here because the only thing+ it controlled was a display preference+ and the dedicated tab was hard to find+ for one setting). -->+ <h3 class="text-sm font-semibold text-[var(--text-secondary)] uppercase tracking-wide pt-4" data-i18n="display.audioPlayerSection">Audio player</h3>+ <p class="text-xs text-[var(--text-muted)]" data-i18n="display.audioPlayerPositionHelp">Choose whether the audio player sits at the bottom of the screen (default) or at the top, just under the recording's title and metadata.</p>+ {% set apos = current_user.audio_player_position or 'bottom' %}+ <div class="grid grid-cols-2 gap-2">+ <label class="flex items-start gap-2 p-3 bg-[var(--bg-tertiary)] border border-[var(--border-secondary)] rounded-md cursor-pointer hover:bg-[var(--bg-accent-hover)]"><input type="radio" name="audio_player_position" value="bottom" {% if apos != 'top' %}checked{% endif %} class="mt-1 h-4 w-4 text-[var(--text-accent)] border-[var(--border-secondary)] focus:ring-[var(--border-focus)]"><span class="flex-1"><span class="block text-sm font-medium text-[var(--text-primary)]" data-i18n="display.playerPositionBottom">Bottom</span>- <span class="block t-meta mt-0.5" data-i18n="display.playerPositionBottomHelp">Player anchored under the transcript + summary columns. Default.</span>+ <span class="block text-xs text-[var(--text-muted)] mt-0.5" data-i18n="display.playerPositionBottomHelp">Player anchored under the transcript + summary columns. Default.</span></span></label>- <label class="flex items-start gap-3 p-3 bg-[var(--bg-tertiary)] border border-[var(--border-secondary)] rounded-md cursor-pointer hover:bg-[var(--bg-accent-hover)]">+ <label class="flex items-start gap-2 p-3 bg-[var(--bg-tertiary)] border border-[var(--border-secondary)] rounded-md cursor-pointer hover:bg-[var(--bg-accent-hover)]"><input type="radio" name="audio_player_position" value="top" {% if apos == 'top' %}checked{% endif %} class="mt-1 h-4 w-4 text-[var(--text-accent)] border-[var(--border-secondary)] focus:ring-[var(--border-focus)]"><span class="flex-1"><span class="block text-sm font-medium text-[var(--text-primary)]" data-i18n="display.playerPositionTop">Top</span>- <span class="block t-meta mt-0.5" data-i18n="display.playerPositionTopHelp">Player sits above the columns, just under the title and metadata strip.</span>+ <span class="block text-xs text-[var(--text-muted)] mt-0.5" data-i18n="display.playerPositionTopHelp">Player sits above the columns, just under the title and metadata strip.</span></span></label></div>@@ -1054,12 +1010,17 @@</form></div><div class="tab-footer">- <button type="submit" form="displayForm" class="btn btn--primary">- <i class="fas fa-save"></i><span data-i18n="buttons.saveSettings">Save Settings</span>+ <button type="submit" form="preferencesForm" class="btn btn--primary">+ <i class="fas fa-save"></i> <span data-i18n="buttons.saveSettings">Save Settings</span></button></div></div>+ <!-- The Display tab was folded into Preferences —+ the only setting it carried (audio player+ position) was a display preference and a+ single-setting tab was hard to find. -->+<div id="content-shares" class="hidden tab-content"><div class="tab-scroll"><h2 class="text-2xl font-semibold text-[var(--text-primary)] mb-6" data-i18n="accountTabs.sharedTranscripts">Shared Transcripts</h2>@@ -3149,11 +3110,9 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</coconst tabWebhooks = document.getElementById('tab-webhooks');const tabAbout = document.getElementById('tab-about');const tabPreferences = document.getElementById('tab-preferences');- const tabDisplay = document.getElementById('tab-display');const contentAccount = document.getElementById('content-account');const contentPrompts = document.getElementById('content-prompts');const contentPreferences = document.getElementById('content-preferences');- const contentDisplay = document.getElementById('content-display');const contentShares = document.getElementById('content-shares');const contentSpeakers = document.getElementById('content-speakers');const contentFolders = document.getElementById('content-folders');@@ -3171,7 +3130,6 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</coconst tabs = [{ tab: tabAccount, content: contentAccount, name: 'account' },{ tab: tabPreferences, content: contentPreferences, name: 'preferences' },- { tab: tabDisplay, content: contentDisplay, name: 'display' },{ tab: tabPrompts, content: contentPrompts, name: 'prompts' },{ tab: tabShares, content: contentShares, name: 'shares' },{ tab: tabSpeakers, content: contentSpeakers, name: 'speakers' },@@ -3222,10 +3180,6 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</coswitchToTab('preferences');}- function showDisplayTab() {- switchToTab('display');- }-function showPromptsTab() {switchToTab('prompts');}@@ -3270,13 +3224,6 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co});}- if (tabDisplay) {- tabDisplay.addEventListener('click', (e) => {- e.preventDefault();- showDisplayTab();- });- }-tabPrompts.addEventListener('click', (e) => {e.preventDefault();showPromptsTab();@@ -4255,6 +4202,106 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</codiv.textContent = text;return div.innerHTML;}++ // ---- AJAX form submission for the settings forms --------+ // Intercepts the four settings-tab forms (Account info,+ // Preferences, Display, Prompts) and submits them via+ // fetch + FormData so the page doesn't reload and the+ // active tab is preserved. Falls back to the browser's+ // native submit if fetch fails (network down etc.) so the+ // user never loses their edit. Shows a small toast on+ // success.+ function settingsToast(message, kind) {+ let bar = document.getElementById('settings-toast');+ if (!bar) {+ bar = document.createElement('div');+ bar.id = 'settings-toast';+ bar.setAttribute('role', 'status');+ bar.style.cssText = [+ 'position: fixed',+ 'left: 50%',+ 'bottom: 80px',+ 'transform: translateX(-50%)',+ 'padding: 10px 18px',+ 'border-radius: var(--radius-md, 8px)',+ 'font-size: 14px',+ 'font-weight: 500',+ 'box-shadow: 0 10px 30px rgba(0,0,0,0.18)',+ 'z-index: 9999',+ 'opacity: 0',+ 'transition: opacity .15s ease, transform .15s ease',+ 'pointer-events: none'+ ].join(';');+ document.body.appendChild(bar);+ }+ bar.textContent = message;+ bar.style.background = kind === 'danger'+ ? 'var(--bg-danger, #dc2626)'+ : 'var(--bg-success, #059669)';+ bar.style.color = '#fff';+ requestAnimationFrame(() => {+ bar.style.opacity = '1';+ bar.style.transform = 'translateX(-50%) translateY(0)';+ });+ clearTimeout(bar._hideTimer);+ bar._hideTimer = setTimeout(() => {+ bar.style.opacity = '0';+ }, 2500);+ }++ function wireAjaxFormSubmit(formId, successKey) {+ const form = document.getElementById(formId);+ if (!form) return;+ form.addEventListener('submit', async (e) => {+ e.preventDefault();+ const submitBtn = form.querySelector('[type=submit]')+ || document.querySelector(`[form="${formId}"][type=submit]`);+ if (submitBtn) submitBtn.disabled = true;+ try {+ const fd = new FormData(form);+ // The Display/Prompts/Account/Preferences forms+ // all POST to the same endpoint and discriminate+ // by checking which marker key is present in+ // request.form (accountInfoForm has user_name,+ // preferences_form / preferences_form fields,+ // etc.). FormData carries those automatically.+ const csrfToken = form.querySelector('[name=csrf_token]')?.value;+ const response = await fetch(form.action || window.location.href, {+ method: form.method || 'POST',+ headers: {+ 'X-Requested-With': 'XMLHttpRequest',+ ...(csrfToken ? { 'X-CSRFToken': csrfToken } : {})+ },+ body: fd,+ credentials: 'same-origin'+ });+ if (!response.ok) {+ throw new Error(`HTTP ${response.status}`);+ }+ // Server still returns the rendered HTML page;+ // we don't need to parse it. The fact that the+ // POST returned 2xx means the save succeeded.+ settingsToast(+ (window.i18nT?.(successKey)) || 'Settings saved',+ 'success'+ );+ } catch (err) {+ console.error('[settings save]', err);+ // Network failure: fall back to a real submit so+ // the user never loses their pending edits.+ settingsToast('Save failed — submitting normally', 'danger');+ form.removeEventListener('submit', arguments.callee);+ form.submit();+ } finally {+ if (submitBtn) submitBtn.disabled = false;+ }+ });+ }+ // Wire all four forms once the DOM is ready (this script+ // already runs after the form elements have been parsed).+ wireAjaxFormSubmit('accountInfoForm', 'account.savedSuccess');+ wireAjaxFormSubmit('preferencesForm', 'account.savedSuccess');+ wireAjaxFormSubmit('customPromptsForm', 'account.savedSuccess');// Update footer with version. Writes the resolved string to// the --footer-version-text CSS variable on :root so every