mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-29 01:25:33 +08:00
Make import existing side-effect free (#2429)
Co-authored-by: Xvvln <3369759202@qq.com>
This commit is contained in:
@@ -268,8 +268,8 @@ impl McpService {
|
||||
state.db.save_mcp_server(&to_save)?;
|
||||
existing.insert(to_save.id.clone(), to_save.clone());
|
||||
|
||||
// 同步到对应应用 live 配置
|
||||
Self::sync_server_to_apps(state, &to_save)?;
|
||||
// 导入是读取已有配置,不应反向写回任何应用的 live 配置。
|
||||
// 显式编辑、启用/禁用或手动同步时再执行写回。
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,8 +306,8 @@ impl McpService {
|
||||
state.db.save_mcp_server(&to_save)?;
|
||||
existing.insert(to_save.id.clone(), to_save.clone());
|
||||
|
||||
// 同步到对应应用 live 配置
|
||||
Self::sync_server_to_apps(state, &to_save)?;
|
||||
// 导入是读取已有配置,不应反向写回任何应用的 live 配置。
|
||||
// 显式编辑、启用/禁用或手动同步时再执行写回。
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,8 +344,8 @@ impl McpService {
|
||||
state.db.save_mcp_server(&to_save)?;
|
||||
existing.insert(to_save.id.clone(), to_save.clone());
|
||||
|
||||
// 同步到对应应用 live 配置
|
||||
Self::sync_server_to_apps(state, &to_save)?;
|
||||
// 导入是读取已有配置,不应反向写回任何应用的 live 配置。
|
||||
// 显式编辑、启用/禁用或手动同步时再执行写回。
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,8 +382,8 @@ impl McpService {
|
||||
state.db.save_mcp_server(&to_save)?;
|
||||
existing.insert(to_save.id.clone(), to_save.clone());
|
||||
|
||||
// 同步到对应应用 live 配置
|
||||
Self::sync_server_to_apps(state, &to_save)?;
|
||||
// 导入是读取已有配置,不应反向写回任何应用的 live 配置。
|
||||
// 显式编辑、启用/禁用或手动同步时再执行写回。
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,8 +420,8 @@ impl McpService {
|
||||
state.db.save_mcp_server(&to_save)?;
|
||||
existing.insert(to_save.id.clone(), to_save.clone());
|
||||
|
||||
// 同步到对应应用 live 配置
|
||||
Self::sync_server_to_apps(state, &to_save)?;
|
||||
// 导入是读取已有配置,不应反向写回任何应用的 live 配置。
|
||||
// 显式编辑、启用/禁用或手动同步时再执行写回。
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1536,19 +1536,6 @@ impl SkillService {
|
||||
// 保存到数据库
|
||||
db.save_skill(&skill)?;
|
||||
|
||||
// 同步到已启用的应用目录(创建 symlink 或复制文件)
|
||||
for app in AppType::all() {
|
||||
if skill.apps.is_enabled_for(&app) {
|
||||
if let Err(e) = Self::sync_to_app_dir(&skill.directory, &app) {
|
||||
log::warn!(
|
||||
"导入后同步 Skill '{}' 到 {:?} 失败: {e:#}",
|
||||
skill.directory,
|
||||
app
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
imported.push(skill);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user