WebUI: Support updating RSS feed URL

PR #21371.

Signed-off-by: Thomas Piccirello <thomas@piccirello.com>
This commit is contained in:
Thomas Piccirello
2024-09-30 05:34:37 -04:00
committed by GitHub
parent 3888b465d8
commit 50acb670b0
3 changed files with 114 additions and 1 deletions

View File

@@ -156,6 +156,7 @@
<li><a href="#update"><img src="images/view-refresh.svg" alt="QBT_TR(Update)QBT_TR[CONTEXT=RSSWidget]"> QBT_TR(Update)QBT_TR[CONTEXT=RSSWidget]</a></li>
<li><a href="#markRead"><img src="images/task-complete.svg" alt="QBT_TR(Mark items read)QBT_TR[CONTEXT=RSSWidget]"> QBT_TR(Mark items read)QBT_TR[CONTEXT=RSSWidget]</a></li>
<li class="separator"><a href="#rename"><img src="images/edit-rename.svg" alt="QBT_TR(Rename...)QBT_TR[CONTEXT=RSSWidget]"> QBT_TR(Rename...)QBT_TR[CONTEXT=RSSWidget]</a></li>
<li><a href="#edit"><img src="images/edit-rename.svg" alt="QBT_TR(Edit feed URL...)QBT_TR[CONTEXT=RSSWidget]"> QBT_TR(Edit feed URL...)QBT_TR[CONTEXT=RSSWidget]</a></li>
<li><a href="#delete"><img src="images/edit-clear.svg" alt="QBT_TR(Delete)QBT_TR[CONTEXT=RSSWidget]"> QBT_TR(Delete)QBT_TR[CONTEXT=RSSWidget]</a></li>
<li class="separator"><a href="#newSubscription"><img src="images/list-add.svg" alt="QBT_TR(New subscription...)QBT_TR[CONTEXT=RSSWidget]"> QBT_TR(New subscription...)QBT_TR[CONTEXT=RSSWidget]</a></li>
@@ -236,6 +237,10 @@
rename: (el) => {
moveItem(rssFeedTable.getRow(rssFeedTable.selectedRows[0]).full_data.dataPath);
},
edit: (el) => {
const data = rssFeedTable.getRow(rssFeedTable.selectedRows[0]).full_data;
editUrl(data.dataPath, data.dataUrl);
},
delete: (el) => {
const selectedDatapaths = rssFeedTable.selectedRows
.filter((rowID) => rowID !== "0")
@@ -499,7 +504,8 @@
match = true;
for (let i = 0; i < flattenedResp.length; ++i) {
if (((flattenedResp[i].uid ? flattenedResp[i].uid : "") !== rssFeedRows[i + 1].full_data.dataUid)
|| (flattenedResp[i].fullName !== rssFeedRows[i + 1].full_data.dataPath)) {
|| (flattenedResp[i].fullName !== rssFeedRows[i + 1].full_data.dataPath)
|| (flattenedResp[i].url !== rssFeedRows[i + 1].full_data.dataUrl)) {
match = false;
break;
}
@@ -729,6 +735,21 @@
});
};
const editUrl = (path, url) => {
new MochaUI.Window({
id: "editFeedURL",
icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Please type a RSS feed URL)QBT_TR[CONTEXT=RSSWidget]",
loadMethod: "iframe",
contentURL: new URI("editfeedurl.html").setData("path", path).setData("url", url).toString(),
scrollbars: false,
resizable: false,
maximizable: false,
width: 350,
height: 100
});
};
const removeItem = (paths) => {
const encodedPaths = paths.map((path) => encodeURIComponent(path));
new MochaUI.Window({