mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 15:23:33 +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:
committed by
Kyle Spearrin
parent
5a6c43e46e
commit
a99ce875ca
26
src/popup/app/components/iconComponent.js
Normal file
26
src/popup/app/components/iconComponent.js
Normal file
@@ -0,0 +1,26 @@
|
||||
angular
|
||||
.module('bit.components')
|
||||
.component('icon', {
|
||||
bindings: {
|
||||
uri: '<'
|
||||
},
|
||||
template: '<div class="icon" ng-if="$ctrl.enabled()"><img src="{{$ctrl.url}}"></div>',
|
||||
controller: function(stateService) {
|
||||
this.$onInit = (function() {
|
||||
this.enabled = function() {
|
||||
return stateService.getState('faviconEnabled');
|
||||
};
|
||||
}).bind(this);
|
||||
|
||||
this.$onChanges = (function () {
|
||||
var hostname;
|
||||
try {
|
||||
hostname = new URL(this.uri).hostname;
|
||||
this.url = 'https://icons.bitwarden.com/' + hostname + '/icon.png';
|
||||
} catch (e) {
|
||||
// Invalid URL.
|
||||
this.url = chrome.extension.getURL('images/fa-globe.png');
|
||||
}
|
||||
}).bind(this);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user