first draft

This commit is contained in:
Wyatt Verchere committed 2024-01-30 17:35:13 -08:00
1 parent 0d3f007dd4
commit bdde054036
21 files changed
+401 -39

No files matched your search

+1
View File
@@ -15,6 +15,7 @@ pub mod profile_create;
pub mod settings;
pub mod tags;
pub mod utils;
pub mod profile_share;
pub type Result<T> = std::result::Result<T, TheseusSerializableError>;
@@ -0,0 +1,76 @@
use crate::api::Result;
use theseus::{prelude::*, shared_profile::SharedProfile};
pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
tauri::plugin::Builder::new("profile_share")
.invoke_handler(tauri::generate_handler![
profile_share_get_all,
profile_share_install,
profile_share_create,
profile_share_inbound_sync,
profile_share_outbound_sync,
profile_share_generate_share_link,
profile_share_accept_share_link
])
.build()
}
// invoke('plugin:profile_share|profile_share_get_all',profile)
#[tauri::command]
pub async fn profile_share_get_all(
) -> Result<Vec<SharedProfile>> {
let res = shared_profile::get_all()
.await?;
Ok(res)
}
#[tauri::command]
pub async fn profile_share_install(
profile: SharedProfile,
) -> Result<ProfilePathId> {
let res = shared_profile::install(profile)
.await?;
Ok(res)
}
#[tauri::command]
pub async fn profile_share_create(
path: ProfilePathId
) -> Result<()> {
shared_profile::create(path)
.await?;
Ok(())
}
#[tauri::command]
pub async fn profile_share_inbound_sync(
path: ProfilePathId
) -> Result<()> {
shared_profile::inbound_sync(path)
.await?;
Ok(())
}
#[tauri::command]
pub async fn profile_share_outbound_sync(
path : ProfilePathId
) -> Result<()> {
shared_profile::outbound_sync(path).await?;
Ok(())
}
#[tauri::command]
pub async fn profile_share_generate_share_link(
path : ProfilePathId
) -> Result<String> {
let res = shared_profile::generate_share_link(path).await?;
Ok(res)
}
#[tauri::command]
pub async fn profile_share_accept_share_link(
link : String
) -> Result<()> {
shared_profile::accept_share_link(link).await?;
Ok(())
}
+1
View File
@@ -139,6 +139,7 @@ fn main() {
.plugin(api::process::init())
.plugin(api::profile::init())
.plugin(api::profile_create::init())
.plugin(api::profile_share::init())
.plugin(api::settings::init())
.plugin(api::tags::init())
.plugin(api::utils::init())