diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 9d57d36e9c..02dab22fae 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -747,6 +747,9 @@ "identityUrl": { "message": "Identity Server URL" }, + "iconsUrl": { + "message": "Icons Server URL" + }, "environmentSaved": { "message": "The environment URLs have been saved." }, diff --git a/src/popup/app/components/iconComponent.js b/src/popup/app/components/iconComponent.js index 9160c3afcb..5b901df4b7 100644 --- a/src/popup/app/components/iconComponent.js +++ b/src/popup/app/components/iconComponent.js @@ -6,10 +6,20 @@ angular cipher: '<' }, templateUrl: 'app/components/views/icon.html', - controller: function (stateService, constantsService) { + controller: function (stateService, constantsService, environmentService) { var ctrl = this; 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 () { switch (ctrl.cipher.type) { case constantsService.cipherType.login: @@ -54,7 +64,7 @@ angular if (ctrl.imageEnabled && isWebsite) { try { 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'); } catch (e) { } diff --git a/src/popup/app/settings/settingsEnvironmentController.js b/src/popup/app/settings/settingsEnvironmentController.js index 653f3c6356..61c776442e 100644 --- a/src/popup/app/settings/settingsEnvironmentController.js +++ b/src/popup/app/settings/settingsEnvironmentController.js @@ -11,13 +11,15 @@ $scope.webVaultUrl = environmentService.webVaultUrl || ''; $scope.apiUrl = environmentService.apiUrl || ''; $scope.identityUrl = environmentService.identityUrl || ''; + $scope.iconsUrl = environmentService.iconsUrl || ''; $scope.save = function () { environmentService.setUrls({ base: $scope.baseUrl, api: $scope.apiUrl, identity: $scope.identityUrl, - webVault: $scope.webVaultUrl + webVault: $scope.webVaultUrl, + icons: $scope.iconsUrl }, function (resUrls) { $timeout(function () { // re-set urls since service can change them, ex: prefixing https:// @@ -25,6 +27,7 @@ $scope.apiUrl = resUrls.api; $scope.identityUrl = resUrls.identity; $scope.webVaultUrl = resUrls.webVault; + $scope.iconsUrl = resUrls.icons; $analytics.eventTrack('Set Environment URLs'); toastr.success(i18nService.environmentSaved); diff --git a/src/popup/app/settings/views/settingsEnvironment.html b/src/popup/app/settings/views/settingsEnvironment.html index b02bc5aa3a..f6b5aea3c3 100644 --- a/src/popup/app/settings/views/settingsEnvironment.html +++ b/src/popup/app/settings/views/settingsEnvironment.html @@ -42,6 +42,10 @@ +
+ + +