mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 14:53:44 +08:00
feat: implement lightweight mode functionality and update related settings
This commit is contained in:
parent
f8dbc7bea0
commit
33d54b27f4
15
src-tauri/src/cmd/lighteweight.rs
Normal file
15
src-tauri/src/cmd/lighteweight.rs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
use crate::module::lightweight;
|
||||||
|
|
||||||
|
use super::CmdResult;
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn entry_lightweight_mode() -> CmdResult {
|
||||||
|
lightweight::entry_lightweight_mode();
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn exit_lightweight_mode() -> CmdResult {
|
||||||
|
lightweight::exit_lightweight_mode();
|
||||||
|
Ok(())
|
||||||
|
}
|
@ -17,6 +17,7 @@ pub mod uwp;
|
|||||||
pub mod validate;
|
pub mod validate;
|
||||||
pub mod verge;
|
pub mod verge;
|
||||||
pub mod webdav;
|
pub mod webdav;
|
||||||
|
pub mod lighteweight;
|
||||||
|
|
||||||
// Re-export all command functions for backwards compatibility
|
// Re-export all command functions for backwards compatibility
|
||||||
pub use app::*;
|
pub use app::*;
|
||||||
@ -32,3 +33,4 @@ pub use uwp::*;
|
|||||||
pub use validate::*;
|
pub use validate::*;
|
||||||
pub use verge::*;
|
pub use verge::*;
|
||||||
pub use webdav::*;
|
pub use webdav::*;
|
||||||
|
pub use lighteweight::*;
|
||||||
|
@ -189,9 +189,6 @@ pub struct IVerge {
|
|||||||
|
|
||||||
pub enable_tray_speed: Option<bool>,
|
pub enable_tray_speed: Option<bool>,
|
||||||
|
|
||||||
/// 轻量模式 - 只保留内核运行
|
|
||||||
pub enable_lite_mode: Option<bool>,
|
|
||||||
|
|
||||||
/// 自动进入轻量模式
|
/// 自动进入轻量模式
|
||||||
pub auto_enter_lite_mode: Option<bool>,
|
pub auto_enter_lite_mode: Option<bool>,
|
||||||
|
|
||||||
@ -299,7 +296,6 @@ impl IVerge {
|
|||||||
webdav_password: None,
|
webdav_password: None,
|
||||||
enable_tray_speed: Some(true),
|
enable_tray_speed: Some(true),
|
||||||
enable_global_hotkey: Some(true),
|
enable_global_hotkey: Some(true),
|
||||||
enable_lite_mode: Some(false),
|
|
||||||
auto_enter_lite_mode: Some(false),
|
auto_enter_lite_mode: Some(false),
|
||||||
auto_enter_lite_mode_delay: Some(10),
|
auto_enter_lite_mode_delay: Some(10),
|
||||||
enable_dns_settings: Some(true),
|
enable_dns_settings: Some(true),
|
||||||
@ -385,7 +381,6 @@ impl IVerge {
|
|||||||
patch!(webdav_username);
|
patch!(webdav_username);
|
||||||
patch!(webdav_password);
|
patch!(webdav_password);
|
||||||
patch!(enable_tray_speed);
|
patch!(enable_tray_speed);
|
||||||
patch!(enable_lite_mode);
|
|
||||||
patch!(auto_enter_lite_mode);
|
patch!(auto_enter_lite_mode);
|
||||||
patch!(auto_enter_lite_mode_delay);
|
patch!(auto_enter_lite_mode_delay);
|
||||||
patch!(enable_dns_settings);
|
patch!(enable_dns_settings);
|
||||||
@ -478,7 +473,6 @@ pub struct IVergeResponse {
|
|||||||
pub webdav_username: Option<String>,
|
pub webdav_username: Option<String>,
|
||||||
pub webdav_password: Option<String>,
|
pub webdav_password: Option<String>,
|
||||||
pub enable_tray_speed: Option<bool>,
|
pub enable_tray_speed: Option<bool>,
|
||||||
pub enable_lite_mode: Option<bool>,
|
|
||||||
pub auto_enter_lite_mode: Option<bool>,
|
pub auto_enter_lite_mode: Option<bool>,
|
||||||
pub auto_enter_lite_mode_delay: Option<u16>,
|
pub auto_enter_lite_mode_delay: Option<u16>,
|
||||||
pub enable_dns_settings: Option<bool>,
|
pub enable_dns_settings: Option<bool>,
|
||||||
@ -545,7 +539,6 @@ impl From<IVerge> for IVergeResponse {
|
|||||||
webdav_username: verge.webdav_username,
|
webdav_username: verge.webdav_username,
|
||||||
webdav_password: verge.webdav_password,
|
webdav_password: verge.webdav_password,
|
||||||
enable_tray_speed: verge.enable_tray_speed,
|
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: verge.auto_enter_lite_mode,
|
||||||
auto_enter_lite_mode_delay: verge.auto_enter_lite_mode_delay,
|
auto_enter_lite_mode_delay: verge.auto_enter_lite_mode_delay,
|
||||||
enable_dns_settings: verge.enable_dns_settings,
|
enable_dns_settings: verge.enable_dns_settings,
|
||||||
|
@ -41,18 +41,6 @@ impl Handle {
|
|||||||
window
|
window
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn destroy_window(&self) -> Result<(), String> {
|
|
||||||
if let Some(window) = self.get_window() {
|
|
||||||
log_err!(window.close());
|
|
||||||
}
|
|
||||||
if let Some(window) = Self::global().get_window() {
|
|
||||||
if let Some(webview) = window.get_webview_window("main") {
|
|
||||||
log_err!(webview.destroy());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn refresh_clash() {
|
pub fn refresh_clash() {
|
||||||
if let Some(window) = Self::global().get_window() {
|
if let Some(window) = Self::global().get_window() {
|
||||||
log_err!(window.emit("verge://refresh-clash-config", "yes"));
|
log_err!(window.emit("verge://refresh-clash-config", "yes"));
|
||||||
|
@ -176,15 +176,13 @@ impl Hotkey {
|
|||||||
println!("Executing function directly");
|
println!("Executing function directly");
|
||||||
log::info!(target: "app", "Executing function directly");
|
log::info!(target: "app", "Executing function directly");
|
||||||
|
|
||||||
// 获取轻量模式状态和全局热键状态
|
// 获取全局热键状态
|
||||||
let is_lite_mode = Config::verge().latest().enable_lite_mode.unwrap_or(false);
|
|
||||||
let is_enable_global_hotkey = Config::verge()
|
let is_enable_global_hotkey = Config::verge()
|
||||||
.latest()
|
.latest()
|
||||||
.enable_global_hotkey
|
.enable_global_hotkey
|
||||||
.unwrap_or(true);
|
.unwrap_or(true);
|
||||||
|
|
||||||
// 在轻量模式下或配置了全局热键时,始终执行热键功能
|
if is_enable_global_hotkey {
|
||||||
if is_lite_mode || is_enable_global_hotkey {
|
|
||||||
f();
|
f();
|
||||||
} else if let Some(window) = app_handle.get_webview_window("main") {
|
} else if let Some(window) = app_handle.get_webview_window("main") {
|
||||||
// 非轻量模式且未启用全局热键时,只在窗口可见且有焦点的情况下响应热键
|
// 非轻量模式且未启用全局热键时,只在窗口可见且有焦点的情况下响应热键
|
||||||
|
@ -2,7 +2,6 @@ use crate::{
|
|||||||
config::{Config, IVerge},
|
config::{Config, IVerge},
|
||||||
core::{handle, hotkey, sysopt, tray, CoreManager},
|
core::{handle, hotkey, sysopt, tray, CoreManager},
|
||||||
log_err,
|
log_err,
|
||||||
utils::resolve,
|
|
||||||
};
|
};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use serde_yaml::Mapping;
|
use serde_yaml::Mapping;
|
||||||
@ -68,7 +67,6 @@ pub async fn patch_verge(patch: IVerge, not_save_file: bool) -> Result<()> {
|
|||||||
let proxy_bypass = patch.system_proxy_bypass;
|
let proxy_bypass = patch.system_proxy_bypass;
|
||||||
let language = patch.language;
|
let language = patch.language;
|
||||||
let mixed_port = patch.verge_mixed_port;
|
let mixed_port = patch.verge_mixed_port;
|
||||||
let lite_mode = patch.enable_lite_mode;
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let tray_icon = patch.tray_icon;
|
let tray_icon = patch.tray_icon;
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
@ -192,15 +190,6 @@ pub async fn patch_verge(patch: IVerge, not_save_file: bool) -> Result<()> {
|
|||||||
tray::Tray::global().update_click_behavior()?;
|
tray::Tray::global().update_click_behavior()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle lite mode switch
|
|
||||||
if let Some(enable) = lite_mode {
|
|
||||||
if enable {
|
|
||||||
handle::Handle::global().destroy_window().ok();
|
|
||||||
} else {
|
|
||||||
resolve::create_window();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
<Result<()>>::Ok(())
|
<Result<()>>::Ok(())
|
||||||
};
|
};
|
||||||
match res {
|
match res {
|
||||||
|
@ -215,6 +215,9 @@ pub fn run() {
|
|||||||
// media unlock checker
|
// media unlock checker
|
||||||
cmd::get_unlock_items,
|
cmd::get_unlock_items,
|
||||||
cmd::check_media_unlock,
|
cmd::check_media_unlock,
|
||||||
|
// light-weight model
|
||||||
|
cmd::entry_lightweight_mode,
|
||||||
|
cmd::exit_lightweight_mode,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
@ -283,41 +286,6 @@ pub fn run() {
|
|||||||
api.prevent_close();
|
api.prevent_close();
|
||||||
let window = core::handle::Handle::global().get_window().unwrap();
|
let window = core::handle::Handle::global().get_window().unwrap();
|
||||||
let _ = window.hide();
|
let _ = window.hide();
|
||||||
|
|
||||||
// 检查是否启用了自动进入 Lite Mode
|
|
||||||
let verge = crate::config::Config::verge();
|
|
||||||
let verge_config = verge.latest();
|
|
||||||
let auto_enter_lite_mode = verge_config.auto_enter_lite_mode.unwrap_or(false);
|
|
||||||
|
|
||||||
if auto_enter_lite_mode {
|
|
||||||
let delay_minutes = verge_config.auto_enter_lite_mode_delay.unwrap_or(10);
|
|
||||||
let app_handle_clone = app_handle.clone();
|
|
||||||
println!("自动进入 Lite Mode 已启用");
|
|
||||||
// 启动一个线程,在指定延迟后启用 Lite Mode
|
|
||||||
std::thread::spawn(move || {
|
|
||||||
println!("等待 {} 分钟后自动进入 Lite Mode", delay_minutes);
|
|
||||||
std::thread::sleep(std::time::Duration::from_secs(delay_minutes as u64 * 60));
|
|
||||||
println!("Lite Mode 倒计时结束");
|
|
||||||
|
|
||||||
// 延迟后检查窗口是否仍然隐藏,如果是,则启用 Lite Mode
|
|
||||||
let window_opt = app_handle_clone.get_webview_window("main");
|
|
||||||
if let Some(window) = window_opt {
|
|
||||||
if !window.is_visible().unwrap_or(true) {
|
|
||||||
println!("倒计时结束,正在进入 Lite Mode...");
|
|
||||||
// 应用 Lite Mode
|
|
||||||
if let Err(e) = tauri::async_runtime::block_on(crate::feat::patch_verge(
|
|
||||||
crate::config::IVerge {
|
|
||||||
enable_lite_mode: Some(true),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
false
|
|
||||||
)) {
|
|
||||||
println!("Lite Mode 进入失败: {:?}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tauri::WindowEvent::Focused(true) => {
|
tauri::WindowEvent::Focused(true) => {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
|
25
src-tauri/src/module/lightweight.rs
Normal file
25
src-tauri/src/module/lightweight.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
use tauri::Manager;
|
||||||
|
|
||||||
|
use crate::{core::handle, log_err, utils::resolve};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pub fn entry_lightweight_mode() {
|
||||||
|
println!("entry_lightweight_mode");
|
||||||
|
log::debug!(target: "app", "entry_lightweight_mode");
|
||||||
|
if let Some(window) = handle::Handle::global().get_window() {
|
||||||
|
log_err!(window.close());
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(window) = handle::Handle::global().get_window() {
|
||||||
|
if let Some(webview) = window.get_webview_window("main") {
|
||||||
|
log_err!(webview.destroy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn exit_lightweight_mode() {
|
||||||
|
println!("exit_lightweight_mode");
|
||||||
|
log::debug!(target: "app", "exit_lightweight_mode");
|
||||||
|
resolve::create_window();
|
||||||
|
}
|
@ -1,2 +1,3 @@
|
|||||||
pub mod mihomo;
|
pub mod mihomo;
|
||||||
pub mod sysinfo;
|
pub mod sysinfo;
|
||||||
|
pub mod lightweight;
|
@ -12,6 +12,7 @@ import {
|
|||||||
import { useVerge } from "@/hooks/use-verge";
|
import { useVerge } from "@/hooks/use-verge";
|
||||||
import { BaseDialog, DialogRef, Notice, Switch } from "@/components/base";
|
import { BaseDialog, DialogRef, Notice, Switch } from "@/components/base";
|
||||||
import { TooltipIcon } from "@/components/base/base-tooltip-icon";
|
import { TooltipIcon } from "@/components/base/base-tooltip-icon";
|
||||||
|
import { entry_lightweight_mode } from "@/services/cmds";
|
||||||
|
|
||||||
export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -34,15 +35,6 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
close: () => setOpen(false),
|
close: () => setOpen(false),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const onEnterLiteMode = useLockFn(async () => {
|
|
||||||
try {
|
|
||||||
await patchVerge({ enable_lite_mode: true });
|
|
||||||
setOpen(false);
|
|
||||||
} catch (err: any) {
|
|
||||||
Notice.error(err.message || err.toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const onSave = useLockFn(async () => {
|
const onSave = useLockFn(async () => {
|
||||||
try {
|
try {
|
||||||
await patchVerge({
|
await patchVerge({
|
||||||
@ -58,7 +50,7 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
return (
|
return (
|
||||||
<BaseDialog
|
<BaseDialog
|
||||||
open={open}
|
open={open}
|
||||||
title={t("Lite Mode Settings")}
|
title={t("LightWeight Mode Settings")}
|
||||||
contentSx={{ width: 450 }}
|
contentSx={{ width: 450 }}
|
||||||
okBtn={t("Save")}
|
okBtn={t("Save")}
|
||||||
cancelBtn={t("Cancel")}
|
cancelBtn={t("Cancel")}
|
||||||
@ -68,7 +60,7 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
>
|
>
|
||||||
<List>
|
<List>
|
||||||
<ListItem sx={{ padding: "5px 2px" }}>
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
<ListItemText primary={t("Enter Lite Mode Now")} />
|
<ListItemText primary={t("Enter LightWeight Mode Now")} />
|
||||||
<Typography
|
<Typography
|
||||||
variant="button"
|
variant="button"
|
||||||
sx={{
|
sx={{
|
||||||
@ -76,7 +68,7 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
color: "primary.main",
|
color: "primary.main",
|
||||||
"&:hover": { textDecoration: "underline" }
|
"&:hover": { textDecoration: "underline" }
|
||||||
}}
|
}}
|
||||||
onClick={onEnterLiteMode}
|
onClick={() => entry_lightweight_mode()}
|
||||||
>
|
>
|
||||||
{t("Enable")}
|
{t("Enable")}
|
||||||
</Typography>
|
</Typography>
|
||||||
@ -84,11 +76,11 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
|
|
||||||
<ListItem sx={{ padding: "5px 2px" }}>
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary={t("Auto Enter Lite Mode")}
|
primary={t("Auto Enter LightWeight Mode")}
|
||||||
sx={{ maxWidth: "fit-content" }}
|
sx={{ maxWidth: "fit-content" }}
|
||||||
/>
|
/>
|
||||||
<TooltipIcon
|
<TooltipIcon
|
||||||
title={t("Auto Enter Lite Mode Info")}
|
title={t("Auto Enter LightWeight Mode Info")}
|
||||||
sx={{ opacity: "0.7" }}
|
sx={{ opacity: "0.7" }}
|
||||||
/>
|
/>
|
||||||
<Switch
|
<Switch
|
||||||
@ -104,7 +96,7 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
{values.autoEnterLiteMode && (
|
{values.autoEnterLiteMode && (
|
||||||
<>
|
<>
|
||||||
<ListItem sx={{ padding: "5px 2px" }}>
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
<ListItemText primary={t("Auto Enter Lite Mode Delay")} />
|
<ListItemText primary={t("Auto Enter LightWeight Mode Delay")} />
|
||||||
<TextField
|
<TextField
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
size="small"
|
size="small"
|
||||||
@ -132,8 +124,8 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
|
|
||||||
<ListItem sx={{ padding: "5px 2px" }}>
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
<Typography variant="body2" color="text.secondary" sx={{ fontStyle: "italic" }}>
|
<Typography variant="body2" color="text.secondary" sx={{ fontStyle: "italic" }}>
|
||||||
{t("When closing the window, Lite Mode will be automatically activated after _n minutes",
|
{t("When closing the window, LightWeight Mode will be automatically activated after _n minutes",
|
||||||
{ n: values.autoEnterLiteModeDelay })}
|
{ n: values.autoEnterLiteModeDelay })}
|
||||||
</Typography>
|
</Typography>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</>
|
</>
|
||||||
|
@ -107,9 +107,9 @@ const SettingVergeAdvanced = ({ onError }: Props) => {
|
|||||||
<SettingItem onClick={openDevTools} label={t("Open Dev Tools")} />
|
<SettingItem onClick={openDevTools} label={t("Open Dev Tools")} />
|
||||||
|
|
||||||
<SettingItem
|
<SettingItem
|
||||||
label={t("Lite Mode Settings")}
|
label={t("LightWeight Mode Settings")}
|
||||||
extra={
|
extra={
|
||||||
<TooltipIcon title={t("Lite Mode Info")} sx={{ opacity: "0.7" }} />
|
<TooltipIcon title={t("LightWeight Mode Info")} sx={{ opacity: "0.7" }} />
|
||||||
}
|
}
|
||||||
onClick={() => liteModeRef.current?.open()}
|
onClick={() => liteModeRef.current?.open()}
|
||||||
/>
|
/>
|
||||||
|
@ -436,8 +436,8 @@
|
|||||||
"Global Mode": "الوضع العالمي",
|
"Global Mode": "الوضع العالمي",
|
||||||
"Direct Mode": "الوضع المباشر",
|
"Direct Mode": "الوضع المباشر",
|
||||||
"Enable Tray Speed": "تفعيل سرعة التراي",
|
"Enable Tray Speed": "تفعيل سرعة التراي",
|
||||||
"Lite Mode": "وضع الأداء الخفيف",
|
"LightWeight Mode": "وضع الأداء الخفيف",
|
||||||
"Lite Mode Info": "إيقاف الواجهة الرسومية والإبقاء على تشغيل النواة",
|
"LightWeight Mode Info": "إيقاف الواجهة الرسومية والإبقاء على تشغيل النواة",
|
||||||
"Config Validation Failed": "فشل التحقق من تكوين الاشتراك، يرجى فحص ملف التكوين، تم التراجع عن التغييرات، تفاصيل الخطأ:",
|
"Config Validation Failed": "فشل التحقق من تكوين الاشتراك، يرجى فحص ملف التكوين، تم التراجع عن التغييرات، تفاصيل الخطأ:",
|
||||||
"Boot Config Validation Failed": "فشل التحقق من التكوين عند الإقلاع، تم استخدام التكوين الافتراضي، يرجى فحص ملف التكوين، تفاصيل الخطأ:",
|
"Boot Config Validation Failed": "فشل التحقق من التكوين عند الإقلاع، تم استخدام التكوين الافتراضي، يرجى فحص ملف التكوين، تفاصيل الخطأ:",
|
||||||
"Core Change Config Validation Failed": "فشل التحقق من التكوين عند تغيير النواة، تم استخدام التكوين الافتراضي، يرجى فحص ملف التكوين، تفاصيل الخطأ:",
|
"Core Change Config Validation Failed": "فشل التحقق من التكوين عند تغيير النواة، تم استخدام التكوين الافتراضي، يرجى فحص ملف التكوين، تفاصيل الخطأ:",
|
||||||
|
@ -451,14 +451,14 @@
|
|||||||
"Global Mode": "Global Mode",
|
"Global Mode": "Global Mode",
|
||||||
"Direct Mode": "Direct Mode",
|
"Direct Mode": "Direct Mode",
|
||||||
"Enable Tray Speed": "Enable Tray Speed",
|
"Enable Tray Speed": "Enable Tray Speed",
|
||||||
"Lite Mode": "Lightweight Mode",
|
"LightWeight Mode": "Lightweight Mode",
|
||||||
"Lite Mode Info": "Close the GUI and keep only the kernel running",
|
"LightWeight Mode Info": "Close the GUI and keep only the kernel running",
|
||||||
"Lite Mode Settings": "Lite Mode Settings",
|
"LightWeight Mode Settings": "LightWeight Mode Settings",
|
||||||
"Enter Lite Mode Now": "Enter Lite Mode Now",
|
"Enter LightWeight Mode Now": "Enter LightWeight Mode Now",
|
||||||
"Auto Enter Lite Mode": "Auto Enter Lite Mode",
|
"Auto Enter LightWeight Mode": "Auto Enter LightWeight Mode",
|
||||||
"Auto Enter Lite Mode Info": "Enable to automatically activate Lite Mode after the window is closed for a period of time",
|
"Auto Enter LightWeight Mode Info": "Enable to automatically activate LightWeight Mode after the window is closed for a period of time",
|
||||||
"Auto Enter Lite Mode Delay": "Auto Enter Lite Mode Delay",
|
"Auto Enter LightWeight Mode Delay": "Auto Enter LightWeight Mode Delay",
|
||||||
"When closing the window, Lite Mode will be automatically activated after _n minutes": "When closing the window, Lite Mode will be automatically activated after {{n}} minutes",
|
"When closing the window, LightWeight Mode will be automatically activated after _n minutes": "When closing the window, LightWeight Mode will be automatically activated after {{n}} minutes",
|
||||||
"Config Validation Failed": "Subscription configuration validation failed. Please check the subscription configuration file; modifications have been rolled back.",
|
"Config Validation Failed": "Subscription configuration validation failed. Please check the subscription configuration file; modifications have been rolled back.",
|
||||||
"Boot Config Validation Failed": "Boot subscription configuration validation failed. Started with the default configuration; please check the subscription configuration file.",
|
"Boot Config Validation Failed": "Boot subscription configuration validation failed. Started with the default configuration; please check the subscription configuration file.",
|
||||||
"Core Change Config Validation Failed": "Configuration validation failed when switching the kernel. Started with the default configuration; please check the subscription configuration file.",
|
"Core Change Config Validation Failed": "Configuration validation failed when switching the kernel. Started with the default configuration; please check the subscription configuration file.",
|
||||||
|
@ -433,8 +433,8 @@
|
|||||||
"Global Mode": "حالت جهانی",
|
"Global Mode": "حالت جهانی",
|
||||||
"Direct Mode": "حالت مستقیم",
|
"Direct Mode": "حالت مستقیم",
|
||||||
"Enable Tray Speed": "فعال کردن سرعت ترای",
|
"Enable Tray Speed": "فعال کردن سرعت ترای",
|
||||||
"Lite Mode": "در فارسی",
|
"LightWeight Mode": "در فارسی",
|
||||||
"Lite Mode Info": "رابط کاربری گرافیکی را ببندید و فقط هسته را در حال اجرا نگه دارید",
|
"LightWeight Mode Info": "رابط کاربری گرافیکی را ببندید و فقط هسته را در حال اجرا نگه دارید",
|
||||||
"Config Validation Failed": "اعتبارسنجی پیکربندی اشتراک ناموفق بود، فایل پیکربندی را بررسی کنید، تغییرات برگشت داده شد، جزئیات خطا:",
|
"Config Validation Failed": "اعتبارسنجی پیکربندی اشتراک ناموفق بود، فایل پیکربندی را بررسی کنید، تغییرات برگشت داده شد، جزئیات خطا:",
|
||||||
"Boot Config Validation Failed": "اعتبارسنجی پیکربندی هنگام راهاندازی ناموفق بود، پیکربندی پیشفرض استفاده شد، فایل پیکربندی را بررسی کنید، جزئیات خطا:",
|
"Boot Config Validation Failed": "اعتبارسنجی پیکربندی هنگام راهاندازی ناموفق بود، پیکربندی پیشفرض استفاده شد، فایل پیکربندی را بررسی کنید، جزئیات خطا:",
|
||||||
"Core Change Config Validation Failed": "اعتبارسنجی پیکربندی هنگام تغییر هسته ناموفق بود، پیکربندی پیشفرض استفاده شد، فایل پیکربندی را بررسی کنید، جزئیات خطا:",
|
"Core Change Config Validation Failed": "اعتبارسنجی پیکربندی هنگام تغییر هسته ناموفق بود، پیکربندی پیشفرض استفاده شد، فایل پیکربندی را بررسی کنید، جزئیات خطا:",
|
||||||
|
@ -432,8 +432,8 @@
|
|||||||
"Restore Success, App will restart in 1s": "Pemulihan Berhasil, Aplikasi akan dimulai ulang dalam 1 detik",
|
"Restore Success, App will restart in 1s": "Pemulihan Berhasil, Aplikasi akan dimulai ulang dalam 1 detik",
|
||||||
"Failed to fetch backup files": "Gagal mengambil file cadangan",
|
"Failed to fetch backup files": "Gagal mengambil file cadangan",
|
||||||
"Enable Tray Speed": "Aktifkan Tray Speed",
|
"Enable Tray Speed": "Aktifkan Tray Speed",
|
||||||
"Lite Mode": "Mode Ringan",
|
"LightWeight Mode": "Mode Ringan",
|
||||||
"Lite Mode Info": "Tutup GUI dan biarkan hanya kernel yang berjalan",
|
"LightWeight Mode Info": "Tutup GUI dan biarkan hanya kernel yang berjalan",
|
||||||
"Config Validation Failed": "Validasi konfigurasi langganan gagal, periksa file konfigurasi, perubahan dibatalkan, detail kesalahan:",
|
"Config Validation Failed": "Validasi konfigurasi langganan gagal, periksa file konfigurasi, perubahan dibatalkan, detail kesalahan:",
|
||||||
"Boot Config Validation Failed": "Validasi konfigurasi saat boot gagal, menggunakan konfigurasi default, periksa file konfigurasi, detail kesalahan:",
|
"Boot Config Validation Failed": "Validasi konfigurasi saat boot gagal, menggunakan konfigurasi default, periksa file konfigurasi, detail kesalahan:",
|
||||||
"Core Change Config Validation Failed": "Validasi konfigurasi saat ganti inti gagal, menggunakan konfigurasi default, periksa file konfigurasi, detail kesalahan:",
|
"Core Change Config Validation Failed": "Validasi konfigurasi saat ganti inti gagal, menggunakan konfigurasi default, periksa file konfigurasi, detail kesalahan:",
|
||||||
|
@ -433,8 +433,8 @@
|
|||||||
"Global Mode": "Глобальный режим",
|
"Global Mode": "Глобальный режим",
|
||||||
"Direct Mode": "Прямой режим",
|
"Direct Mode": "Прямой режим",
|
||||||
"Enable Tray Speed": "Включить скорость в лотке",
|
"Enable Tray Speed": "Включить скорость в лотке",
|
||||||
"Lite Mode": "Облегченный режим",
|
"LightWeight Mode": "Облегченный режим",
|
||||||
"Lite Mode Info": "Закройте графический интерфейс и оставьте работать только ядро",
|
"LightWeight Mode Info": "Закройте графический интерфейс и оставьте работать только ядро",
|
||||||
"Config Validation Failed": "Ошибка проверки конфигурации подписки, проверьте файл конфигурации, изменения отменены, ошибка:",
|
"Config Validation Failed": "Ошибка проверки конфигурации подписки, проверьте файл конфигурации, изменения отменены, ошибка:",
|
||||||
"Boot Config Validation Failed": "Ошибка проверки конфигурации при запуске, используется конфигурация по умолчанию, проверьте файл конфигурации, ошибка:",
|
"Boot Config Validation Failed": "Ошибка проверки конфигурации при запуске, используется конфигурация по умолчанию, проверьте файл конфигурации, ошибка:",
|
||||||
"Core Change Config Validation Failed": "Ошибка проверки конфигурации при смене ядра, используется конфигурация по умолчанию, проверьте файл конфигурации, ошибка:",
|
"Core Change Config Validation Failed": "Ошибка проверки конфигурации при смене ядра, используется конфигурация по умолчанию, проверьте файл конфигурации, ошибка:",
|
||||||
|
@ -432,8 +432,8 @@
|
|||||||
"Global Mode": "Глобаль режим",
|
"Global Mode": "Глобаль режим",
|
||||||
"Direct Mode": "Туры режим",
|
"Direct Mode": "Туры режим",
|
||||||
"Enable Tray Speed": "Трей скоростьне үстерү",
|
"Enable Tray Speed": "Трей скоростьне үстерү",
|
||||||
"Lite Mode": "Җиңел Режим",
|
"LightWeight Mode": "Җиңел Режим",
|
||||||
"Lite Mode Info": "GUI-ны ябыгыз һәм бары тик төшне генә эшләтеп калдырыгыз",
|
"LightWeight Mode Info": "GUI-ны ябыгыз һәм бары тик төшне генә эшләтеп калдырыгыз",
|
||||||
"Config Validation Failed": "Язылу көйләү тикшерүе уңышсыз, көйләү файлын тикшерегез, үзгәрешләр кире кайтарылды, хата:",
|
"Config Validation Failed": "Язылу көйләү тикшерүе уңышсыз, көйләү файлын тикшерегез, үзгәрешләр кире кайтарылды, хата:",
|
||||||
"Boot Config Validation Failed": "Йөкләү вакытында көйләү тикшерүе уңышсыз, стандарт көйләү кулланылды, көйләү файлын тикшерегез, хата:",
|
"Boot Config Validation Failed": "Йөкләү вакытында көйләү тикшерүе уңышсыз, стандарт көйләү кулланылды, көйләү файлын тикшерегез, хата:",
|
||||||
"Core Change Config Validation Failed": "Ядро алыштырганда көйләү тикшерүе уңышсыз, стандарт көйләү кулланылды, көйләү файлын тикшерегез, хата:",
|
"Core Change Config Validation Failed": "Ядро алыштырганда көйләү тикшерүе уңышсыз, стандарт көйләү кулланылды, көйләү файлын тикшерегез, хата:",
|
||||||
|
@ -451,14 +451,14 @@
|
|||||||
"Global Mode": "全局模式",
|
"Global Mode": "全局模式",
|
||||||
"Direct Mode": "直连模式",
|
"Direct Mode": "直连模式",
|
||||||
"Enable Tray Speed": "启用托盘速率",
|
"Enable Tray Speed": "启用托盘速率",
|
||||||
"Lite Mode": "轻量模式",
|
"LightWeight Mode": "轻量模式",
|
||||||
"Lite Mode Info": "关闭GUI界面,仅保留内核运行",
|
"LightWeight Mode Info": "关闭GUI界面,仅保留内核运行",
|
||||||
"Lite Mode Settings": "轻量模式设置",
|
"LightWeight Mode Settings": "轻量模式设置",
|
||||||
"Enter Lite Mode Now": "立即进入轻量模式",
|
"Enter LightWeight Mode Now": "立即进入轻量模式",
|
||||||
"Auto Enter Lite Mode": "自动进入轻量模式",
|
"Auto Enter LightWeight Mode": "自动进入轻量模式",
|
||||||
"Auto Enter Lite Mode Info": "启用后,将在窗口关闭一段时间后自动激活轻量模式",
|
"Auto Enter LightWeight Mode Info": "启用后,将在窗口关闭一段时间后自动激活轻量模式",
|
||||||
"Auto Enter Lite Mode Delay": "自动进入轻量模式延迟",
|
"Auto Enter LightWeight Mode Delay": "自动进入轻量模式延迟",
|
||||||
"When closing the window, Lite Mode will be automatically activated after _n minutes": "关闭窗口后,轻量模式将在 {{n}} 分钟后自动激活",
|
"When closing the window, LightWeight Mode will be automatically activated after _n minutes": "关闭窗口后,轻量模式将在 {{n}} 分钟后自动激活",
|
||||||
"Config Validation Failed": "订阅配置校验失败,请检查订阅配置文件,变更已撤销,错误详情:",
|
"Config Validation Failed": "订阅配置校验失败,请检查订阅配置文件,变更已撤销,错误详情:",
|
||||||
"Boot Config Validation Failed": "启动订阅配置校验失败,已使用默认配置启动;请检查订阅配置文件,错误详情:",
|
"Boot Config Validation Failed": "启动订阅配置校验失败,已使用默认配置启动;请检查订阅配置文件,错误详情:",
|
||||||
"Core Change Config Validation Failed": "切换内核时配置校验失败,已使用默认配置启动;请检查订阅配置文件,错误详情:",
|
"Core Change Config Validation Failed": "切换内核时配置校验失败,已使用默认配置启动;请检查订阅配置文件,错误详情:",
|
||||||
|
@ -37,7 +37,7 @@ import { BasePage } from "@/components/base";
|
|||||||
import { ClashInfoCard } from "@/components/home/clash-info-card";
|
import { ClashInfoCard } from "@/components/home/clash-info-card";
|
||||||
import { SystemInfoCard } from "@/components/home/system-info-card";
|
import { SystemInfoCard } from "@/components/home/system-info-card";
|
||||||
import { useLockFn } from "ahooks";
|
import { useLockFn } from "ahooks";
|
||||||
import { openWebUrl, patchVergeConfig } from "@/services/cmds";
|
import { entry_lightweight_mode, openWebUrl, patchVergeConfig } from "@/services/cmds";
|
||||||
import { TestCard } from "@/components/home/test-card";
|
import { TestCard } from "@/components/home/test-card";
|
||||||
import { IpInfoCard } from "@/components/home/ip-info-card";
|
import { IpInfoCard } from "@/components/home/ip-info-card";
|
||||||
|
|
||||||
@ -259,8 +259,8 @@ const HomePage = () => {
|
|||||||
contentStyle={{ padding: 2 }}
|
contentStyle={{ padding: 2 }}
|
||||||
header={
|
header={
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Tooltip title={t("Lite Mode")} arrow>
|
<Tooltip title={t("LightWeight Mode")} arrow>
|
||||||
<IconButton onClick={() => patchVergeConfig({ enable_lite_mode: true })} size="small" color="inherit">
|
<IconButton onClick={() => entry_lightweight_mode()} size="small" color="inherit">
|
||||||
<HistoryEduOutlined />
|
<HistoryEduOutlined />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
@ -324,3 +324,11 @@ export const getAppUptime = async () => {
|
|||||||
export const installService = async () => {
|
export const installService = async () => {
|
||||||
return invoke<void>("install_service");
|
return invoke<void>("install_service");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const entry_lightweight_mode = async () => {
|
||||||
|
return invoke<void>("entry_lightweight_mode");
|
||||||
|
}
|
||||||
|
|
||||||
|
export const exit_lightweight_mode = async () => {
|
||||||
|
return invoke<void>("exit_lightweight_mode");
|
||||||
|
}
|
1
src/services/types.d.ts
vendored
1
src/services/types.d.ts
vendored
@ -739,7 +739,6 @@ interface IVergeConfig {
|
|||||||
tun_tray_icon?: boolean;
|
tun_tray_icon?: boolean;
|
||||||
enable_tray_speed?: boolean;
|
enable_tray_speed?: boolean;
|
||||||
enable_tun_mode?: boolean;
|
enable_tun_mode?: boolean;
|
||||||
enable_lite_mode?: boolean;
|
|
||||||
auto_enter_lite_mode?: boolean;
|
auto_enter_lite_mode?: boolean;
|
||||||
auto_enter_lite_mode_delay?: number;
|
auto_enter_lite_mode_delay?: number;
|
||||||
enable_auto_launch?: boolean;
|
enable_auto_launch?: boolean;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user