diff --git a/lib/window.ts b/lib/window.ts index 9b61818..3caa6e7 100644 --- a/lib/window.ts +++ b/lib/window.ts @@ -75,7 +75,7 @@ export async function openWindow({ name, url, width = 820, - height = 700, + height = platform() === 'windows' ? 730 : 700, }: { name: string url: string diff --git a/main.ts b/main.ts index b841811..ab6e94b 100644 --- a/main.ts +++ b/main.ts @@ -130,6 +130,16 @@ async function checkAlreadyRunning() { } ) if (confirmed) { + if (platform() === 'windows') { + await message( + "If you're on Windows, you might notice a few powershell/terminal windows opening and closing.\n\nThis is normal and expected, imagine we are playing whack-a-mole with the rclone process to close it.", + { + 'title': 'Trigger Warning', + 'kind': 'info', + 'okLabel': 'Got it', + } + ) + } const result = await invoke('stop_rclone_processes') console.log('stop_rclone_processes', result) await new Promise((resolve) => setTimeout(resolve, 1000)) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index b6b9dc0..13bf8b1 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -277,6 +277,7 @@ dependencies = [ "tauri-plugin-notification", "tauri-plugin-opener", "tauri-plugin-os", + "tauri-plugin-prevent-default", "tauri-plugin-process", "tauri-plugin-sentry", "tauri-plugin-shell", @@ -1443,6 +1444,12 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + [[package]] name = "embed-resource" version = "3.0.5" @@ -2706,6 +2713,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.15" @@ -5562,6 +5578,27 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.104", +] + [[package]] name = "subtle" version = "2.6.1" @@ -6088,6 +6125,20 @@ dependencies = [ "thiserror 2.0.14", ] +[[package]] +name = "tauri-plugin-prevent-default" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e133889986e498b0377e4999d6c45e7aff41ae808c87265a11e3f544748abe" +dependencies = [ + "bitflags 2.9.1", + "itertools", + "serde", + "strum", + "tauri", + "thiserror 2.0.14", +] + [[package]] name = "tauri-plugin-process" version = "2.3.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index a69acd8..a612102 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -42,6 +42,7 @@ tauri-plugin-autostart = "2.5.0" tauri-plugin-single-instance = "2.3.4" tauri-plugin-updater = "2.9.0" tauri-plugin-clipboard-manager = "2.3.0" +tauri-plugin-prevent-default = "3" reqwest = { version = "0.11", features = ["json"] } sysinfo = "0.37" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 75548d7..4bf59d7 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -607,22 +607,23 @@ pub fn run() { .plugin(tauri_plugin_process::init()) .plugin(tauri_plugin_autostart::init(tauri_plugin_autostart::MacosLauncher::LaunchAgent, Some(vec![]))) // .plugin(tauri_plugin_single_instance::init(|app, argv, cwd| { - // println!("{}, {argv:?}, {cwd}", app.package_info().name); - // // app.emit("single-instance", Payload { args: argv, cwd }).unwrap(); - // })) - // .plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| { - // let _ = app - // .get_webview_window("main") - // .expect("no main window") - // .set_focus(); - // })) - .plugin(tauri_plugin_store::Builder::new().build()) - .plugin(tauri_plugin_http::init()) - .plugin(tauri_plugin_fs::init()) - .plugin(tauri_plugin_dialog::init()) - .plugin(tauri_plugin_log::Builder::new().build()) - .plugin(tauri_plugin_shell::init()) - .plugin(tauri_plugin_opener::init()) + // println!("{}, {argv:?}, {cwd}", app.package_info().name); + // // app.emit("single-instance", Payload { args: argv, cwd }).unwrap(); + // })) + // .plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| { + // let _ = app + // .get_webview_window("main") + // .expect("no main window") + // .set_focus(); + // })) + .plugin(tauri_plugin_store::Builder::new().build()) + .plugin(tauri_plugin_http::init()) + .plugin(tauri_plugin_fs::init()) + .plugin(tauri_plugin_dialog::init()) + .plugin(tauri_plugin_log::Builder::new().build()) + .plugin(tauri_plugin_shell::init()) + .plugin(tauri_plugin_opener::init()) + .plugin(tauri_plugin_prevent_default::debug()) .invoke_handler(tauri::generate_handler![unzip_file, get_arch, get_uid, is_rclone_running, stop_rclone_processes, prompt_password, prompt_text, stop_pid, update_system_rclone, test_proxy_connection]) .setup(|_app| Ok(())) // .setup(|app| { diff --git a/src/pages/Copy.tsx b/src/pages/Copy.tsx index 29e9bda..f55012b 100644 --- a/src/pages/Copy.tsx +++ b/src/pages/Copy.tsx @@ -536,7 +536,7 @@ export default function Copy() { />
diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index b9d61e3..90a5bd6 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -814,7 +814,7 @@ function LicenseSection() {
@@ -1328,17 +1328,21 @@ function AboutSection() { const isLoadingLogs = useRef(false) const [last30Lines, setLast30Lines] = useState([]) + const jsonStringified = info + ? JSON.stringify(info, null, 2).replace(DOUBLE_BACKSLASH_REGEX, '\\') + : '' + async function fetchInfo() { + if (!currentConfig) return const defaultPaths = await getDefaultPaths() const version = await getVersion() const dirs = { - // replace ALL (not just one) double backslashes with a single backslash - home: (await homeDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'), - appLocalData: (await appLocalDataDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'), - temp: (await tempDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'), - appLog: (await appLogDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'), - download: (await downloadDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'), - appData: (await appDataDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'), + home: await homeDir(), + appLocalData: await appLocalDataDir(), + temp: await tempDir(), + appLog: await appLogDir(), + download: await downloadDir(), + appData: await appDataDir(), } return { versions: { @@ -1351,10 +1355,10 @@ function AboutSection() { paths: defaultPaths, dirs, config: { - id: currentConfig?.id!, - label: currentConfig?.label!, - sync: currentConfig?.sync, - isEncrypted: currentConfig?.isEncrypted!, + id: currentConfig.id, + label: currentConfig.label, + sync: currentConfig.sync, + isEncrypted: currentConfig.isEncrypted, }, } } @@ -1383,9 +1387,10 @@ function AboutSection() { } useEffect(() => { - fetchInfo().then(setInfo) + if (!currentConfig) return + fetchInfo().then((info) => setInfo(info || null)) // biome-ignore lint/correctness/useExhaustiveDependencies: - }, [fetchInfo]) + }, [fetchInfo, currentConfig]) useEffect(() => { if (!info) { @@ -1436,7 +1441,7 @@ function AboutSection() { fullWidth={true} color="default" onPress={async () => { - await writeText(JSON.stringify(info, null, 2)) + await writeText(jsonStringified) }} > Copy Debug Info @@ -1459,7 +1464,7 @@ function AboutSection() { Debug Info: \`\`\`json -${JSON.stringify(info, null, 2)} +${jsonStringified} \`\`\` Logs (last 30 lines): @@ -1479,7 +1484,7 @@ ${last30Lines.join('\n')}