mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 00:17:23 -06:00
WebUI: fix dark mode in RSS entry viewer
Use `allow-same-origin` sandbox directive to allow fetching the parent CSS. PR #22536.
This commit is contained in:
@@ -494,10 +494,18 @@
|
|||||||
detailsView.append(divElement);
|
detailsView.append(divElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place in iframe with sandbox attribute to prevent js execution
|
const articleDescription = article.description;
|
||||||
const torrentDescription = document.createRange().createContextualFragment('<iframe sandbox id="rssDescription"></iframe>');
|
if (articleDescription !== undefined) {
|
||||||
$("rssDetailsView").append(torrentDescription);
|
const rootColor = document.documentElement.classList.contains("dark") ? "class='dark'" : "";
|
||||||
document.getElementById("rssDescription").srcdoc = `<html><head><link rel="stylesheet" type="text/css" href="css/style.css"></head><body>${article.description}</body></html>`;
|
|
||||||
|
// Place in iframe with sandbox attribute to prevent js execution
|
||||||
|
const iframeElement = document.createElement("iframe");
|
||||||
|
iframeElement.id = "rssDescription";
|
||||||
|
iframeElement.sandbox = "allow-same-origin"; // allowed to get parent css
|
||||||
|
iframeElement.srcdoc = `<html ${rootColor}><head><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="css/style.css?v=${CACHEID}"></head><body>${articleDescription}</body></html>`;
|
||||||
|
|
||||||
|
detailsView.append(iframeElement);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateRssFeedList = () => {
|
const updateRssFeedList = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user