Compare commits
2 Commits
0f10beb3b4
...
e76d67f3a8
| Author | SHA1 | Date | |
|---|---|---|---|
| e76d67f3a8 | |||
| 9811b36e58 |
Generated
+1
@@ -1010,6 +1010,7 @@ dependencies = [
|
||||
"tauri-plugin-shell",
|
||||
"tauri-plugin-single-instance",
|
||||
"tokio",
|
||||
"url",
|
||||
"widestring",
|
||||
"winapi",
|
||||
"windows-sys 0.61.2",
|
||||
|
||||
@@ -47,6 +47,7 @@ once_cell = "1.21.4"
|
||||
futures-util = "0.3.32"
|
||||
byteorder = "1.5.0"
|
||||
anyhow = "1.0.102"
|
||||
url = "2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg = "0.56.0"
|
||||
|
||||
@@ -12,6 +12,7 @@ use tokio::io::AsyncWriteExt;
|
||||
use tokio::process::Command;
|
||||
use tokio::time::{Duration, sleep};
|
||||
|
||||
use crate::OpenedUrls;
|
||||
use crate::osudb::parse_osudb;
|
||||
use crate::presence;
|
||||
use crate::utils::{
|
||||
@@ -20,6 +21,11 @@ use crate::utils::{
|
||||
set_osu_config_vals, set_osu_user_config_vals,
|
||||
};
|
||||
|
||||
#[tauri::command]
|
||||
pub fn opened_urls(app: tauri::AppHandle) -> Vec<PathBuf> {
|
||||
app.state::<OpenedUrls>().0.lock().unwrap().clone()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_launcher_version() -> String {
|
||||
env!("CARGO_PKG_VERSION").to_string()
|
||||
|
||||
+33
-4
@@ -1,21 +1,25 @@
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
use std::sync::Mutex;
|
||||
use std::path::PathBuf;
|
||||
use tauri::Manager;
|
||||
|
||||
pub mod commands;
|
||||
pub mod osudb;
|
||||
pub mod presence;
|
||||
pub mod utils;
|
||||
pub mod osudb;
|
||||
use crate::commands::{
|
||||
check_for_corruption, download_ezpp_launcher_update, download_ezpp_launcher_update_files,
|
||||
encrypt_string, exit, find_osu_installation, get_beatmapsets_count,
|
||||
get_ezpp_launcher_update_files, get_hwid, get_launcher_version, get_osu_release_stream,
|
||||
get_osu_skin, get_osu_version, get_platform, get_skins, get_skins_count, has_net8,
|
||||
has_osuwinello, has_wmctrl, install_ezpp_launcher_update, is_osu_running, open_url_in_browser,
|
||||
presence_connect, presence_disconnect, presence_is_connected, presence_update_status,
|
||||
presence_update_user, replace_ui_files, run_osu, run_osu_updater, set_osu_config_values,
|
||||
set_osu_user_config_values, valid_osu_folder,
|
||||
opened_urls, presence_connect, presence_disconnect, presence_is_connected,
|
||||
presence_update_status, presence_update_user, replace_ui_files, run_osu, run_osu_updater,
|
||||
set_osu_config_values, set_osu_user_config_values, valid_osu_folder,
|
||||
};
|
||||
|
||||
struct OpenedUrls(Mutex<Vec<PathBuf>>);
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
#[cfg(target_os = "linux")]
|
||||
@@ -33,7 +37,32 @@ pub fn run() {
|
||||
}
|
||||
|
||||
let app = builder
|
||||
.manage(OpenedUrls(Mutex::new(vec![])))
|
||||
.setup(|app| {
|
||||
let args = std::env::args().collect::<Vec<_>>();
|
||||
if args.len() > 1 {
|
||||
let mut files = Vec::new();
|
||||
|
||||
for maybe_file in args.iter().skip(1) {
|
||||
if maybe_file.starts_with("-") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Ok(url) = url::Url::parse(&maybe_file) {
|
||||
if let Ok(path) = url.to_file_path() {
|
||||
files.push(path);
|
||||
}
|
||||
} else {
|
||||
files.push(PathBuf::from(maybe_file))
|
||||
}
|
||||
}
|
||||
|
||||
app.state::<OpenedUrls>().0.lock().unwrap().extend(files);
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
opened_urls,
|
||||
get_hwid,
|
||||
find_osu_installation,
|
||||
valid_osu_folder,
|
||||
|
||||
@@ -123,6 +123,8 @@
|
||||
import { sileo } from 'sileo';
|
||||
import ScrollContainer from '@/components/ui/scroll-container/ScrollContainer.svelte';
|
||||
import { deleteTheme, downloadTheme, loadTheme } from '@/themes';
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
|
||||
let selectedView = $state('home');
|
||||
let progress = $state(-1);
|
||||
@@ -720,6 +722,17 @@
|
||||
}, 450);
|
||||
};
|
||||
|
||||
const setupThemeImport = async () => {
|
||||
const initialUrls = await invoke<string[]>('opened_urls');
|
||||
if (initialUrls.length > 0) {
|
||||
console.log(initialUrls);
|
||||
}
|
||||
|
||||
await listen('opened', (event) => {
|
||||
console.log(event.payload);
|
||||
});
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
const config = $userSettings;
|
||||
const trackingConsent = config.value('tracking_consent');
|
||||
@@ -736,6 +749,8 @@
|
||||
ease: (t: number) => (t - 1) ** 7 + 1,
|
||||
onComplete: doBPMAnimation,
|
||||
});
|
||||
|
||||
setupThemeImport();
|
||||
return () => {
|
||||
window.clearInterval(animateInterval);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user