From 6a4fa415872003c0edd1d9c8691a1c7e09d550c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=9Al=C4=99zak?= Date: Mon, 8 Sep 2025 10:08:30 +0200 Subject: [PATCH 1/3] fix clipboard hook fix permissions for opening file dialogs --- src-tauri/capabilities/default.json | 2 ++ src/shared/hooks/useClipboard.ts | 23 ++++++++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 1ce6eecf..845f9a65 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -45,6 +45,8 @@ "notification:default", "os:default", "os:allow-hostname", + "dialog:default", + "clipboard-manager:allow-write-text", { "identifier": "http:default", "allow": [ diff --git a/src/shared/hooks/useClipboard.ts b/src/shared/hooks/useClipboard.ts index 0d257d26..2db90825 100644 --- a/src/shared/hooks/useClipboard.ts +++ b/src/shared/hooks/useClipboard.ts @@ -1,3 +1,4 @@ +import { writeText } from '@tauri-apps/plugin-clipboard-manager'; import { useCallback } from 'react'; import { useI18nContext } from '../../i18n/i18n-react'; @@ -10,20 +11,16 @@ export const useClipboard = () => { const writeToClipboard = useCallback( async (content: string, customMessage?: string) => { - if (window.isSecureContext) { - try { - await navigator.clipboard.writeText(content); - if (customMessage) { - toaster.success(customMessage); - } else { - toaster.success(LL.common.messages.clipboard.success()); - } - } catch (e) { - toaster.error(LL.common.messages.clipboard.error()); - console.error(e); + try { + await writeText(content); + if (customMessage) { + toaster.success(customMessage); + } else { + toaster.success(LL.common.messages.clipboard.success()); } - } else { - toaster.warning(LL.common.messages.insecureContext()); + } catch (e) { + toaster.error(LL.common.messages.clipboard.error()); + console.error(e); } }, [LL.common.messages, toaster], From 52194fd3e4579ab11935bc1838fd40a97baa9f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=9Al=C4=99zak?= Date: Mon, 8 Sep 2025 10:16:59 +0200 Subject: [PATCH 2/3] Update deny.toml --- src-tauri/deny.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/src-tauri/deny.toml b/src-tauri/deny.toml index e2d73e8e..f0d3f368 100644 --- a/src-tauri/deny.toml +++ b/src-tauri/deny.toml @@ -86,6 +86,7 @@ ignore = [ { id = "RUSTSEC-2024-0419", reason = "Tauri v2 GTK3 dependency (unmaintained)" }, { id = "RUSTSEC-2024-0420", reason = "Tauri v2 GTK3 dependency (unmaintained)" }, { id = "RUSTSEC-2025-0052", reason = "Discontinued, but dark-light v2.0.0 needs it" }, + { id = "RUSTSEC-2025-0057", reason = "Tauri needs it" }, ] # If this is true, then cargo deny will use the git executable to fetch advisory database. # If this is false, then it uses a built-in git library. From c5632570a3874c8b69612124920c24199cdc7bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=9Al=C4=99zak?= Date: Mon, 8 Sep 2025 10:31:41 +0200 Subject: [PATCH 3/3] Update test.yml --- .github/workflows/test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fcce08fe..7a837db4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,8 +55,9 @@ jobs: rustup component add clippy cargo clippy --all-targets --all-features -- -D warnings - name: Run cargo deny - uses: EmbarkStudios/cargo-deny-action@v2 - with: - manifest-path: ./src-tauri/Cargo.toml + working-directory: ./src-tauri + run: | + cargo install cargo-deny + cargo deny check - name: Run tests run: cargo test --locked --no-fail-fast