From b19a0ef705b75d6c630eefce52b65ceab9d48ba4 Mon Sep 17 00:00:00 2001 From: YoVinchen Date: Mon, 12 Jan 2026 14:39:52 +0800 Subject: [PATCH] feat(commands): add get/set rectifier config commands --- src-tauri/src/commands/settings.rs | 21 +++++++++++++++++++++ src-tauri/src/lib.rs | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src-tauri/src/commands/settings.rs b/src-tauri/src/commands/settings.rs index b10c12339..12cd64fff 100644 --- a/src-tauri/src/commands/settings.rs +++ b/src-tauri/src/commands/settings.rs @@ -59,3 +59,24 @@ pub async fn set_auto_launch(enabled: bool) -> Result { pub async fn get_auto_launch_status() -> Result { crate::auto_launch::is_auto_launch_enabled().map_err(|e| format!("获取开机自启状态失败: {e}")) } + +/// 获取整流器配置 +#[tauri::command] +pub async fn get_rectifier_config( + state: tauri::State<'_, crate::AppState>, +) -> Result { + state.db.get_rectifier_config().map_err(|e| e.to_string()) +} + +/// 设置整流器配置 +#[tauri::command] +pub async fn set_rectifier_config( + state: tauri::State<'_, crate::AppState>, + config: crate::proxy::types::RectifierConfig, +) -> Result { + state + .db + .set_rectifier_config(&config) + .map_err(|e| e.to_string())?; + Ok(true) +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 9fb6fc706..f81863a6e 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -703,6 +703,8 @@ pub fn run() { commands::read_live_provider_settings, commands::get_settings, commands::save_settings, + commands::get_rectifier_config, + commands::set_rectifier_config, commands::restart_app, commands::check_for_updates, commands::is_portable_mode,