feat: groundwork for multi-profile support

This commit is contained in:
2025-03-03 02:07:15 +01:00
parent d25841853c
commit 6410ca2721
16 changed files with 744 additions and 184 deletions

View File

@ -12,7 +12,6 @@ mod appdata;
use closure::closure;
use appdata::AppData;
use pkg::PkgKey;
use pkg_store::PackageStore;
use profile::Profile;
use tauri::{Listener, Manager};
use tauri_plugin_deep_link::DeepLinkExt;
@ -47,6 +46,7 @@ pub async fn run(_args: Vec<String>) {
// Todo deindent this chimera
let url = &args[1];
if &url[..13] == "rainycolor://" {
log::info!("Deep link: {}", url);
let regex = regex::Regex::new(
r"rainycolor://v1/install/rainy\.patafour\.zip/([^/]+)/([^/]+)/[0-9]+\.[0-9]+\.[0-9]+/"
).expect("Invalid regex");
@ -72,10 +72,7 @@ pub async fn run(_args: Vec<String>) {
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_opener::init())
.setup(|app| {
let app_data = AppData {
profile: Profile::load(),
pkgs: PackageStore::new(app.handle().clone())
};
let app_data = AppData::new(app.handle().clone());
app.manage(Mutex::new(app_data));
app.deep_link().register_all()?;
@ -103,9 +100,11 @@ pub async fn run(_args: Vec<String>) {
cmd::install_package,
cmd::delete_package,
cmd::toggle_package,
cmd::get_current_profile,
cmd::list_profiles,
cmd::init_profile,
cmd::save_profile,
cmd::load_profile,
cmd::get_current_profile,
cmd::save_current_profile,
cmd::read_profile_data,
cmd::write_profile_data,
cmd::startline,