From 19738de02e9c2e7542a561f6784c46aeab015090 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sat, 29 Nov 2025 06:48:54 -0600 Subject: [PATCH] admin only frigate+ submission --- web/src/components/overlay/detail/SearchDetailDialog.tsx | 3 ++- web/src/components/overlay/detail/TrackingDetails.tsx | 6 ++++-- web/src/components/overlay/dialog/FrigatePlusDialog.tsx | 3 +++ web/src/components/player/HlsVideoPlayer.tsx | 4 +++- web/src/components/timeline/EventMenu.tsx | 5 ++++- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/web/src/components/overlay/detail/SearchDetailDialog.tsx b/web/src/components/overlay/detail/SearchDetailDialog.tsx index 467008e92..4ead27218 100644 --- a/web/src/components/overlay/detail/SearchDetailDialog.tsx +++ b/web/src/components/overlay/detail/SearchDetailDialog.tsx @@ -1299,7 +1299,8 @@ function ObjectDetailsTab({ - {search.data.type === "object" && + {isAdmin && + search.data.type === "object" && config?.plus?.enabled && search.end_time != undefined && search.has_snapshot && ( diff --git a/web/src/components/overlay/detail/TrackingDetails.tsx b/web/src/components/overlay/detail/TrackingDetails.tsx index c6e10f8c2..26cba7d3a 100644 --- a/web/src/components/overlay/detail/TrackingDetails.tsx +++ b/web/src/components/overlay/detail/TrackingDetails.tsx @@ -38,6 +38,7 @@ import { isDesktop, isIOS, isMobileOnly, isSafari } from "react-device-detect"; import { useApiHost } from "@/api"; import ImageLoadingIndicator from "@/components/indicators/ImageLoadingIndicator"; import ObjectTrackOverlay from "../ObjectTrackOverlay"; +import { useIsAdmin } from "@/hooks/use-is-admin"; type TrackingDetailsProps = { className?: string; @@ -777,6 +778,7 @@ function LifecycleIconRow({ const { data: config } = useSWR("config"); const [isOpen, setIsOpen] = useState(false); const navigate = useNavigate(); + const isAdmin = useIsAdmin(); const aspectRatio = useMemo(() => { if (!config) { @@ -993,7 +995,7 @@ function LifecycleIconRow({
{formattedEventTimestamp}
- {(config?.plus?.enabled || item.data.box) && ( + {((isAdmin && config?.plus?.enabled) || item.data.box) && (
@@ -1002,7 +1004,7 @@ function LifecycleIconRow({ - {config?.plus?.enabled && ( + {isAdmin && config?.plus?.enabled && ( { diff --git a/web/src/components/overlay/dialog/FrigatePlusDialog.tsx b/web/src/components/overlay/dialog/FrigatePlusDialog.tsx index b57e73755..c011fa14b 100644 --- a/web/src/components/overlay/dialog/FrigatePlusDialog.tsx +++ b/web/src/components/overlay/dialog/FrigatePlusDialog.tsx @@ -20,6 +20,7 @@ import ImageLoadingIndicator from "@/components/indicators/ImageLoadingIndicator import { baseUrl } from "@/api/baseUrl"; import { getTranslatedLabel } from "@/utils/i18n"; import useImageLoaded from "@/hooks/use-image-loaded"; +import { useIsAdmin } from "@/hooks/use-is-admin"; export type FrigatePlusDialogProps = { upload?: Event; @@ -57,7 +58,9 @@ export function FrigatePlusDialog({ ); const [imgRef, imgLoaded, onImgLoad] = useImageLoaded(); + const isAdmin = useIsAdmin(); const showCard = + isAdmin && !!upload && upload.data.type === "object" && upload.plus_id !== "not_enabled" && diff --git a/web/src/components/player/HlsVideoPlayer.tsx b/web/src/components/player/HlsVideoPlayer.tsx index f51085e51..4d7068204 100644 --- a/web/src/components/player/HlsVideoPlayer.tsx +++ b/web/src/components/player/HlsVideoPlayer.tsx @@ -20,6 +20,7 @@ import { cn } from "@/lib/utils"; import { ASPECT_VERTICAL_LAYOUT, RecordingPlayerError } from "@/types/record"; import { useTranslation } from "react-i18next"; import ObjectTrackOverlay from "@/components/overlay/ObjectTrackOverlay"; +import { useIsAdmin } from "@/hooks/use-is-admin"; // Android native hls does not seek correctly const USE_NATIVE_HLS = false; @@ -83,6 +84,7 @@ export default function HlsVideoPlayer({ }: HlsVideoPlayerProps) { const { t } = useTranslation("components/player"); const { data: config } = useSWR("config"); + const isAdmin = useIsAdmin(); // for detail stream context in History const currentTime = currentTimeOverride; @@ -285,7 +287,7 @@ export default function HlsVideoPlayer({ volume: true, seek: true, playbackRate: true, - plusUpload: config?.plus?.enabled == true, + plusUpload: isAdmin && config?.plus?.enabled == true, fullscreen: supportsFullscreen, }} setControlsOpen={setControlsOpen} diff --git a/web/src/components/timeline/EventMenu.tsx b/web/src/components/timeline/EventMenu.tsx index ca14fcae8..e6ad8eba4 100644 --- a/web/src/components/timeline/EventMenu.tsx +++ b/web/src/components/timeline/EventMenu.tsx @@ -13,6 +13,7 @@ import { useTranslation } from "react-i18next"; import { Event } from "@/types/event"; import { FrigateConfig } from "@/types/frigateConfig"; import { useState } from "react"; +import { useIsAdmin } from "@/hooks/use-is-admin"; type EventMenuProps = { event: Event; @@ -35,6 +36,7 @@ export default function EventMenu({ const navigate = useNavigate(); const { t } = useTranslation("views/explore"); const [isOpen, setIsOpen] = useState(false); + const isAdmin = useIsAdmin(); const handleObjectSelect = () => { if (isSelected) { @@ -85,7 +87,8 @@ export default function EventMenu({ - {event.has_snapshot && + {isAdmin && + event.has_snapshot && event.plus_id == undefined && event.data.type == "object" && config?.plus?.enabled && (