From 52a3301726b83410cbb297020d1d1449204d0f53 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 5 May 2026 10:03:49 -0500 Subject: [PATCH] Miscellaneous fixes (#23111) * return 404 from /api/login if auth is disabled * locale sort object label switches * enable search on object switches field * add profiles docs link --- frigate/api/auth.py | 5 +++++ .../widgets/ObjectLabelSwitchesWidget.tsx | 10 +++++++-- web/src/views/settings/ProfilesView.tsx | 21 ++++++++++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/frigate/api/auth.py b/frigate/api/auth.py index d1c968818..641131208 100644 --- a/frigate/api/auth.py +++ b/frigate/api/auth.py @@ -812,6 +812,11 @@ limiter = Limiter(key_func=get_remote_addr) ) @limiter.limit(limit_value=rateLimiter.get_limit) def login(request: Request, body: AppPostLoginBody): + if not request.app.frigate_config.auth.enabled: + return JSONResponse( + content={"message": "Authentication is disabled"}, status_code=404 + ) + JWT_COOKIE_NAME = request.app.frigate_config.auth.cookie_name JWT_COOKIE_SECURE = request.app.frigate_config.auth.cookie_secure JWT_SESSION_LENGTH = request.app.frigate_config.auth.session_length diff --git a/web/src/components/config-form/theme/widgets/ObjectLabelSwitchesWidget.tsx b/web/src/components/config-form/theme/widgets/ObjectLabelSwitchesWidget.tsx index d3d6bdbe3..072b9c017 100644 --- a/web/src/components/config-form/theme/widgets/ObjectLabelSwitchesWidget.tsx +++ b/web/src/components/config-form/theme/widgets/ObjectLabelSwitchesWidget.tsx @@ -2,7 +2,7 @@ import { WidgetProps } from "@rjsf/utils"; import { SwitchesWidget } from "./SwitchesWidget"; import { FormContext } from "./SwitchesWidget"; -import { getTranslatedLabel } from "@/utils/i18n"; +import i18n, { getTranslatedLabel } from "@/utils/i18n"; import { FrigateConfig } from "@/types/frigateConfig"; import { JsonObject } from "@/types/configForm"; @@ -76,7 +76,12 @@ function getObjectLabels(context: FormContext): string[] { ...sourceLabels, ...formDataLabels, ]); - return [...combinedLabels].sort(); + return [...combinedLabels].sort((a, b) => + getObjectLabelDisplayName(a).localeCompare( + getObjectLabelDisplayName(b), + i18n.language, + ), + ); } function getObjectLabelDisplayName(label: string): string { @@ -94,6 +99,7 @@ export function ObjectLabelSwitchesWidget(props: WidgetProps) { i18nKey: "objectLabels", listClassName: "relative max-h-none overflow-visible md:max-h-64 md:overflow-y-auto md:overscroll-contain md:scrollbar-container", + enableSearch: true, }} /> ); diff --git a/web/src/views/settings/ProfilesView.tsx b/web/src/views/settings/ProfilesView.tsx index 0143e55bc..684b9193e 100644 --- a/web/src/views/settings/ProfilesView.tsx +++ b/web/src/views/settings/ProfilesView.tsx @@ -7,13 +7,20 @@ import useSWR from "swr"; import axios from "axios"; import { toast } from "sonner"; import { Pencil, Trash2 } from "lucide-react"; -import { LuChevronDown, LuChevronRight, LuPlus } from "react-icons/lu"; +import { + LuChevronDown, + LuChevronRight, + LuExternalLink, + LuPlus, +} from "react-icons/lu"; +import { Link } from "react-router-dom"; import type { FrigateConfig } from "@/types/frigateConfig"; import type { JsonObject } from "@/types/configForm"; import type { ProfileState, ProfilesApiResponse } from "@/types/profile"; import { getProfileColor } from "@/utils/profileColors"; import { PROFILE_ELIGIBLE_SECTIONS } from "@/utils/configUtil"; import { resolveCameraName } from "@/hooks/use-camera-friendly-name"; +import { useDocDomain } from "@/hooks/use-doc-domain"; import { cn } from "@/lib/utils"; import Heading from "@/components/ui/heading"; import { Button } from "@/components/ui/button"; @@ -66,6 +73,7 @@ export default function ProfilesView({ setProfilesUIEnabled, }: ProfilesViewProps) { const { t } = useTranslation(["views/settings", "common"]); + const { getLocaleDocUrl } = useDocDomain(); const { data: config, mutate: updateConfig } = useSWR("config"); const { data: profilesData, mutate: updateProfiles } = @@ -360,6 +368,17 @@ export default function ProfilesView({
{t("profiles.disabledDescription", { ns: "views/settings" })}
+
+ + {t("readTheDocumentation", { ns: "common" })} + + +
{/* Enable Profiles Toggle — shown only when no profiles exist */} {!hasProfiles && setProfilesUIEnabled && (