From 8efc46ca2eb4f39a0b76d0281c57fdb951271793 Mon Sep 17 00:00:00 2001 From: diamondeyesfox Date: Tue, 24 Mar 2026 18:10:18 -0500 Subject: [PATCH] fix: add clipboard fallback for insecure origins --- src/components/connection-startup-screen.tsx | 3 +- .../mobile-prompt/MobileSetupModal.tsx | 3 +- .../prompt-kit/code-block/index.tsx | 3 +- src/lib/clipboard.ts | 37 +++++++++++++++++++ .../chat/components/message-actions-bar.tsx | 3 +- src/screens/chat/hooks/use-chat-settings.ts | 5 ++- .../settings/components/provider-wizard.tsx | 3 +- 7 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 src/lib/clipboard.ts diff --git a/src/components/connection-startup-screen.tsx b/src/components/connection-startup-screen.tsx index a1ef9a02..9a51e05d 100644 --- a/src/components/connection-startup-screen.tsx +++ b/src/components/connection-startup-screen.tsx @@ -1,5 +1,6 @@ import { useEffect, useRef, useState } from 'react' import type { AuthStatus } from '@/lib/hermes-auth' +import { writeTextToClipboard } from '@/lib/clipboard' import { fetchHermesAuthStatus } from '@/lib/hermes-auth' const POLL_INTERVAL_MS = 2_000 @@ -113,7 +114,7 @@ export function ConnectionStartupScreen({ onConnected }: Props) { const handleCopy = async (text: string, idx: number) => { try { - await navigator.clipboard.writeText(text) + await writeTextToClipboard(text) setCopiedIdx(idx) } catch { /* clipboard not available */ diff --git a/src/components/mobile-prompt/MobileSetupModal.tsx b/src/components/mobile-prompt/MobileSetupModal.tsx index 1a67bc27..b0d4031e 100644 --- a/src/components/mobile-prompt/MobileSetupModal.tsx +++ b/src/components/mobile-prompt/MobileSetupModal.tsx @@ -4,6 +4,7 @@ import { useEffect, useState } from 'react'; import { AnimatePresence, motion } from 'motion/react'; import { HugeiconsIcon } from '@hugeicons/react'; import { Cancel01Icon, Sent02Icon, Tick01Icon } from '@hugeicons/core-free-icons'; +import { writeTextToClipboard } from '@/lib/clipboard'; const STORAGE_KEY_SEEN = 'hermes-mobile-setup-seen'; @@ -157,7 +158,7 @@ export function MobileSetupModal({ isOpen, onClose }: MobileSetupModalProps) { action: (