From 3431f73c969d54c2283c7b07bb17cfd0c1843d6e Mon Sep 17 00:00:00 2001 From: 0xbyt4 <35742124+0xbyt4@users.noreply.github.com> Date: Wed, 11 Mar 2026 22:05:09 +0300 Subject: [PATCH] fix: show mic button on mobile Web UI with HTTPS warning Mobile browsers require HTTPS for navigator.mediaDevices API. Instead of hiding the mic button (confusing UX), show it as dimmed and display an informative message when tapped explaining the HTTPS requirement. --- gateway/platforms/web.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gateway/platforms/web.py b/gateway/platforms/web.py index 52a19b4d..148b422e 100644 --- a/gateway/platforms/web.py +++ b/gateway/platforms/web.py @@ -953,6 +953,10 @@ body { color: #fff; box-shadow: 0 0 16px var(--accent-glow); } +#voice-btn.unavailable { + opacity: 0.4; + cursor: not-allowed; +} #input-bar.voice-mode-active { justify-content: center; } @@ -1092,9 +1096,11 @@ function handleServerMessage(data) { document.getElementById('chat-screen').style.display = 'flex'; document.getElementById('input').focus(); setStatus(true); - // Check voice support + // Check voice support — on mobile browsers, mediaDevices + // requires HTTPS (localhost is exempt). Mark as unavailable + // but keep the button visible so users know the feature exists. if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) { - document.getElementById('voice-btn').style.display = 'none'; + document.getElementById('voice-btn').classList.add('unavailable'); } break; @@ -1197,6 +1203,10 @@ const SILENCE_THRESHOLD = 0.015; const SILENCE_DURATION = 1500; // ms of silence to auto-stop async function toggleVoice() { + if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) { + addSystemMessage('Microphone requires HTTPS. On mobile, use https:// or access via localhost.'); + return; + } if (voiceMode) { exitVoiceMode(); } else {