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 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-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. 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],