From c15186001d8acccd0ff050a25fc4ae597747d3d7 Mon Sep 17 00:00:00 2001 From: 1zuna Date: Fri, 27 Dec 2024 03:49:04 +0100 Subject: [PATCH] fix: use tauri-opener plugin instead --- package.json | 2 +- src-tauri/Cargo.lock | 343 +++++++++++++++--- src-tauri/Cargo.toml | 2 +- src-tauri/capabilities/main.json | 2 +- src-tauri/src/app/gui/commands/auth.rs | 23 +- src-tauri/src/app/gui/commands/client.rs | 31 +- src-tauri/src/app/gui/commands/data.rs | 19 + src-tauri/src/app/gui/commands/mod.rs | 19 + src-tauri/src/app/gui/commands/system.rs | 21 +- src-tauri/src/app/gui/mod.rs | 2 +- src/lib/common/social/ButtonIcon.svelte | 4 +- src/lib/common/social/ButtonIconText.svelte | 4 +- src/lib/login/loginmodal/LoginModal.svelte | 8 +- src/lib/main/news/News.svelte | 4 +- src/lib/main/settings/DonatorSettings.svelte | 13 +- .../settings/DirectorySelectorSetting.svelte | 4 +- yarn.lock | 14 +- 17 files changed, 422 insertions(+), 93 deletions(-) diff --git a/package.json b/package.json index 5ba10ef..0bc0712 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@tauri-apps/api": "^2", "@tauri-apps/plugin-process": "^2", "@tauri-apps/plugin-dialog": "^2", - "@tauri-apps/plugin-shell": "^2", + "@tauri-apps/plugin-opener": "^2", "@tauri-apps/plugin-updater": "^2", "jwt-decode": "^4.0.0", "nouislider": "^15.7" diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index c7b02c2..72c6e29 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -100,7 +100,7 @@ dependencies = [ "wayland-backend", "wayland-client", "wayland-protocols", - "zbus", + "zbus 5.2.0", ] [[package]] @@ -115,6 +115,18 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "async-channel" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + [[package]] name = "async-compression" version = "0.3.15" @@ -132,6 +144,79 @@ dependencies = [ "zstd-safe", ] +[[package]] +name = "async-executor" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" +dependencies = [ + "async-lock", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-io" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" +dependencies = [ + "async-lock", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix", + "tracing", +] + [[package]] name = "async-recursion" version = "1.1.1" @@ -143,6 +228,30 @@ dependencies = [ "syn 2.0.91", ] +[[package]] +name = "async-signal" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix", + "signal-hook-registry", + "slab", + "windows-sys 0.59.0", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + [[package]] name = "async-trait" version = "0.1.83" @@ -352,6 +461,19 @@ dependencies = [ "objc2", ] +[[package]] +name = "blocking" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + [[package]] name = "brotli" version = "7.0.0" @@ -1275,6 +1397,19 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +[[package]] +name = "futures-lite" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + [[package]] name = "futures-macro" version = "0.3.31" @@ -1655,6 +1790,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + [[package]] name = "hex" version = "0.4.3" @@ -2272,8 +2413,8 @@ dependencies = [ "tauri", "tauri-build", "tauri-plugin-dialog", + "tauri-plugin-opener", "tauri-plugin-process", - "tauri-plugin-shell", "tauri-plugin-updater", "thiserror 2.0.9", "tokio", @@ -3000,16 +3141,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "os_pipe" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982" -dependencies = [ - "libc", - "windows-sys 0.59.0", -] - [[package]] name = "overload" version = "0.1.1" @@ -3275,6 +3406,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + [[package]] name = "pkcs1" version = "0.7.5" @@ -3328,6 +3470,21 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "polling" +version = "3.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -4197,16 +4354,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shared_child" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fa9338aed9a1df411814a5b2252f7cd206c55ae9bf2fa763f8de84603aa60c" -dependencies = [ - "libc", - "windows-sys 0.59.0", -] - [[package]] name = "shlex" version = "1.3.0" @@ -4777,34 +4924,35 @@ dependencies = [ ] [[package]] -name = "tauri-plugin-process" -version = "2.2.0" +name = "tauri-plugin-opener" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40cc553ab29581c8c43dfa5fb0c9d5aee8ba962ad3b42908eea26c79610441b7" +checksum = "63ac39033ef1bb4d52da4878c3d8ab6d80b0a569d69208c884e6d4d54eb427b9" dependencies = [ + "dunce", + "glob", + "objc2-app-kit", + "objc2-foundation", + "open", + "schemars", + "serde", + "serde_json", "tauri", "tauri-plugin", + "thiserror 2.0.9", + "url", + "windows", + "zbus 4.4.0", ] [[package]] -name = "tauri-plugin-shell" +name = "tauri-plugin-process" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c50a63e60fb8925956cc5b7569f4b750ac197a4d39f13b8dd46ea8e2bad79" +checksum = "40cc553ab29581c8c43dfa5fb0c9d5aee8ba962ad3b42908eea26c79610441b7" dependencies = [ - "encoding_rs", - "log", - "open", - "os_pipe", - "regex", - "schemars", - "serde", - "serde_json", - "shared_child", "tauri", "tauri-plugin", - "thiserror 2.0.9", - "tokio", ] [[package]] @@ -6336,6 +6484,44 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zbus" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725" +dependencies = [ + "async-broadcast", + "async-executor", + "async-fs", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix", + "ordered-stream", + "rand 0.8.5", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "windows-sys 0.52.0", + "xdg-home", + "zbus_macros 4.4.0", + "zbus_names 3.0.0", + "zvariant 4.2.0", +] + [[package]] name = "zbus" version = "5.2.0" @@ -6361,9 +6547,22 @@ dependencies = [ "windows-sys 0.59.0", "winnow 0.6.20", "xdg-home", - "zbus_macros", - "zbus_names", - "zvariant", + "zbus_macros 5.2.0", + "zbus_names 4.1.0", + "zvariant 5.1.0", +] + +[[package]] +name = "zbus_macros" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267db9407081e90bbfa46d841d3cbc60f59c0351838c4bc65199ecd79ab1983e" +dependencies = [ + "proc-macro-crate 3.2.0", + "proc-macro2", + "quote", + "syn 2.0.91", + "zvariant_utils 2.1.0", ] [[package]] @@ -6376,9 +6575,20 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.91", - "zbus_names", - "zvariant", - "zvariant_utils", + "zbus_names 4.1.0", + "zvariant 5.1.0", + "zvariant_utils 3.0.2", +] + +[[package]] +name = "zbus_names" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" +dependencies = [ + "serde", + "static_assertions", + "zvariant 4.2.0", ] [[package]] @@ -6390,7 +6600,7 @@ dependencies = [ "serde", "static_assertions", "winnow 0.6.20", - "zvariant", + "zvariant 5.1.0", ] [[package]] @@ -6507,6 +6717,19 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "zvariant" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe" +dependencies = [ + "endi", + "enumflags2", + "serde", + "static_assertions", + "zvariant_derive 4.2.0", +] + [[package]] name = "zvariant" version = "5.1.0" @@ -6519,8 +6742,21 @@ dependencies = [ "static_assertions", "url", "winnow 0.6.20", - "zvariant_derive", - "zvariant_utils", + "zvariant_derive 5.1.0", + "zvariant_utils 3.0.2", +] + +[[package]] +name = "zvariant_derive" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449" +dependencies = [ + "proc-macro-crate 3.2.0", + "proc-macro2", + "quote", + "syn 2.0.91", + "zvariant_utils 2.1.0", ] [[package]] @@ -6533,7 +6769,18 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.91", - "zvariant_utils", + "zvariant_utils 3.0.2", +] + +[[package]] +name = "zvariant_utils" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", ] [[package]] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 50702b9..bf6f564 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -55,7 +55,7 @@ base16ct = {version = "0.2.0", features = ["alloc"] } tauri = { version = "^2", features = [] } tauri-plugin-process = "^2" tauri-plugin-dialog = "^2" -tauri-plugin-shell = "^2" +tauri-plugin-opener = "^2" tauri-plugin-updater = "^2" # HTTP library diff --git a/src-tauri/capabilities/main.json b/src-tauri/capabilities/main.json index 8ef5897..3a2f246 100644 --- a/src-tauri/capabilities/main.json +++ b/src-tauri/capabilities/main.json @@ -18,7 +18,7 @@ "dialog:allow-open", "dialog:allow-confirm", "dialog:allow-ask", - "shell:allow-open", + "opener:default", "process:allow-exit", "updater:default" ] diff --git a/src-tauri/src/app/gui/commands/auth.rs b/src-tauri/src/app/gui/commands/auth.rs index 8e25605..2c05887 100644 --- a/src-tauri/src/app/gui/commands/auth.rs +++ b/src-tauri/src/app/gui/commands/auth.rs @@ -1,3 +1,22 @@ +/* + * This file is part of LiquidLauncher (https://github.com/CCBlueX/LiquidLauncher) + * + * Copyright (c) 2015 - 2024 CCBlueX + * + * LiquidLauncher is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LiquidLauncher is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LiquidLauncher. If not, see . + */ + use tauri::{Emitter, Window}; use tracing::{debug, info}; @@ -25,9 +44,9 @@ pub(crate) async fn login_microsoft(window: Window) -> Result Result { +pub(crate) async fn client_account_authenticate() -> Result { let mut account = ClientAccountAuthenticator::start_auth(|uri| { - let _ = window.emit("auth_url", uri); + let _ = tauri_plugin_opener::open_url(uri, None::<&str>); }) .await .map_err(|e| format!("{}", e))?; diff --git a/src-tauri/src/app/gui/commands/client.rs b/src-tauri/src/app/gui/commands/client.rs index aef3360..a6c9ae9 100644 --- a/src-tauri/src/app/gui/commands/client.rs +++ b/src-tauri/src/app/gui/commands/client.rs @@ -1,23 +1,42 @@ +/* + * This file is part of LiquidLauncher (https://github.com/CCBlueX/LiquidLauncher) + * + * Copyright (c) 2015 - 2024 CCBlueX + * + * LiquidLauncher is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LiquidLauncher is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LiquidLauncher. If not, see . + */ + +use anyhow::anyhow; +use backon::{ExponentialBuilder, Retryable}; +use std::path::PathBuf; use std::{ sync::{Arc, Mutex}, thread, }; -use std::path::PathBuf; -use anyhow::anyhow; -use backon::{ExponentialBuilder, Retryable}; use tauri::{Emitter, Window}; use tokio::fs; use tracing::{error, info, warn}; use uuid::Uuid; -use crate::{app::gui::{AppState, RunnerInstance, ShareableWindow}, app::client_api::{ApiEndpoints, Build, Branches, Changelog, ContentDelivery, News}, minecraft::{ +use crate::app::client_api::{LoaderMod, ModSource}; +use crate::app::options::Options; +use crate::{app::client_api::{ApiEndpoints, Branches, Build, Changelog, ContentDelivery, News}, app::gui::{AppState, RunnerInstance, ShareableWindow}, minecraft::{ auth::{self, MinecraftAccount}, launcher::{LauncherData, StartParameter}, prelauncher, progress::ProgressUpdate, }, LAUNCHER_DIRECTORY}; -use crate::app::client_api::{LoaderMod, ModSource}; -use crate::app::options::Options; #[tauri::command] pub(crate) async fn request_branches() -> Result { diff --git a/src-tauri/src/app/gui/commands/data.rs b/src-tauri/src/app/gui/commands/data.rs index 77316e0..3f72235 100644 --- a/src-tauri/src/app/gui/commands/data.rs +++ b/src-tauri/src/app/gui/commands/data.rs @@ -1,3 +1,22 @@ +/* + * This file is part of LiquidLauncher (https://github.com/CCBlueX/LiquidLauncher) + * + * Copyright (c) 2015 - 2024 CCBlueX + * + * LiquidLauncher is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LiquidLauncher is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LiquidLauncher. If not, see . + */ + use tracing::info; use crate::{ diff --git a/src-tauri/src/app/gui/commands/mod.rs b/src-tauri/src/app/gui/commands/mod.rs index e842921..4c3783a 100644 --- a/src-tauri/src/app/gui/commands/mod.rs +++ b/src-tauri/src/app/gui/commands/mod.rs @@ -1,3 +1,22 @@ +/* + * This file is part of LiquidLauncher (https://github.com/CCBlueX/LiquidLauncher) + * + * Copyright (c) 2015 - 2024 CCBlueX + * + * LiquidLauncher is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LiquidLauncher is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LiquidLauncher. If not, see . + */ + pub(crate) mod auth; pub(crate) mod client; pub(crate) mod data; diff --git a/src-tauri/src/app/gui/commands/system.rs b/src-tauri/src/app/gui/commands/system.rs index 4e26052..48db47d 100644 --- a/src-tauri/src/app/gui/commands/system.rs +++ b/src-tauri/src/app/gui/commands/system.rs @@ -1,6 +1,25 @@ +/* + * This file is part of LiquidLauncher (https://github.com/CCBlueX/LiquidLauncher) + * + * Copyright (c) 2015 - 2024 CCBlueX + * + * LiquidLauncher is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LiquidLauncher is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LiquidLauncher. If not, see . + */ + +use crate::{utils, HTTP_CLIENT, LAUNCHER_VERSION}; use backon::{ExponentialBuilder, Retryable}; use tracing::{info, warn}; -use crate::{utils, HTTP_CLIENT, LAUNCHER_VERSION}; #[tauri::command] pub(crate) async fn get_launcher_version() -> Result { diff --git a/src-tauri/src/app/gui/mod.rs b/src-tauri/src/app/gui/mod.rs index e466f97..1a0ad32 100644 --- a/src-tauri/src/app/gui/mod.rs +++ b/src-tauri/src/app/gui/mod.rs @@ -47,7 +47,7 @@ pub fn gui_main() { tauri::Builder::default() .plugin(tauri_plugin_updater::Builder::new().build()) .plugin(tauri_plugin_process::init()) - .plugin(tauri_plugin_shell::init()) + .plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_dialog::init()) .manage(AppState::new()) .invoke_handler(tauri::generate_handler![ diff --git a/src/lib/common/social/ButtonIcon.svelte b/src/lib/common/social/ButtonIcon.svelte index 96fe859..b748f5b 100644 --- a/src/lib/common/social/ButtonIcon.svelte +++ b/src/lib/common/social/ButtonIcon.svelte @@ -1,13 +1,13 @@ diff --git a/src/lib/common/social/ButtonIconText.svelte b/src/lib/common/social/ButtonIconText.svelte index 779e3e1..972ecf8 100644 --- a/src/lib/common/social/ButtonIconText.svelte +++ b/src/lib/common/social/ButtonIconText.svelte @@ -1,12 +1,12 @@ diff --git a/src/lib/login/loginmodal/LoginModal.svelte b/src/lib/login/loginmodal/LoginModal.svelte index a66df6a..d44a5c0 100644 --- a/src/lib/login/loginmodal/LoginModal.svelte +++ b/src/lib/login/loginmodal/LoginModal.svelte @@ -1,10 +1,10 @@ diff --git a/src/lib/main/settings/DonatorSettings.svelte b/src/lib/main/settings/DonatorSettings.svelte index cf463dc..fa15891 100644 --- a/src/lib/main/settings/DonatorSettings.svelte +++ b/src/lib/main/settings/DonatorSettings.svelte @@ -4,20 +4,11 @@ import LiquidBounceAccount from "../../settings/LiquidBounceAccount.svelte"; import Description from "../../settings/Description.svelte"; import ButtonSetting from "../../settings/ButtonSetting.svelte"; - import { open as shellOpen } from "@tauri-apps/plugin-shell"; import {invoke} from "@tauri-apps/api/core"; - import {listen} from "@tauri-apps/api/event"; + import {openUrl} from "@tauri-apps/plugin-opener"; export let options; - listen("auth_url", async (event) => { - try { - await shellOpen(event.payload); - } catch (error) { - console.error("Failed to open auth URL:", error); - } - }); - async function login() { try { const account = await invoke("client_account_authenticate"); @@ -53,7 +44,7 @@ shellOpen("https://user.liquidbounce.net")} + on:click={() => openUrl("https://user.liquidbounce.net")} color="#4677FF" /> import {open as dialogOpen} from "@tauri-apps/plugin-dialog"; - import {open as shellOpen} from "@tauri-apps/plugin-shell"; + import {openPath} from "@tauri-apps/plugin-opener"; export let title; export let windowTitle; @@ -21,7 +21,7 @@ } function handleDirectoryOpen(e) { - shellOpen(value || placeholder); + openPath(value || placeholder); } diff --git a/yarn.lock b/yarn.lock index 3321463..f6978d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -335,6 +335,13 @@ dependencies: "@tauri-apps/api" "^2.0.0" +"@tauri-apps/plugin-opener@^2": + version "2.2.2" + resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-opener/-/plugin-opener-2.2.2.tgz#31f5bde7fc1ba2431c83ee1378ea34eb6fc67b20" + integrity sha512-E/XIHKqGV+FT8PDdkfMETmgPUxcR79Rk8USuzbadD/ZdvsKCfQR5q+6rpZC9zEnG2wzi9lVQM4D3xwrtGGIB8A== + dependencies: + "@tauri-apps/api" "^2.0.0" + "@tauri-apps/plugin-process@^2": version "2.0.0" resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-process/-/plugin-process-2.0.0.tgz#002fd73f0d7b1ae2a5aacf442aa657e83dc2960b" @@ -342,13 +349,6 @@ dependencies: "@tauri-apps/api" "^2.0.0" -"@tauri-apps/plugin-shell@^2": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-shell/-/plugin-shell-2.0.1.tgz#db3ea23e2b34b98ad89e283a87e3e7f7e557f655" - integrity sha512-akU1b77sw3qHiynrK0s930y8zKmcdrSD60htjH+mFZqv5WaakZA/XxHR3/sF1nNv9Mgmt/Shls37HwnOr00aSw== - dependencies: - "@tauri-apps/api" "^2.0.0" - "@tauri-apps/plugin-updater@^2": version "2.0.0" resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-updater/-/plugin-updater-2.0.0.tgz#38cb3e735da28cd1726a3c0e13f032117e4db111"