diff --git a/Cargo.lock b/Cargo.lock index 2df62e49..11d3abcc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -855,7 +855,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -1959,6 +1959,16 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.0.3", + "windows-link 0.2.1", +] + [[package]] name = "getrandom" version = "0.1.16" @@ -3026,6 +3036,18 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "cfg_aliases 0.2.1", + "libc", +] + [[package]] name = "nodrop" version = "0.1.14" @@ -3261,6 +3283,16 @@ dependencies = [ "objc2-foundation 0.3.1", ] +[[package]] +name = "objc2-core-location" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac0f75792558aa9d618443bbb5db7426a7a0b6fddf96903f86ef9ad02e135740" +dependencies = [ + "objc2 0.6.1", + "objc2-foundation 0.3.1", +] + [[package]] name = "objc2-encode" version = "4.1.0" @@ -3357,6 +3389,7 @@ checksum = "90ffb6a0cd5f182dc964334388560b12a57f7b74b3e2dec5e2722aa2dfb2ccd5" dependencies = [ "bitflags 2.6.0", "objc2 0.6.1", + "objc2-core-foundation", "objc2-foundation 0.3.1", ] @@ -3367,8 +3400,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25b1312ad7bc8a0e92adae17aa10f90aae1fb618832f9b993b022b591027daed" dependencies = [ "bitflags 2.6.0", + "block2 0.6.1", "objc2 0.6.1", + "objc2-cloud-kit", + "objc2-core-data", "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.3.1", + "objc2-quartz-core 0.3.1", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3f5ec77a81d9e0c5a0b32159b0cb143d7086165e79708351e02bf37dfc65cd" +dependencies = [ + "objc2 0.6.1", "objc2-foundation 0.3.1", ] @@ -3421,6 +3472,7 @@ dependencies = [ "tauri-plugin-deep-link", "tauri-plugin-dialog", "tauri-plugin-fs", + "tauri-plugin-os", "tauri-plugin-single-instance", "tauri-plugin-updater", "tauri-plugin-window-state", @@ -3478,6 +3530,7 @@ dependencies = [ "specta", "sysinfo", "tauri", + "tauri-plugin-os", "taurpc", "thiserror 2.0.12", "tokio", @@ -3535,6 +3588,7 @@ dependencies = [ "tauri-plugin-deep-link", "tauri-plugin-dialog", "tauri-plugin-opener", + "tauri-plugin-os", "tauri-plugin-single-instance", "tauri-plugin-updater", "tauri-plugin-window-state", @@ -3623,6 +3677,22 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "os_info" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c39b5918402d564846d5aba164c09a66cc88d232179dfd3e3c619a25a268392" +dependencies = [ + "android_system_properties", + "log", + "nix 0.30.1", + "objc2 0.6.1", + "objc2-foundation 0.3.1", + "objc2-ui-kit", + "serde", + "windows-sys 0.61.2", +] + [[package]] name = "os_pipe" version = "1.2.1" @@ -5759,6 +5829,15 @@ dependencies = [ "futures-core", ] +[[package]] +name = "sys-locale" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" +dependencies = [ + "libc", +] + [[package]] name = "sysinfo" version = "0.34.2" @@ -6114,6 +6193,24 @@ dependencies = [ "zbus", ] +[[package]] +name = "tauri-plugin-os" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "424f19432397850c2ddd42aa58078630c15287bbce3866eb1d90e7dbee680637" +dependencies = [ + "gethostname 1.1.0", + "log", + "os_info", + "serde", + "serde_json", + "serialize-to-javascript", + "sys-locale", + "tauri", + "tauri-plugin", + "thiserror 2.0.12", +] + [[package]] name = "tauri-plugin-single-instance" version = "2.2.3" @@ -7315,7 +7412,7 @@ dependencies = [ "windows-collections", "windows-core 0.61.0", "windows-future", - "windows-link", + "windows-link 0.1.1", "windows-numerics", ] @@ -7357,7 +7454,7 @@ checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" dependencies = [ "windows-implement 0.60.0", "windows-interface 0.59.1", - "windows-link", + "windows-link 0.1.1", "windows-result 0.3.2", "windows-strings 0.4.0", ] @@ -7369,7 +7466,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a1d6bbefcb7b60acd19828e1bc965da6fcf18a7e39490c5f8be71e54a19ba32" dependencies = [ "windows-core 0.61.0", - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -7422,6 +7519,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -7429,7 +7532,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core 0.61.0", - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -7449,7 +7552,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad1da3e436dc7653dfdf3da67332e22bff09bb0e28b0239e1624499c7830842e" dependencies = [ - "windows-link", + "windows-link 0.1.1", "windows-result 0.3.2", "windows-strings 0.4.0", ] @@ -7478,7 +7581,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" dependencies = [ - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -7497,7 +7600,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" dependencies = [ - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -7536,6 +7639,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -7860,7 +7972,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12" dependencies = [ - "gethostname", + "gethostname 0.4.3", "rustix 0.38.44", "x11rb-protocol", ] @@ -7918,7 +8030,7 @@ dependencies = [ "futures-core", "futures-lite", "hex", - "nix", + "nix 0.29.0", "ordered-stream", "serde", "serde_repr", diff --git a/Cargo.toml b/Cargo.toml index 6369ebfd..fb99741e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,7 @@ tauri-plugin-clipboard-manager = { version = "=2.2.2" } tauri-plugin-deep-link = { version = "=2.2.1" } tauri-plugin-dialog = { version = "=2.2.1" } tauri-plugin-fs = { version = "=2.2.1" } +tauri-plugin-os = { version = "=2.2.1" } tauri-plugin-single-instance = { version = "=2.2.3" } tauri-plugin-updater = { version = "=2.7.1" } tauri-plugin-window-state = { version = "=2.2.2" } diff --git a/apps/oneclient/desktop/Cargo.toml b/apps/oneclient/desktop/Cargo.toml index 572627e8..0683596d 100644 --- a/apps/oneclient/desktop/Cargo.toml +++ b/apps/oneclient/desktop/Cargo.toml @@ -37,6 +37,7 @@ tauri-plugin-updater = { workspace = true } tauri-plugin-clipboard-manager = { workspace = true } tauri-plugin-dialog = { workspace = true } tauri-plugin-fs = { workspace = true } +tauri-plugin-os = { workspace = true } tauri-plugin-deep-link = { workspace = true } # code gen diff --git a/apps/oneclient/desktop/build.rs b/apps/oneclient/desktop/build.rs index 106b7123..9f7658d7 100644 --- a/apps/oneclient/desktop/build.rs +++ b/apps/oneclient/desktop/build.rs @@ -1,3 +1,20 @@ +use std::process::Command; +use std::time::{SystemTime, UNIX_EPOCH}; + fn main() { + let output = Command::new("git") + .args(&["rev-parse", "HEAD"]) + .output() + .unwrap(); + let git_hash = String::from_utf8(output.stdout).unwrap(); + println!("cargo:rustc-env=GIT_HASH={}", git_hash); + + let start = SystemTime::now(); + let timestamp = start + .duration_since(UNIX_EPOCH) + .expect("Time went backwards") + .as_secs(); + println!("cargo:rustc-env=BUILD_TIMESTAMP={}", timestamp); + tauri_build::build(); } diff --git a/apps/oneclient/desktop/capabilities/default.json b/apps/oneclient/desktop/capabilities/default.json index 341ba87a..97bca373 100644 --- a/apps/oneclient/desktop/capabilities/default.json +++ b/apps/oneclient/desktop/capabilities/default.json @@ -36,6 +36,8 @@ "fs:allow-download-read", "fs:allow-download-write", "fs:allow-data-read-recursive", - "fs:allow-data-write-recursive" + "fs:allow-data-write-recursive", + + "os:default" ] } diff --git a/apps/oneclient/desktop/src/api/commands.rs b/apps/oneclient/desktop/src/api/commands.rs index 696d9b03..0d76f5ff 100644 --- a/apps/oneclient/desktop/src/api/commands.rs +++ b/apps/oneclient/desktop/src/api/commands.rs @@ -4,16 +4,12 @@ use onelauncher_core::api::cluster::dao::ClusterId; use onelauncher_core::api::packages::modpack::data::ModpackArchive; use onelauncher_core::entity::clusters; use onelauncher_core::error::LauncherResult; -use tauri::Runtime; use crate::oneclient::bundles::BundlesManager; use crate::oneclient::clusters::{OnlineClusterManifest, get_data_storage_versions}; #[taurpc::procedures(path = "oneclient", export_to = "../frontend/src/bindings.gen.ts")] pub trait OneClientApi { - #[taurpc(alias = "openDevTools")] - async fn open_dev_tools(webview_window: tauri::WebviewWindow); - #[taurpc(alias = "getClustersGroupedByMajor")] async fn get_clusters_grouped_by_major() -> LauncherResult>>; @@ -29,11 +25,6 @@ pub struct OneClientApiImpl; #[taurpc::resolvers] impl OneClientApi for OneClientApiImpl { - async fn open_dev_tools(self, webview_window: tauri::WebviewWindow) { - #[cfg(feature = "devtools")] - webview_window.open_devtools(); - } - async fn get_clusters_grouped_by_major( self, ) -> LauncherResult>> { diff --git a/apps/oneclient/frontend/src/components/DownloadMods.tsx b/apps/oneclient/frontend/src/components/DownloadMods.tsx index cad29556..a8145e14 100644 --- a/apps/oneclient/frontend/src/components/DownloadMods.tsx +++ b/apps/oneclient/frontend/src/components/DownloadMods.tsx @@ -1,4 +1,5 @@ import type { ExternalPackage, ManagedVersionDependency, ModpackFile, Provider } from '@/bindings.gen'; +import { useSettings } from '@/hooks/useSettings'; import { bindings } from '@/main'; import { useCommandMut } from '@onelauncher/common'; import { Button } from '@onelauncher/common/components'; @@ -7,7 +8,6 @@ import { useEffect, useImperativeHandle, useState } from 'react'; import { DialogTrigger } from 'react-aria-components'; import { getModMetaDataName } from './Bundle'; import { Overlay } from './overlay'; -import { useSettings } from '@/hooks/useSettings'; export interface DownloadModsRef { openDownloadDialog: (nextPath?: string) => void; @@ -129,12 +129,11 @@ function DownloadingMods({ mods, setOpen, nextPath }: { mods: ModDataArray; setO }); const { setting } = useSettings(); - let useSlowDownloading = setting('slow_mod_bulk_downloading'); - + let useParallelModDownloading = setting('parallel_mod_downloading'); useEffect(() => { const downloadAll = async () => { - if (useSlowDownloading) + if (useParallelModDownloading) for (const mod of mods) { setModName(mod.name); try { @@ -153,7 +152,6 @@ function DownloadingMods({ mods, setOpen, nextPath }: { mods: ModDataArray; setO setDownloadedMods(prev => prev + 1); } }); - }; downloadAll(); diff --git a/apps/oneclient/frontend/src/components/Navbar.tsx b/apps/oneclient/frontend/src/components/Navbar.tsx index 1cc69435..607f98f0 100644 --- a/apps/oneclient/frontend/src/components/Navbar.tsx +++ b/apps/oneclient/frontend/src/components/Navbar.tsx @@ -9,6 +9,7 @@ import { Window } from '@tauri-apps/api/window'; import { MinusIcon, Settings02Icon, SquareIcon, XCloseIcon } from '@untitled-theme/icons-react'; import { twMerge } from 'tailwind-merge'; import { AccountAvatar } from './AccountAvatar'; +import { Overlay, SuperSecretDevOptions } from './overlay'; import { AccountPopup } from './overlay/AccountPopup'; export function Navbar() { @@ -21,8 +22,16 @@ export function Navbar() { return (