fix(ui-copy): copyText utility with execCommand fallback — navigator.clipboard is gated by Secure Context (HTTPS-only) and is undefined on plain-HTTP self-hosted deployments. Apply to ExtensionKeyBar + BrowserExtensionCard.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useCredentialsStore } from '../../stores/credentials.js'
|
||||
import { copyText } from '../../utils/clipboard.js'
|
||||
|
||||
const store = useCredentialsStore()
|
||||
const showRotateConfirm = ref(false)
|
||||
@@ -37,7 +38,7 @@ onMounted(() => store.loadKey())
|
||||
async function copyKey() {
|
||||
if (!store.extensionKey) return
|
||||
try {
|
||||
await navigator.clipboard.writeText(store.extensionKey)
|
||||
await copyText(store.extensionKey)
|
||||
globalThis.window?.__fcToast?.({ text: 'Copied', type: 'success' })
|
||||
} catch {
|
||||
globalThis.window?.__fcToast?.({ text: 'Copy failed', type: 'error' })
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useApi } from '../../composables/useApi.js'
|
||||
import { copyText } from '../../utils/clipboard.js'
|
||||
|
||||
const api = useApi()
|
||||
|
||||
@@ -172,7 +173,7 @@ async function rotateKey() {
|
||||
|
||||
async function copy(text, label) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
await copyText(text)
|
||||
window.__fcToast?.({ text: `${label} copied.`, type: 'success' })
|
||||
} catch (e) {
|
||||
window.__fcToast?.({ text: `Copy failed: ${e.message}`, type: 'error' })
|
||||
|
||||
Reference in New Issue
Block a user