From 97eefcde5d773925d8fdb7c7cc3ffcba8da436e3 Mon Sep 17 00:00:00 2001 From: cynfo3000 Date: Tue, 10 Mar 2026 00:07:47 +0100 Subject: [PATCH] fix: Kopieren auf HTTP nutzt execCommand-Fallback (clipboard API braucht HTTPS) --- frontend/src/components/ScriptModal.jsx | 3 ++- frontend/src/pages/Customers.jsx | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/ScriptModal.jsx b/frontend/src/components/ScriptModal.jsx index 672de5e..f190e4a 100644 --- a/frontend/src/components/ScriptModal.jsx +++ b/frontend/src/components/ScriptModal.jsx @@ -1,6 +1,7 @@ import { useState, useRef, useEffect } from 'react' import { X, Play, Loader, Terminal, Copy, Check } from 'lucide-react' import api from '../api/client' +import { copyToClipboard } from '../utils/clipboard' export default function ScriptModal({ agentId, agentName, onClose }) { const [script, setScript] = useState('#!/bin/bash\n\n') @@ -35,7 +36,7 @@ export default function ScriptModal({ agentId, agentName, onClose }) { const copyOutput = () => { if (output) { - navigator.clipboard.writeText(output) + copyToClipboard(output) setCopied(true) setTimeout(() => setCopied(false), 2000) } diff --git a/frontend/src/pages/Customers.jsx b/frontend/src/pages/Customers.jsx index 2f7f89c..09cd29d 100644 --- a/frontend/src/pages/Customers.jsx +++ b/frontend/src/pages/Customers.jsx @@ -1,5 +1,6 @@ import { useEffect, useState } from 'react' import api from '../api/client' +import { copyToClipboard } from '../utils/clipboard' import { Plus, Trash2, Edit2, X, Check, ChevronDown, ChevronRight, Copy, Key } from 'lucide-react' const PERM_LABELS = { @@ -204,11 +205,7 @@ function CustomerKeyPanel({ customerId }) { }, [customerId]) const copyKey = (key, id) => { - navigator.clipboard.writeText(key).catch(() => { - const el = document.createElement('textarea') - el.value = key; document.body.appendChild(el); el.select() - document.execCommand('copy'); document.body.removeChild(el) - }) + copyToClipboard(key) setCopied(id) setTimeout(() => setCopied(null), 2000) }