mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 18:41:59 -07: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 urlbase = 'rest';
|
||||
var guiVersion = null;
|
||||
|
||||
syncthing.config(function ($httpProvider, $translateProvider) {
|
||||
$httpProvider.defaults.xsrfHeaderName = 'X-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({
|
||||
prefix: 'lang/lang-',
|
||||
@ -164,17 +178,13 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
|
||||
return;
|
||||
}
|
||||
|
||||
if (restarting) {
|
||||
document.location.reload(true);
|
||||
} else {
|
||||
console.log('UIOnline');
|
||||
$scope.init();
|
||||
online = true;
|
||||
restarting = false;
|
||||
$('#networkError').modal('hide');
|
||||
$('#restarting').modal('hide');
|
||||
$('#shutdown').modal('hide');
|
||||
}
|
||||
console.log('UIOnline');
|
||||
$scope.init();
|
||||
online = true;
|
||||
restarting = false;
|
||||
$('#networkError').modal('hide');
|
||||
$('#restarting').modal('hide');
|
||||
$('#shutdown').modal('hide');
|
||||
});
|
||||
|
||||
$scope.$on('UIOffline', function (event, arg) {
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user