Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Add Display tab to user settings with audio-player-position preference — new tab between Preferences and Prompts on account.html lets the user choose whether the desktop audio player sits at the bottom (default, current behaviour) or at the top of the recording-detail screen just under the title-meta strip; preference stored as the new user.audio_player_position VARCHAR(10) column (DEFAULT 'bottom') with the same SQLite/PostgreSQL-compatible migration pattern as the other UI prefs, mirrored to the reactive audioPlayerPosition ref in app.modular.js via a new data-audio-player-position attribute on the Vue mount element, and consumed by detail-view.html to switch between rendering desktop-bottom-player.html before or after the main split view; account form save handler accepts the new radio field and validates it against {top, bottom} before persisting; all 7 locale files get a new accountTabs.display label plus a display.* namespace with section heading, label, help text, and per-option labels and help; tab-switching JS in account.html registers the new tab id so it switches with the same .is-active toggle as the other tabs; 369 backend tests still pass
Murtaza Nasird67fad02c629
diff --git a/src/api/auth.py b/src/api/auth.pyindex 8888c8dc..95e9d6b0 100644--- a/src/api/auth.py+++ b/src/api/auth.py@@ -575,6 +575,10 @@ def account():elif 'preferences_form' in request.form:current_user.show_timestamps_simple_view = 'show_timestamps_simple_view' in request.formcurrent_user.editor_autosave = 'editor_autosave' in request.form+ # Audio player position — only 'top' or 'bottom' are valid;+ # anything else falls back to the default 'bottom'.+ pos = request.form.get('audio_player_position', 'bottom')+ current_user.audio_player_position = pos if pos in ('bottom', 'top') else 'bottom'ui_lang = request.form.get('ui_language')transcription_lang = request.form.get('transcription_language')diff --git a/src/init_db.py b/src/init_db.pyindex 98372fb2..9a461dde 100644--- a/src/init_db.py+++ b/src/init_db.py@@ -304,6 +304,8 @@ def initialize_database(app):app.logger.info("Added show_timestamps_simple_view column to user table")if add_column_if_not_exists(engine, 'user', 'editor_autosave', 'BOOLEAN DEFAULT 0'):app.logger.info("Added editor_autosave column to user table")+ if add_column_if_not_exists(engine, 'user', 'audio_player_position', "VARCHAR(10) DEFAULT 'bottom'"):+ app.logger.info("Added audio_player_position column to user table")if add_column_if_not_exists(engine, 'tag', 'default_hotwords', 'TEXT'):app.logger.info("Added default_hotwords column to tag table")if add_column_if_not_exists(engine, 'tag', 'default_initial_prompt', 'TEXT'):diff --git a/src/models/user.py b/src/models/user.pyindex 3e996faa..cc5863e1 100644--- a/src/models/user.py+++ b/src/models/user.py@@ -65,6 +65,11 @@ class User(db.Model, UserMixin):# UI/display preferencesshow_timestamps_simple_view = db.Column(db.Boolean, default=False)editor_autosave = db.Column(db.Boolean, default=False)+ # Audio player placement in the recording-detail view. 'bottom'+ # (default) keeps the player anchored under the content columns;+ # 'top' renders it above the columns so it sits closer to the+ # title bar. User-configurable from the Display tab in settings.+ audio_player_position = db.Column(db.String(10), default='bottom')def __repr__(self):return f"User('{self.username}', '{self.email}')"diff --git a/static/js/app.modular.js b/static/js/app.modular.jsindex 4ab9618e..fc69c853 100644--- a/static/js/app.modular.js+++ b/static/js/app.modular.js@@ -999,6 +999,7 @@ document.addEventListener('DOMContentLoaded', async () => {const connectorSupportsInitialPrompt = ref(false); // Connector accepts initial prompt / context hintconst showTimestampsSimpleView = ref(false); // User pref: display timestamps in simple viewconst editorAutosave = ref(false); // User pref: autosave transcript editor+ const audioPlayerPosition = ref('bottom'); // User pref: 'bottom' or 'top' for desktop player placementconst currentUserName = ref('');const canDeleteRecordings = ref(true);const enableInternalSharing = ref(false);@@ -1283,7 +1284,7 @@ document.addEventListener('DOMContentLoaded', async () => {openAsrDropdownIndex,// App Config- useAsrEndpoint, connectorSupportsDiarization, connectorSupportsSpeakerCount, connectorSupportsHotwords, connectorSupportsInitialPrompt, showTimestampsSimpleView, editorAutosave, formatTimestamp, currentUserName, canDeleteRecordings, enableInternalSharing, enableArchiveToggle, showUsernamesInUI,+ useAsrEndpoint, connectorSupportsDiarization, connectorSupportsSpeakerCount, connectorSupportsHotwords, connectorSupportsInitialPrompt, showTimestampsSimpleView, editorAutosave, audioPlayerPosition, formatTimestamp, currentUserName, canDeleteRecordings, enableInternalSharing, enableArchiveToggle, showUsernamesInUI,// Internal SharingshowUnifiedShareModal, internalShareUserSearch, internalShareSearchResults,@@ -2830,6 +2831,8 @@ document.addEventListener('DOMContentLoaded', async () => {connectorSupportsInitialPrompt.value = appElement.dataset.connectorSupportsInitialPrompt === 'True';showTimestampsSimpleView.value = appElement.dataset.showTimestampsSimpleView === 'True';editorAutosave.value = appElement.dataset.editorAutosave === 'True';+ const pos = appElement.dataset.audioPlayerPosition;+ audioPlayerPosition.value = (pos === 'top') ? 'top' : 'bottom';currentUserName.value = appElement.dataset.currentUserName || '';}diff --git a/static/locales/de.json b/static/locales/de.jsonindex a7b8741f..4a2a31ea 100644--- a/static/locales/de.json+++ b/static/locales/de.json@@ -119,7 +119,8 @@"templates": "Vorlagen","transcriptTemplates": "Transkript-Vorlagen","preferences": "Einstellungen",- "webhooks": "Webhooks"+ "webhooks": "Webhooks",+ "display": "Anzeige"},"admin": {"title": "Administration",@@ -1617,5 +1618,14 @@"secretBannerTitle": "Geheimnis jetzt kopieren — es wird nicht erneut angezeigt","secretBannerHint": "Signieren Sie jede Empfänger-Anfrage: HMAC-SHA256 des Rohkörpers mit diesem Geheimnis. Header: Speakr-Signature: sha256=<hex>","copy": "Kopieren"+ },+ "display": {+ "audioPlayerSection": "Audio-Player",+ "audioPlayerPositionLabel": "Player-Position im Aufnahme-Detailbildschirm",+ "audioPlayerPositionHelp": "Wählen Sie, ob der Audio-Player am unteren Rand des Bildschirms (Standard) oder oben, direkt unter Titel und Metadaten der Aufnahme, angezeigt wird.",+ "playerPositionBottom": "Unten",+ "playerPositionBottomHelp": "Player unter den Transkript- und Zusammenfassungsspalten verankert. Standard.",+ "playerPositionTop": "Oben",+ "playerPositionTopHelp": "Der Player sitzt über den Spalten, direkt unter dem Titel und der Metadatenleiste."}}diff --git a/static/locales/en.json b/static/locales/en.jsonindex f3be0c59..1cd77b95 100644--- a/static/locales/en.json+++ b/static/locales/en.json@@ -119,7 +119,8 @@"tagManagement": "Tag Management","templates": "Templates","transcriptTemplates": "Transcript Templates",- "webhooks": "Webhooks"+ "webhooks": "Webhooks",+ "display": "Display"},"admin": {"title": "Admin",@@ -1617,5 +1618,14 @@"secretBannerTitle": "Copy this secret now — it will not be shown again","secretBannerHint": "Sign every receiver request: HMAC-SHA256 of the raw body using this secret. Header: Speakr-Signature: sha256=<hex>","copy": "Copy"+ },+ "display": {+ "audioPlayerSection": "Audio player",+ "audioPlayerPositionLabel": "Player position in the recording-detail screen",+ "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.",+ "playerPositionBottom": "Bottom",+ "playerPositionBottomHelp": "Player anchored under the transcript + summary columns. Default.",+ "playerPositionTop": "Top",+ "playerPositionTopHelp": "Player sits above the columns, just under the title and metadata strip."}}diff --git a/static/locales/es.json b/static/locales/es.jsonindex 61ee07ba..4380ec4e 100644--- a/static/locales/es.json+++ b/static/locales/es.json@@ -119,7 +119,8 @@"templates": "Plantillas","transcriptTemplates": "Plantillas de Transcripción","preferences": "Preferencias",- "webhooks": "Webhooks"+ "webhooks": "Webhooks",+ "display": "Visualización"},"admin": {"title": "Administración",@@ -1617,5 +1618,14 @@"secretBannerTitle": "Copie este secreto ahora — no se mostrará otra vez","secretBannerHint": "Firme cada solicitud del receptor: HMAC-SHA256 del cuerpo crudo usando este secreto. Cabecera: Speakr-Signature: sha256=<hex>","copy": "Copiar"+ },+ "display": {+ "audioPlayerSection": "Reproductor de audio",+ "audioPlayerPositionLabel": "Posición del reproductor en la pantalla de detalle de la grabación",+ "audioPlayerPositionHelp": "Elige si el reproductor de audio se sitúa en la parte inferior de la pantalla (predeterminado) o en la parte superior, justo debajo del título y los metadatos de la grabación.",+ "playerPositionBottom": "Inferior",+ "playerPositionBottomHelp": "Reproductor anclado debajo de las columnas de transcripción y resumen. Predeterminado.",+ "playerPositionTop": "Superior",+ "playerPositionTopHelp": "El reproductor se sitúa encima de las columnas, justo debajo del título y la barra de metadatos."}}diff --git a/static/locales/fr.json b/static/locales/fr.jsonindex 34b6532b..7aece233 100644--- a/static/locales/fr.json+++ b/static/locales/fr.json@@ -119,7 +119,8 @@"templates": "Modèles","transcriptTemplates": "Modèles de Transcription","preferences": "Préférences",- "webhooks": "Webhooks"+ "webhooks": "Webhooks",+ "display": "Affichage"},"admin": {"title": "Administration",@@ -1617,5 +1618,14 @@"secretBannerTitle": "Copiez ce secret maintenant — il ne sera plus affiché","secretBannerHint": "Signez chaque requête du récepteur : HMAC-SHA256 du corps brut avec ce secret. En-tête : Speakr-Signature: sha256=<hex>","copy": "Copier"+ },+ "display": {+ "audioPlayerSection": "Lecteur audio",+ "audioPlayerPositionLabel": "Position du lecteur dans l'écran de détail de l'enregistrement",+ "audioPlayerPositionHelp": "Choisissez si le lecteur audio se trouve en bas de l'écran (par défaut) ou en haut, juste sous le titre et les métadonnées de l'enregistrement.",+ "playerPositionBottom": "En bas",+ "playerPositionBottomHelp": "Lecteur ancré sous les colonnes de transcription et de résumé. Par défaut.",+ "playerPositionTop": "En haut",+ "playerPositionTopHelp": "Le lecteur se place au-dessus des colonnes, juste sous le titre et la barre de métadonnées."}}diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.jsonindex f5d8faa3..554842d4 100644--- a/static/locales/pt-BR.json+++ b/static/locales/pt-BR.json@@ -119,7 +119,8 @@"templates": "Modelos","transcriptTemplates": "Modelos de Transcrição","preferences": "Preferências",- "webhooks": "Webhooks"+ "webhooks": "Webhooks",+ "display": "Exibição"},"admin": {"title": "Administração",@@ -1617,5 +1618,14 @@"secretBannerTitle": "Copie este segredo agora — não será mostrado de novo","secretBannerHint": "Assine cada requisição do receptor: HMAC-SHA256 do corpo bruto usando este segredo. Cabeçalho: Speakr-Signature: sha256=<hex>","copy": "Copiar"+ },+ "display": {+ "audioPlayerSection": "Reprodutor de áudio",+ "audioPlayerPositionLabel": "Posição do reprodutor na tela de detalhes da gravação",+ "audioPlayerPositionHelp": "Escolha se o reprodutor de áudio fica na parte inferior da tela (padrão) ou na parte superior, logo abaixo do título e dos metadados da gravação.",+ "playerPositionBottom": "Inferior",+ "playerPositionBottomHelp": "Reprodutor ancorado abaixo das colunas de transcrição e resumo. Padrão.",+ "playerPositionTop": "Superior",+ "playerPositionTopHelp": "O reprodutor fica acima das colunas, logo abaixo do título e da barra de metadados."}}diff --git a/static/locales/ru.json b/static/locales/ru.jsonindex 4a6dca80..d96059b6 100644--- a/static/locales/ru.json+++ b/static/locales/ru.json@@ -119,7 +119,8 @@"templates": "Шаблоны","transcriptTemplates": "Шаблоны транскриптов","preferences": "Настройки",- "webhooks": "Вебхуки"+ "webhooks": "Вебхуки",+ "display": "Отображение"},"admin": {"title": "Администратор",@@ -1617,5 +1618,14 @@"secretBannerTitle": "Скопируйте этот секрет сейчас — он больше не будет показан","secretBannerHint": "Подписывайте каждый запрос получателя: HMAC-SHA256 от исходного тела с этим секретом. Заголовок: Speakr-Signature: sha256=<hex>","copy": "Копировать"+ },+ "display": {+ "audioPlayerSection": "Аудиоплеер",+ "audioPlayerPositionLabel": "Положение плеера на экране деталей записи",+ "audioPlayerPositionHelp": "Выберите, где будет располагаться аудиоплеер: внизу экрана (по умолчанию) или вверху, прямо под заголовком и метаданными записи.",+ "playerPositionBottom": "Внизу",+ "playerPositionBottomHelp": "Плеер закреплён под столбцами расшифровки и резюме. По умолчанию.",+ "playerPositionTop": "Вверху",+ "playerPositionTopHelp": "Плеер располагается над столбцами, прямо под заголовком и панелью метаданных."}}diff --git a/static/locales/zh.json b/static/locales/zh.jsonindex be9618fe..12b20c0a 100644--- a/static/locales/zh.json+++ b/static/locales/zh.json@@ -119,7 +119,8 @@"templates": "模板","transcriptTemplates": "转录模板","preferences": "偏好设置",- "webhooks": "Webhook"+ "webhooks": "Webhook",+ "display": "显示"},"admin": {"title": "管理员",@@ -1617,5 +1618,14 @@"secretBannerTitle": "立即复制此密钥 — 不会再次显示","secretBannerHint": "用此密钥对每个接收方请求进行签名: 原始正文的 HMAC-SHA256。请求头: Speakr-Signature: sha256=<hex>","copy": "复制"+ },+ "display": {+ "audioPlayerSection": "音频播放器",+ "audioPlayerPositionLabel": "录音详情页中播放器的位置",+ "audioPlayerPositionHelp": "选择音频播放器是位于屏幕底部(默认)还是顶部(紧贴录音标题和元数据下方)。",+ "playerPositionBottom": "底部",+ "playerPositionBottomHelp": "播放器固定在转录和摘要栏下方。默认。",+ "playerPositionTop": "顶部",+ "playerPositionTopHelp": "播放器位于栏的上方,紧贴标题和元数据栏下方。"}}diff --git a/templates/account.html b/templates/account.htmlindex de1db866..d9088158 100644--- a/templates/account.html+++ b/templates/account.html@@ -419,6 +419,9 @@<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>@@ -910,6 +913,57 @@</form></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 pt-6">+ <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 this+ form doesn't reset them to blank/default. -->+ <input type="hidden" name="show_timestamps_simple_view" value="{% if current_user.show_timestamps_simple_view %}on{% endif %}">+ <input type="hidden" name="editor_autosave" value="{% if current_user.editor_autosave %}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)]' : ''">+ <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>+ </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)]">+ <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>+ </label>+ </div>+ </div>++ <div class="flex justify-end pt-2">+ <button type="submit" class="btn btn--primary">+ <i class="fas fa-save"></i><span data-i18n="buttons.saveSettings">Save Settings</span>+ </button>+ </div>+ </form>+ </div>+<div id="content-shares" class="hidden tab-content pt-6"><h2 class="text-2xl font-semibold text-[var(--text-primary)] mb-6" data-i18n="accountTabs.sharedTranscripts">Shared Transcripts</h2><div id="shares-container" class="space-y-4">@@ -2967,9 +3021,11 @@ 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');@@ -2987,6 +3043,7 @@ 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' },@@ -3037,6 +3094,10 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</coswitchToTab('preferences');}+ function showDisplayTab() {+ switchToTab('display');+ }+function showPromptsTab() {switchToTab('prompts');}@@ -3081,6 +3142,13 @@ 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();diff --git a/templates/components/detail-view.html b/templates/components/detail-view.htmlindex 23fbedc0..72145b6b 100644--- a/templates/components/detail-view.html+++ b/templates/components/detail-view.html@@ -101,6 +101,17 @@</button></div>+ <!-- Persistent audio player. By default sits at the BOTTOM of+ the recording-detail screen, but the user can flip it to+ the TOP from the Display tab in settings (preference+ stored in user.audio_player_position; mirrored to the+ reactive audioPlayerPosition ref). When 'top', the same+ component renders ABOVE the main content split view so+ it sits just under the title-meta strip. -->+ <template v-if="audioPlayerPosition === 'top'">+ {% include 'components/detail/desktop-bottom-player.html' %}+ </template>+<!-- Main Content Split View --><div id="mainContentColumns" class="flex-1 flex overflow-hidden">{% include 'components/detail/desktop-transcription-panel.html' %}@@ -111,10 +122,9 @@{% include 'components/detail/desktop-right-panel.html' %}</div>- <!-- Persistent Bottom Audio Player. Spans the transcript + right- rail. Stays anchored to the bottom of the recording-detail- screen so the player is always within reach. -->- {% include 'components/detail/desktop-bottom-player.html' %}+ <template v-if="audioPlayerPosition !== 'top'">+ {% include 'components/detail/desktop-bottom-player.html' %}+ </template></div><!-- Floating dockable chat (teleported to body; desktop-only). -->diff --git a/templates/index.html b/templates/index.htmlindex c8d12810..0b95852c 100644--- a/templates/index.html+++ b/templates/index.html@@ -57,6 +57,7 @@data-user-language="{{ user_language }}"data-show-timestamps-simple-view="{{ 'True' if (current_user.is_authenticated and current_user.show_timestamps_simple_view) else 'False' }}"data-editor-autosave="{{ 'True' if (current_user.is_authenticated and current_user.editor_autosave) else 'False' }}"+ data-audio-player-position="{{ (current_user.audio_player_position or 'bottom') if current_user.is_authenticated else 'bottom' }}"data-server-recording-chunks="{{ 'True' if server_recording_chunks_enabled else 'False' }}"data-recording-max-hours="{{ recording_max_hours }}"class="h-full flex flex-col opacity-0 transition-opacity duration-500">