From b63af01d73652e8c5cf236c6a0f856f47fd0e497 Mon Sep 17 00:00:00 2001 From: Alex P Date: Sun, 21 Sep 2025 21:07:41 +0000 Subject: [PATCH] [WIP] Improvements, Bugfixes: Improve audio experience when running in HTTP mode --- ui/src/components/ActionBar.tsx | 2 ++ .../popovers/AudioControlPopover.tsx | 24 +++++++++++++++---- ui/src/hooks/useAudioDevices.ts | 9 +++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/ui/src/components/ActionBar.tsx b/ui/src/components/ActionBar.tsx index 4fc9c8d0..f205f2a8 100644 --- a/ui/src/components/ActionBar.tsx +++ b/ui/src/components/ActionBar.tsx @@ -43,6 +43,8 @@ interface MicrophoneHookReturn { isStarting: boolean; isStopping: boolean; isToggling: boolean; + // HTTP/HTTPS detection + isHttpsRequired: boolean; } export default function Actionbar({ diff --git a/ui/src/components/popovers/AudioControlPopover.tsx b/ui/src/components/popovers/AudioControlPopover.tsx index 87ad097f..3bd9a528 100644 --- a/ui/src/components/popovers/AudioControlPopover.tsx +++ b/ui/src/components/popovers/AudioControlPopover.tsx @@ -87,6 +87,8 @@ export default function AudioControlPopover({ microphone }: AudioControlPopoverP isStarting, isStopping, isToggling, + // HTTP/HTTPS detection + isHttpsRequired, } = microphone; // Use WebSocket data exclusively - no polling fallback @@ -344,10 +346,24 @@ export default function AudioControlPopover({ microphone }: AudioControlPopoverP theme={isMicrophoneActiveFromHook ? "danger" : "primary"} text={isMicrophoneActiveFromHook ? "Disable" : "Enable"} onClick={handleToggleMicrophoneEnable} - disabled={isLoading} + disabled={isLoading || isHttpsRequired} /> + {/* HTTPS requirement notice */} + {isHttpsRequired && ( +
+

HTTPS Required for Microphone

+

+ Microphone access requires a secure connection. Please access this device using HTTPS instead of HTTP to enable audio input features. +

+

+ Current: {window.location.protocol + '//' + window.location.host} +
+ Secure: {'https://' + window.location.host} +

+
+ )} @@ -377,7 +393,7 @@ export default function AudioControlPopover({ microphone }: AudioControlPopoverP handleAudioOutputDeviceChange(e.target.value)} - disabled={devicesLoading} + disabled={devicesLoading || isHttpsRequired} className="w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:bg-slate-50 disabled:text-slate-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-300 dark:focus:border-blue-400 dark:disabled:bg-slate-800" > {audioOutputDevices.map((device) => ( @@ -414,7 +430,7 @@ export default function AudioControlPopover({ microphone }: AudioControlPopoverP