Files
Modrinth-plus/theseus_gui/src-tauri/src/api/settings.rs

38 lines
1.1 KiB
Rust
Raw Normal View History

use crate::api::Result;
use serde::{Deserialize, Serialize};
use theseus::prelude::*;
2023-04-10 18:12:43 -07:00
// Identical to theseus::settings::Settings except for the custom_java_args field
// This allows us to split the custom_java_args string into a Vec<String> here and join it back into a string in the backend
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct FrontendSettings {
pub theme: Theme,
2023-04-10 18:12:43 -07:00
pub memory: MemorySettings,
pub game_resolution: WindowSize,
pub custom_java_args: String,
pub custom_env_args: String,
2023-04-10 18:12:43 -07:00
pub java_globals: JavaGlobals,
pub default_user: Option<uuid::Uuid>,
pub hooks: Hooks,
pub max_concurrent_downloads: usize,
pub max_concurrent_writes: usize,
2023-04-10 18:12:43 -07:00
pub version: u32,
pub collapsed_navigation: bool,
2023-04-10 18:12:43 -07:00
}
// Get full settings
// invoke('settings_get')
#[tauri::command]
pub async fn settings_get() -> Result<Settings> {
let res = settings::get().await?;
Ok(res)
}
// Set full settings
// invoke('settings_set', settings)
#[tauri::command]
pub async fn settings_set(settings: Settings) -> Result<()> {
settings::set(settings).await?;
Ok(())
}