15 lines
473 B
Cheetah
15 lines
473 B
Cheetah
{{define "ping-script"}}
|
|
<script>
|
|
// Shared ping utility — warm-up fetch then measure
|
|
function popPing(dns) {
|
|
if (!dns) return Promise.resolve(null);
|
|
return fetch('https://' + dns + ':1984/ping').then(()=>{}).catch(()=>{}).then(() => {
|
|
const t0 = performance.now();
|
|
return fetch('https://' + dns + ':1984/ping').then(()=>{}).catch(()=>{}).then(() => {
|
|
return Math.round(performance.now() - t0);
|
|
});
|
|
});
|
|
}
|
|
</script>
|
|
{{end}}
|