mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-18 15:47:57 +01:00
set icons server environment url
This commit is contained in:
parent
a6d56975fb
commit
0c90d9dba2
@ -747,6 +747,9 @@
|
|||||||
"identityUrl": {
|
"identityUrl": {
|
||||||
"message": "Identity Server URL"
|
"message": "Identity Server URL"
|
||||||
},
|
},
|
||||||
|
"iconsUrl": {
|
||||||
|
"message": "Icons Server URL"
|
||||||
|
},
|
||||||
"environmentSaved": {
|
"environmentSaved": {
|
||||||
"message": "The environment URLs have been saved."
|
"message": "The environment URLs have been saved."
|
||||||
},
|
},
|
||||||
|
@ -6,10 +6,20 @@ angular
|
|||||||
cipher: '<'
|
cipher: '<'
|
||||||
},
|
},
|
||||||
templateUrl: 'app/components/views/icon.html',
|
templateUrl: 'app/components/views/icon.html',
|
||||||
controller: function (stateService, constantsService) {
|
controller: function (stateService, constantsService, environmentService) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
ctrl.imageEnabled = stateService.getState('faviconEnabled');
|
ctrl.imageEnabled = stateService.getState('faviconEnabled');
|
||||||
|
|
||||||
|
var iconsUrl = environmentService.iconsUrl;
|
||||||
|
if (!iconsUrl) {
|
||||||
|
if (environmentService.baseUrl) {
|
||||||
|
iconsUrl = environmentService.baseUrl = '/icons';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
iconsUrl = 'https://icons.bitwarden.com';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ctrl.$onChanges = function () {
|
ctrl.$onChanges = function () {
|
||||||
switch (ctrl.cipher.type) {
|
switch (ctrl.cipher.type) {
|
||||||
case constantsService.cipherType.login:
|
case constantsService.cipherType.login:
|
||||||
@ -54,7 +64,7 @@ angular
|
|||||||
if (ctrl.imageEnabled && isWebsite) {
|
if (ctrl.imageEnabled && isWebsite) {
|
||||||
try {
|
try {
|
||||||
var url = new URL(hostnameUri);
|
var url = new URL(hostnameUri);
|
||||||
ctrl.image = 'https://icons.bitwarden.com/' + url.hostname + '/icon.png';
|
ctrl.image = iconsUrl + '/' + url.hostname + '/icon.png';
|
||||||
ctrl.fallbackImage = chrome.extension.getURL('images/fa-globe.png');
|
ctrl.fallbackImage = chrome.extension.getURL('images/fa-globe.png');
|
||||||
}
|
}
|
||||||
catch (e) { }
|
catch (e) { }
|
||||||
|
@ -11,13 +11,15 @@
|
|||||||
$scope.webVaultUrl = environmentService.webVaultUrl || '';
|
$scope.webVaultUrl = environmentService.webVaultUrl || '';
|
||||||
$scope.apiUrl = environmentService.apiUrl || '';
|
$scope.apiUrl = environmentService.apiUrl || '';
|
||||||
$scope.identityUrl = environmentService.identityUrl || '';
|
$scope.identityUrl = environmentService.identityUrl || '';
|
||||||
|
$scope.iconsUrl = environmentService.iconsUrl || '';
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
environmentService.setUrls({
|
environmentService.setUrls({
|
||||||
base: $scope.baseUrl,
|
base: $scope.baseUrl,
|
||||||
api: $scope.apiUrl,
|
api: $scope.apiUrl,
|
||||||
identity: $scope.identityUrl,
|
identity: $scope.identityUrl,
|
||||||
webVault: $scope.webVaultUrl
|
webVault: $scope.webVaultUrl,
|
||||||
|
icons: $scope.iconsUrl
|
||||||
}, function (resUrls) {
|
}, function (resUrls) {
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
// re-set urls since service can change them, ex: prefixing https://
|
// re-set urls since service can change them, ex: prefixing https://
|
||||||
@ -25,6 +27,7 @@
|
|||||||
$scope.apiUrl = resUrls.api;
|
$scope.apiUrl = resUrls.api;
|
||||||
$scope.identityUrl = resUrls.identity;
|
$scope.identityUrl = resUrls.identity;
|
||||||
$scope.webVaultUrl = resUrls.webVault;
|
$scope.webVaultUrl = resUrls.webVault;
|
||||||
|
$scope.iconsUrl = resUrls.icons;
|
||||||
|
|
||||||
$analytics.eventTrack('Set Environment URLs');
|
$analytics.eventTrack('Set Environment URLs');
|
||||||
toastr.success(i18nService.environmentSaved);
|
toastr.success(i18nService.environmentSaved);
|
||||||
|
@ -42,6 +42,10 @@
|
|||||||
<label for="identityUrl" class="item-label">{{i18n.identityUrl}}</label>
|
<label for="identityUrl" class="item-label">{{i18n.identityUrl}}</label>
|
||||||
<input id="identityUrl" type="text" name="IdentityUrl" ng-model="identityUrl">
|
<input id="identityUrl" type="text" name="IdentityUrl" ng-model="identityUrl">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="list-section-item">
|
||||||
|
<label for="iconsUrl" class="item-label">{{i18n.iconsUrl}}</label>
|
||||||
|
<input id="iconsUrl" type="text" name="IconsUrl" ng-model="iconsUrl">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="list-section-footer">
|
<div class="list-section-footer">
|
||||||
{{i18n.customEnvironmentFooter}}
|
{{i18n.customEnvironmentFooter}}
|
||||||
|
@ -6,6 +6,7 @@ function EnvironmentService(constantsService, apiService) {
|
|||||||
this.webVaultUrl = null;
|
this.webVaultUrl = null;
|
||||||
this.apiUrl = null;
|
this.apiUrl = null;
|
||||||
this.identityUrl = null;
|
this.identityUrl = null;
|
||||||
|
this.iconsUrl = null;
|
||||||
|
|
||||||
initEnvironmentService();
|
initEnvironmentService();
|
||||||
}
|
}
|
||||||
@ -19,6 +20,7 @@ function initEnvironmentService() {
|
|||||||
base: null,
|
base: null,
|
||||||
api: null,
|
api: null,
|
||||||
identity: null,
|
identity: null,
|
||||||
|
icons: null,
|
||||||
webVault: null
|
webVault: null
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -34,6 +36,7 @@ function initEnvironmentService() {
|
|||||||
self.webVaultUrl = urls.webVault;
|
self.webVaultUrl = urls.webVault;
|
||||||
self.apiUrl = urls.api;
|
self.apiUrl = urls.api;
|
||||||
self.identityUrl = urls.identity;
|
self.identityUrl = urls.identity;
|
||||||
|
self.iconsUrl = urls.icons;
|
||||||
|
|
||||||
self.apiService.setUrls({
|
self.apiService.setUrls({
|
||||||
api: self.apiUrl,
|
api: self.apiUrl,
|
||||||
@ -51,13 +54,15 @@ function initEnvironmentService() {
|
|||||||
urls.webVault = formatUrl(urls.webVault);
|
urls.webVault = formatUrl(urls.webVault);
|
||||||
urls.api = formatUrl(urls.api);
|
urls.api = formatUrl(urls.api);
|
||||||
urls.identity = formatUrl(urls.identity);
|
urls.identity = formatUrl(urls.identity);
|
||||||
|
urls.icons = formatUrl(urls.icons);
|
||||||
|
|
||||||
var urlsObj = {};
|
var urlsObj = {};
|
||||||
urlsObj[self.constantsService.environmentUrlsKey] = {
|
urlsObj[self.constantsService.environmentUrlsKey] = {
|
||||||
base: urls.base,
|
base: urls.base,
|
||||||
api: urls.api,
|
api: urls.api,
|
||||||
identity: urls.identity,
|
identity: urls.identity,
|
||||||
webVault: urls.webVault
|
webVault: urls.webVault,
|
||||||
|
icons: urls.icons
|
||||||
};
|
};
|
||||||
|
|
||||||
chrome.storage.local.set(urlsObj, function () {
|
chrome.storage.local.set(urlsObj, function () {
|
||||||
@ -65,6 +70,7 @@ function initEnvironmentService() {
|
|||||||
self.webVaultUrl = urls.webVault;
|
self.webVaultUrl = urls.webVault;
|
||||||
self.apiUrl = urls.api;
|
self.apiUrl = urls.api;
|
||||||
self.identityUrl = urls.identity;
|
self.identityUrl = urls.identity;
|
||||||
|
self.iconsUrl = urls.icons;
|
||||||
|
|
||||||
if (self.baseUrl) {
|
if (self.baseUrl) {
|
||||||
self.apiService.setUrls({
|
self.apiService.setUrls({
|
||||||
|
Loading…
Reference in New Issue
Block a user