fix: Size the gallery fallback icon frame to fill the thumbnail box (#2705)

- Closes: #2701
This commit is contained in:
Dermot Duffy
2026-08-22 15:02:28 -07:00
committed by GitHub
parent 60e01cf537
commit b2f3243f3e
4 changed files with 94 additions and 17 deletions
+12
View File
@@ -226,6 +226,7 @@ const matchesEventQuery = (event: FrigateEvent, query: EventQuery): boolean =>
export class FakeFrigate {
private _events: FrigateEvent[] = [];
private _mediaURLs = new Map<string, string>();
private _thumbnailFailureStatus: number | null = null;
constructor(hass: FakeHASS) {
hass.registerCommand(
@@ -306,6 +307,13 @@ export class FakeFrigate {
this._mediaURLs.set(this._getMediaKey(eventID, mediaType), url);
}
/**
* Refuse every thumbnail request with the given HTTP status.
*/
public failThumbnails(status = 404): void {
this._thumbnailFailureStatus = status;
}
// Answer a command addressed to this instance, refusing one meant for
// another. Frigate answers with JSON.
private _answerAsFrigate(
@@ -397,6 +405,10 @@ export class FakeFrigate {
throw new Error(`FakeFrigate has no thumbnail at: ${path}`);
}
if (this._thumbnailFailureStatus !== null) {
return new Response(null, { status: this._thumbnailFailureStatus });
}
return await fetch(createFixtureURL(SNAPSHOT_FIXTURE_FILENAME));
}
}