1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

set icons server environment url

This commit is contained in:
Kyle Spearrin
2017-10-23 23:05:24 -04:00
parent a6d56975fb
commit 0c90d9dba2
5 changed files with 30 additions and 4 deletions

View File

@@ -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) { }

View File

@@ -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);

View File

@@ -42,6 +42,10 @@
<label for="identityUrl" class="item-label">{{i18n.identityUrl}}</label>
<input id="identityUrl" type="text" name="IdentityUrl" ng-model="identityUrl">
</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 class="list-section-footer">
{{i18n.customEnvironmentFooter}}