mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-15 11:32:09 +03:00
update default app view
This commit is contained in:
parent
953e467b56
commit
812a46d688
@ -47,6 +47,9 @@ function App() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function DefaultAppView() {
|
function DefaultAppView() {
|
||||||
|
const { data: config } = useSWR<FrigateConfig>("config", {
|
||||||
|
revalidateOnFocus: false,
|
||||||
|
});
|
||||||
return (
|
return (
|
||||||
<div className="size-full overflow-hidden">
|
<div className="size-full overflow-hidden">
|
||||||
{isDesktop && <Sidebar />}
|
{isDesktop && <Sidebar />}
|
||||||
@ -64,7 +67,15 @@ function DefaultAppView() {
|
|||||||
<Suspense>
|
<Suspense>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route
|
<Route
|
||||||
element={<ProtectedRoute requiredRoles={["viewer", "admin"]} />}
|
element={
|
||||||
|
<ProtectedRoute
|
||||||
|
requiredRoles={
|
||||||
|
config?.auth.roles
|
||||||
|
? Object.keys(config.auth.roles)
|
||||||
|
: ["admin", "viewer"]
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Route index element={<Live />} />
|
<Route index element={<Live />} />
|
||||||
<Route path="/review" element={<Events />} />
|
<Route path="/review" element={<Events />} />
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import ActivityIndicator from "../indicators/activity-indicator";
|
|||||||
export default function ProtectedRoute({
|
export default function ProtectedRoute({
|
||||||
requiredRoles,
|
requiredRoles,
|
||||||
}: {
|
}: {
|
||||||
requiredRoles: ("admin" | "viewer")[];
|
requiredRoles: string[];
|
||||||
}) {
|
}) {
|
||||||
const { auth } = useContext(AuthContext);
|
const { auth } = useContext(AuthContext);
|
||||||
|
|
||||||
|
|||||||
@ -342,6 +342,10 @@ export interface FrigateConfig {
|
|||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auth: {
|
||||||
|
roles: string[];
|
||||||
|
};
|
||||||
|
|
||||||
birdseye: BirdseyeConfig;
|
birdseye: BirdseyeConfig;
|
||||||
|
|
||||||
cameras: {
|
cameras: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user