Add connected library for Git modpack manifests
Some checks failed
Build / verify (push) Failing after 18m55s
Some checks failed
Build / verify (push) Failing after 18m55s
This commit is contained in:
62
apps/app/src/api/connected_library.rs
Normal file
62
apps/app/src/api/connected_library.rs
Normal file
@@ -0,0 +1,62 @@
|
||||
use crate::api::Result;
|
||||
use theseus::connected_library::{
|
||||
ConnectedCheckResult, ConnectedPack, check, check_all, connect, install,
|
||||
list, remove, set_auto_update,
|
||||
};
|
||||
|
||||
pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
|
||||
tauri::plugin::Builder::new("connected-library")
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
connected_library_list,
|
||||
connected_library_connect,
|
||||
connected_library_remove,
|
||||
connected_library_set_auto_update,
|
||||
connected_library_check,
|
||||
connected_library_check_all,
|
||||
connected_library_install,
|
||||
])
|
||||
.build()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn connected_library_list() -> Result<Vec<ConnectedPack>> {
|
||||
Ok(list().await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn connected_library_connect(
|
||||
source_url: String,
|
||||
) -> Result<ConnectedPack> {
|
||||
Ok(connect(source_url).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn connected_library_remove(id: String) -> Result<()> {
|
||||
Ok(remove(id).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn connected_library_set_auto_update(
|
||||
id: String,
|
||||
auto_update: bool,
|
||||
) -> Result<ConnectedPack> {
|
||||
Ok(set_auto_update(id, auto_update).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn connected_library_check(
|
||||
id: String,
|
||||
) -> Result<ConnectedCheckResult> {
|
||||
Ok(check(id).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn connected_library_check_all() -> Result<Vec<ConnectedCheckResult>>
|
||||
{
|
||||
Ok(check_all().await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn connected_library_install(id: String) -> Result<ConnectedPack> {
|
||||
Ok(install(id).await?)
|
||||
}
|
||||
@@ -19,6 +19,7 @@ pub mod utils;
|
||||
|
||||
pub mod ads;
|
||||
pub mod cache;
|
||||
pub mod connected_library;
|
||||
pub mod files;
|
||||
pub mod friends;
|
||||
pub mod worlds;
|
||||
|
||||
@@ -233,6 +233,7 @@ fn main() {
|
||||
.plugin(api::tags::init())
|
||||
.plugin(api::utils::init())
|
||||
.plugin(api::cache::init())
|
||||
.plugin(api::connected_library::init())
|
||||
.plugin(api::files::init())
|
||||
.plugin(api::ads::init())
|
||||
.plugin(api::friends::init())
|
||||
|
||||
Reference in New Issue
Block a user