Skip to content

Commit

Permalink
Remove 'no cache' directive for POST requests
Browse files Browse the repository at this point in the history
The response for POST request is only cachable under a specific condition and
qbt doesn't use it.
https://developer.mozilla.org/en-US/docs/Glossary/Cacheable
  • Loading branch information
Chocobo1 committed Feb 11, 2024
1 parent f7e9ff0 commit 8ef99b3
Show file tree
Hide file tree
Showing 20 changed files with 15 additions and 36 deletions.
1 change: 0 additions & 1 deletion src/webui/www/private/confirmfeeddeletion.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
paths.forEach((path) => {
new Request({
url: 'api/v2/rss/removeItem',
noCache: true,
method: 'post',
data: {
path: decodeURIComponent(path)
Expand Down
1 change: 0 additions & 1 deletion src/webui/www/private/confirmruledeletion.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
rules.forEach((rule) => {
new Request({
url: 'api/v2/rss/removeRule',
noCache: true,
method: 'post',
data: {
ruleName: decodeURIComponent(rule)
Expand Down
1 change: 0 additions & 1 deletion src/webui/www/private/newfeed.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

new Request({
url: 'api/v2/rss/addFeed',
noCache: true,
method: 'post',
data: {
url: feedURL,
Expand Down
1 change: 0 additions & 1 deletion src/webui/www/private/newfolder.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

new Request({
url: 'api/v2/rss/addFolder',
noCache: true,
method: 'post',
data: {
path: path ? (path + '\\' + folderName) : folderName
Expand Down
1 change: 0 additions & 1 deletion src/webui/www/private/newrule.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
$('submitButton').disabled = true;
new Request({
url: 'api/v2/rss/setRule',
noCache: true,
method: 'post',
data: {
ruleName: name,
Expand Down
1 change: 0 additions & 1 deletion src/webui/www/private/rename_feed.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@

new Request({
url: 'api/v2/rss/moveItem',
noCache: true,
method: 'post',
data: {
itemPath: oldPath,
Expand Down
1 change: 0 additions & 1 deletion src/webui/www/private/rename_rule.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
$('renameButton').disabled = true;
new Request({
url: 'api/v2/rss/renameRule',
noCache: true,
method: 'post',
data: {
ruleName: oldName,
Expand Down
2 changes: 1 addition & 1 deletion src/webui/www/private/scripts/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ window.qBittorrent.Download = (function() {
const getCategories = function() {
new Request.JSON({
url: 'api/v2/torrents/categories',
noCache: true,
method: 'get',
noCache: true,
onSuccess: function(data) {
if (data) {
categories = data;
Expand Down
2 changes: 1 addition & 1 deletion src/webui/www/private/scripts/prop-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ window.qBittorrent.PropFiles = (function() {
const url = new URI('api/v2/torrents/files?hash=' + current_hash);
new Request.JSON({
url: url,
noCache: true,
method: 'get',
noCache: true,
onComplete: function() {
clearTimeout(loadTorrentFilesDataTimer);
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(5000);
Expand Down
4 changes: 2 additions & 2 deletions src/webui/www/private/scripts/prop-general.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ window.qBittorrent.PropGeneral = (function() {
const url = new URI('api/v2/torrents/properties?hash=' + current_id);
new Request.JSON({
url: url,
noCache: true,
method: 'get',
noCache: true,
onFailure: function() {
$('error_div').set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
clearTimeout(loadTorrentDataTimer);
Expand Down Expand Up @@ -223,8 +223,8 @@ window.qBittorrent.PropGeneral = (function() {
const piecesUrl = new URI('api/v2/torrents/pieceStates?hash=' + current_id);
new Request.JSON({
url: piecesUrl,
noCache: true,
method: 'get',
noCache: true,
onFailure: function() {
$('error_div').set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
clearTimeout(loadTorrentDataTimer);
Expand Down
3 changes: 1 addition & 2 deletions src/webui/www/private/scripts/prop-peers.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ window.qBittorrent.PropPeers = (function() {
url.setData('hash', current_hash);
new Request.JSON({
url: url,
noCache: true,
method: 'get',
noCache: true,
onComplete: function() {
clearTimeout(loadTorrentPeersTimer);
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
Expand Down Expand Up @@ -144,7 +144,6 @@ window.qBittorrent.PropPeers = (function() {
if (confirm('QBT_TR(Are you sure you want to permanently ban the selected peers?)QBT_TR[CONTEXT=PeerListWidget]')) {
new Request({
url: 'api/v2/transfer/banPeers',
noCache: true,
method: 'post',
data: {
hash: torrentsTable.getCurrentTorrentID(),
Expand Down
2 changes: 1 addition & 1 deletion src/webui/www/private/scripts/prop-trackers.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ window.qBittorrent.PropTrackers = (function() {
const url = new URI('api/v2/torrents/trackers?hash=' + current_hash);
new Request.JSON({
url: url,
noCache: true,
method: 'get',
noCache: true,
onComplete: function() {
clearTimeout(loadTrackersDataTimer);
loadTrackersDataTimer = loadTrackersData.delay(10000);
Expand Down
2 changes: 1 addition & 1 deletion src/webui/www/private/scripts/prop-webseeds.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ window.qBittorrent.PropWebseeds = (function() {
const url = new URI('api/v2/torrents/webseeds?hash=' + current_hash);
new Request.JSON({
url: url,
noCache: true,
method: 'get',
noCache: true,
onFailure: function() {
$('error_div').set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
clearTimeout(loadWebSeedsDataTimer);
Expand Down
2 changes: 0 additions & 2 deletions src/webui/www/private/scripts/speedslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ MochaUI.extend({
else {
new Request.JSON({
url: 'api/v2/torrents/uploadLimit',
noCache: true,
method: 'post',
data: {
hashes: hashes.join('|')
Expand Down Expand Up @@ -189,7 +188,6 @@ MochaUI.extend({
else {
new Request.JSON({
url: 'api/v2/torrents/downloadLimit',
noCache: true,
method: 'post',
data: {
hashes: hashes.join('|')
Expand Down
1 change: 0 additions & 1 deletion src/webui/www/private/views/installsearchplugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ <h2>QBT_TR(Plugin path:)QBT_TR[CONTEXT=PluginSourceDlg]</h2>
if (path)
new Request({
url: 'api/v2/search/installPlugin',
noCache: true,
method: 'post',
data: {
sources: path,
Expand Down
2 changes: 1 addition & 1 deletion src/webui/www/private/views/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@

new Request.JSON({
url: url,
noCache: true,
method: 'get',
noCache: true,
onFailure: function(response) {
const errorDiv = $('error_div');
if (errorDiv)
Expand Down
5 changes: 1 addition & 4 deletions src/webui/www/private/views/rss.html
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@
const updateRssFeedList = () => {
new Request.JSON({
url: 'api/v2/rss/items',
noCache: true,
method: 'get',
noCache: true,
data: {
withData: true
},
Expand Down Expand Up @@ -668,7 +668,6 @@

new Request({
url: 'api/v2/rss/refreshItem',
noCache: true,
method: 'post',
data: {
itemPath: pathByFeedId.get(feedUid)
Expand Down Expand Up @@ -746,7 +745,6 @@
// send request
new Request({
url: 'api/v2/rss/markAsRead',
noCache: true,
method: 'post',
data: {
itemPath: path
Expand Down Expand Up @@ -787,7 +785,6 @@

new Request({
url: 'api/v2/rss/markAsRead',
noCache: true,
method: 'post',
data: {
itemPath: path,
Expand Down
10 changes: 4 additions & 6 deletions src/webui/www/private/views/rssDownloader.html
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@
// get all categories and add to combobox
new Request.JSON({
url: 'api/v2/torrents/categories',
noCache: true,
method: 'get',
noCache: true,
onSuccess: (response) => {
let combobox = $('assignCategoryCombobox');
for (let cat in response) {
Expand All @@ -450,8 +450,8 @@
// get all rss feed
new Request.JSON({
url: 'api/v2/rss/items',
noCache: true,
method: 'get',
noCache: true,
data: {
withData: false
},
Expand All @@ -478,8 +478,8 @@
// get all rules
new Request.JSON({
url: 'api/v2/rss/rules',
noCache: true,
method: 'get',
noCache: true,
onSuccess: (response) => {
rssDownloaderRulesTable.clear();
let rowCount = 0;
Expand All @@ -500,7 +500,6 @@
rulesList[rule][setting] = newState;
new Request({
url: 'api/v2/rss/setRule',
noCache: true,
method: 'post',
data: {
ruleName: rule,
Expand Down Expand Up @@ -627,7 +626,6 @@

new Request({
url: 'api/v2/rss/setRule',
noCache: true,
method: 'post',
data: {
ruleName: rule,
Expand All @@ -642,8 +640,8 @@
const updateMatchingArticles = (ruleName) => {
new Request.JSON({
url: 'api/v2/rss/matchingArticles',
noCache: true,
method: 'get',
noCache: true,
data: {
ruleName: ruleName
},
Expand Down
6 changes: 2 additions & 4 deletions src/webui/www/private/views/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@
const url = new URI('api/v2/search/start');
new Request.JSON({
url: url,
noCache: true,
method: 'post',
data: {
pattern: pattern,
Expand All @@ -323,7 +322,6 @@
const url = new URI('api/v2/search/stop');
new Request({
url: url,
noCache: true,
method: 'post',
data: {
id: activeSearchId
Expand Down Expand Up @@ -515,8 +513,8 @@
const getPlugins = function() {
new Request.JSON({
url: new URI('api/v2/search/plugins'),
noCache: true,
method: 'get',
noCache: true,
onSuccess: function(response) {
if (response !== prevSearchPluginsResponse) {
prevSearchPluginsResponse = response;
Expand Down Expand Up @@ -641,8 +639,8 @@
const url = new URI('api/v2/search/results');
new Request.JSON({
url: url,
noCache: true,
method: 'get',
noCache: true,
data: {
id: activeSearchId,
limit: maxResults,
Expand Down
3 changes: 0 additions & 3 deletions src/webui/www/private/views/searchplugins.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ <h2>QBT_TR(Installed search plugins:)QBT_TR[CONTEXT=PluginSelectDlg]</h2>
const url = new URI('api/v2/search/uninstallPlugin');
new Request({
url: url,
noCache: true,
method: 'post',
data: {
names: plugins,
Expand All @@ -155,7 +154,6 @@ <h2>QBT_TR(Installed search plugins:)QBT_TR[CONTEXT=PluginSelectDlg]</h2>
const url = new URI('api/v2/search/enablePlugin');
new Request({
url: url,
noCache: true,
method: 'post',
data: {
names: plugins.join('|'),
Expand All @@ -168,7 +166,6 @@ <h2>QBT_TR(Installed search plugins:)QBT_TR[CONTEXT=PluginSelectDlg]</h2>
const url = new URI('api/v2/search/updatePlugins');
new Request({
url: url,
noCache: true,
method: 'post'
}).send();
};
Expand Down

0 comments on commit 8ef99b3

Please sign in to comment.