From 51d73566ea167a4bf95e911dda840c6802eb14da Mon Sep 17 00:00:00 2001 From: The Daniel Date: Fri, 10 Jul 2026 18:41:15 -0400 Subject: [PATCH] Fix Sign Message copy button in non-secure contexts The Copy button called navigator.clipboard.writeText directly, which is undefined when ThunderHub is served over plain HTTP or a LAN/Tor address (a non-secure context), so clicking Copy silently did nothing. Add a fallback that copies via a temporary textarea and document.execCommand('copy') when the async Clipboard API is unavailable, and surface a success or error toast in both code paths. --- .../src/views/tools/messages/SignMessage.tsx | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/client/src/views/tools/messages/SignMessage.tsx b/src/client/src/views/tools/messages/SignMessage.tsx index 7761a244e..0e18afff9 100644 --- a/src/client/src/views/tools/messages/SignMessage.tsx +++ b/src/client/src/views/tools/messages/SignMessage.tsx @@ -20,6 +20,26 @@ export const SignMessage = () => { } }, [loading, data]); + const copySignature = async () => { + try { + if (navigator.clipboard && window.isSecureContext) { + await navigator.clipboard.writeText(signed); + } else { + const textArea = document.createElement('textarea'); + textArea.value = signed; + textArea.style.position = 'fixed'; + textArea.style.opacity = '0'; + document.body.appendChild(textArea); + textArea.select(); + document.execCommand('copy'); + document.body.removeChild(textArea); + } + toast.success('Signature Copied'); + } catch { + toast.error('Failed to copy signature'); + } + }; + return (
@@ -41,15 +61,7 @@ export const SignMessage = () => {

Signature

{signed}
-