mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
[PM-6658] Migrate disableFavicon to Domain Settings service and remove Settings service (#8333)
* add showFavicons to domain settings * replace usages of disableFavicon with showFavicons via the domain settings service and remove/replace settings service * create migration for disableFavicon * cleanup
This commit is contained in:
@@ -2,12 +2,7 @@ import { Utils } from "../../platform/misc/utils";
|
||||
import { CipherType } from "../enums/cipher-type";
|
||||
import { CipherView } from "../models/view/cipher.view";
|
||||
|
||||
export function buildCipherIcon(
|
||||
iconsServerUrl: string,
|
||||
cipher: CipherView,
|
||||
isFaviconDisabled: boolean,
|
||||
) {
|
||||
const imageEnabled = !isFaviconDisabled;
|
||||
export function buildCipherIcon(iconsServerUrl: string, cipher: CipherView, showFavicon: boolean) {
|
||||
let icon;
|
||||
let image;
|
||||
let fallbackImage = "";
|
||||
@@ -38,17 +33,17 @@ export function buildCipherIcon(
|
||||
icon = "bwi-apple";
|
||||
image = null;
|
||||
} else if (
|
||||
imageEnabled &&
|
||||
showFavicon &&
|
||||
hostnameUri.indexOf("://") === -1 &&
|
||||
hostnameUri.indexOf(".") > -1
|
||||
) {
|
||||
hostnameUri = `http://${hostnameUri}`;
|
||||
isWebsite = true;
|
||||
} else if (imageEnabled) {
|
||||
} else if (showFavicon) {
|
||||
isWebsite = hostnameUri.indexOf("http") === 0 && hostnameUri.indexOf(".") > -1;
|
||||
}
|
||||
|
||||
if (imageEnabled && isWebsite) {
|
||||
if (showFavicon && isWebsite) {
|
||||
try {
|
||||
image = `${iconsServerUrl}/${Utils.getHostname(hostnameUri)}/icon.png`;
|
||||
fallbackImage = "images/bwi-globe.png";
|
||||
@@ -65,7 +60,7 @@ export function buildCipherIcon(
|
||||
break;
|
||||
case CipherType.Card:
|
||||
icon = "bwi-credit-card";
|
||||
if (imageEnabled && cipher.card.brand in cardIcons) {
|
||||
if (showFavicon && cipher.card.brand in cardIcons) {
|
||||
icon = `credit-card-icon ${cardIcons[cipher.card.brand]}`;
|
||||
}
|
||||
break;
|
||||
@@ -77,7 +72,7 @@ export function buildCipherIcon(
|
||||
}
|
||||
|
||||
return {
|
||||
imageEnabled,
|
||||
imageEnabled: showFavicon,
|
||||
image,
|
||||
fallbackImage,
|
||||
icon,
|
||||
|
||||
Reference in New Issue
Block a user