mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 05:13:30 -07: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:
parent
9331580e86
commit
5465605377
1 changed files with 12 additions and 4 deletions
|
@ -494,10 +494,18 @@
|
|||
detailsView.append(divElement);
|
||||
}
|
||||
|
||||
// Place in iframe with sandbox attribute to prevent js execution
|
||||
const torrentDescription = document.createRange().createContextualFragment('<iframe sandbox id="rssDescription"></iframe>');
|
||||
$("rssDetailsView").append(torrentDescription);
|
||||
document.getElementById("rssDescription").srcdoc = `<html><head><link rel="stylesheet" type="text/css" href="css/style.css"></head><body>${article.description}</body></html>`;
|
||||
const articleDescription = article.description;
|
||||
if (articleDescription !== undefined) {
|
||||
const rootColor = document.documentElement.classList.contains("dark") ? "class='dark'" : "";
|
||||
|
||||
// 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 = () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue