feat(config): 支持共享代理配置文件,发布 0.5.2

This commit is contained in:
yml
2026-11-20 13:20:12 +08:00
parent 635d80e63e
commit f4b3cfa486
13 changed files with 595 additions and 6 deletions
+18
View File
@@ -183,6 +183,24 @@ func (a *App) Startup(ctx context.Context) {
// 优先初始化调度器和账号库,避免前端首屏请求早于启动网络探测时读到 nil。
cfg := config.LoadConfig(a.paths.ConfigFile)
sharedPath := strings.TrimSpace(cfg.SharedProxyConfigFile)
if sharedPath == "" {
if inheritedPath, err := config.LoadSharedProxyConfigPointer(); err != nil {
logger.LogEvent("配置", "warn", "读取本机共享代理配置路径失败: %v", err)
} else {
sharedPath = strings.TrimSpace(inheritedPath)
}
}
if sharedPath != "" {
cfg.SharedProxyConfigFile = sharedPath
shared, err := config.LoadSharedProxyConfig(sharedPath)
if err != nil {
logger.LogEvent("配置", "warn", "启动加载共享代理配置失败,继续使用本机配置: %v", err)
} else {
config.ApplySharedProxyConfig(&cfg, shared)
logger.LogEvent("配置", "success", "已加载共享代理配置: %s", sharedPath)
}
}
a.setCfg(cfg)
logger.SetMinLevel(cfg.LogLevel)
a.replaceTrace(cfg)