(opts = {})
| 48 | } |
| 49 | |
| 50 | function clearSettings(opts = {}) { |
| 51 | try { |
| 52 | const file = getSettingsFile(); |
| 53 | if (fs.existsSync(file)) { |
| 54 | const current = readSettings(); |
| 55 | const proxyPid = current.proxy?.pid; |
| 56 | if (!opts.force && proxyPid && proxyPid !== process.pid) return false; |
| 57 | delete current.proxy; |
| 58 | fs.writeFileSync(file, JSON.stringify(current, null, 2), 'utf8'); |
| 59 | return true; |
| 60 | } |
| 61 | } catch {} |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | function isStaleProxy() { |
| 66 | const settings = readSettings(); |
no test coverage detected