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