mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-07 02:18:07 +01:00
Add Camera Wizard tweaks (#20889)
* digest auth backend * frontend * i18n * update field description language to include note about onvif specific credentials * mask util helper function * language * mask passwords in http-flv and others where a url param is password
This commit is contained in:
@@ -16,6 +16,7 @@ import type {
|
||||
} from "@/types/cameraWizard";
|
||||
import { FaCircleCheck } from "react-icons/fa6";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { maskUri } from "@/utils/cameraUtil";
|
||||
|
||||
type OnvifProbeResultsProps = {
|
||||
isLoading: boolean;
|
||||
@@ -258,12 +259,6 @@ function CandidateItem({
|
||||
const { t } = useTranslation(["views/settings"]);
|
||||
const [showFull, setShowFull] = useState(false);
|
||||
|
||||
const maskUri = (uri: string) => {
|
||||
const match = uri.match(/rtsp:\/\/([^:]+):([^@]+)@(.+)/);
|
||||
if (match) return `rtsp://${match[1]}:••••@${match[3]}`;
|
||||
return uri;
|
||||
};
|
||||
|
||||
return (
|
||||
<Card
|
||||
className={cn(
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "@/components/ui/form";
|
||||
import { Checkbox } from "@/components/ui/checkbox";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import {
|
||||
Select,
|
||||
@@ -81,6 +82,7 @@ export default function Step1NameCamera({
|
||||
password: z.string().optional(),
|
||||
brandTemplate: z.enum(CAMERA_BRAND_VALUES).optional(),
|
||||
onvifPort: z.coerce.number().int().min(1).max(65535).optional(),
|
||||
useDigestAuth: z.boolean().optional(),
|
||||
customUrl: z
|
||||
.string()
|
||||
.optional()
|
||||
@@ -118,6 +120,7 @@ export default function Step1NameCamera({
|
||||
: "dahua",
|
||||
customUrl: wizardData.customUrl || "",
|
||||
onvifPort: wizardData.onvifPort ?? 80,
|
||||
useDigestAuth: wizardData.useDigestAuth ?? false,
|
||||
},
|
||||
mode: "onChange",
|
||||
});
|
||||
@@ -330,6 +333,32 @@ export default function Step1NameCamera({
|
||||
/>
|
||||
)}
|
||||
|
||||
{probeMode && (
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="useDigestAuth"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex items-start space-x-2">
|
||||
<FormControl>
|
||||
<Checkbox
|
||||
className="size-5 text-white accent-white data-[state=checked]:bg-selected data-[state=checked]:text-white"
|
||||
checked={!!field.value}
|
||||
onCheckedChange={(val) => field.onChange(!!val)}
|
||||
/>
|
||||
</FormControl>
|
||||
<div className="flex flex-1 flex-col space-y-1">
|
||||
<FormLabel className="mb-0 text-primary-variant">
|
||||
{t("cameraWizard.step1.useDigestAuth")}
|
||||
</FormLabel>
|
||||
<FormDescription className="mt-0">
|
||||
{t("cameraWizard.step1.useDigestAuthDescription")}
|
||||
</FormDescription>
|
||||
</div>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!probeMode && (
|
||||
<div className="space-y-4">
|
||||
<FormField
|
||||
|
||||
@@ -191,6 +191,7 @@ export default function Step2ProbeOrSnapshot({
|
||||
username: wizardData.username || "",
|
||||
password: wizardData.password || "",
|
||||
test: false,
|
||||
auth_type: wizardData.useDigestAuth ? "digest" : "basic",
|
||||
},
|
||||
timeout: 30000,
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ import { PlayerStatsType } from "@/types/live";
|
||||
import { FaCircleCheck, FaTriangleExclamation } from "react-icons/fa6";
|
||||
import { LuX } from "react-icons/lu";
|
||||
import { Card, CardContent } from "../../ui/card";
|
||||
import { maskUri } from "@/utils/cameraUtil";
|
||||
|
||||
type Step4ValidationProps = {
|
||||
wizardData: Partial<WizardFormData>;
|
||||
@@ -374,7 +375,7 @@ export default function Step4Validation({
|
||||
|
||||
<div className="mb-2 flex flex-col justify-between gap-1 md:flex-row md:items-center">
|
||||
<span className="break-all text-sm text-muted-foreground">
|
||||
{stream.url}
|
||||
{maskUri(stream.url)}
|
||||
</span>
|
||||
<Button
|
||||
onClick={() => {
|
||||
|
||||
Reference in New Issue
Block a user