()
| 65 | * 加载代理配置 |
| 66 | */ |
| 67 | export function loadProxyConfig(): ProxyConfig { |
| 68 | const configPath = getConfigPath() |
| 69 | |
| 70 | if (!fs.existsSync(configPath)) { |
| 71 | return { ...DEFAULT_CONFIG } |
| 72 | } |
| 73 | |
| 74 | try { |
| 75 | const content = fs.readFileSync(configPath, 'utf-8') |
| 76 | const data = JSON.parse(content) |
| 77 | return migrateOldConfig(data) |
| 78 | } catch { |
| 79 | return { ...DEFAULT_CONFIG } |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * 保存代理配置 |
no test coverage detected