mirror of
https://github.com/bitwarden/browser
synced 2025-12-22 19:23:52 +00:00
icons for vault listing
This commit is contained in:
11
src/app/directives/fallbackSrcDirective.js
Normal file
11
src/app/directives/fallbackSrcDirective.js
Normal file
@@ -0,0 +1,11 @@
|
||||
angular
|
||||
.module('bit.directives')
|
||||
|
||||
.directive('fallbackSrc', function () {
|
||||
return function (scope, element, attrs) {
|
||||
var el = $(element);
|
||||
el.bind('error', function (event) {
|
||||
el.attr('src', attrs.fallbackSrc);
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -220,7 +220,36 @@ angular
|
||||
case constants.cipherType.login:
|
||||
cipher.subTitle = _service.decryptProperty(cipherData.Username, key, true, true);
|
||||
cipher.meta.password = _service.decryptProperty(cipherData.Password, key, true, true);
|
||||
cipher.icon = 'fa-globe';
|
||||
cipher.meta.uri = _service.decryptProperty(cipherData.Uri, key, true, true);
|
||||
|
||||
if (cipher.meta.uri) {
|
||||
var hostnameUri = cipher.meta.uri;
|
||||
|
||||
if (hostnameUri.indexOf('androidapp://') === 0) {
|
||||
cipher.icon = 'fa-android';
|
||||
}
|
||||
else if (hostnameUri.indexOf('iosapp://') === 0) {
|
||||
cipher.icon = 'fa-apple';
|
||||
}
|
||||
else if (hostnameUri.indexOf('://') === -1 && hostnameUri.indexOf('http://') !== 0 &&
|
||||
hostnameUri.indexOf('https://') !== 0) {
|
||||
hostnameUri = "http://" + hostnameUri;
|
||||
}
|
||||
|
||||
if (!cipher.icon && hostnameUri.indexOf('.') > 0) {
|
||||
try {
|
||||
var url = new URL(hostnameUri);
|
||||
if (url && url.hostname) {
|
||||
cipher.meta.image = 'https://icons.bitwarden.com?url=' + url.hostname;
|
||||
}
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
}
|
||||
|
||||
if (!cipher.icon) {
|
||||
cipher.icon = 'fa-globe';
|
||||
}
|
||||
break;
|
||||
case constants.cipherType.secureNote:
|
||||
cipher.subTitle = null;
|
||||
|
||||
@@ -119,7 +119,9 @@
|
||||
<input type="checkbox" value="{{::cipher.id}}" name="cipherSelection" stop-prop />
|
||||
</td>
|
||||
<td class="vault-icon" ng-click="select($event)">
|
||||
<i class="fa fa-fw fa-lg {{::cipher.icon}}"></i>
|
||||
<i class="fa fa-fw fa-lg {{::cipher.icon}}" ng-if="!cipher.meta.image"></i>
|
||||
<img alt="" ng-if="cipher.meta.image" ng-src="{{cipher.meta.image}}"
|
||||
fallback-src="images/fa-globe.png" />
|
||||
</td>
|
||||
<td ng-click="select($event)">
|
||||
<a href="#" stop-click ng-click="editCipher(cipher)" stop-prop>{{cipher.name}}</a>
|
||||
@@ -186,7 +188,7 @@
|
||||
<div class="table-responsive" ng-show="folderCiphers.length">
|
||||
<table class="table table-striped table-hover table-vmiddle">
|
||||
<tbody>
|
||||
<tr ng-repeat="cipher in folderCiphers = (ciphers | filter: { folderId: folder.id } |
|
||||
<tr ng-repeat="cipher in folderCiphers = (ciphers | filter: { folderId: folder.id } |
|
||||
filter: cipherFilter | filter: (main.searchVaultText || '')) track by cipher.id">
|
||||
<td style="width: 70px;">
|
||||
<div class="btn-group" data-append-to="body">
|
||||
@@ -232,7 +234,9 @@
|
||||
<input type="checkbox" value="{{::cipher.id}}" name="cipherSelection" stop-prop />
|
||||
</td>
|
||||
<td class="vault-icon" ng-click="select($event)">
|
||||
<i class="fa fa-fw fa-lg {{::cipher.icon}}"></i>
|
||||
<i class="fa fa-fw fa-lg {{::cipher.icon}}" ng-if="!cipher.meta.image"></i>
|
||||
<img alt="" ng-if="cipher.meta.image" ng-src="{{cipher.meta.image}}"
|
||||
fallback-src="images/fa-globe.png" />
|
||||
</td>
|
||||
<td ng-click="select($event)">
|
||||
<a href="#" stop-click ng-click="editCipher(cipher)" stop-prop>{{cipher.name}}</a>
|
||||
|
||||
@@ -87,6 +87,11 @@
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td class="vault-icon">
|
||||
<i class="fa fa-fw fa-lg {{::cipher.icon}}" ng-if="!cipher.meta.image"></i>
|
||||
<img alt="" ng-if="cipher.meta.image" ng-src="{{cipher.meta.image}}"
|
||||
fallback-src="images/fa-globe.png" />
|
||||
</td>
|
||||
<td>
|
||||
<a href="#" stop-click ng-click="editCipher(cipher)">{{cipher.name}}</a>
|
||||
<i class="fa fa-star text-muted" title="Favorite" ng-show="cipher.favorite"></i>
|
||||
|
||||
Reference in New Issue
Block a user