From 20fc1d4a6e8f1b1759d0b580c183195f800741bc Mon Sep 17 00:00:00 2001 From: Konstantin Kolesnyak Date: Thu, 25 Jun 2026 21:21:58 +0200 Subject: [PATCH] Fix navigator.clipboard crash over plain HTTP (non-secure context) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit navigator.clipboard is only exposed in secure contexts (HTTPS or http://localhost). When the UI is accessed over plain HTTP via a LAN hostname/IP, or behind a proxy without a trusted cert, the entire clipboard object is undefined and any call throws 'TypeError: Cannot read properties of undefined (reading writeText)'. Two affected call sites: - web/src/components/Chat/CodeBlock.tsx — the per-code-block Copy button - web/src/pages/ChatPage.tsx — Cmd+Shift+C 'copy last response' shortcut Both silently failed without surfacing any UI feedback. Add a shared copyToClipboard helper that prefers navigator.clipboard when available and falls back to a hidden off-screen