mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
catch security error when setting env urls
This commit is contained in:
@@ -11,20 +11,26 @@ function ApiService(tokenService, appIdService, utilsService, constantsService,
|
|||||||
|
|
||||||
function initApiService() {
|
function initApiService() {
|
||||||
ApiService.prototype.setUrls = function () {
|
ApiService.prototype.setUrls = function () {
|
||||||
var storedBaseUrl = window.localStorage.getItem(this.constantsService.baseUrlKey);
|
try {
|
||||||
|
var storedBaseUrl = window.localStorage.getItem(this.constantsService.baseUrlKey);
|
||||||
|
|
||||||
if (storedBaseUrl) {
|
if (storedBaseUrl) {
|
||||||
this.baseUrl = storedBaseUrl + '/api';
|
this.baseUrl = storedBaseUrl + '/api';
|
||||||
this.identityBaseUrl = storedBaseUrl + '/identity';
|
this.identityBaseUrl = storedBaseUrl + '/identity';
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var storedApiUrl = window.localStorage.getItem(this.constantsService.apiUrlKey);
|
||||||
|
var storedIdentityUrl = window.localStorage.getItem(this.constantsService.identityUrlKey);
|
||||||
|
if (storedApiUrl && storedIdentityUrl) {
|
||||||
|
this.baseUrl = storedApiUrl;
|
||||||
|
this.identityBaseUrl = storedIdentityUrl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
var storedApiUrl = window.localStorage.getItem(this.constantsService.apiUrlKey);
|
console.log('Unable to set custom environment URLs:');
|
||||||
var storedIdentityUrl = window.localStorage.getItem(this.constantsService.identityUrlKey);
|
console.log(e);
|
||||||
if (storedApiUrl && storedIdentityUrl) {
|
|
||||||
this.baseUrl = storedApiUrl;
|
|
||||||
this.identityBaseUrl = storedIdentityUrl;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Desktop
|
// Desktop
|
||||||
|
|||||||
Reference in New Issue
Block a user