You've already forked AstralRinth
forked from didirus/AstralRinth
Mod Management API (#81)
* Profile mod management * remove print statement
This commit is contained in:
@@ -19,11 +19,8 @@ pub async fn auth_authenticate_await_completion() -> Result<Credentials> {
|
||||
/// Refresh some credentials using Hydra, if needed
|
||||
// invoke('auth_refresh',user)
|
||||
#[tauri::command]
|
||||
pub async fn auth_refresh(
|
||||
user: uuid::Uuid,
|
||||
update_name: bool,
|
||||
) -> Result<Credentials> {
|
||||
Ok(auth::refresh(user, update_name).await?)
|
||||
pub async fn auth_refresh(user: uuid::Uuid) -> Result<Credentials> {
|
||||
Ok(auth::refresh(user).await?)
|
||||
}
|
||||
|
||||
/// Remove a user account from the database
|
||||
|
||||
@@ -27,6 +27,51 @@ pub async fn profile_list(
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
// Adds a project to a profile from a version ID
|
||||
// invoke('profile_add_project_from_version')
|
||||
#[tauri::command]
|
||||
pub async fn profile_add_project_from_version(
|
||||
path: &Path,
|
||||
version_id: String,
|
||||
) -> Result<PathBuf> {
|
||||
let res = profile::add_project_from_version(path, version_id).await?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
// Adds a project to a profile from a path
|
||||
// invoke('profile_add_project_from_path')
|
||||
#[tauri::command]
|
||||
pub async fn profile_add_project_from_path(
|
||||
path: &Path,
|
||||
project_path: &Path,
|
||||
project_type: Option<String>,
|
||||
) -> Result<PathBuf> {
|
||||
let res = profile::add_project_from_path(path, project_path, project_type)
|
||||
.await?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
// Toggles disabling a project from its path
|
||||
// invoke('profile_toggle_disable_project')
|
||||
#[tauri::command]
|
||||
pub async fn profile_toggle_disable_project(
|
||||
path: &Path,
|
||||
project_path: &Path,
|
||||
) -> Result<()> {
|
||||
profile::toggle_disable_project(path, project_path).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Removes a project from a profile
|
||||
// invoke('profile_remove_project')
|
||||
#[tauri::command]
|
||||
pub async fn profile_remove_project(
|
||||
path: &Path,
|
||||
project_path: &Path,
|
||||
) -> Result<()> {
|
||||
profile::remove_project(path, project_path).await?;
|
||||
Ok(())
|
||||
}
|
||||
// Run minecraft using a profile using the default credentials
|
||||
// Returns a u32 representing the PID, which can be used to poll
|
||||
// for the actual Child in the state.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::api::Result;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use theseus::prelude::*;
|
||||
|
||||
// Identical to theseus::settings::Settings except for the custom_java_args field
|
||||
@@ -43,7 +43,11 @@ pub async fn settings_set(settings: FrontendSettings) -> Result<()> {
|
||||
let backend_settings = Settings {
|
||||
memory: settings.memory,
|
||||
game_resolution: settings.game_resolution,
|
||||
custom_java_args: settings.custom_java_args.split_whitespace().map(|s| s.to_string()).collect(),
|
||||
custom_java_args: settings
|
||||
.custom_java_args
|
||||
.split_whitespace()
|
||||
.map(|s| s.to_string())
|
||||
.collect(),
|
||||
custom_env_args: settings.custom_env_args,
|
||||
java_globals: settings.java_globals,
|
||||
default_user: settings.default_user,
|
||||
|
||||
Reference in New Issue
Block a user