@@ -16,13 +16,9 @@ var syncthing = angular.module('syncthing', [
|
||||
]);
|
||||
|
||||
var urlbase = 'rest';
|
||||
var authUrlbase = urlbase + '/noauth/auth';
|
||||
|
||||
syncthing.config(function ($httpProvider, $translateProvider, LocaleServiceProvider) {
|
||||
var deviceIDShort = metadata.deviceID.substr(0, 5);
|
||||
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token-' + deviceIDShort;
|
||||
$httpProvider.defaults.xsrfCookieName = 'CSRF-Token-' + deviceIDShort;
|
||||
$httpProvider.useApplyAsync(true);
|
||||
|
||||
// language and localisation
|
||||
|
||||
$translateProvider.useSanitizeValueStrategy('escape');
|
||||
@@ -33,6 +29,18 @@ syncthing.config(function ($httpProvider, $translateProvider, LocaleServiceProvi
|
||||
|
||||
LocaleServiceProvider.setAvailableLocales(validLangs);
|
||||
LocaleServiceProvider.setDefaultLocale('en');
|
||||
|
||||
$httpProvider.useApplyAsync(true);
|
||||
|
||||
if (!window.metadata) {
|
||||
// Most likely we're not authenticated yet, in which case we can't proceed with the rest of the setup.
|
||||
// Do nothing and wait for the page reload on successful login.
|
||||
return;
|
||||
}
|
||||
|
||||
var deviceIDShort = metadata.deviceID.substr(0, 5);
|
||||
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token-' + deviceIDShort;
|
||||
$httpProvider.defaults.xsrfCookieName = 'CSRF-Token-' + deviceIDShort;
|
||||
});
|
||||
|
||||
// @TODO: extract global level functions into separate service(s)
|
||||
|
||||
Reference in New Issue
Block a user