Merge branch 'blakeblackshear:dev' into dev

This commit is contained in:
GuoQing Liu 2025-03-15 22:50:54 +08:00 committed by GitHub
commit 9ebf156542
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 6 deletions

View File

@ -253,12 +253,12 @@ def auth(request: Request):
# pass the user header value from the upstream proxy if a mapping is specified
# or use anonymous if none are specified
user_header = proxy_config.header_map.user
role_header = proxy_config.header_map.role
success_response.headers["remote-user"] = (
request.headers.get(user_header, default="anonymous")
if user_header
else "anonymous"
)
role_header = proxy_config.header_map.role
role = (
request.headers.get(role_header, default="viewer")

View File

@ -62,11 +62,13 @@ def migrate(migrator, database, fake=False, **kwargs):
'SELECT "id" FROM "reviewsegment" WHERE "has_been_reviewed" = 1'
)
reviewed_segment_ids = [row[0] for row in cursor.fetchall()]
# also migrate for anonymous (unauthenticated users)
usernames = [user.username for user in all_users] + ["anonymous"]
for segment_id in reviewed_segment_ids:
for user in all_users:
for username in usernames:
UserReviewStatus.create(
user_id=user.username,
user_id=username,
review_segment=segment_id,
has_been_reviewed=True,
)

View File

@ -61,6 +61,7 @@ import { useIsAdmin } from "@/hooks/use-is-admin";
import SetPasswordDialog from "../overlay/SetPasswordDialog";
import { toast } from "sonner";
import axios from "axios";
import { FrigateConfig } from "@/types/frigateConfig";
type GeneralSettingsProps = {
className?: string;
@ -68,7 +69,7 @@ type GeneralSettingsProps = {
export default function GeneralSettings({ className }: GeneralSettingsProps) {
const { data: profile } = useSWR("profile");
const { data: config } = useSWR("config");
const { data: config } = useSWR<FrigateConfig>("config");
const logoutUrl = config?.proxy?.logout_url || "/api/logout";
// settings
@ -275,7 +276,7 @@ export default function GeneralSettings({ className }: GeneralSettingsProps) {
</Link>
</>
)}
{isAdmin && isMobile && (
{isAdmin && isMobile && config?.face_recognition.enabled && (
<>
<Link to="/faces">
<MenuItem
@ -283,7 +284,7 @@ export default function GeneralSettings({ className }: GeneralSettingsProps) {
aria-label="Face Library"
>
<LuSquarePen className="mr-2 size-4" />
<span>Configuration editor</span>
<span>Face Library</span>
</MenuItem>
</Link>
</>

View File

@ -435,6 +435,10 @@ export interface FrigateConfig {
enabled: boolean;
};
proxy: {
logout_url?: string;
};
record: {
enabled: boolean;
enabled_in_config: boolean | null;