feat: lite mode settings

This commit is contained in:
wonfen
2025-03-20 01:44:43 +08:00
parent ad45485009
commit e31f176c25
7 changed files with 212 additions and 2 deletions

View File

@@ -191,6 +191,12 @@ pub struct IVerge {
/// 轻量模式 - 只保留内核运行
pub enable_lite_mode: Option<bool>,
/// 自动进入轻量模式
pub auto_enter_lite_mode: Option<bool>,
/// 自动进入轻量模式的延迟(分钟)
pub auto_enter_lite_mode_delay: Option<u16>,
}
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
@@ -294,6 +300,8 @@ impl IVerge {
enable_tray_speed: Some(true),
enable_global_hotkey: Some(true),
enable_lite_mode: Some(false),
auto_enter_lite_mode: Some(false),
auto_enter_lite_mode_delay: Some(10),
enable_dns_settings: Some(true),
home_cards: None,
..Self::default()
@@ -378,6 +386,8 @@ impl IVerge {
patch!(webdav_password);
patch!(enable_tray_speed);
patch!(enable_lite_mode);
patch!(auto_enter_lite_mode);
patch!(auto_enter_lite_mode_delay);
patch!(enable_dns_settings);
patch!(home_cards);
}
@@ -469,6 +479,8 @@ pub struct IVergeResponse {
pub webdav_password: Option<String>,
pub enable_tray_speed: Option<bool>,
pub enable_lite_mode: Option<bool>,
pub auto_enter_lite_mode: Option<bool>,
pub auto_enter_lite_mode_delay: Option<u16>,
pub enable_dns_settings: Option<bool>,
pub home_cards: Option<serde_json::Value>,
}
@@ -534,6 +546,8 @@ impl From<IVerge> for IVergeResponse {
webdav_password: verge.webdav_password,
enable_tray_speed: verge.enable_tray_speed,
enable_lite_mode: verge.enable_lite_mode,
auto_enter_lite_mode: verge.auto_enter_lite_mode,
auto_enter_lite_mode_delay: verge.auto_enter_lite_mode_delay,
enable_dns_settings: verge.enable_dns_settings,
home_cards: verge.home_cards,
}