From fe0daaa3089ec5b42dba13c4b8839d5fa209c1d9 Mon Sep 17 00:00:00 2001 From: FTCHD <144691102+FTCHD@users.noreply.github.com> Date: Wed, 13 Aug 2025 04:19:27 +0200 Subject: [PATCH] About section (settings) Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com> --- package-lock.json | 10 ++ package.json | 1 + src-tauri/Cargo.lock | 220 ++++++++++++++++++++++++++-- src-tauri/Cargo.toml | 1 + src-tauri/capabilities/default.json | 1 + src-tauri/src/lib.rs | 1 + src/pages/Settings.tsx | 128 +++++++++++++++- 7 files changed, 344 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index ac616d1..395b984 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@heroui/react": "^2.7.11", "@tauri-apps/api": "~2.7.0", "@tauri-apps/plugin-autostart": "^2.5.0", + "@tauri-apps/plugin-clipboard-manager": "^2.3.0", "@tauri-apps/plugin-dialog": "^2.3.2", "@tauri-apps/plugin-fs": "^2.4.1", "@tauri-apps/plugin-http": "^2.5.1", @@ -5363,6 +5364,15 @@ "@tauri-apps/api": "^2.6.0" } }, + "node_modules/@tauri-apps/plugin-clipboard-manager": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-clipboard-manager/-/plugin-clipboard-manager-2.3.0.tgz", + "integrity": "sha512-81NOBA2P+OTY8RLkBwyl9ZR/0CeggLub4F6zxcxUIfFOAqtky7J61+K/MkH2SC1FMxNBxrX0swDuKvkjkHadlA==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.6.0" + } + }, "node_modules/@tauri-apps/plugin-dialog": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-dialog/-/plugin-dialog-2.3.2.tgz", diff --git a/package.json b/package.json index b85bba0..5625583 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@heroui/react": "^2.7.11", "@tauri-apps/api": "~2.7.0", "@tauri-apps/plugin-autostart": "^2.5.0", + "@tauri-apps/plugin-clipboard-manager": "^2.3.0", "@tauri-apps/plugin-dialog": "^2.3.2", "@tauri-apps/plugin-fs": "^2.4.1", "@tauri-apps/plugin-http": "^2.5.1", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 0c19258..0345c84 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -114,6 +114,7 @@ dependencies = [ "tauri", "tauri-build", "tauri-plugin-autostart", + "tauri-plugin-clipboard-manager", "tauri-plugin-dialog", "tauri-plugin-fs", "tauri-plugin-http", @@ -139,6 +140,27 @@ dependencies = [ "derive_arbitrary", ] +[[package]] +name = "arboard" +version = "3.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55f533f8e0af236ffe5eb979b99381df3258853f00ba2e44b6e1955292c75227" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2 0.6.1", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.1", + "parking_lot", + "percent-encoding", + "windows-sys 0.59.0", + "wl-clipboard-rs", + "x11rb", +] + [[package]] name = "arrayvec" version = "0.7.6" @@ -217,7 +239,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix", + "rustix 1.0.8", "slab", "windows-sys 0.60.2", ] @@ -248,7 +270,7 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix", + "rustix 1.0.8", ] [[package]] @@ -274,7 +296,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix", + "rustix 1.0.8", "signal-hook-registry", "slab", "windows-sys 0.60.2", @@ -725,6 +747,15 @@ dependencies = [ "inout", ] +[[package]] +name = "clipboard-win" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +dependencies = [ + "error-code", +] + [[package]] name = "cocoa" version = "0.26.1" @@ -1309,6 +1340,12 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "error-code" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" + [[package]] name = "event-listener" version = "5.4.1" @@ -1398,6 +1435,12 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + [[package]] name = "flate2" version = "1.1.2" @@ -1685,13 +1728,23 @@ dependencies = [ "version_check", ] +[[package]] +name = "gethostname" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" +dependencies = [ + "libc", + "windows-targets 0.48.5", +] + [[package]] name = "gethostname" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc257fdb4038301ce4b9cd1b3b51704509692bb3ff716a410cbd07925d9dae55" dependencies = [ - "rustix", + "rustix 1.0.8", "windows-targets 0.52.6", ] @@ -2279,6 +2332,7 @@ dependencies = [ "byteorder-lite", "num-traits", "png", + "tiff", ] [[package]] @@ -2428,6 +2482,12 @@ dependencies = [ "libc", ] +[[package]] +name = "jpeg-decoder" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00810f1d8b74be64b13dbf3db89ac67740615d6c891f0e7b6179326533011a07" + [[package]] name = "js-sys" version = "0.3.77" @@ -2561,6 +2621,12 @@ dependencies = [ "redox_syscall", ] +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "linux-raw-sys" version = "0.9.4" @@ -2780,6 +2846,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "minisign-verify" version = "0.2.4" @@ -2912,6 +2984,16 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "notify-rust" version = "4.11.7" @@ -3474,6 +3556,16 @@ dependencies = [ "sha2", ] +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.10.0", +] + [[package]] name = "phf" version = "0.8.0" @@ -3679,7 +3771,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix", + "rustix 1.0.8", "windows-sys 0.60.2", ] @@ -4289,6 +4381,19 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.9.1", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + [[package]] name = "rustix" version = "1.0.8" @@ -4298,7 +4403,7 @@ dependencies = [ "bitflags 2.9.1", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.9.4", "windows-sys 0.60.2", ] @@ -5340,6 +5445,21 @@ dependencies = [ "thiserror 2.0.14", ] +[[package]] +name = "tauri-plugin-clipboard-manager" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adddd9e9275b20e77af3061d100a25a884cced3c4c9ef680bd94dd0f7e26c1ca" +dependencies = [ + "arboard", + "log", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.14", +] + [[package]] name = "tauri-plugin-dialog" version = "2.3.2" @@ -5475,7 +5595,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05bccb4c6de4299beec5a9b070878a01bce9e2c945aa7a75bcea38bcba4c675d" dependencies = [ - "gethostname", + "gethostname 1.0.2", "log", "os_info", "serde", @@ -5716,7 +5836,7 @@ dependencies = [ "fastrand", "getrandom 0.3.3", "once_cell", - "rustix", + "rustix 1.0.8", "windows-sys 0.59.0", ] @@ -5771,6 +5891,17 @@ dependencies = [ "syn 2.0.104", ] +[[package]] +name = "tiff" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" +dependencies = [ + "flate2", + "jpeg-decoder", + "weezl", +] + [[package]] name = "time" version = "0.3.41" @@ -6103,6 +6234,18 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "tree_magic_mini" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f943391d896cdfe8eec03a04d7110332d445be7df856db382dd96a730667562c" +dependencies = [ + "memchr", + "nom", + "once_cell", + "petgraph", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -6473,7 +6616,7 @@ checksum = "673a33c33048a5ade91a6b139580fa174e19fb0d23f396dca9fa15f2e1e49b35" dependencies = [ "cc", "downcast-rs", - "rustix", + "rustix 1.0.8", "scoped-tls", "smallvec", "wayland-sys", @@ -6486,7 +6629,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c66a47e840dc20793f2264eb4b3e4ecb4b75d91c0dd4af04b456128e0bdd449d" dependencies = [ "bitflags 2.9.1", - "rustix", + "rustix 1.0.8", "wayland-backend", "wayland-scanner", ] @@ -6503,6 +6646,19 @@ dependencies = [ "wayland-scanner", ] +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd94963ed43cf9938a090ca4f7da58eb55325ec8200c3848963e98dc25b78ec" +dependencies = [ + "bitflags 2.9.1", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + [[package]] name = "wayland-scanner" version = "0.31.7" @@ -6634,6 +6790,12 @@ dependencies = [ "windows-core", ] +[[package]] +name = "weezl" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3" + [[package]] name = "win7-notifications" version = "0.4.5" @@ -7165,6 +7327,25 @@ dependencies = [ "bitflags 2.9.1", ] +[[package]] +name = "wl-clipboard-rs" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5ff8d0e60065f549fafd9d6cb626203ea64a798186c80d8e7df4f8af56baeb" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 0.38.44", + "tempfile", + "thiserror 2.0.14", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + [[package]] name = "writeable" version = "0.6.1" @@ -7245,6 +7426,23 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "x11rb" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12" +dependencies = [ + "gethostname 0.4.3", + "rustix 0.38.44", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" + [[package]] name = "xattr" version = "1.5.1" @@ -7252,7 +7450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af3a19837351dc82ba89f8a125e22a3c475f05aba604acc023d62b2739ae2909" dependencies = [ "libc", - "rustix", + "rustix 1.0.8", ] [[package]] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 821fc99..1cf9f37 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -40,6 +40,7 @@ tauri-plugin-sentry = "0.4.1" tauri-plugin-autostart = "2.5.0" tauri-plugin-single-instance = "2.3.2" tauri-plugin-updater = "2.9.0" +tauri-plugin-clipboard-manager = "2" [target.'cfg(target_os = "macos")'.dependencies] cocoa = "0.26" diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index ce8f976..6998558 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -161,6 +161,7 @@ "core:webview:allow-reparent", "core:webview:allow-internal-toggle-devtools", "core:webview:allow-get-all-webviews", + "clipboard-manager:allow-write-text", "shell:default", "shell:allow-kill", "shell:allow-spawn", diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 001faa3..81f1a6d 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -82,6 +82,7 @@ pub fn run() { let _guard = minidump::init(&client); let mut app = tauri::Builder::default() + .plugin(tauri_plugin_clipboard_manager::init()) .plugin(tauri_plugin_updater::Builder::new().build()) .plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_notification::init()) diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index 3e583c2..7680ccf 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -9,21 +9,35 @@ import { DropdownMenu, DropdownTrigger, Input, + Spinner, Tab, Tabs, + Textarea, } from '@heroui/react' -import { getVersion as getUiVersion } from '@tauri-apps/api/app' +import { getTauriVersion, getVersion as getUiVersion } from '@tauri-apps/api/app' +import { + appDataDir, + appLocalDataDir, + appLogDir, + downloadDir, + homeDir, + tempDir, +} from '@tauri-apps/api/path' +import { writeText } from '@tauri-apps/plugin-clipboard-manager' import { ask, message } from '@tauri-apps/plugin-dialog' import { remove } from '@tauri-apps/plugin-fs' import { openUrl } from '@tauri-apps/plugin-opener' +import { version as osVersion, type } from '@tauri-apps/plugin-os' import { relaunch } from '@tauri-apps/plugin-process' import { type Update, check } from '@tauri-apps/plugin-updater' import { CheckIcon, CodeIcon, CogIcon, + CopyIcon, EyeIcon, ImportIcon, + InfoIcon, MedalIcon, PencilIcon, PlusIcon, @@ -32,8 +46,8 @@ import { } from 'lucide-react' import { useCallback, useEffect, useState } from 'react' import { revokeLicense, validateLicense } from '../../lib/license' -import { deleteRemote, getVersion as getCliVersion } from '../../lib/rclone/api' -import { getConfigPath } from '../../lib/rclone/common' +import { deleteRemote, getVersion as getCliVersion, getVersion } from '../../lib/rclone/api' +import { getConfigPath, getDefaultPaths } from '../../lib/rclone/common' import { usePersistedStore, useStore } from '../../lib/store' import { triggerTrayRebuild } from '../../lib/tray' import ConfigCreateDrawer from '../components/ConfigCreateDrawer' @@ -150,6 +164,20 @@ function Settings() { > + + + + Config + + } + data-focus-visible="false" + className="w-full max-h-screen p-0 overflow-scroll overscroll-none" + > + + - - Config + + About } data-focus-visible="false" className="w-full max-h-screen p-0 overflow-scroll overscroll-none" > - + {/* state.activeConfigFile) + const [info, setInfo] = useState<{ versions: any; paths: any; config: any; dirs: any } | null>( + null + ) + + const [isCopied, setIsCopied] = useState(false) + + const fetchInfo = useCallback(async () => { + const defaultPaths = await getDefaultPaths() + const version = await getVersion() + const dirs = { + home: await homeDir(), + appLocalData: await appLocalDataDir(), + temp: await tempDir(), + appLog: await appLogDir(), + download: await downloadDir(), + appData: await appDataDir(), + } + return { + versions: { + ...version, + ui: await getUiVersion(), + tauri: await getTauriVersion(), + osVersion: osVersion(), + osFamily: type(), + }, + paths: defaultPaths, + dirs, + config: { + id: currentConfig?.id!, + label: currentConfig?.label!, + sync: currentConfig?.sync, + isEncrypted: currentConfig?.isEncrypted!, + }, + } + }, [currentConfig]) + + useEffect(() => { + fetchInfo().then(setInfo) + }, [fetchInfo]) + + return ( + + + + + {!info && } + {info && ( + { + await writeText(JSON.stringify(info, null, 2)) + setIsCopied(true) + setTimeout(() => { + setIsCopied(false) + }, 1200) + }} + isDisabled={isCopied} + > + {isCopied ? ( + + ) : ( + + )} + + } + /> + )} + + + ) +} + function BaseHeader({ title, endContent }: { title: string; endContent?: React.ReactNode }) { return (