Fix client info
All checks were successful
Deploy / deploy (push) Successful in 17s

This commit is contained in:
elijah 2024-11-05 01:57:55 +01:00
parent 3c8fe59e8c
commit 279ef6d807

View File

@ -78,7 +78,6 @@ function updateClientInfo() {
}
locationElement.classList.add("loading");
fetch(window.location.href)
.then((response) => {
const clientInfo = response.headers.get("X-Client-Info");
@ -86,20 +85,9 @@ function updateClientInfo() {
throw new Error("X-Client-Info header not present");
}
// Clean up the time value and convert units
const cleanClientInfo = clientInfo
// Replace UTF-8 encoded microsecond symbols
.replace(/\u00C2\u00B5s/g, "µs")
.replace(/µs/g, "µs")
// Convert microseconds to picoseconds for display
.replace(/(\d+\.?\d*)\s*µs/g, (match, number) => {
const picoseconds = parseFloat(number) * 1000000;
return `${picoseconds.toLocaleString(undefined, {
maximumFractionDigits: 2,
})} ps`;
})
// Remove any other non-ASCII characters
.replace(/[\u0080-\u00FF]/g, "")
.trim();
requestAnimationFrame(() => {