mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 05:35:25 +03:00
Don't request preview for current hour and fix content type
This commit is contained in:
parent
d6e93d039d
commit
9070ba23f0
@ -1351,6 +1351,6 @@ def preview_thumbnail(file_name: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = make_response(jpg_bytes)
|
response = make_response(jpg_bytes)
|
||||||
response.headers["Content-Type"] = "image/jpeg"
|
response.headers["Content-Type"] = "image/webp"
|
||||||
response.headers["Cache-Control"] = "private, max-age=31536000"
|
response.headers["Cache-Control"] = "private, max-age=31536000"
|
||||||
return response
|
return response
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import {
|
|||||||
InProgressPreview,
|
InProgressPreview,
|
||||||
VideoPreview,
|
VideoPreview,
|
||||||
} from "../player/PreviewThumbnailPlayer";
|
} from "../player/PreviewThumbnailPlayer";
|
||||||
|
import { isCurrentHour } from "@/utils/dateUtil";
|
||||||
|
|
||||||
type AnimatedEventCardProps = {
|
type AnimatedEventCardProps = {
|
||||||
event: ReviewSegment;
|
event: ReviewSegment;
|
||||||
@ -19,10 +20,14 @@ type AnimatedEventCardProps = {
|
|||||||
export function AnimatedEventCard({ event }: AnimatedEventCardProps) {
|
export function AnimatedEventCard({ event }: AnimatedEventCardProps) {
|
||||||
const { data: config } = useSWR<FrigateConfig>("config");
|
const { data: config } = useSWR<FrigateConfig>("config");
|
||||||
|
|
||||||
|
const currentHour = useMemo(() => isCurrentHour(event.start_time), [event]);
|
||||||
|
|
||||||
// preview
|
// preview
|
||||||
|
|
||||||
const { data: previews } = useSWR<Preview[]>(
|
const { data: previews } = useSWR<Preview[]>(
|
||||||
`/preview/${event.camera}/start/${Math.round(event.start_time)}/end/${Math.round(event.end_time || event.start_time + 20)}`,
|
currentHour
|
||||||
|
? null
|
||||||
|
: `/preview/${event.camera}/start/${Math.round(event.start_time)}/end/${Math.round(event.end_time || event.start_time + 20)}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
// interaction
|
// interaction
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user