Skip to content

Commit d30811b

Browse files
authored
fix(ui): make request IDs and copying work over plain HTTP (#1583)
* fix(ui): make request IDs and copying work over plain HTTP `crypto.randomUUID` and `navigator.clipboard` exist only in secure contexts (HTTPS or localhost). Served over plain HTTP behind a proxy, every action that makes an ID failed with "crypto.randomUUID is not a function": starting, cancelling and rerunning runs, acknowledging, and changing triggers. Copy buttons either threw or said "Copied" without copying. - `newRequestId()` uses `crypto.randomUUID` where it exists, and otherwise builds an RFC 4122 version 4 UUID from `crypto.getRandomValues`, which every context has. - `copyText()` uses the Clipboard API where it exists and works, and otherwise copies from a hidden textarea. Copy buttons say "Copied" only when the text was copied. - A unit check keeps `crypto.randomUUID` and `navigator.clipboard` out of everything but these two helpers. - Tests: the fallback's format, version and variant bits, and uniqueness; in a browser with both APIs removed before the app loads, a plan (which makes a request ID) opens, and Copy as sqb build copies. * fix(ui): keep the selection when copying without the Clipboard API, and help copy a secret by hand - The fallback copy puts back the person's own selection and focus, without scrolling, after copying from its hidden textarea. - When a one-time secret can't be copied, it is selected, with a hint to copy it with Ctrl+C (⌘C on a Mac).
1 parent 1fb37f7 commit d30811b

12 files changed

Lines changed: 200 additions & 23 deletions

File tree

‎ui/e2e/insecure-context.spec.ts‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { expect, test } from '@playwright/test';
2+
3+
// Served over plain HTTP from a host name, a page is not a secure context: `crypto.randomUUID` and
4+
// `navigator.clipboard` don't exist. Both are removed before the app loads, as they would be there.
5+
test.beforeEach(async ({ page }) => {
6+
await page.addInitScript(() => {
7+
Object.defineProperty(Crypto.prototype, 'randomUUID', { value: undefined, configurable: true });
8+
Object.defineProperty(Navigator.prototype, 'clipboard', { get: () => undefined, configurable: true });
9+
const w = window as unknown as { copied: string[] };
10+
w.copied = [];
11+
document.addEventListener('copy', () => w.copied.push(String(document.getSelection() ?? '')));
12+
});
13+
});
14+
15+
test('a plan, which makes a request ID, opens without randomUUID', async ({ page }) => {
16+
const errors: string[] = [];
17+
page.on('pageerror', (e) => errors.push(e.message));
18+
await page.goto(`/plan?mock&large&cmd=${encodeURIComponent('sqb build --changed')}`);
19+
expect(await page.evaluate(() => typeof crypto.randomUUID)).toBe('undefined');
20+
await expect(page.locator('.pane .plan-row').first()).toBeVisible({ timeout: 30_000 });
21+
expect(errors).toEqual([]);
22+
});
23+
24+
test('copying a selection works without navigator.clipboard', async ({ page }) => {
25+
await page.goto('/catalog?mock');
26+
const name = (await page.locator('table.catalog tbody tr .cell-name a').first().innerText({ timeout: 20_000 })).trim();
27+
await page.goto(`/catalog?mock&select=${encodeURIComponent(name)}`);
28+
const copy = page.getByRole('button', { name: /^Copy as/ });
29+
// Enabled once the selection is checked and names a node.
30+
await expect(page.getByText(/^1 of \d+ nodes$/)).toBeVisible({ timeout: 20_000 });
31+
await expect(copy).toBeEnabled();
32+
await copy.click();
33+
await expect.poll(() => page.evaluate(() => (window as unknown as { copied: string[] }).copied)).toEqual([`sqb build -s ${name}`]);
34+
});
35+
36+
test('copying keeps what the person had selected', async ({ page }) => {
37+
await page.goto('/catalog?mock');
38+
const name = (await page.locator('table.catalog tbody tr .cell-name a').first().innerText({ timeout: 20_000 })).trim();
39+
await page.goto(`/catalog?mock&select=${encodeURIComponent(name)}`);
40+
await expect(page.getByText(/^1 of \d+ nodes$/)).toBeVisible({ timeout: 20_000 });
41+
await page.locator('h1').first().selectText();
42+
const before = await page.evaluate(() => String(getSelection()));
43+
expect(before.length).toBeGreaterThan(0);
44+
await page.getByRole('button', { name: /^Copy as/ }).click();
45+
await expect.poll(() => page.evaluate(() => (window as unknown as { copied: string[] }).copied.length)).toBe(1);
46+
expect(await page.evaluate(() => String(getSelection()))).toBe(before);
47+
});
48+
49+
test('a one-time secret that cannot be copied is selected, with a hint to copy it by hand', async ({ page }) => {
50+
await page.addInitScript(() => (document.execCommand = () => false));
51+
await page.goto('/locations/0d9c6a52-3f1e-4b7a-9c43-5b8e2f61a7d4?mock');
52+
await page.getByRole('button', { name: 'Create token' }).click({ timeout: 20_000 });
53+
const issued = page.locator('.issued');
54+
await issued.getByRole('button', { name: 'Copy' }).click();
55+
await expect(issued.getByRole('alert')).toContainText('copy it with Ctrl+C');
56+
expect(await page.evaluate(() => String(getSelection()))).toBe(await issued.locator('code').innerText());
57+
});

‎ui/src/lib/api/http-client.ts‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import type { AuthMode, Bootstrap, Capability, Location, NavCounts, PlatformEven
2323
import type { Account, AuditEntry, AuditQuery, ConnectionTest, LocationDetail, ServerSettings, WarehouseConnection, LocationSummary, PlatformEventQuery, PlatformEventRecord, PlatformHealth, MaintenanceHistory, ProviderConnection, RoleAssignment, RoleAssignmentRequest, RoleDefinition, RoleDetail } from './types/platform';
2424
import type { Acknowledgement, CatalogNode, CatalogNodeDetail, Check, CheckDetail, CheckEvidence, CheckSql, NodeStates, NodeStatusDelta, Overview, SnapshotChange, ColumnLineage } from './types/build';
2525
import type { AdhocRunCheck, AdhocRunRequest, BulkRunResult, SelectionEvaluation, SelectionRequest, SelectionVocabulary, PlanDiff, PlanPage, PlanPageSection, PlanResult, QueueEntry, Timeline, Job, JobDetail, JobLaunchOptions, RerunMode, SnapshotNode, Run, RunDetail, RunListQuery, RunRowPage, RunRowQuery, RunTabCounts, Trigger, TriggerDetail, TriggerState, RunEventPage, RunNodeError, RunOutputLine, RunStatement, IgnoredAuditFailure, RunCostRow, CostSummary, NodeBuildCost, StatementSql } from './types/operate';
26+
import { newRequestId } from '$lib/browser/request-id';
2627

2728
type Wire = components['schemas'];
2829

@@ -364,7 +365,7 @@ export function createHttpClient({ baseUrl = '', onUnauthorized, fetch: answer,
364365
const { rows } = runRowPageOver([await listedRuns(scope)], scope.locationId, { ...query, cursor: null, limit: RUN_WINDOW });
365366
const result: BulkRunResult = { done: [], failed: [] };
366367
for (const { run } of rows.filter((row) => isActiveRun(row.run.status) && !row.cancelRequestedAt)) {
367-
const body = { run_id: run.id, event_id: crypto.randomUUID(), reason: 'Cancelled from the web UI' };
368+
const body = { run_id: run.id, event_id: newRequestId(), reason: 'Cancelled from the web UI' };
368369
const { error, response } = await http.POST('/api/control/runs/cancel', { body, params: { header: { 'x-sqb-csrf': csrfToken(document.cookie) } } });
369370
if (response.status === 401) onUnauthorized();
370371
if (response.ok) result.done.push(run.id);
@@ -483,7 +484,7 @@ export function createHttpClient({ baseUrl = '', onUnauthorized, fetch: answer,
483484
return { nodeKey: data.node_key, errorCode: data.error_code ?? null, message: data.message ?? null, file: data.path ?? null };
484485
},
485486
async cancelRun(scope: Scope, runId: string): Promise<Run> {
486-
const body = { run_id: runId, event_id: crypto.randomUUID(), reason: 'Cancelled from the web UI' };
487+
const body = { run_id: runId, event_id: newRequestId(), reason: 'Cancelled from the web UI' };
487488
const { error, response } = await http.POST('/api/control/runs/cancel', { body, params: { header: { 'x-sqb-csrf': csrfToken(document.cookie) } } });
488489
forgetPending();
489490
if (response.status === 401) onUnauthorized();
@@ -492,7 +493,7 @@ export function createHttpClient({ baseUrl = '', onUnauthorized, fetch: answer,
492493
},
493494
async rerunSelectedNodes(scope: Scope, runId: string, nodes: string[]): Promise<Run> {
494495
const source = await requireRun(scope, runId);
495-
const body = { run_id: crypto.randomUUID(), source_run_id: runId, from_failure: false, nodes, priority: source.priority, reason: 'Rerun selected nodes from the web UI' };
496+
const body = { run_id: newRequestId(), source_run_id: runId, from_failure: false, nodes, priority: source.priority, reason: 'Rerun selected nodes from the web UI' };
496497
const { error, response } = await http.POST('/api/control/runs/rerun', { body, params: { header: { 'x-sqb-csrf': csrfToken(document.cookie) } } });
497498
forgetPending();
498499
if (response.status === 401) onUnauthorized();
@@ -502,15 +503,15 @@ export function createHttpClient({ baseUrl = '', onUnauthorized, fetch: answer,
502503
async acknowledgeRun(scope: Scope, runId: string, acknowledged: boolean): Promise<void> {
503504
const { locationId, target } = parseLocationKey(scope.locationId);
504505
const { error, response } = await http.POST('/api/control/locations/{location_id}/targets/{target}/acknowledgements', {
505-
body: { event_id: crypto.randomUUID(), run_id: runId, acknowledged },
506+
body: { event_id: newRequestId(), run_id: runId, acknowledged },
506507
params: { path: { location_id: locationId, target }, header: { 'x-sqb-csrf': csrfToken(document.cookie) } }
507508
});
508509
if (response.status === 401) onUnauthorized();
509510
if (!response.ok) throw new ApiError(errorText(error, response), response.status);
510511
},
511512
async rerunRun(scope: Scope, runId: string, mode: Exclude<RerunMode, 'selected'>): Promise<Run> {
512513
const source = await requireRun(scope, runId);
513-
const body = { run_id: crypto.randomUUID(), source_run_id: runId, from_failure: mode === 'from_failure', priority: source.priority, reason: 'Rerun from the web UI' };
514+
const body = { run_id: newRequestId(), source_run_id: runId, from_failure: mode === 'from_failure', priority: source.priority, reason: 'Rerun from the web UI' };
514515
const { error, response } = await http.POST('/api/control/runs/rerun', { body, params: { header: { 'x-sqb-csrf': csrfToken(document.cookie) } } });
515516
forgetPending();
516517
if (response.status === 401) onUnauthorized();
@@ -576,7 +577,7 @@ export function createHttpClient({ baseUrl = '', onUnauthorized, fetch: answer,
576577
},
577578
async launchAdhocRun(scope: Scope, request: AdhocRunRequest): Promise<Run> {
578579
const { locationId, target } = parseLocationKey(scope.locationId);
579-
const body = { run_id: crypto.randomUUID(), location_id: locationId, target, command: request.command, priority: request.priority, reason: 'Started from the web UI' };
580+
const body = { run_id: newRequestId(), location_id: locationId, target, command: request.command, priority: request.priority, reason: 'Started from the web UI' };
580581
const { error, response } = await http.POST('/api/control/runs/adhoc', { body, params: { header: { 'x-sqb-csrf': csrfToken(document.cookie) } } });
581582
forgetPending();
582583
if (response.status === 401) onUnauthorized();
@@ -590,7 +591,7 @@ export function createHttpClient({ baseUrl = '', onUnauthorized, fetch: answer,
590591
async planBuild(scope: Scope, command: string[]): Promise<PlanResult> {
591592
const { locationId, target } = parseLocationKey(scope.locationId);
592593
const path = { location_id: locationId, target };
593-
const requestId = crypto.randomUUID();
594+
const requestId = newRequestId();
594595
const asked = await http.POST('/api/control/locations/{location_id}/targets/{target}/plans', {
595596
body: { request_id: requestId, command },
596597
params: { path, header: { 'x-sqb-csrf': csrfToken(document.cookie) } }
@@ -662,7 +663,7 @@ export function createHttpClient({ baseUrl = '', onUnauthorized, fetch: answer,
662663
async requestWarehouseSync(scope: Scope): Promise<void> {
663664
const { locationId, target } = parseLocationKey(scope.locationId);
664665
const { error, response } = await http.POST('/api/control/locations/{location_id}/targets/{target}/warehouse-syncs', {
665-
body: { request_id: crypto.randomUUID(), reason: 'Requested from the web UI' },
666+
body: { request_id: newRequestId(), reason: 'Requested from the web UI' },
666667
params: { path: { location_id: locationId, target }, header: { 'x-sqb-csrf': csrfToken(document.cookie) } }
667668
});
668669
if (response.status === 401) onUnauthorized();
@@ -672,7 +673,7 @@ export function createHttpClient({ baseUrl = '', onUnauthorized, fetch: answer,
672673
async testConnection(scope: Scope): Promise<ConnectionTest> {
673674
const { locationId, target } = parseLocationKey(scope.locationId);
674675
const path = { location_id: locationId, target };
675-
const requestId = crypto.randomUUID();
676+
const requestId = newRequestId();
676677
const asked = await http.POST('/api/control/locations/{location_id}/targets/{target}/connection-tests', {
677678
body: { request_id: requestId, reason: 'Tested from the web UI' },
678679
params: { path, header: { 'x-sqb-csrf': csrfToken(document.cookie) } }
@@ -1149,7 +1150,7 @@ export function createHttpClient({ baseUrl = '', onUnauthorized, fetch: answer,
11491150

11501151
/** Records an operator change; the server takes the actor from the session and needs a reason. */
11511152
async function changeTrigger(triggerId: string, change: Wire['TriggerChange'], reason?: string | null) {
1152-
const body = { trigger_id: triggerId, event_id: crypto.randomUUID(), actor: '', reason: reason?.trim() || 'Changed from the web UI', change };
1153+
const body = { trigger_id: triggerId, event_id: newRequestId(), actor: '', reason: reason?.trim() || 'Changed from the web UI', change };
11531154
const { error, response } = await http.POST('/api/control/triggers', { body, params: { header: { 'x-sqb-csrf': csrfToken(document.cookie) } } });
11541155
forgetPending();
11551156
if (response.status === 401) onUnauthorized();
@@ -1223,7 +1224,7 @@ export function createHttpClient({ baseUrl = '', onUnauthorized, fetch: answer,
12231224
const narrowed = !!(options?.select?.length || options?.exclude?.length);
12241225
const reason = fullRefresh ? 'Full refresh started from the web UI' : window ? 'Backfill started from the web UI' : narrowed ? 'Part of the job started from the web UI' : 'Started from the web UI';
12251226
const body = {
1226-
run_id: crypto.randomUUID(),
1227+
run_id: newRequestId(),
12271228
location_id: locationId,
12281229
target,
12291230
job_key: key,

‎ui/src/lib/api/mock/large-project.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { PlanDocument, PlanPage, PlanResult } from '../types';
88
import { largePlanDocument, planModelDiff, planPage, planSummary } from './large-plan';
99
import { recordPlanDiff, recordPlanRows } from './plan-rows-log';
1010
import type { CatalogNode } from '../types';
11+
import { newRequestId } from '$lib/browser/request-id';
1112

1213
const LAYERS = [['sources'], ['seeds', 'orders'], ['customers', 'inventory'], ['payments', 'shipping'], ['returns', 'pricing'], ['suppliers', 'regions'], ['finance', 'marketing']];
1314
const PER_SUBFOLDER = 15;
@@ -53,7 +54,7 @@ export function largeProject(client: ApiClient): ApiClient {
5354
const result = await target.planBuild(...args);
5455
if (!result.plan) return result;
5556
const doc = largePlanDocument(args[1].some((t) => t === '--changed' || t.startsWith('--changed=')));
56-
const requestId = crypto.randomUUID();
57+
const requestId = newRequestId();
5758
plans.set(requestId, doc);
5859
return { plan: { ...planSummary(doc), timings: result.plan.timings }, error: null, requestId };
5960
};

‎ui/src/lib/browser/clipboard.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copies text. `navigator.clipboard` exists only in secure contexts (HTTPS or localhost), and the UI is also
2+
// served over plain HTTP behind a proxy, so without it the text is copied from a hidden textarea.
3+
4+
/** Copies `text`; whether it was copied. Call it from a click, which the fallback needs. */
5+
export async function copyText(text: string): Promise<boolean> {
6+
if (navigator.clipboard?.writeText) {
7+
try {
8+
await navigator.clipboard.writeText(text);
9+
return true;
10+
} catch {
11+
// Denied or unavailable: try the fallback.
12+
}
13+
}
14+
const area = document.createElement('textarea');
15+
area.value = text;
16+
area.setAttribute('readonly', '');
17+
area.style.cssText = 'position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;';
18+
// Selecting the textarea replaces the person's own selection and focus; both are put back afterwards.
19+
const focused = document.activeElement as HTMLElement | null;
20+
const selection = document.getSelection();
21+
const ranges = selection ? Array.from({ length: selection.rangeCount }, (_, i) => selection.getRangeAt(i)) : [];
22+
document.body.append(area);
23+
area.select();
24+
try {
25+
return document.execCommand('copy');
26+
} catch {
27+
return false;
28+
} finally {
29+
area.remove();
30+
focused?.focus?.({ preventScroll: true });
31+
if (selection) {
32+
selection.removeAllRanges();
33+
for (const range of ranges) selection.addRange(range);
34+
}
35+
}
36+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { webcrypto } from 'node:crypto';
2+
import { describe, expect, it } from 'vitest';
3+
import { newRequestId } from './request-id';
4+
5+
const V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
6+
/** A browser page that is not a secure context: random values, but no `randomUUID`. */
7+
const insecure = { getRandomValues: <T extends ArrayBufferView | null>(array: T) => webcrypto.getRandomValues(array as Uint8Array) as unknown as T };
8+
9+
describe('request IDs', () => {
10+
it('builds RFC 4122 version 4 UUIDs from random values when randomUUID is missing', () => {
11+
const ids = Array.from({ length: 2000 }, () => newRequestId(insecure));
12+
for (const id of ids) expect(id).toMatch(V4);
13+
expect(new Set(ids).size).toBe(ids.length);
14+
});
15+
16+
it('sets the version and variant bits whatever the random bytes are', () => {
17+
for (const fill of [0x00, 0xff]) {
18+
const id = newRequestId({ getRandomValues: <T extends ArrayBufferView | null>(a: T) => ((a as Uint8Array).fill(fill), a) });
19+
expect(id).toMatch(V4);
20+
}
21+
expect(newRequestId({ getRandomValues: <T extends ArrayBufferView | null>(a: T) => ((a as Uint8Array).fill(0), a) })).toBe('00000000-0000-4000-8000-000000000000');
22+
});
23+
24+
it('uses randomUUID where the page has it', () => {
25+
expect(newRequestId({ ...insecure, randomUUID: () => 'from-randomUUID' })).toBe('from-randomUUID');
26+
});
27+
});

‎ui/src/lib/browser/request-id.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// IDs for the requests the UI makes (runs, events, plans). `crypto.randomUUID` exists only in secure
2+
// contexts (HTTPS or localhost), and the UI is also served over plain HTTP behind a proxy, so without it
3+
// the ID is built from `crypto.getRandomValues`, which every context has. Never `Math.random`: these IDs
4+
// make retried requests apply once, so they must not collide.
5+
6+
/** A random RFC 4122 version 4 UUID. */
7+
export function newRequestId(source: Pick<Crypto, 'getRandomValues'> & { randomUUID?: () => string } = crypto): string {
8+
if (typeof source.randomUUID === 'function') return source.randomUUID();
9+
const bytes = source.getRandomValues(new Uint8Array(16));
10+
bytes[6] = (bytes[6] & 0x0f) | 0x40; // version 4
11+
bytes[8] = (bytes[8] & 0x3f) | 0x80; // variant 10xx
12+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
13+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
14+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// `crypto.randomUUID` and `navigator.clipboard` exist only in secure contexts (HTTPS or localhost), and the
2+
// UI is also served over plain HTTP behind a proxy, where calling them breaks every action that makes an
3+
// ID or copies text. Use `newRequestId` (request-id.ts) and `copyText` (clipboard.ts), which fall back.
4+
import { readdirSync, readFileSync, statSync } from 'node:fs';
5+
import { join, relative } from 'node:path';
6+
import { describe, expect, it } from 'vitest';
7+
8+
const SRC = new URL('../../', import.meta.url).pathname;
9+
const BANNED = /\bcrypto\.randomUUID\b|\bnavigator\.clipboard\b/;
10+
const HELPERS = new Set(['lib/browser/request-id.ts', 'lib/browser/clipboard.ts']);
11+
12+
function files(dir: string): string[] {
13+
return readdirSync(dir).flatMap((name) => {
14+
const path = join(dir, name);
15+
if (statSync(path).isDirectory()) return files(path);
16+
return /\.(ts|svelte|js)$/.test(name) && !/\.test\.ts$/.test(name) ? [path] : [];
17+
});
18+
}
19+
20+
describe('secure-context-only browser APIs', () => {
21+
it('are called only from the helpers that fall back without them', () => {
22+
const found = files(SRC).flatMap((path) => {
23+
const file = relative(SRC, path);
24+
if (HELPERS.has(file)) return [];
25+
return readFileSync(path, 'utf8')
26+
.split('\n')
27+
.flatMap((line, i) => (BANNED.test(line) ? [`${file}:${i + 1}: ${line.trim()}`] : []));
28+
});
29+
expect(found, 'use newRequestId or copyText from $lib/browser').toEqual([]);
30+
});
31+
});

‎ui/src/lib/components/code/sql-viewer.svelte‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { copyText } from '$lib/browser/clipboard';
23
import SegmentedFilter from '$lib/components/list/segmented-filter.svelte';
34
import ArrowUpRightIcon from '@lucide/svelte/icons/arrow-up-right';
45
import UnfoldVerticalIcon from '@lucide/svelte/icons/unfold-vertical';
@@ -117,8 +118,7 @@
117118
}
118119
119120
async function copy() {
120-
await navigator.clipboard?.writeText(mode === 'compiled' ? compiled : raw);
121-
copied = true;
121+
copied = await copyText(mode === 'compiled' ? compiled : raw);
122122
setTimeout(() => (copied = false), 1200);
123123
}
124124
</script>

‎ui/src/lib/components/copy-button.svelte‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { copyText } from '$lib/browser/clipboard';
23
import CheckIcon from '@lucide/svelte/icons/check';
34
import CopyIcon from '@lucide/svelte/icons/copy';
45
@@ -12,8 +13,7 @@
1213
async function copy(e: MouseEvent) {
1314
e.stopPropagation();
1415
e.preventDefault();
15-
await navigator.clipboard?.writeText(value).catch(() => undefined);
16-
copied = true;
16+
copied = await copyText(value);
1717
clearTimeout(timer);
1818
timer = setTimeout(() => (copied = false), 1200);
1919
}

0 commit comments

Comments
 (0)