Remove 'no cache' directive for POST requests

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
This commit is contained in:
Chocobo1 2024-02-09 14:56:17 +08:00
parent f7e9ff0fb0
commit 8ef99b336c
20 changed files with 15 additions and 36 deletions

View file

@ -23,7 +23,6 @@
paths.forEach((path) => {
new Request({
url: 'api/v2/rss/removeItem',
noCache: true,
method: 'post',
data: {
path: decodeURIComponent(path)

View file

@ -24,7 +24,6 @@
rules.forEach((rule) => {
new Request({
url: 'api/v2/rss/removeRule',
noCache: true,
method: 'post',
data: {
ruleName: decodeURIComponent(rule)

View file

@ -44,7 +44,6 @@
new Request({
url: 'api/v2/rss/addFeed',
noCache: true,
method: 'post',
data: {
url: feedURL,

View file

@ -44,7 +44,6 @@
new Request({
url: 'api/v2/rss/addFolder',
noCache: true,
method: 'post',
data: {
path: path ? (path + '\\' + folderName) : folderName

View file

@ -41,7 +41,6 @@
$('submitButton').disabled = true;
new Request({
url: 'api/v2/rss/setRule',
noCache: true,
method: 'post',
data: {
ruleName: name,

View file

@ -53,7 +53,6 @@
new Request({
url: 'api/v2/rss/moveItem',
noCache: true,
method: 'post',
data: {
itemPath: oldPath,

View file

@ -52,7 +52,6 @@
$('renameButton').disabled = true;
new Request({
url: 'api/v2/rss/renameRule',
noCache: true,
method: 'post',
data: {
ruleName: oldName,

View file

@ -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;

View file

@ -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);

View file

@ -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);
@ -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);

View file

@ -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());
@ -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(),

View file

@ -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);

View file

@ -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);

View file

@ -85,7 +85,6 @@ MochaUI.extend({
else {
new Request.JSON({
url: 'api/v2/torrents/uploadLimit',
noCache: true,
method: 'post',
data: {
hashes: hashes.join('|')
@ -189,7 +188,6 @@ MochaUI.extend({
else {
new Request.JSON({
url: 'api/v2/torrents/downloadLimit',
noCache: true,
method: 'post',
data: {
hashes: hashes.join('|')

View file

@ -65,7 +65,6 @@
if (path)
new Request({
url: 'api/v2/search/installPlugin',
noCache: true,
method: 'post',
data: {
sources: path,

View file

@ -361,8 +361,8 @@
new Request.JSON({
url: url,
noCache: true,
method: 'get',
noCache: true,
onFailure: function(response) {
const errorDiv = $('error_div');
if (errorDiv)

View file

@ -446,8 +446,8 @@
const updateRssFeedList = () => {
new Request.JSON({
url: 'api/v2/rss/items',
noCache: true,
method: 'get',
noCache: true,
data: {
withData: true
},
@ -668,7 +668,6 @@
new Request({
url: 'api/v2/rss/refreshItem',
noCache: true,
method: 'post',
data: {
itemPath: pathByFeedId.get(feedUid)
@ -746,7 +745,6 @@
// send request
new Request({
url: 'api/v2/rss/markAsRead',
noCache: true,
method: 'post',
data: {
itemPath: path
@ -787,7 +785,6 @@
new Request({
url: 'api/v2/rss/markAsRead',
noCache: true,
method: 'post',
data: {
itemPath: path,

View file

@ -436,8 +436,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
// 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) {
@ -450,8 +450,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
// get all rss feed
new Request.JSON({
url: 'api/v2/rss/items',
noCache: true,
method: 'get',
noCache: true,
data: {
withData: false
},
@ -478,8 +478,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
// get all rules
new Request.JSON({
url: 'api/v2/rss/rules',
noCache: true,
method: 'get',
noCache: true,
onSuccess: (response) => {
rssDownloaderRulesTable.clear();
let rowCount = 0;
@ -500,7 +500,6 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
rulesList[rule][setting] = newState;
new Request({
url: 'api/v2/rss/setRule',
noCache: true,
method: 'post',
data: {
ruleName: rule,
@ -627,7 +626,6 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
new Request({
url: 'api/v2/rss/setRule',
noCache: true,
method: 'post',
data: {
ruleName: rule,
@ -642,8 +640,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
const updateMatchingArticles = (ruleName) => {
new Request.JSON({
url: 'api/v2/rss/matchingArticles',
noCache: true,
method: 'get',
noCache: true,
data: {
ruleName: ruleName
},

View file

@ -303,7 +303,6 @@
const url = new URI('api/v2/search/start');
new Request.JSON({
url: url,
noCache: true,
method: 'post',
data: {
pattern: pattern,
@ -323,7 +322,6 @@
const url = new URI('api/v2/search/stop');
new Request({
url: url,
noCache: true,
method: 'post',
data: {
id: activeSearchId
@ -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;
@ -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,

View file

@ -138,7 +138,6 @@
const url = new URI('api/v2/search/uninstallPlugin');
new Request({
url: url,
noCache: true,
method: 'post',
data: {
names: plugins,
@ -155,7 +154,6 @@
const url = new URI('api/v2/search/enablePlugin');
new Request({
url: url,
noCache: true,
method: 'post',
data: {
names: plugins.join('|'),
@ -168,7 +166,6 @@
const url = new URI('api/v2/search/updatePlugins');
new Request({
url: url,
noCache: true,
method: 'post'
}).send();
};