1
0
mirror of https://github.com/bitwarden/web synced 2025-12-13 06:43:31 +00:00

icons for vault listing

This commit is contained in:
Kyle Spearrin
2017-10-10 21:55:58 -04:00
parent 7a36f13034
commit f828288b84
7 changed files with 62 additions and 4 deletions

View File

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