aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/src/core/instance.rs
diff options
context:
space:
mode:
author苏向夜 <46275354+fu050409@users.noreply.github.com>2026-02-25 02:06:07 +0800
committerGitHub <noreply@github.com>2026-02-25 02:06:07 +0800
commit78ac61904d78d558d092eff08c9f261cbdb187e8 (patch)
tree96f68d1f1554ee3a0532793afaaa52b0c73dcbec /src-tauri/src/core/instance.rs
parent8ff3af6cb908fd824b512379dd21ed4f595ab6bb (diff)
parent329734b23957b84cde2af459fa61c7385fb5b5f1 (diff)
downloadDropOut-78ac61904d78d558d092eff08c9f261cbdb187e8.tar.gz
DropOut-78ac61904d78d558d092eff08c9f261cbdb187e8.zip
feat(ui): partial react rewrite (#77)
## Summary by Sourcery Export backend data structures to TypeScript for the new React-based UI and update CI to build additional targets. New Features: - Generate TypeScript definitions for core backend structs and enums used by the UI. - Now use our own Azure app(_DropOut_) to finish the authorize process. Enhancements: - Annotate existing Rust models with ts-rs metadata to control exported TypeScript shapes, including tagged enums and opaque JSON fields. Build: - Add ts-rs as a dependency for generating TypeScript bindings from Rust types. CI: - Extend the Semifold CI workflow to run on the dev branch and build additional Linux musl and Windows GNU targets using cross where needed.
Diffstat (limited to 'src-tauri/src/core/instance.rs')
-rw-r--r--src-tauri/src/core/instance.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src-tauri/src/core/instance.rs b/src-tauri/src/core/instance.rs
index 573273e..0237270 100644
--- a/src-tauri/src/core/instance.rs
+++ b/src-tauri/src/core/instance.rs
@@ -11,9 +11,12 @@ use std::fs;
use std::path::{Path, PathBuf};
use std::sync::Mutex;
use tauri::{AppHandle, Manager};
+use ts_rs::TS;
/// Represents a game instance/profile
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, TS)]
+#[serde(rename_all = "camelCase")]
+#[ts(export, export_to = "instance.ts")]
pub struct Instance {
pub id: String, // 唯一标识符(UUID)
pub name: String, // 显示名称
@@ -28,17 +31,22 @@ pub struct Instance {
pub jvm_args_override: Option<String>, // JVM参数覆盖(可选)
#[serde(default)]
pub memory_override: Option<MemoryOverride>, // 内存设置覆盖(可选)
+ pub java_path_override: Option<String>, // 实例级Java路径覆盖(可选)
}
/// Memory settings override for an instance
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, TS)]
+#[serde(rename_all = "camelCase")]
+#[ts(export, export_to = "instance.ts")]
pub struct MemoryOverride {
pub min: u32, // MB
pub max: u32, // MB
}
/// Configuration for all instances
-#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
+#[serde(rename_all = "camelCase")]
+#[ts(export, export_to = "instance.ts")]
pub struct InstanceConfig {
pub instances: Vec<Instance>,
pub active_instance_id: Option<String>, // 当前活动的实例ID
@@ -111,6 +119,7 @@ impl InstanceState {
mod_loader_version: None,
jvm_args_override: None,
memory_override: None,
+ java_path_override: None,
};
let mut config = self.instances.lock().unwrap();
@@ -267,6 +276,7 @@ impl InstanceState {
last_played: None,
jvm_args_override: source_instance.jvm_args_override.clone(),
memory_override: source_instance.memory_override.clone(),
+ java_path_override: source_instance.java_path_override.clone(),
};
self.update_instance(new_instance.clone())?;