mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:02:22 +08:00
fix: restart core or change can not remember proxy select in Global mode with sidecar #5466
This commit is contained in:
@@ -7,7 +7,7 @@ use crate::{
|
|||||||
constants,
|
constants,
|
||||||
core::{CoreManager, handle, validate::CoreConfigValidator},
|
core::{CoreManager, handle, validate::CoreConfigValidator},
|
||||||
};
|
};
|
||||||
use clash_verge_logging::{Type, logging};
|
use clash_verge_logging::{Type, logging, logging_error};
|
||||||
use compact_str::CompactString;
|
use compact_str::CompactString;
|
||||||
use serde_yaml_ng::Mapping;
|
use serde_yaml_ng::Mapping;
|
||||||
use smartstring::alias::String;
|
use smartstring::alias::String;
|
||||||
@@ -46,6 +46,11 @@ pub async fn change_clash_core(clash_core: String) -> CmdResult<Option<String>>
|
|||||||
|
|
||||||
match CoreManager::global().change_core(&clash_core).await {
|
match CoreManager::global().change_core(&clash_core).await {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
|
logging_error!(
|
||||||
|
Type::Core,
|
||||||
|
Config::profiles().await.latest_arc().save_file().await
|
||||||
|
);
|
||||||
|
|
||||||
// 切换内核后重启内核
|
// 切换内核后重启内核
|
||||||
match CoreManager::global().restart_core().await {
|
match CoreManager::global().restart_core().await {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
@@ -89,6 +94,10 @@ pub async fn start_core() -> CmdResult {
|
|||||||
/// 关闭核心
|
/// 关闭核心
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn stop_core() -> CmdResult {
|
pub async fn stop_core() -> CmdResult {
|
||||||
|
logging_error!(
|
||||||
|
Type::Core,
|
||||||
|
Config::profiles().await.latest_arc().save_file().await
|
||||||
|
);
|
||||||
let result = CoreManager::global().stop_core().await.stringify_err();
|
let result = CoreManager::global().stop_core().await.stringify_err();
|
||||||
if result.is_ok() {
|
if result.is_ok() {
|
||||||
handle::Handle::refresh_clash();
|
handle::Handle::refresh_clash();
|
||||||
@@ -99,6 +108,10 @@ pub async fn stop_core() -> CmdResult {
|
|||||||
/// 重启核心
|
/// 重启核心
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn restart_core() -> CmdResult {
|
pub async fn restart_core() -> CmdResult {
|
||||||
|
logging_error!(
|
||||||
|
Type::Core,
|
||||||
|
Config::profiles().await.latest_arc().save_file().await
|
||||||
|
);
|
||||||
let result = CoreManager::global().restart_core().await.stringify_err();
|
let result = CoreManager::global().restart_core().await.stringify_err();
|
||||||
if result.is_ok() {
|
if result.is_ok() {
|
||||||
handle::Handle::refresh_clash();
|
handle::Handle::refresh_clash();
|
||||||
|
|||||||
Reference in New Issue
Block a user