fix for firefox 52

This commit is contained in:
murdle 2025-12-20 23:59:30 +02:00
parent 8f34654929
commit d8ec3ce019
4 changed files with 34 additions and 15 deletions

View File

@ -7,12 +7,15 @@ async function isPushRegistered() {
checkServiceWorkerSupport();
try {
const registrations = await navigator.serviceWorker.getRegistrations();
if (!registrations?.length) return false;
if (!registrations || registrations.length === 0) return false;
return await Promise.any(
registrations.map(async (reg) => !!(await reg.pushManager.getSubscription()))
).catch(() => false);
} catch {
for (let reg of registrations) {
const subscription = await reg.pushManager.getSubscription();
if (subscription) return true;
}
return false;
} catch (error) {
return false;
}
}

View File

@ -14,7 +14,10 @@ window.RTCPeerConnection = function (...args) {
const lines = offer.sdp.split("\n");
for (const line of lines) {
if (line.includes("a=fingerprint")) {
fingerprint = line.split("a=fingerprint:")[1]?.trim() ?? null;
const fingerprintMatch = line.split("a=fingerprint:")[1];
if (fingerprintMatch) {
fingerprint = fingerprintMatch.trim();
}
}
}
}

View File

@ -23,7 +23,7 @@ function loadConfig() {
...DEFAULT_CONFIG,
...JSON.parse(localStorage_.getItem(CONFIG_KEY) || "{}")
};
} catch {
} catch(error) {
return { ...DEFAULT_CONFIG };
}
}

View File

@ -32,14 +32,26 @@
if (document.querySelector("[data-join-date]")) return;
const nitroBadge = document.querySelector(CSS_CLASSES.nitroBadge);
const date = nitroBadge?.getAttribute("aria-label")?.replace("Subscriber since ", "");
if (!date) return;
if (!nitroBadge) return;
const date = nitroBadge.getAttribute("aria-label");
if (date) {
const formattedDate = date.replace("Subscriber since ", "");
if (!formattedDate) return;
}
const isCompact = !!document.querySelector("h3.bodyTitle-2Az3VQ");
const anchor = [...document.querySelectorAll("h3")].find(h =>
(h.className.includes("bodyTitle") && h.textContent.includes("Role")) ||
h.textContent.trim() === "Note"
);
const h3Elements = document.querySelectorAll("h3");
let anchor = null;
for (let i = 0; i < h3Elements.length; i++) {
const h = h3Elements[i];
if ((h.className.indexOf("bodyTitle") > -1 && h.textContent.indexOf("Role") > -1) ||
h.textContent.trim() === "Note") {
anchor = h;
break;
}
}
if (!anchor) return;
const infoText = document.createElement("div");
@ -50,7 +62,7 @@
const dateText = document.createElement("div");
dateText.className = isCompact ? CSS_CLASSES.userInfoBody : CSS_CLASSES.userInfoText;
dateText.textContent = date;
dateText.textContent = formattedDate;
dateText.dataset.joinDate = "value";
if (isCompact) {
@ -64,7 +76,8 @@
}
infoText.style.marginTop = isNewSection ? "0px" : "10px";
infoSection.append(infoText, dateText);
infoSection.appendChild(infoText);
infoSection.appendChild(dateText);
} else {
anchor.parentNode.insertBefore(infoText, anchor);
anchor.parentNode.insertBefore(dateText, anchor);