fix: (regression beta) ddns was updated even without public-ip changing

Massimo Melina committed Jun 7, 2024 at 23:17 UTC 6faf4d68e83e27583ff08965f4c888c64f5cd3e5
1 file changed +4 -3
src/ddns.ts
+4 -3
@@ -14,13 +14,14 @@ const dynamicDnsUrl = defineConfig(CFG.dynamic_dns_url, '')
14 // listening this event will trigger public-ips fetching
15 const EVENT = 'publicIpsChanged'
16 let stopFetching: any
17 -let lastIps: any
17 +let lastIPs: any
18 events.onListeners(EVENT, cbs => {
19 stopFetching?.()
20 - if (!cbs?.size()) return
20 + if (!cbs?.size) return
21 stopFetching = repeat(HOUR, async () => {
22 const IPs = await getPublicIps()
23 - if (_.isEqual(lastIps, IPs)) return
23 + if (_.isEqual(lastIPs, IPs)) return
24 + lastIPs = IPs
25 events.emit(EVENT, {
26 IPs,
27 IPX: IPs[0] || '',