1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

Website icons (#285)

* Initial attempt at adding favicons.

* Cache the favicons for 30 days.

* Refactor faviconService, remove unused faviconDirective.

* Change icon url to icons.bitwarden.com. Update style to support dynamic size of icon.

* Use hostname instead of domain.

* Fix getFavicon throwing an exception if the uri is not a valid url.

* Add enabled property to faviconService to prevent slow calls to storage. Fixed chrome not displaying chrome://favicon properly.

* Fix chrome disable favicon not working as expected.

* Add default icon.

* Fix jshint errors.

* Cleanup of faviconService, removed caching related code. Add faviconComponent for handling favicons.

* Remove faviconService, moved functionallity into faviconComponent.

* Fix faviconComponent not updating when uri changes.

* Rename favicon to icon.

* Improve whitelist.
This commit is contained in:
Oscar Hinton
2017-10-12 20:48:29 +02:00
committed by Kyle Spearrin
parent 5a6c43e46e
commit a99ce875ca
13 changed files with 109 additions and 3 deletions

View File

@@ -2,13 +2,14 @@
.module('bit.settings')
.controller('settingsFeaturesController', function ($scope, i18nService, $analytics, constantsService, utilsService,
totpService, $timeout) {
totpService, stateService, $timeout) {
$scope.i18n = i18nService;
$scope.disableGa = false;
$scope.disableAddLoginNotification = false;
$scope.disableContextMenuItem = false;
$scope.disableAutoTotpCopy = false;
$scope.enableAutoFillOnPageLoad = false;
$scope.disableFavicon = false;
chrome.storage.local.get(constantsService.enableAutoFillOnPageLoadKey, function (obj) {
$timeout(function () {
@@ -57,6 +58,12 @@
});
});
chrome.storage.local.get(constantsService.disableFaviconKey, function (obj) {
$timeout(function () {
$scope.disableFavicon = obj && obj[constantsService.disableFaviconKey] === true;
});
});
$scope.updateGa = function () {
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
// Default for Firefox is disabled.
@@ -176,4 +183,28 @@
});
});
};
$scope.updateDisableFavicon = function () {
chrome.storage.local.get(constantsService.disableFaviconKey, function (obj) {
if (obj[constantsService.disableFaviconKey]) {
// enable
obj[constantsService.disableFaviconKey] = false;
}
else {
// disable
$analytics.eventTrack('Disabled Favicon');
obj[constantsService.disableFaviconKey] = true;
}
chrome.storage.local.set(obj, function () {
$timeout(function () {
$scope.disableFavicon = obj[constantsService.disableFaviconKey];
stateService.saveState('faviconEnabled', !$scope.disableFavicon);
});
if (!obj[constantsService.disableFaviconKey]) {
$analytics.eventTrack('Enabled Favicon');
}
});
});
};
});