Skip to content

Commit 54e6a4f

Browse files
committed
WebUI: disallow unnecessary quotes in property name
Those two forms are the same and from now on we enforce to one style.
1 parent a841fe9 commit 54e6a4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+142
-141
lines changed

src/webui/www/eslint.config.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default [
4242
"Stylistic/no-mixed-operators": [
4343
"error",
4444
{
45-
"groups": [
45+
groups: [
4646
["&", "|", "^", "~", "<<", ">>", ">>>", "==", "!=", "===", "!==", ">", ">=", "<", "<=", "&&", "||", "in", "instanceof"]
4747
]
4848
}
@@ -52,12 +52,13 @@ export default [
5252
"error",
5353
"double",
5454
{
55-
"avoidEscape": true,
56-
"allowTemplateLiterals": true
55+
avoidEscape: true,
56+
allowTemplateLiterals: true
5757
}
5858
],
59+
"Stylistic/quote-props": ["error", "consistent-as-needed"],
5960
"Stylistic/semi": "error",
60-
"Stylistic/spaced-comment": ["error", "always", { "exceptions": ["*"] }]
61+
"Stylistic/spaced-comment": ["error", "always", { exceptions: ["*"] }]
6162
}
6263
}
6364
];

src/webui/www/private/addpeers.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
fetch("api/v2/torrents/addPeers", {
4040
method: "POST",
4141
body: new URLSearchParams({
42-
"hashes": hash,
43-
"peers": peers.join("|")
42+
hashes: hash,
43+
peers: peers.join("|")
4444
})
4545
})
4646
.then((response) => {

src/webui/www/private/addtrackers.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
fetch("api/v2/torrents/addTrackers", {
3131
method: "POST",
3232
body: new URLSearchParams({
33-
"hash": new URI().getData("hash"),
34-
"urls": $("trackersUrls").value
33+
hash: new URI().getData("hash"),
34+
urls: $("trackersUrls").value
3535
})
3636
})
3737
.then((response) => {

src/webui/www/private/addwebseeds.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
fetch("api/v2/torrents/addWebSeeds", {
3030
method: "POST",
3131
body: new URLSearchParams({
32-
"hash": new URI().getData("hash"),
33-
"urls": $("urls").value.split("\n").map(w => encodeURIComponent(w.trim())).filter(w => (w.length > 0)).join("|")
32+
hash: new URI().getData("hash"),
33+
urls: $("urls").value.split("\n").map(w => encodeURIComponent(w.trim())).filter(w => (w.length > 0)).join("|")
3434
})
3535
})
3636
.then((response) => {

src/webui/www/private/confirmfeeddeletion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
fetch("api/v2/rss/removeItem", {
3030
method: "POST",
3131
body: new URLSearchParams({
32-
"path": decodeURIComponent(path)
32+
path: decodeURIComponent(path)
3333
})
3434
})
3535
.then((response) => {

src/webui/www/private/confirmruledeletion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
fetch("api/v2/rss/removeRule", {
3131
method: "POST",
3232
body: new URLSearchParams({
33-
"ruleName": decodeURIComponent(rule)
33+
ruleName: decodeURIComponent(rule)
3434
})
3535
})
3636
.then((response) => {

src/webui/www/private/confirmtrackerdeletion.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
fetch("api/v2/torrents/removeTrackers", {
2929
method: "POST",
3030
body: new URLSearchParams({
31-
"hash": "*",
32-
"urls": urls
31+
hash: "*",
32+
urls: urls
3333
})
3434
})
3535
.then((response) => {

src/webui/www/private/downloadlimit.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
fetch("api/v2/transfer/setDownloadLimit", {
5454
method: "POST",
5555
body: new URLSearchParams({
56-
"limit": limit
56+
limit: limit
5757
})
5858
})
5959
.then(async (response) => {
@@ -68,8 +68,8 @@
6868
fetch("api/v2/torrents/setDownloadLimit", {
6969
method: "POST",
7070
body: new URLSearchParams({
71-
"hashes": hashes.join("|"),
72-
"limit": limit
71+
hashes: hashes.join("|"),
72+
limit: limit
7373
})
7474
})
7575
.then(async (response) => {

src/webui/www/private/editfeedurl.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
fetch("api/v2/rss/setFeedURL", {
5555
method: "POST",
5656
body: new URLSearchParams({
57-
"path": new URI().getData("path"),
58-
"url": newUrl
57+
path: new URI().getData("path"),
58+
url: newUrl
5959
})
6060
})
6161
.then(async (response) => {

src/webui/www/private/edittracker.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
fetch("api/v2/torrents/editTracker", {
4141
method: "POST",
4242
body: new URLSearchParams({
43-
"hash": new URI().getData("hash"),
44-
"origUrl": currentUrl,
45-
"newUrl": $("trackerUrl").value
43+
hash: new URI().getData("hash"),
44+
origUrl: currentUrl,
45+
newUrl: $("trackerUrl").value
4646
})
4747
})
4848
.then((response) => {

src/webui/www/private/editwebseed.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
fetch("api/v2/torrents/editWebSeed", {
3737
method: "POST",
3838
body: new URLSearchParams({
39-
"hash": new URI().getData("hash"),
40-
"origUrl": origUrl,
41-
"newUrl": encodeURIComponent($("url").value.trim())
39+
hash: new URI().getData("hash"),
40+
origUrl: origUrl,
41+
newUrl: encodeURIComponent($("url").value.trim())
4242
})
4343
})
4444
.then((response) => {

src/webui/www/private/newcategory.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
fetch("api/v2/torrents/createCategory", {
7676
method: "POST",
7777
body: new URLSearchParams({
78-
"category": categoryName,
79-
"savePath": savePath
78+
category: categoryName,
79+
savePath: savePath
8080
})
8181
})
8282
.then((response) => {
@@ -88,8 +88,8 @@
8888
fetch("api/v2/torrents/setCategory", {
8989
method: "POST",
9090
body: new URLSearchParams({
91-
"hashes": uriHashes,
92-
"category": categoryName
91+
hashes: uriHashes,
92+
category: categoryName
9393
})
9494
})
9595
.then((response) => {
@@ -111,8 +111,8 @@
111111
fetch("api/v2/torrents/createCategory", {
112112
method: "POST",
113113
body: new URLSearchParams({
114-
"category": categoryName,
115-
"savePath": savePath
114+
category: categoryName,
115+
savePath: savePath
116116
})
117117
})
118118
.then((response) => {
@@ -130,8 +130,8 @@
130130
fetch("api/v2/torrents/editCategory", {
131131
method: "POST",
132132
body: new URLSearchParams({
133-
"category": uriCategoryName, // category name can't be changed
134-
"savePath": savePath
133+
category: uriCategoryName, // category name can't be changed
134+
savePath: savePath
135135
})
136136
})
137137
.then((response) => {

src/webui/www/private/newfeed.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
fetch("api/v2/rss/addFeed", {
4646
method: "POST",
4747
body: new URLSearchParams({
48-
"url": feedURL,
49-
"path": path ? (path + "\\" + feedURL) : ""
48+
url: feedURL,
49+
path: path ? (path + "\\" + feedURL) : ""
5050
})
5151
})
5252
.then(async (response) => {

src/webui/www/private/newfolder.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
fetch("api/v2/rss/addFolder", {
4747
method: "POST",
4848
body: new URLSearchParams({
49-
"path": path ? (path + "\\" + folderName) : folderName
49+
path: path ? (path + "\\" + folderName) : folderName
5050
})
5151
})
5252
.then(async (response) => {

src/webui/www/private/newrule.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
fetch("api/v2/rss/setRule", {
4444
method: "POST",
4545
body: new URLSearchParams({
46-
"ruleName": name,
47-
"ruleDef": "{}"
46+
ruleName: name,
47+
ruleDef: "{}"
4848
})
4949
})
5050
.then((response) => {

src/webui/www/private/newtag.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
fetch("api/v2/torrents/addTags", {
6060
method: "POST",
6161
body: new URLSearchParams({
62-
"hashes": uriHashes,
63-
"tags": tagName
62+
hashes: uriHashes,
63+
tags: tagName
6464
})
6565
})
6666
.then(async (response) => {
@@ -78,7 +78,7 @@
7878
fetch("api/v2/torrents/createTags", {
7979
method: "POST",
8080
body: new URLSearchParams({
81-
"tags": tagName
81+
tags: tagName
8282
})
8383
})
8484
.then(async (response) => {

src/webui/www/private/rename.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
fetch("api/v2/torrents/rename", {
4848
method: "POST",
4949
body: new URLSearchParams({
50-
"hash": hash,
51-
"name": name
50+
hash: hash,
51+
name: name
5252
})
5353
})
5454
.then((response) => {

src/webui/www/private/rename_feed.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
fetch("api/v2/rss/moveItem", {
5555
method: "POST",
5656
body: new URLSearchParams({
57-
"itemPath": oldPath,
58-
"destPath": newPath
57+
itemPath: oldPath,
58+
destPath: newPath
5959
})
6060
})
6161
.then(async (response) => {

src/webui/www/private/rename_file.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363
fetch((isFolder ? "api/v2/torrents/renameFolder" : "api/v2/torrents/renameFile"), {
6464
method: "POST",
6565
body: new URLSearchParams({
66-
"hash": hash,
67-
"oldPath": oldPath,
68-
"newPath": newPath
66+
hash: hash,
67+
oldPath: oldPath,
68+
newPath: newPath
6969
})
7070
})
7171
.then((response) => {

src/webui/www/private/rename_files.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@
6464
new Keyboard({
6565
defaultEventType: "keydown",
6666
events: {
67-
"Escape": function(event) {
68-
window.qBittorrent.Client.closeWindow(windowEl);
69-
event.preventDefault();
70-
},
71-
"Esc": function(event) {
72-
window.qBittorrent.Client.closeWindow(windowEl);
73-
event.preventDefault();
74-
}
67+
Escape: (event) => {
68+
window.qBittorrent.Client.closeWindow(windowEl);
69+
event.preventDefault();
70+
},
71+
Esc: (event) => {
72+
window.qBittorrent.Client.closeWindow(windowEl);
73+
event.preventDefault();
74+
}
7575
}
7676
}).activate();
7777

src/webui/www/private/rename_rule.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
fetch("api/v2/rss/renameRule", {
5555
method: "POST",
5656
body: new URLSearchParams({
57-
"ruleName": oldName,
58-
"newRuleName": newName
57+
ruleName: oldName,
58+
newRuleName: newName
5959
})
6060
})
6161
.then((response) => {

src/webui/www/private/scripts/cache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ window.qBittorrent.Cache ??= (() => {
121121
fetch("api/v2/app/setPreferences", {
122122
method: "POST",
123123
body: new URLSearchParams({
124-
"json": JSON.stringify(obj.data)
124+
json: JSON.stringify(obj.data)
125125
})
126126
})
127127
.then(async (response) => {

src/webui/www/private/scripts/client.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -724,25 +724,25 @@ window.addEventListener("DOMContentLoaded", () => {
724724
};
725725

726726
const statusSortOrder = Object.freeze({
727-
"unknown": -1,
728-
"forcedDL": 0,
729-
"downloading": 1,
730-
"forcedMetaDL": 2,
731-
"metaDL": 3,
732-
"stalledDL": 4,
733-
"forcedUP": 5,
734-
"uploading": 6,
735-
"stalledUP": 7,
736-
"checkingResumeData": 8,
737-
"queuedDL": 9,
738-
"queuedUP": 10,
739-
"checkingUP": 11,
740-
"checkingDL": 12,
741-
"stoppedDL": 13,
742-
"stoppedUP": 14,
743-
"moving": 15,
744-
"missingFiles": 16,
745-
"error": 17
727+
unknown: -1,
728+
forcedDL: 0,
729+
downloading: 1,
730+
forcedMetaDL: 2,
731+
metaDL: 3,
732+
stalledDL: 4,
733+
forcedUP: 5,
734+
uploading: 6,
735+
stalledUP: 7,
736+
checkingResumeData: 8,
737+
queuedDL: 9,
738+
queuedUP: 10,
739+
checkingUP: 11,
740+
checkingDL: 12,
741+
stoppedDL: 13,
742+
stoppedUP: 14,
743+
moving: 15,
744+
missingFiles: 16,
745+
error: 17
746746
});
747747

748748
let syncMainDataTimeoutID = -1;

0 commit comments

Comments
 (0)