v0.2.18
RustBox CI / rustbox (push) Canceled after 0s

This commit is contained in:
Mateusz Gruszczyński committed 2026-11-03 12:11:13 +01:00
1 parent 1bb398acd1
commit 1309358b68
17 files changed
+239 -50

No files matched your search

+12 -1
View File
@@ -68,6 +68,7 @@
realtimeSeenEvents: new Map(),
realtimeNotifiedMessages: new Map(),
realtimeNotificationSuppressions: new Map(),
realtimeNotificationSuppressedMessages: new Map(),
realtimeNotificationsReady: false,
realtimeNotificationsArmRequested: false,
realtimeNotificationsReadyTimer: null,
@@ -166,7 +167,17 @@
}
function sanitizeMessagePreviewHtml(html) {
const doc = new DOMParser().parseFromString(sanitizeMessageHtml(html), "text/html");
const source = stripRustBoxUiLeak(html);
const sourceDoc = new DOMParser().parseFromString(source, "text/html");
const headStyles = [...sourceDoc.head.querySelectorAll("style")]
.map((node) => String(node.textContent || "").replace(/@import\s+(?:url\()?[^;]+;?/gi, ""))
.filter((css) => css.trim());
const doc = new DOMParser().parseFromString(sanitizeMessageHtml(source), "text/html");
for (const css of headStyles.reverse()) {
const style = doc.createElement("style");
style.textContent = css;
doc.body.prepend(style);
}
doc.querySelectorAll("a[href]").forEach((node) => {
if (!node.hasAttribute("target")) node.setAttribute("target", "_blank");
const target = String(node.getAttribute("target") || "").toLowerCase();