Browse Source

Merge pull request #14570 from brvphoenix/decode

WebUI: Avoid decoding strings repeatedly
adaptive-webui-19844
Mike Tzou 4 years ago committed by GitHub
parent
commit
4e8eb2c996
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/webui/www/private/confirmfeeddeletion.html
  2. 2
      src/webui/www/private/confirmruleclear.html
  3. 2
      src/webui/www/private/confirmruledeletion.html
  4. 5
      src/webui/www/private/edittracker.html
  5. 2
      src/webui/www/private/rename.html
  6. 3
      src/webui/www/private/rename_file.html
  7. 4
      src/webui/www/private/scripts/mocha-init.js
  8. 2
      src/webui/www/private/setlocation.html
  9. 3
      src/webui/www/private/views/rss.html
  10. 6
      src/webui/www/private/views/rssDownloader.html

2
src/webui/www/private/confirmfeeddeletion.html

@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
noCache: true,
method: 'post',
data: {
path: path
path: decodeURIComponent(path)
},
onComplete: (response) => {
++completionCount;

2
src/webui/www/private/confirmruleclear.html

@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
new Event(e).stop();
let completionCount = 0;
rules.forEach((rule) => {
window.parent.qBittorrent.RssDownloader.modifyRuleState(rule, 'previouslyMatchedEpisodes', [], () => {
window.parent.qBittorrent.RssDownloader.modifyRuleState(decodeURIComponent(rule), 'previouslyMatchedEpisodes', [], () => {
++completionCount;
if (completionCount === rules.length) {
window.parent.qBittorrent.RssDownloader.updateRulesList();

2
src/webui/www/private/confirmruledeletion.html

@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
noCache: true,
method: 'post',
data: {
ruleName: rule
ruleName: decodeURIComponent(rule)
},
onComplete: (response) => {
++completionCount;

5
src/webui/www/private/edittracker.html

@ -33,8 +33,7 @@ @@ -33,8 +33,7 @@
if (!currentUrl)
return false;
const decodedUrl = decodeURIComponent(currentUrl);
$('trackerUrl').value = decodedUrl;
$('trackerUrl').value = currentUrl;
$('trackerUrl').focus();
$('editTrackerButton').addEvent('click', function(e) {
@ -45,7 +44,7 @@ @@ -45,7 +44,7 @@
method: 'post',
data: {
hash: hash,
origUrl: decodedUrl,
origUrl: currentUrl,
newUrl: $('trackerUrl').value
},
onComplete: function() {

2
src/webui/www/private/rename.html

@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
const name = new URI().getData('name');
// set text field to current value
if (name)
$('rename').value = decodeURIComponent(name);
$('rename').value = name;
$('rename').focus();
$('renameButton').addEvent('click', function(e) {

3
src/webui/www/private/rename_file.html

@ -32,10 +32,9 @@ @@ -32,10 +32,9 @@
window.addEvent('domready', function() {
const hash = new URI().getData('hash');
const path = new URI().getData('path');
const oldPath = new URI().getData('path');
const isFolder = ((new URI().getData('isFolder')) === 'true');
const oldPath = decodeURIComponent(path);
const oldName = window.qBittorrent.Filesystem.fileName(oldPath);
$('rename').value = oldName;
$('rename').focus();

4
src/webui/www/private/scripts/mocha-init.js

@ -120,9 +120,9 @@ const initializeWindows = function() { @@ -120,9 +120,9 @@ const initializeWindows = function() {
const id = 'downloadPage';
let contentUrl = 'download.html';
if (urls && (urls.length > 0)) {
contentUrl += ('?urls=' + urls.map(function(url) {
contentUrl += ('?urls=' + encodeURIComponent(urls.map(function(url) {
return encodeURIComponent(url);
}).join("|"));
}).join("|")));
}
new MochaUI.Window({

2
src/webui/www/private/setlocation.html

@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
const path = new URI().getData('path');
// set text field to current value
if (path)
$('setLocation').value = window.qBittorrent.Misc.escapeHtml(decodeURIComponent(path));
$('setLocation').value = window.qBittorrent.Misc.escapeHtml(path);
$('setLocation').focus();
$('setLocationButton').addEvent('click', function(e) {

3
src/webui/www/private/views/rss.html

@ -697,11 +697,12 @@ @@ -697,11 +697,12 @@
};
const removeItem = (paths) => {
const encodedPaths = paths.map((path) => encodeURIComponent(path));
new MochaUI.Window({
id: 'confirmFeedDeletionPage',
title: 'QBT_TR(Deletion confirmation)QBT_TR[CONTEXT=RSSWidget]',
loadMethod: 'iframe',
contentURL: 'confirmfeeddeletion.html?paths=' + encodeURIComponent(paths.join('|')),
contentURL: 'confirmfeeddeletion.html?paths=' + encodeURIComponent(encodedPaths.join('|')),
scrollbars: false,
resizable: false,
maximizable: false,

6
src/webui/www/private/views/rssDownloader.html

@ -535,11 +535,12 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also @@ -535,11 +535,12 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
};
const removeRules = (rules) => {
const encodedRules = rules.map((rule) => encodeURIComponent(rule));
new MochaUI.Window({
id: 'removeRulePage',
title: 'QBT_TR(Rule deletion confirmation)QBT_TR[CONTEXT=AutomatedRssDownloader]',
loadMethod: 'iframe',
contentURL: 'confirmruledeletion.html?rules=' + encodeURIComponent(rules.join('|')),
contentURL: 'confirmruledeletion.html?rules=' + encodeURIComponent(encodedRules.join('|')),
scrollbars: false,
resizable: false,
maximizable: false,
@ -549,11 +550,12 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also @@ -549,11 +550,12 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
};
const clearDownloadedEpisodes = (rules) => {
const encodedRules = rules.map((rule) => encodeURIComponent(rule));
new MochaUI.Window({
id: 'clearRulesPage',
title: 'QBT_TR(New rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]',
loadMethod: 'iframe',
contentURL: 'confirmruleclear.html?rules=' + encodeURIComponent(rules.join('|')),
contentURL: 'confirmruleclear.html?rules=' + encodeURIComponent(encodedRules.join('|')),
scrollbars: false,
resizable: false,
maximizable: false,

Loading…
Cancel
Save