You've already forked AstralRinth
forked from didirus/AstralRinth
Updating + Profile Repairs + Performance Improvements (#97)
* repairing * Main framework for updating * add jsconfig * more work * Improve performance * Finish updating * run lint
This commit is contained in:
@@ -40,7 +40,7 @@ pub async fn auth_has_user(user: uuid::Uuid) -> Result<bool> {
|
||||
/// Get a copy of the list of all user credentials
|
||||
// invoke('auth_users',user)
|
||||
#[tauri::command]
|
||||
pub async fn auth_users() -> Result<Box<[Credentials]>> {
|
||||
pub async fn auth_users() -> Result<Vec<Credentials>> {
|
||||
Ok(auth::users().await?)
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,14 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
// Lists active progress bars
|
||||
#[tauri::command]
|
||||
pub async fn progress_bars_list(
|
||||
) -> Result<std::collections::HashMap<uuid::Uuid, theseus::LoadingBar>> {
|
||||
let res = theseus::EventState::list_progress_bars().await?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
// This is a very simple macro that implements a very basic Serializable for each variant of TheseusSerializableError,
|
||||
// where the field is the string. (This allows easy extension to errors without many match arms)
|
||||
macro_rules! impl_serialize {
|
||||
|
||||
@@ -28,6 +28,53 @@ pub async fn profile_list(
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
/// Syncs a profile's in memory state with the state on the disk
|
||||
/// // invoke('profile_sync')
|
||||
#[tauri::command]
|
||||
pub async fn profile_sync(path: &Path) -> Result<()> {
|
||||
profile::sync(path).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Installs/Repairs a profile
|
||||
/// invoke('profile_install')
|
||||
#[tauri::command]
|
||||
pub async fn profile_install(path: &Path) -> Result<()> {
|
||||
profile::install(path).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Updates all of the profile's projects
|
||||
/// invoke('profile_update_all')
|
||||
#[tauri::command]
|
||||
pub async fn profile_update_all(path: &Path) -> Result<()> {
|
||||
profile::update_all(path).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Updates a specified project
|
||||
/// invoke('profile_update_project')
|
||||
#[tauri::command]
|
||||
pub async fn profile_update_project(
|
||||
path: &Path,
|
||||
project_path: &Path,
|
||||
) -> Result<()> {
|
||||
profile::update_project(path, project_path, None).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Replaces a project with the given version ID
|
||||
/// invoke('profile_replace_project')
|
||||
#[tauri::command]
|
||||
pub async fn profile_replace_project(
|
||||
path: &Path,
|
||||
project: &Path,
|
||||
version_id: String,
|
||||
) -> Result<PathBuf> {
|
||||
let res = profile::replace_project(path, project, version_id).await?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
// Adds a project to a profile from a version ID
|
||||
// invoke('profile_add_project_from_version')
|
||||
#[tauri::command]
|
||||
|
||||
@@ -27,6 +27,7 @@ pub async fn profile_create(
|
||||
Some(loader_version),
|
||||
icon,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
Ok(res)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use crate::api::Result;
|
||||
use theseus::tags::{
|
||||
Category, DonationPlatform, GameVersion, License, Loader, TagBundle,
|
||||
};
|
||||
use theseus::tags::{Category, DonationPlatform, GameVersion, Loader, Tags};
|
||||
|
||||
/// Gets cached category tags from the database
|
||||
#[tauri::command]
|
||||
@@ -27,12 +25,6 @@ pub async fn tags_get_game_versions() -> Result<Vec<GameVersion>> {
|
||||
Ok(theseus::tags::get_game_version_tags().await?)
|
||||
}
|
||||
|
||||
/// Gets cached license tags from the database
|
||||
#[tauri::command]
|
||||
pub async fn tags_get_licenses() -> Result<Vec<License>> {
|
||||
Ok(theseus::tags::get_license_tags().await?)
|
||||
}
|
||||
|
||||
/// Gets cached donation platform tags from the database
|
||||
#[tauri::command]
|
||||
pub async fn tags_get_donation_platforms() -> Result<Vec<DonationPlatform>> {
|
||||
@@ -41,6 +33,6 @@ pub async fn tags_get_donation_platforms() -> Result<Vec<DonationPlatform>> {
|
||||
|
||||
/// Gets cached tag bundle from the database
|
||||
#[tauri::command]
|
||||
pub async fn tags_get_tag_bundle() -> Result<TagBundle> {
|
||||
pub async fn tags_get_tag_bundle() -> Result<Tags> {
|
||||
Ok(theseus::tags::get_tag_bundle().await?)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user