mirror of
https://github.com/tormachris/cf-workers-status-page.git
synced 2024-11-23 22:45:43 +01:00
PoP location detection
This commit is contained in:
parent
8eadbb32ac
commit
01c058ed1b
@ -64,10 +64,11 @@ export async function processCronTrigger(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save last check timestamp including PoP location
|
// save last check timestamp including PoP location
|
||||||
const res = await fetch("https://www.cloudflare.com/cdn-cgi/trace")
|
const res = await fetch('https://cloudflare-dns.com/dns-query', {
|
||||||
const resText = await res.text()
|
method: 'OPTIONS',
|
||||||
const loc = /loc=([\w]{2})/.exec(resText)[1]
|
})
|
||||||
await setKV('lastUpdate', Date.now(), {loc})
|
const loc = res.headers.get('cf-ray').split('-')[1]
|
||||||
|
await setKV('lastUpdate', Date.now(), { loc })
|
||||||
|
|
||||||
// gc monitor statuses
|
// gc monitor statuses
|
||||||
event.waitUntil(gcMonitors(config))
|
event.waitUntil(gcMonitors(config))
|
||||||
|
Loading…
Reference in New Issue
Block a user