fix: Size the gallery fallback icon frame to fill the thumbnail box (#2705)
- Closes: #2701
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user