You've already forked AstralRinth
forked from didirus/AstralRinth
Upgrading (#354)
* fixed no download bug * draft * Working version * minor improvements * cicd fix * merge conflicts * fixed major merge confusion * more conflicts, reformatting * fixed random bugs found * added second repair option to avoid confusion
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
use crate::api::Result;
|
||||
use theseus::logs::{self, Logs};
|
||||
use uuid::Uuid;
|
||||
use theseus::{
|
||||
logs::{self, Logs},
|
||||
prelude::ProfilePathId,
|
||||
};
|
||||
|
||||
/*
|
||||
A log is a struct containing the datetime string, stdout, and stderr, as follows:
|
||||
@@ -27,10 +29,10 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
|
||||
/// Get all Logs for a profile, sorted by datetime
|
||||
#[tauri::command]
|
||||
pub async fn logs_get_logs(
|
||||
profile_uuid: Uuid,
|
||||
profile_path: ProfilePathId,
|
||||
clear_contents: Option<bool>,
|
||||
) -> Result<Vec<Logs>> {
|
||||
let val = logs::get_logs(profile_uuid, clear_contents).await?;
|
||||
let val = logs::get_logs(profile_path, clear_contents).await?;
|
||||
|
||||
Ok(val)
|
||||
}
|
||||
@@ -38,25 +40,25 @@ pub async fn logs_get_logs(
|
||||
/// Get a Log struct for a profile by profile id and datetime string
|
||||
#[tauri::command]
|
||||
pub async fn logs_get_logs_by_datetime(
|
||||
profile_uuid: Uuid,
|
||||
profile_path: ProfilePathId,
|
||||
datetime_string: String,
|
||||
) -> Result<Logs> {
|
||||
Ok(logs::get_logs_by_datetime(profile_uuid, datetime_string).await?)
|
||||
Ok(logs::get_logs_by_datetime(profile_path, datetime_string).await?)
|
||||
}
|
||||
|
||||
/// Get the stdout for a profile by profile id and datetime string
|
||||
#[tauri::command]
|
||||
pub async fn logs_get_output_by_datetime(
|
||||
profile_uuid: Uuid,
|
||||
profile_path: ProfilePathId,
|
||||
datetime_string: String,
|
||||
) -> Result<String> {
|
||||
let profile_path = if let Some(p) =
|
||||
crate::profile::get_by_uuid(profile_uuid, None).await?
|
||||
crate::profile::get(&profile_path, None).await?
|
||||
{
|
||||
p.profile_id()
|
||||
} else {
|
||||
return Err(theseus::Error::from(
|
||||
theseus::ErrorKind::UnmanagedProfileError(profile_uuid.to_string()),
|
||||
theseus::ErrorKind::UnmanagedProfileError(profile_path.to_string()),
|
||||
)
|
||||
.into());
|
||||
};
|
||||
@@ -66,15 +68,15 @@ pub async fn logs_get_output_by_datetime(
|
||||
|
||||
/// Delete all logs for a profile by profile id
|
||||
#[tauri::command]
|
||||
pub async fn logs_delete_logs(profile_uuid: Uuid) -> Result<()> {
|
||||
Ok(logs::delete_logs(profile_uuid).await?)
|
||||
pub async fn logs_delete_logs(profile_path: ProfilePathId) -> Result<()> {
|
||||
Ok(logs::delete_logs(profile_path).await?)
|
||||
}
|
||||
|
||||
/// Delete a log for a profile by profile id and datetime string
|
||||
#[tauri::command]
|
||||
pub async fn logs_delete_logs_by_datetime(
|
||||
profile_uuid: Uuid,
|
||||
profile_path: ProfilePathId,
|
||||
datetime_string: String,
|
||||
) -> Result<()> {
|
||||
Ok(logs::delete_logs_by_datetime(profile_uuid, &datetime_string).await?)
|
||||
Ok(logs::delete_logs_by_datetime(profile_path, &datetime_string).await?)
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
|
||||
profile_add_project_from_path,
|
||||
profile_toggle_disable_project,
|
||||
profile_remove_project,
|
||||
profile_update_managed_modrinth,
|
||||
profile_repair_managed_modrinth,
|
||||
profile_is_managed_modrinth,
|
||||
profile_run,
|
||||
profile_run_wait,
|
||||
profile_run_credentials,
|
||||
@@ -105,7 +108,7 @@ pub async fn profile_install(path: ProfilePathId) -> Result<()> {
|
||||
pub async fn profile_update_all(
|
||||
path: ProfilePathId,
|
||||
) -> Result<HashMap<ProjectPathId, ProjectPathId>> {
|
||||
Ok(profile::update_all(&path).await?)
|
||||
Ok(profile::update_all_projects(&path).await?)
|
||||
}
|
||||
|
||||
/// Updates a specified project
|
||||
@@ -162,6 +165,28 @@ pub async fn profile_remove_project(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Updates a managed Modrinth profile
|
||||
#[tauri::command]
|
||||
pub async fn profile_update_managed_modrinth(
|
||||
path: ProfilePathId,
|
||||
) -> Result<()> {
|
||||
Ok(profile::update::update_managed_modrinth(&path).await?)
|
||||
}
|
||||
|
||||
// Repairs a managed Modrinth profile by updating it to the current version
|
||||
#[tauri::command]
|
||||
pub async fn profile_repair_managed_modrinth(
|
||||
path: ProfilePathId,
|
||||
) -> Result<()> {
|
||||
Ok(profile::update::repair_managed_modrinth(&path).await?)
|
||||
}
|
||||
|
||||
// Gets if a profile is managed by Modrinth
|
||||
#[tauri::command]
|
||||
pub async fn profile_is_managed_modrinth(path: ProfilePathId) -> Result<bool> {
|
||||
Ok(profile::is_managed_modrinth_pack(&path).await?)
|
||||
}
|
||||
|
||||
// Exports a profile to a .mrpack file (export_location should end in .mrpack)
|
||||
// invoke('profile_export_mrpack')
|
||||
#[tauri::command]
|
||||
|
||||
@@ -18,7 +18,7 @@ pub async fn profile_create(
|
||||
loader_version: Option<String>, // the modloader version to use, set to "latest", "stable", or the ID of your chosen loader
|
||||
icon: Option<PathBuf>, // the icon for the profile
|
||||
) -> Result<ProfilePathId> {
|
||||
let res = profile_create::profile_create(
|
||||
let res = profile::create::profile_create(
|
||||
name,
|
||||
game_version,
|
||||
modloader,
|
||||
|
||||
Reference in New Issue
Block a user