Use base64 instead of blob URLs
This commit is contained in:
@@ -54,10 +54,20 @@ export class FrigateCardThumbnailFeatureEvent extends LitElement {
|
|||||||
if (this.thumbnail?.startsWith('data:')) {
|
if (this.thumbnail?.startsWith('data:')) {
|
||||||
return this.thumbnail;
|
return this.thumbnail;
|
||||||
}
|
}
|
||||||
return await this.hass
|
return new Promise((resolve, reject) => {
|
||||||
.fetchWithAuth(thumbnail)
|
//eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
|
this.hass!.fetchWithAuth(thumbnail)
|
||||||
.then((response) => response.blob())
|
.then((response) => response.blob())
|
||||||
.then((blob) => URL.createObjectURL(blob));
|
.then((blob) => {
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = () => {
|
||||||
|
const result = reader.result;
|
||||||
|
resolve(typeof result === 'string' ? result : null);
|
||||||
|
};
|
||||||
|
reader.onerror = (e) => reject(e);
|
||||||
|
reader.readAsDataURL(blob);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult | void {
|
||||||
|
|||||||
Reference in New Issue
Block a user