working acceptance + download

This commit is contained in:
thesuzerain committed 2024-01-30 19:14:47 -08:00
1 parent 719aded698
commit 1018d05e36
7 files changed
+97 -55

No files matched your search

+16 -4
View File
@@ -1,5 +1,5 @@
use crate::api::Result;
use theseus::{prelude::*, shared_profile::SharedProfile};
use theseus::{prelude::*, shared_profile::{SharedProfile,SharedProfileResponse}};
pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
tauri::plugin::Builder::new("profile_share")
@@ -12,7 +12,8 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
profile_share_generate_share_link,
profile_share_accept_share_link,
profile_share_remove_users,
profile_share_remove_links
profile_share_remove_links,
profile_share_get_link_id,
])
.build()
}
@@ -28,9 +29,9 @@ pub async fn profile_share_get_all(
#[tauri::command]
pub async fn profile_share_install(
profile: SharedProfile,
shared_profile_id: String,
) -> Result<ProfilePathId> {
let res = shared_profile::install(profile)
let res = shared_profile::install(shared_profile_id)
.await?;
Ok(res)
}
@@ -77,6 +78,17 @@ pub async fn profile_share_accept_share_link(
Ok(())
}
// Gets a shared profile from a share link
// This is done without accepting it- so would not include any link information, and is only usable for basic info
#[tauri::command]
pub async fn profile_share_get_link_id(
link : String
) -> Result<SharedProfileResponse> {
let res = shared_profile::get_from_link(link).await?;
Ok(res)
}
#[tauri::command]
pub async fn profile_share_remove_users(
path : ProfilePathId,
+7 -1
View File
@@ -20,7 +20,8 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
get_opening_command,
await_sync,
is_offline,
refresh_offline
refresh_offline,
test_command,
])
.build()
}
@@ -159,6 +160,11 @@ pub async fn get_opening_command() -> Result<Option<CommandPayload>> {
Ok(None)
}
#[tauri::command]
pub async fn test_command(command: String) -> Result<()> {
Ok(handle_command(command).await?)
}
// helper function called when redirected by a weblink (ie: modrith://do-something) or when redirected by a .mrpack file (in which case its a filepath)
// We hijack the deep link library (which also contains functionality for instance-checking)
pub async fn handle_command(command: String) -> Result<()> {