mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-09 09:51:02 +01:00
ie fixes
This commit is contained in:
parent
8211e19db0
commit
f40451ecc5
@ -10,6 +10,7 @@ export abstract class PlatformUtilsService {
|
|||||||
isOpera: () => boolean;
|
isOpera: () => boolean;
|
||||||
isVivaldi: () => boolean;
|
isVivaldi: () => boolean;
|
||||||
isSafari: () => boolean;
|
isSafari: () => boolean;
|
||||||
|
isIE: () => boolean;
|
||||||
isMacAppStore: () => boolean;
|
isMacAppStore: () => boolean;
|
||||||
analyticsId: () => string;
|
analyticsId: () => string;
|
||||||
getDomain: (uriString: string) => string;
|
getDomain: (uriString: string) => string;
|
||||||
|
@ -11,6 +11,8 @@ import { StateService } from '../../abstractions/state.service';
|
|||||||
|
|
||||||
import { ConstantsService } from '../../services/constants.service';
|
import { ConstantsService } from '../../services/constants.service';
|
||||||
|
|
||||||
|
import { Utils } from '../../misc/utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-vault-icon',
|
selector: 'app-vault-icon',
|
||||||
templateUrl: 'icon.component.html',
|
templateUrl: 'icon.component.html',
|
||||||
@ -77,8 +79,7 @@ export class IconComponent implements OnChanges {
|
|||||||
|
|
||||||
if (this.imageEnabled && isWebsite) {
|
if (this.imageEnabled && isWebsite) {
|
||||||
try {
|
try {
|
||||||
const url = new URL(hostnameUri);
|
this.image = this.iconsUrl + '/' + Utils.getHostname(hostnameUri) + '/icon.png';
|
||||||
this.image = this.iconsUrl + '/' + url.hostname + '/icon.png';
|
|
||||||
this.fallbackImage = 'images/fa-globe.png';
|
this.fallbackImage = 'images/fa-globe.png';
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,10 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isIE(): boolean {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
isMacAppStore(): boolean {
|
isMacAppStore(): boolean {
|
||||||
return isMacAppStore();
|
return isMacAppStore();
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,15 @@ export class Utils {
|
|||||||
|
|
||||||
if (uriString.startsWith('http://') || uriString.startsWith('https://')) {
|
if (uriString.startsWith('http://') || uriString.startsWith('https://')) {
|
||||||
try {
|
try {
|
||||||
return nodeURL != null ? new nodeURL(uriString) : new URL(uriString);
|
if (nodeURL != null) {
|
||||||
|
return new nodeURL(uriString);
|
||||||
|
} else if (typeof URL === 'function') {
|
||||||
|
return new URL(uriString);
|
||||||
|
} else if (window != null) {
|
||||||
|
const anchor = window.document.createElement('a');
|
||||||
|
anchor.href = uriString;
|
||||||
|
return anchor as any;
|
||||||
|
}
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,16 +12,18 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
|||||||
private crypto: Crypto;
|
private crypto: Crypto;
|
||||||
private subtle: SubtleCrypto;
|
private subtle: SubtleCrypto;
|
||||||
private isEdge: boolean;
|
private isEdge: boolean;
|
||||||
|
private isIE: boolean;
|
||||||
|
|
||||||
constructor(private win: Window, private platformUtilsService: PlatformUtilsService) {
|
constructor(private win: Window, private platformUtilsService: PlatformUtilsService) {
|
||||||
this.crypto = win.crypto;
|
this.crypto = typeof win.crypto !== 'undefined' ? win.crypto : null;
|
||||||
this.subtle = win.crypto.subtle;
|
this.subtle = (!!this.crypto && typeof win.crypto.subtle !== 'undefined') ? win.crypto.subtle : null;
|
||||||
this.isEdge = platformUtilsService.isEdge();
|
this.isEdge = platformUtilsService.isEdge();
|
||||||
|
this.isIE = platformUtilsService.isIE();
|
||||||
}
|
}
|
||||||
|
|
||||||
async pbkdf2(password: string | ArrayBuffer, salt: string | ArrayBuffer, algorithm: 'sha256' | 'sha512',
|
async pbkdf2(password: string | ArrayBuffer, salt: string | ArrayBuffer, algorithm: 'sha256' | 'sha512',
|
||||||
iterations: number): Promise<ArrayBuffer> {
|
iterations: number): Promise<ArrayBuffer> {
|
||||||
if (this.isEdge) {
|
if (this.isEdge || this.isIE) {
|
||||||
const forgeLen = algorithm === 'sha256' ? 32 : 64;
|
const forgeLen = algorithm === 'sha256' ? 32 : 64;
|
||||||
const passwordBytes = this.toByteString(password);
|
const passwordBytes = this.toByteString(password);
|
||||||
const saltBytes = this.toByteString(salt);
|
const saltBytes = this.toByteString(salt);
|
||||||
@ -46,7 +48,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async hash(value: string | ArrayBuffer, algorithm: 'sha1' | 'sha256' | 'sha512'): Promise<ArrayBuffer> {
|
async hash(value: string | ArrayBuffer, algorithm: 'sha1' | 'sha256' | 'sha512'): Promise<ArrayBuffer> {
|
||||||
if (this.isEdge && algorithm === 'sha1') {
|
if ((this.isEdge || this.isIE) && algorithm === 'sha1') {
|
||||||
const md = forge.md.sha1.create();
|
const md = forge.md.sha1.create();
|
||||||
const valueBytes = this.toByteString(value);
|
const valueBytes = this.toByteString(value);
|
||||||
md.update(valueBytes, 'raw');
|
md.update(valueBytes, 'raw');
|
||||||
|
Loading…
Reference in New Issue
Block a user