mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-31 08:20:37 +01:00
set login icon function
This commit is contained in:
parent
4de08f2e71
commit
4af2edafd3
@ -221,35 +221,7 @@ angular
|
|||||||
cipher.subTitle = _service.decryptProperty(cipherData.Username, key, true, true);
|
cipher.subTitle = _service.decryptProperty(cipherData.Username, key, true, true);
|
||||||
cipher.meta.password = _service.decryptProperty(cipherData.Password, key, true, true);
|
cipher.meta.password = _service.decryptProperty(cipherData.Password, key, true, true);
|
||||||
cipher.meta.uri = _service.decryptProperty(cipherData.Uri, key, true, true);
|
cipher.meta.uri = _service.decryptProperty(cipherData.Uri, key, true, true);
|
||||||
|
setLoginIcon(cipher, cipher.meta.uri, 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;
|
break;
|
||||||
case constants.cipherType.secureNote:
|
case constants.cipherType.secureNote:
|
||||||
cipher.subTitle = null;
|
cipher.subTitle = null;
|
||||||
@ -297,6 +269,35 @@ angular
|
|||||||
return cipher;
|
return cipher;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function setLoginIcon(cipher, uri, setImage) {
|
||||||
|
if (uri) {
|
||||||
|
var hostnameUri = 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 (setImage && !cipher.icon && hostnameUri.indexOf('.') > 0) {
|
||||||
|
try {
|
||||||
|
var url = new URL(hostnameUri);
|
||||||
|
cipher.meta.image = 'https://icons.bitwarden.com?url=' + url.hostname;
|
||||||
|
}
|
||||||
|
catch (e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cipher.icon) {
|
||||||
|
cipher.icon = 'fa-globe';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_service.decryptAttachment = function (key, encryptedAttachment) {
|
_service.decryptAttachment = function (key, encryptedAttachment) {
|
||||||
if (!encryptedAttachment) throw "encryptedAttachment is undefined or null";
|
if (!encryptedAttachment) throw "encryptedAttachment is undefined or null";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user