mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-08 14:58:26 +00:00
parent
d3a9b126a6
commit
e50469d84e
32
gui/app.js
32
gui/app.js
@ -20,10 +20,24 @@
|
|||||||
|
|
||||||
var syncthing = angular.module('syncthing', ['pascalprecht.translate']);
|
var syncthing = angular.module('syncthing', ['pascalprecht.translate']);
|
||||||
var urlbase = 'rest';
|
var urlbase = 'rest';
|
||||||
|
var guiVersion = null;
|
||||||
|
|
||||||
syncthing.config(function ($httpProvider, $translateProvider) {
|
syncthing.config(function ($httpProvider, $translateProvider) {
|
||||||
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token';
|
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token';
|
||||||
$httpProvider.defaults.xsrfCookieName = 'CSRF-Token';
|
$httpProvider.defaults.xsrfCookieName = 'CSRF-Token';
|
||||||
|
$httpProvider.interceptors.push(function() {
|
||||||
|
return {
|
||||||
|
response: function(response) {
|
||||||
|
var responseVersion = response.headers()['x-syncthing-version'];
|
||||||
|
if (!guiVersion) {
|
||||||
|
guiVersion = responseVersion;
|
||||||
|
} else if (guiVersion != responseVersion) {
|
||||||
|
document.location.reload(true);
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
$translateProvider.useStaticFilesLoader({
|
$translateProvider.useStaticFilesLoader({
|
||||||
prefix: 'lang/lang-',
|
prefix: 'lang/lang-',
|
||||||
@ -164,17 +178,13 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (restarting) {
|
console.log('UIOnline');
|
||||||
document.location.reload(true);
|
$scope.init();
|
||||||
} else {
|
online = true;
|
||||||
console.log('UIOnline');
|
restarting = false;
|
||||||
$scope.init();
|
$('#networkError').modal('hide');
|
||||||
online = true;
|
$('#restarting').modal('hide');
|
||||||
restarting = false;
|
$('#shutdown').modal('hide');
|
||||||
$('#networkError').modal('hide');
|
|
||||||
$('#restarting').modal('hide');
|
|
||||||
$('#shutdown').modal('hide');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$on('UIOffline', function (event, arg) {
|
$scope.$on('UIOffline', function (event, arg) {
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user