fix(ProxyManager): handle optional currentProxy in system proxy check and log changes (#8865)

This commit is contained in:
beyondkmp 2025-08-06 11:19:41 +08:00 committed by GitHub
parent 281c545a8f
commit 9e0aa1f3fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -87,10 +87,11 @@ export class ProxyManager {
// Set new interval
this.systemProxyInterval = setInterval(async () => {
const currentProxy = await getSystemProxy()
if (currentProxy && currentProxy.proxyUrl.toLowerCase() === this.config?.proxyRules) {
if (currentProxy?.proxyUrl.toLowerCase() === this.config?.proxyRules) {
return
}
logger.info(`system proxy changed: ${currentProxy?.proxyUrl}, this.config.proxyRules: ${this.config.proxyRules}`)
await this.configureProxy({
mode: 'system',
proxyRules: currentProxy?.proxyUrl.toLowerCase(),