Commit Graph

1559 Commits

Author SHA1 Message Date
Josh Hawkins
86bfe11885
Merge 78bc11d7e0 into 722ef6a1fe 2026-03-16 18:46:09 +00:00
Josh Hawkins
eeeec2db86 don't require restart for camera enabled change for profiles 2026-03-16 13:35:26 -05:00
Josh Hawkins
b1081d7217 formatting 2026-03-16 13:17:17 -05:00
Josh Hawkins
3a08b3d54b fix zones
- Fix zone colors not matching across profiles by falling back to base zone color when profile zone data lacks a color field
- Use base_config for base-layer values in masks/zones view so profile-merged values don't pollute the base config editing view
- Handle zones separately in profile manager snapshot/restore since ZoneConfig requires special serialization (color as private attr, contour generation)
- Inherit base zone color and generate contours for profile zone overrides in profile manager
2026-03-16 13:14:58 -05:00
Josh Hawkins
80239a8017 fix settings showing profile-merged values when editing base config
When a profile is active, the in-memory config contains effective
(profile-merged) values. The settings UI was displaying these merged
values even when the "Base Config" view was selected.

Backend: snapshot pre-profile base configs in ProfileManager and expose
them via a `base_config` key in the /api/config camera response when a
profile is active. The top-level sections continue to reflect the
effective running config.

Frontend: read from `base_config` when available in BaseSection,
useConfigOverride, useAllCameraOverrides, and prepareSectionSavePayload.
Include formData labels in Object/Audio switches widgets so that labels
added only by a profile override remain visible when editing that profile.
2026-03-16 12:23:07 -05:00
ryzendigo
e80da2b297
fix: WebSocket connection leaked on WebRTC player cleanup (#22473)
The connect() function creates a WebSocket but never stores the
reference. The useEffect cleanup only closes the RTCPeerConnection
via pcRef, leaving the WebSocket open.

Each time the component re-renders with changed deps (camera switch,
playback toggle, microphone toggle), a new WebSocket is created
without closing the previous one. This leaks connections until the
browser garbage-collects them or the server times out.

Store the WebSocket in a ref and close it in the cleanup function.
2026-03-16 06:47:07 -06:00
ryzendigo
dfc6ff9202
fix: variable shadowing silently drops object label updates (#22472)
When an existing tracked object's label or stationary status changes
(e.g. sub_label assignment from face recognition), the update handler
declares a new const newObjects that shadows the outer let newObjects.

The label and stationary mutations apply to the inner copy, but
handleSetObjects on line 148 reads the outer variable which was never
mutated. The update is silently discarded.

Remove the inner declaration so mutations apply to the outer variable
that gets passed to handleSetObjects.
2026-03-16 06:43:25 -06:00
Josh Hawkins
310b5dfe05
UI tweaks and fixes (#22448)
* fix double scrollbar in debug replay

* always hide ffmpeg cpu warnings for replay cameras

* add slovenian

* fix motion previews on safari and ios

match the logic used in ScrubbablePreview for manually stepping currentTime at the correct rate

* prevent motion recalibration when opening motion tuner
2026-03-15 07:26:23 -05:00
Josh Hawkins
324953d3a5
UI tweaks (#22405)
Some checks failed
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
* add shm frame lifetime calculation and update UI for shared memory metrics

* consistent sizing on activity indicator in save buttons

* fix offline overlay overflowing on mobile when in grid mode
2026-03-12 16:57:42 -06:00
Josh Hawkins
12e9bb3944 fix profile config inheritance bug where Pydantic defaults override base values
The /config API was dumping profile overrides with model_dump() which included
all Pydantic defaults. When the frontend merged these over
the camera's base config, explicitly-set base values were
lost. Now profile overrides are re-dumped with exclude_unset=True so only
user-specified fields are returned.

Also fixes the Save All path generating spurious deletion markers for
restart-required fields that are hidden during profile
editing but not excluded from the raw data sanitization in
prepareSectionSavePayload.
2026-03-12 11:20:03 -05:00
Josh Hawkins
091e0b80d2 show active profile indicator in desktop status bar 2026-03-12 10:58:16 -05:00
Josh Hawkins
0748766713 hide restart-required fields when editing a profile section
fields that require a restart cannot take effect via profile switching,
so they are merged into hiddenFields when profileName is set
2026-03-12 10:56:08 -05:00
Josh Hawkins
611316906a immediately create profiles on backend instead of deferring to Save All 2026-03-12 10:53:53 -05:00
Josh Hawkins
e92fa2b4ba tweak language 2026-03-12 10:47:31 -05:00
Josh Hawkins
8d633423b0 show activity indicator on trash icon while deleting a profile 2026-03-12 10:47:05 -05:00
Josh Hawkins
46d91af001 change color order 2026-03-12 09:00:45 -05:00
Josh Hawkins
0f735bea37 use icon only on mobile 2026-03-12 08:57:57 -05:00
Josh Hawkins
5a1ec5d729 remove profile badge in settings and add profiles to main menu 2026-03-12 08:32:23 -05:00
Josh Hawkins
39500b20a0 implement profile friendly names and improve profile UI
- Add ProfileDefinitionConfig type and profiles field to FrigateConfig
- Use ProfilesApiResponse type with friendly_name support throughout
- Replace Record<string, unknown> with proper JsonObject/JsonValue types
- Add profile creation form matching zone pattern (Zod + NameAndIdFields)
- Add pencil icon for renaming profile friendly names in ProfilesView
- Move Profiles menu item to first under Camera Configuration
- Add activity indicators on save/rename/delete buttons
- Display friendly names in CameraManagementView profile selector
- Fix duplicate colored dots in management profile dropdown
- Fix i18n namespace for overridden base config tooltips
- Move profile override deletion from dropdown trash icon to footer
  button with confirmation dialog, matching Reset to Global pattern
- Remove Add Profile from section header dropdown to prevent saving
  camera overrides before top-level profile definition exists
- Clean up newProfiles state after API profile deletion
- Refresh profiles SWR cache after saving profile definitions
2026-03-11 20:55:56 -05:00
Josh Hawkins
dace54734b more unique colors 2026-03-11 16:21:41 -05:00
Josh Hawkins
210d203fa4 fix mask deletion 2026-03-11 16:04:17 -05:00
Josh Hawkins
5ec1b1841c refactor profilesview and add dots/border colors when overridden 2026-03-11 15:51:29 -05:00
Josh Hawkins
33e4dddb3e rename profile settings to ui settings 2026-03-11 12:35:45 -05:00
Josh Hawkins
8072c991cd ui tweaks 2026-03-11 12:35:13 -05:00
Josh Hawkins
3cdb40610f fix profile save diff, masksAndZones delete, and config sync 2026-03-11 12:04:35 -05:00
Josh Hawkins
7925d120ae tweak colors and switch 2026-03-11 11:36:15 -05:00
Josh Hawkins
18d413fbee tweaks 2026-03-11 11:35:12 -05:00
Josh Hawkins
98e9e79881 formatting 2026-03-11 11:07:23 -05:00
Josh Hawkins
a0849b104c add profiles enable toggle and improve empty state 2026-03-11 11:05:18 -05:00
Josh Hawkins
096a13bce9 move profile dropdown from section panes to settings header 2026-03-11 11:01:51 -05:00
Josh Hawkins
eccad7aa21 add face_recognition and lpr to profile-eligible sections 2026-03-11 10:35:38 -05:00
Josh Hawkins
cd58329796 fix hidden field validation errors caused by lodash wildcard and schema gaps
lodash unset does not support wildcard (*) segments, so hidden fields like
filters.*.mask were never stripped from form data, leaving null raw_coordinates
that fail RJSF anyOf validation. Add unsetWithWildcard helper and also strip
hidden fields from the JSON schema itself as defense-in-depth.
2026-03-11 10:35:19 -05:00
Josh Hawkins
192aba901a
Replace react-tracked and react-use-websocket with useSyncExternalStore (#22386)
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* refactor websockets to remove react-tracked

react 19 removed useReducer eager bailout, which broke react-tracked.

react-tracked works by wrapping state in a JavaScript Proxy. When a component reads state.someField, the proxy records that access. On the next state update, it compares only the fields each component actually touched and skips re-renders if those fields are unchanged. Under the hood, this relies on useReducer — and in React 18, useReducer had an "eager bail-out" that short-circuited rendering when the new state was === to the old state. React 19 removed that optimization, so every dispatch now schedules a render regardless, and the proxy comparison runs too late to prevent it.

useSyncExternalStore is a React primitive (added in 18, stable in 19) designed for exactly this pattern: subscribing to an external store:

useSyncExternalStore(
  subscribe,   // (listener) => unsubscribe — called when the store changes
  getSnapshot  // () => value — returns the current value for this subscriber
)

React calls getSnapshot during render and compares the result with Object.is. If the value is the same reference, the component bails out — no re-render. The key difference from react-tracked is that this bail-out is built into React's reconciler, not bolted on via proxy tricks and useReducer.

The per-topic subscription model makes this efficient. Instead of one global store where every subscriber has to check if their fields changed, each useWs("some/topic", ...) call subscribes only to that topic's listener set. When a message arrives for front_door/detect/state, only components subscribed to that exact topic get their listener fired → React calls their getSnapshot → Object.is compares the value → bail-out if unchanged. Components watching back_yard/detect/state are never even notified.

* remove react-tracked and react-use-websocket

* refactor usePolygonStates to use ws topic subscription

* fix TimeAgo refresh interval always returning 1s due to unit mismatch (seconds vs milliseconds)

older events now correctly refresh every minute/hour instead of every second

* simplify

* clean up

* don't resend onconnect

* clean up

* remove patch
2026-03-11 09:02:51 -05:00
Josh Hawkins
379247dee6 profile support for mask and zone editor 2026-03-11 07:16:44 -05:00
Josh Hawkins
e8b9225175
Recordings API and calendar UI performance improvements (#22352)
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* optimize recordings/summary endpoint db query

replace strftime with integer arithmetic. increases speed by about 6x, especially noticeable for installs with long retention days

* optimize calendar rendering with Set lookups and remove unnecessary remount key

The old code built Date[] arrays with a TZDate object for every day in recording history (365+ timezone-aware date constructions). react-day-picker then did O(visible × history) date comparisons to match each of the displayed days against these arrays. Now we build Set<string> from the raw keys (zero date construction), and pass matcher functions that do O(1) Set.has() lookups. react-day-picker only calls these for visible days

* clean up
2026-03-09 17:22:01 -06:00
Josh Hawkins
6205a9d588 add red dot for any pending changes including profiles 2026-03-09 16:08:50 -05:00
Josh Hawkins
fa49e0e7b1 add active profile badge to settings toolbar 2026-03-09 15:57:24 -05:00
Josh Hawkins
fe7aa2ba3d add profiles summary page with card-based layout and fix backend zone comparison bug 2026-03-09 15:52:26 -05:00
Josh Hawkins
7131acafa6 add per-profile camera enable/disable to Camera Management view 2026-03-09 15:35:35 -05:00
Josh Hawkins
94dbabd0ef add profile section dropdown and wire into camera settings pages 2026-03-09 15:20:50 -05:00
Josh Hawkins
9cbd80d981
Add motion previews filter (#22347)
* add ability to filter motion previews via heatmap grid

* i18n

* use dialog on mobile
2026-03-09 14:14:13 -06:00
Josh Hawkins
d5dc77daa4 add profileName prop to BaseSection for profile-aware config editing 2026-03-09 15:11:56 -05:00
Josh Hawkins
edf7fcb5b4 add profile state management and save preview support 2026-03-09 15:06:11 -05:00
Josh Hawkins
72b4a4ddad add frontend profile types, color utility, and config save support 2026-03-09 15:00:25 -05:00
Josh Hawkins
dd9497baf2
Add ability to delete cameras (#22336)
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* refactor camera cleanup code to generic util

* add api endpoint for deleting a camera

* frontend

* i18n

* clean up
2026-03-08 16:23:48 -06:00
Josh Hawkins
df27e04c0f
Frontend updates (#22327)
* add optional field widget

adds a switch to enable nullable fields like skip_motion_threshold

* config field updates

add skip_motion_threshold optional switch
add fps back to detect restart required

* don't use ternary operator when displaying motion previews

the main previews were being unnecessarily unmounted

* lazy mount motion preview clips to reduce DOM overhead
2026-03-08 12:27:53 -05:00
Nicolas Mowen
a705f254e5
Support using GenAI for embeddings / semantic search (#22323)
* Support GenAI for embeddings

* Add embed API support

* Add support for embedding via genai

* Basic docs

* undo

* Fix sending images

* Don't require download check

* Set model

* Handle emb correctly

* Clarification

* Cleanup

* Cleanup
2026-03-08 10:55:00 -05:00
Josh Hawkins
acdfed40a9
Improve annotation offset UX (#22310)
Some checks failed
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
* keep nav buttons visible

nav buttons would be hidden when closing and reopening dialog after selecting the tracking details pane

* better ux in tracking details

actually pause the video and seek when annotation offset changes to make it easier to visually line up the bounding box

* improve detail stream ux

* update dummy camera docs

* fix docs link
2026-03-07 07:50:00 -06:00
Josh Hawkins
889dfca36c
Frontend fixes (#22309)
* prevent unnecessary reloads in useUserPersistence hook

* always render ProtectedRoute (handling undefined roles internally) and add Suspense fallback

* add missing i18n namespaces

react 19 enforces Suspense more strictly, so components using useTranslation() with unloaded namespaces would suspend, blanking the content behind the empty Suspense fallback

* add missing namespace

* remove unneeded

* remove modal from actions dropdown
2026-03-07 06:43:00 -07:00
Josh Hawkins
c2e667c0dd
Add dynamic configuration for more fields (#22295)
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* face recognition dynamic config

* lpr dynamic config

* safe changes for birdseye dynamic config

* bird classification dynamic config

* always assign new config to stats emitter to make telemetry fields dynamic

* add wildcard support for camera config updates in config_set

* update restart required fields for global sections

* add test

* fix rebase issue

* collapsible settings sidebar

use the preexisting control available with shadcn's sidebar (cmd/ctrl-B) to give users more space to set masks/zones on smaller screens

* dynamic ffmpeg

* ensure previews dir exists

when ffmpeg processes restart, there's a brief window where the preview frame generation pipeline is torn down and restarted. before these changes, ffmpeg only restarted on crash/stall recovery or full Frigate restart. Now that ffmpeg restarts happen on-demand via config changes, there's a higher chance a frontend request hits the preview_mp4 or preview_gif endpoints during that brief restart window when the directory might not exist yet. The existing os.listdir() call would throw FileNotFoundError without a directory existence check. this fix just checks if the directory exists and returns 404 if not, exactly how preview_thumbnail already handles the same scenario a few lines below

* global ffmpeg section

* clean up

* tweak

* fix test
2026-03-06 13:45:39 -07:00