fix: update clash_verge_service_ipc to version 2.0.16 and improve log handling

This commit is contained in:
Tunglies
2025-10-13 11:38:54 +08:00
parent 5fb770c113
commit 902c8fcaf2
4 changed files with 9 additions and 12 deletions

View File

@@ -884,12 +884,7 @@ impl CoreManager {
pub async fn get_clash_logs(&self) -> Result<VecDeque<CompactString>> {
logging!(info, Type::Core, "get clash logs");
let logs = match self.get_running_mode() {
// TODO 服务端也完成 CompactString 迁移
RunningMode::Service => service::get_clash_logs_by_service()
.await?
.into_iter()
.map(CompactString::from)
.collect::<VecDeque<CompactString>>(),
RunningMode::Service => service::get_clash_logs_by_service().await?,
RunningMode::Sidecar => ClashLogger::global().get_logs().clone(),
_ => VecDeque::new(),
};

View File

@@ -5,6 +5,7 @@ use crate::{
};
use anyhow::{Context, Result, bail};
use clash_verge_service_ipc::CoreConfig;
use compact_str::CompactString;
use once_cell::sync::Lazy;
use std::{
collections::VecDeque,
@@ -393,7 +394,7 @@ pub(super) async fn run_core_by_service(config_file: &PathBuf) -> Result<()> {
start_with_existing_service(config_file).await
}
pub(super) async fn get_clash_logs_by_service() -> Result<VecDeque<String>> {
pub(super) async fn get_clash_logs_by_service() -> Result<VecDeque<CompactString>> {
logging!(info, Type::Service, "正在获取服务模式下的 Clash 日志");
let response = clash_verge_service_ipc::get_clash_logs()