mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-27 19:57:54 -05:00
Compare commits
1 Commits
birdseye-v
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96c70eee4c |
2
Makefile
2
Makefile
@@ -1,7 +1,7 @@
|
||||
default_target: local
|
||||
|
||||
COMMIT_HASH := $(shell git log -1 --pretty=format:"%h"|tail -1)
|
||||
VERSION = 0.17.1
|
||||
VERSION = 0.17.0
|
||||
IMAGE_REPO ?= ghcr.io/blakeblackshear/frigate
|
||||
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||
BOARDS= #Initialized empty
|
||||
|
||||
@@ -161,7 +161,7 @@ YOLOv9 models that are compiled for TensorFlow Lite and properly quantized are s
|
||||
|
||||
:::tip
|
||||
|
||||
**Frigate+ Users:** Follow the [instructions](../integrations/plus#use-models) to set a model ID in your config file.
|
||||
**Frigate+ Users:** Follow the [instructions](/integrations/plus#use-models) to set a model ID in your config file.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ import { useStreamingSettings } from "@/context/streaming-settings-provider";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { CameraNameLabel } from "../camera/FriendlyNameLabel";
|
||||
import { useAllowedCameras } from "@/hooks/use-allowed-cameras";
|
||||
import { useHasFullCameraAccess } from "@/hooks/use-has-full-camera-access";
|
||||
import { useIsAdmin } from "@/hooks/use-is-admin";
|
||||
import { useUserPersistedOverlayState } from "@/hooks/use-overlay-state";
|
||||
|
||||
@@ -678,7 +677,7 @@ export function CameraGroupEdit({
|
||||
);
|
||||
|
||||
const allowedCameras = useAllowedCameras();
|
||||
const hasFullCameraAccess = useHasFullCameraAccess();
|
||||
const isAdmin = useIsAdmin();
|
||||
|
||||
const [openCamera, setOpenCamera] = useState<string | null>();
|
||||
|
||||
@@ -867,7 +866,8 @@ export function CameraGroupEdit({
|
||||
<FormDescription>{t("group.cameras.desc")}</FormDescription>
|
||||
<FormMessage />
|
||||
{[
|
||||
...(birdseyeConfig?.enabled && hasFullCameraAccess
|
||||
...(birdseyeConfig?.enabled &&
|
||||
(isAdmin || "birdseye" in allowedCameras)
|
||||
? ["birdseye"]
|
||||
: []),
|
||||
...Object.keys(config?.cameras ?? {})
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import { useAllowedCameras } from "@/hooks/use-allowed-cameras";
|
||||
import useSWR from "swr";
|
||||
import { FrigateConfig } from "@/types/frigateConfig";
|
||||
|
||||
/**
|
||||
* Returns true if the current user has access to all cameras.
|
||||
* This is used to determine birdseye access — users who can see
|
||||
* all cameras should also be able to see the birdseye view.
|
||||
*/
|
||||
export function useHasFullCameraAccess() {
|
||||
const allowedCameras = useAllowedCameras();
|
||||
const { data: config } = useSWR<FrigateConfig>("config", {
|
||||
revalidateOnFocus: false,
|
||||
});
|
||||
|
||||
if (!config?.cameras) return false;
|
||||
|
||||
const enabledCameraNames = Object.entries(config.cameras)
|
||||
.filter(([, cam]) => cam.enabled_in_config)
|
||||
.map(([name]) => name);
|
||||
|
||||
return (
|
||||
enabledCameraNames.length > 0 &&
|
||||
enabledCameraNames.every((name) => allowedCameras.includes(name))
|
||||
);
|
||||
}
|
||||
@@ -11,12 +11,12 @@ import { useTranslation } from "react-i18next";
|
||||
import { useEffect, useMemo, useRef } from "react";
|
||||
import useSWR from "swr";
|
||||
import { useAllowedCameras } from "@/hooks/use-allowed-cameras";
|
||||
import { useHasFullCameraAccess } from "@/hooks/use-has-full-camera-access";
|
||||
import { useIsAdmin } from "@/hooks/use-is-admin";
|
||||
|
||||
function Live() {
|
||||
const { t } = useTranslation(["views/live"]);
|
||||
const { data: config } = useSWR<FrigateConfig>("config");
|
||||
const hasFullCameraAccess = useHasFullCameraAccess();
|
||||
const isAdmin = useIsAdmin();
|
||||
|
||||
// selection
|
||||
|
||||
@@ -90,8 +90,8 @@ function Live() {
|
||||
const allowedCameras = useAllowedCameras();
|
||||
|
||||
const includesBirdseye = useMemo(() => {
|
||||
// Users without access to all cameras should not have access to birdseye
|
||||
if (!hasFullCameraAccess) {
|
||||
// Restricted users should never have access to birdseye
|
||||
if (!isAdmin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ function Live() {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}, [config, cameraGroup, hasFullCameraAccess]);
|
||||
}, [config, cameraGroup, isAdmin]);
|
||||
|
||||
const cameras = useMemo(() => {
|
||||
if (!config) {
|
||||
@@ -151,9 +151,7 @@ function Live() {
|
||||
|
||||
return (
|
||||
<div className="size-full" ref={mainRef}>
|
||||
{selectedCameraName === "birdseye" &&
|
||||
hasFullCameraAccess &&
|
||||
config?.birdseye?.enabled ? (
|
||||
{selectedCameraName === "birdseye" ? (
|
||||
<LiveBirdseyeView
|
||||
supportsFullscreen={supportsFullScreen}
|
||||
fullscreen={fullscreen}
|
||||
|
||||
Reference in New Issue
Block a user