mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 11:28:59 +00:00
fix(core): prevent endless reload on cache requests
This commit is contained in:
parent
895d56ed04
commit
dfcc166918
@ -22,20 +22,26 @@ syncthing.config(function ($httpProvider, $translateProvider, LocaleServiceProvi
|
|||||||
$httpProvider.interceptors.push(function () {
|
$httpProvider.interceptors.push(function () {
|
||||||
return {
|
return {
|
||||||
response: function (response) {
|
response: function (response) {
|
||||||
var responseVersion = response.headers()['x-syncthing-version'];
|
var headers = response.headers();
|
||||||
if (!guiVersion) {
|
|
||||||
guiVersion = responseVersion;
|
// angular template cache sends no headers
|
||||||
} else if (guiVersion != responseVersion) {
|
if(Object.keys(headers).length > 0) {
|
||||||
document.location.reload(true);
|
var responseVersion = headers['x-syncthing-version'];
|
||||||
}
|
if (!guiVersion) {
|
||||||
if (!deviceId) {
|
guiVersion = responseVersion;
|
||||||
deviceId = response.headers()['x-syncthing-id'];
|
} else if (guiVersion != responseVersion) {
|
||||||
if (deviceId) {
|
document.location.reload(true);
|
||||||
var deviceIdShort = deviceId.substring(0, 5);
|
}
|
||||||
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token-' + deviceIdShort;
|
if (!deviceId) {
|
||||||
$httpProvider.defaults.xsrfCookieName = 'CSRF-Token-' + deviceIdShort;
|
deviceId = headers['x-syncthing-id'];
|
||||||
|
if (deviceId) {
|
||||||
|
var deviceIdShort = deviceId.substring(0, 5);
|
||||||
|
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token-' + deviceIdShort;
|
||||||
|
$httpProvider.defaults.xsrfCookieName = 'CSRF-Token-' + deviceIdShort;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user