mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-09 11:52:08 +08:00
fix(sysinfo): return only displayed system fields
This commit is contained in:
@@ -9,23 +9,13 @@ use crate::Platform;
|
||||
pub struct SystemInfo {
|
||||
pub system_name: String,
|
||||
pub system_version: String,
|
||||
pub system_kernel_version: String,
|
||||
pub system_arch: String,
|
||||
pub app_version: String,
|
||||
pub app_core_mode: String,
|
||||
pub app_is_admin: bool,
|
||||
}
|
||||
|
||||
impl From<Platform> for SystemInfo {
|
||||
fn from(platform: Platform) -> Self {
|
||||
impl From<&Platform> for SystemInfo {
|
||||
fn from(platform: &Platform) -> Self {
|
||||
Self {
|
||||
system_name: platform.sysinfo.system_name,
|
||||
system_version: platform.sysinfo.system_version,
|
||||
system_kernel_version: platform.sysinfo.system_kernel_version,
|
||||
system_arch: platform.sysinfo.system_arch,
|
||||
app_version: platform.appinfo.app_version,
|
||||
app_core_mode: platform.appinfo.app_core_mode,
|
||||
app_is_admin: platform.appinfo.app_is_admin,
|
||||
system_name: platform.sysinfo.system_name.clone(),
|
||||
system_version: platform.sysinfo.system_version.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +24,7 @@ impl From<Platform> for SystemInfo {
|
||||
#[specta::specta]
|
||||
pub fn get_system_info(state: State<'_, RwLock<Platform>>) -> Result<SystemInfo, String> {
|
||||
let platform = state.inner().read();
|
||||
Ok(SystemInfo::from(platform.clone()))
|
||||
Ok(SystemInfo::from(&*platform))
|
||||
}
|
||||
|
||||
/// 获取应用的运行时间(毫秒)
|
||||
|
||||
@@ -989,11 +989,6 @@ export type SidecarFailureSnapshot = {
|
||||
export type SystemInfo = {
|
||||
system_name: string
|
||||
system_version: string
|
||||
system_kernel_version: string
|
||||
system_arch: string
|
||||
app_version: string
|
||||
app_core_mode: string
|
||||
app_is_admin: boolean
|
||||
}
|
||||
|
||||
export type SystemProxy = {
|
||||
|
||||
Reference in New Issue
Block a user