mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
refactor custom env urls, cleanup bg script a bit
This commit is contained in:
@@ -5,53 +5,49 @@ function ApiService(tokenService, appIdService, utilsService, constantsService,
|
||||
this.utilsService = utilsService;
|
||||
this.constantsService = constantsService;
|
||||
|
||||
this.urlsSet = false;
|
||||
this.baseUrl = null;
|
||||
this.identityBaseUrl = null;
|
||||
|
||||
initApiService();
|
||||
this.setUrls();
|
||||
}
|
||||
|
||||
function initApiService() {
|
||||
ApiService.prototype.setUrls = function () {
|
||||
try {
|
||||
var storedBaseUrl = window.localStorage.getItem(this.constantsService.baseUrlKey);
|
||||
ApiService.prototype.setUrls = function (urls) {
|
||||
var self = this;
|
||||
self.urlsSet = true;
|
||||
|
||||
if (storedBaseUrl) {
|
||||
this.baseUrl = storedBaseUrl + '/api';
|
||||
this.identityBaseUrl = storedBaseUrl + '/identity';
|
||||
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;
|
||||
}
|
||||
if (urls.base) {
|
||||
self.baseUrl = urls.base + '/api';
|
||||
self.identityBaseUrl = urls.base + '/identity';
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
console.log('Unable to set custom environment URLs:');
|
||||
console.log(e);
|
||||
|
||||
if (urls.api && urls.identity) {
|
||||
self.baseUrl = urls.api;
|
||||
self.identityBaseUrl = urls.identity;
|
||||
return;
|
||||
}
|
||||
|
||||
// Desktop
|
||||
//this.baseUrl = 'http://localhost:4000';
|
||||
//this.identityBaseUrl = 'http://localhost:33656';
|
||||
//self.baseUrl = 'http://localhost:4000';
|
||||
//self.identityBaseUrl = 'http://localhost:33656';
|
||||
|
||||
// Desktop HTTPS
|
||||
//this.baseUrl = 'https://localhost:44377';
|
||||
//this.identityBaseUrl = 'https://localhost:44392';
|
||||
//self.baseUrl = 'https://localhost:44377';
|
||||
//self.identityBaseUrl = 'https://localhost:44392';
|
||||
|
||||
// Desktop external
|
||||
//this.baseUrl = 'http://192.168.1.4:4000';
|
||||
//this.identityBaseUrl = 'http://192.168.1.4:33656';
|
||||
//self.baseUrl = 'http://192.168.1.4:4000';
|
||||
//self.identityBaseUrl = 'http://192.168.1.4:33656';
|
||||
|
||||
// Preview
|
||||
//this.baseUrl = 'https://preview-api.bitwarden.com';
|
||||
//this.identityBaseUrl = 'https://preview-identity.bitwarden.com';
|
||||
//self.baseUrl = 'https://preview-api.bitwarden.com';
|
||||
//self.identityBaseUrl = 'https://preview-identity.bitwarden.com';
|
||||
|
||||
// Production
|
||||
this.baseUrl = 'https://api.bitwarden.com';
|
||||
this.identityBaseUrl = 'https://identity.bitwarden.com';
|
||||
self.baseUrl = 'https://api.bitwarden.com';
|
||||
self.identityBaseUrl = 'https://identity.bitwarden.com';
|
||||
};
|
||||
|
||||
// Auth APIs
|
||||
|
||||
Reference in New Issue
Block a user