mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 08:27:24 -06:00
WebUI: iterate over own properties only
This commit is contained in:
@@ -825,6 +825,9 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
if (response["torrents"]) {
|
||||
let updateTorrentList = false;
|
||||
for (const key in response["torrents"]) {
|
||||
if (!Object.hasOwn(response["torrents"], key))
|
||||
continue;
|
||||
|
||||
response["torrents"][key]["hash"] = key;
|
||||
response["torrents"][key]["rowId"] = key;
|
||||
if (response["torrents"][key]["state"])
|
||||
@@ -853,8 +856,11 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
torrentsTable.altRow();
|
||||
if (response["server_state"]) {
|
||||
const tmp = response["server_state"];
|
||||
for (const k in tmp)
|
||||
for (const k in tmp) {
|
||||
if (!Object.hasOwn(tmp, k))
|
||||
continue;
|
||||
serverState[k] = tmp[k];
|
||||
}
|
||||
processServerState();
|
||||
}
|
||||
updateFiltersList();
|
||||
|
||||
@@ -47,6 +47,9 @@ window.qBittorrent.Download = (function() {
|
||||
if (data) {
|
||||
categories = data;
|
||||
for (const i in data) {
|
||||
if (!Object.hasOwn(data, i))
|
||||
continue;
|
||||
|
||||
const category = data[i];
|
||||
const option = new Element("option");
|
||||
option.set("value", category.name);
|
||||
|
||||
@@ -672,8 +672,11 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
row = this.rows.get(rowId);
|
||||
|
||||
row["data"] = data;
|
||||
for (const x in data)
|
||||
for (const x in data) {
|
||||
if (!Object.hasOwn(data, x))
|
||||
continue;
|
||||
row["full_data"][x] = data[x];
|
||||
}
|
||||
},
|
||||
|
||||
getFilteredAndSortedRows: function() {
|
||||
|
||||
@@ -80,8 +80,10 @@ window.qBittorrent.PropPeers = (function() {
|
||||
syncTorrentPeersLastResponseId = response["rid"];
|
||||
if (response["peers"]) {
|
||||
for (const key in response["peers"]) {
|
||||
response["peers"][key]["rowId"] = key;
|
||||
if (!Object.hasOwn(response["peers"], key))
|
||||
continue;
|
||||
|
||||
response["peers"][key]["rowId"] = key;
|
||||
torrentPeersTable.updateRowData(response["peers"][key]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,6 +199,8 @@ window.qBittorrent.MultiRename = (function() {
|
||||
}
|
||||
// Replace named groups
|
||||
for (const namedGroup in match.groups) {
|
||||
if (!Object.hasOwn(match.groups, namedGroup))
|
||||
continue;
|
||||
replacement = replaceGroup(replacement, `$${namedGroup}`, match.groups[namedGroup], "\\", false);
|
||||
}
|
||||
// Replace auxiliary variables
|
||||
|
||||
Reference in New Issue
Block a user