Commit Graph
3254 Commits
Author SHA1 Message Date
Harsh Singh 08bc20d83a fix: options save refuses a list for an option or a new menu entry field instead of storing Array or dying (#8525) 2026-11-29 17:38:47 -05:00
Harsh Singh ec8f4f3c8a fix: event rename and detail refuse a list for the name, cause or notes instead of writing Array (#8523) 2026-11-29 17:38:43 -05:00
Harsh Singh e136b16f04 fix: console restart skips a WebSite monitor instead of starting a capture daemon for it (#8521) 2026-11-29 17:38:40 -05:00
Harsh Singh 9d5e7a8c51 fix: exporting a running event no longer raises a strtotime null deprecation (#8519) 2026-11-29 17:38:36 -05:00
Harsh Singh 49c5febd64 fix: options menu delete and sort order ignore a nested list instead of using entry 1 (#8492) 2026-11-28 11:08:19 -05:00
Harsh Singh 6d000ec263 fix: group save ignores a nested list among the monitor ids instead of adding monitor 1 (#8494) 2026-11-28 11:06:26 -05:00
Jash Ambaliya 69196f3ae7 feat: console Restart button restarts the selected monitors' capture daemons refs #8226 (#8227) 2026-11-28 10:52:11 -05:00
fec0999425 feat: ONVIF event notes and tags from what the camera detected (#7712)
* feat: name what an ONVIF camera detected in the event note refs #7688

The ONVIF event note was the raw topic plus the value of the first Data
SimpleItem, e.g. "tns1:RuleEngine/MyRuleDetector/PeopleDetect/true".
parse_event_message() dropped every other item, the item names and the
Source Rule, so cameras that name the detection in an item (Tapo
IsPeople=true under a generic TPSmartEvent topic) or in a value (Ajax
ClassTypes="Human Vehicle") produced notes that did not say what was
detected.

parse_event_message() now also returns every Data SimpleItem and the
Source Rule, and ONVIFEventNote() builds the note from them with rules
that hold across vendors rather than a per-camera list:

- strip the namespace prefix of every topic segment (tns1:, tnsajax:)
- drop a leading RuleEngine/, the root of every analytics topic
- leave out items that are empty or inactive, by the same words
  interpret_alarm_value() uses for the alarm state, and per-object ids,
  which would otherwise add a note per object as notes only accumulate
- leave out the value of items that say active, and State/LogicalState
  items that say active
- add the Rule in parentheses when the camera names one

  Reolink  MyRuleDetector/PeopleDetect
  Tapo     TPSmartEventDetector/TPSmartEvent IsPeople (MyTPSmartEventDetectorRule)
  Ajax     ObjectDetection/Object ClassTypes=Human Vehicle (AjaxObjectRule)

The word lists that drive this sit together, so a camera with other
vocabulary is handled by extending them. The inactive words move from
interpret_alarm_value() into that shared list unchanged. A value found
outside the Data SimpleItems (ElementItem, fallback search) still goes in
the note, and a topic that reduces to nothing is used as it is.

Alarm on/off decisions, the value they use, ONVIF_Alarm_Text matching and
the alarms map keys are unchanged; a test pins interpret_alarm_value() to
its previous results. parse_event_message() and interpret_alarm_value()
are now static, as they use no member state, so they can be tested.

Notes change format: filters matching the old text (e.g. Notes LIKE
"tns1:RuleEngine" or "/true") need updating.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: link existing tags to events and stop logging new ones as errors refs #7688

Event::AddPacket_ tagged events from object detections, but when the tag
name was already in Tags it neither linked it to the event nor cached it,
and leaked the Tag that Tag::find returned. Only a tag name created for the
first time was ever linked, so detections of person, car, ... after the
first never reached Events_Tags.

Move the tagging into Event::AddTag, which finds or creates the tag, links
it once per event and caches it. A mutex guards the cache so the analysis
thread can tag the event too. Event_Tag::save uses INSERT IGNORE so a link
another writer made first (zm_detect via pyzm) is not an error, and
Tag::find returns nullptr without logging two errors when the name is not
there yet, which is how callers learn a tag is new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: tag events with the objects an ONVIF camera reports refs #7688

Add a per-monitor "Tag Events From ONVIF" checkbox (Monitors.ONVIF_Event_Tags,
off by default). When set, events raised by the ONVIF event listener are
tagged with what the camera detected, through the existing Tags and
Events_Tags tables.

ONVIFEventTags() reads the object from wherever the camera puts it, using
the items parse_event_message() already collects for the note: the topic
(Reolink PeopleDetect), an active item name without its "Is" (Tapo
IsPeople) or the classes in an item value (Ajax ClassTypes="Human
Vehicle"). Camera names map to the names object detection uses, so one tag
means one thing: person, vehicle, animal, package, face, and doorbell for
a Visitor press. An alarm that names no object (motion, tamper, line
crossing, an unknown detector) is tagged with its last topic segment, e.g.
MotionAlarm. The names are a table next to the note vocabulary; items are
judged by the same helper the note uses (inactive, per-object id, generic
state).

Each alarm entry keeps its tags beside its note, SetTagSet() returns them
as SetNoteSet() returns notes, including for a pulse that has already
cleared, and Monitor::Analyse() hands them to Event::AddTag().

Schema: zm_update-1.39.55.sql adds the column, zm_create.sql.in matches,
version 1.39.55. Web: checkbox and help text next to ONVIF Event Listener,
unticked default for the save action. Perl: Monitor field list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: map camera object names to AI object classes for ONVIF tags refs #7688

ONVIF event tags were mapped from a word list compiled into zmc, so a
camera using another word for an object needed a code change. Move the
mapping into the database, on the object classes ZM already has.

- Add AI_Object_Classes.Aliases, a comma separated list of what cameras
  call the class, editable in Options, AI Classes.
- Seed aliases on the COCO person class and add a Camera dataset for
  the objects COCO has no class for: vehicle, animal, package, face and
  doorbell. Aliases already set are kept when the migration reruns.
- zmc loads the class names and aliases when the ONVIF listener starts
  on a monitor with ONVIF_Event_Tags set. A class name maps to itself,
  so a camera reporting Car is tagged car, as object detection would.
- Without the classes (an older database) alarms are tagged with their
  topic, as for an alarm that names no object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: address review of the ONVIF event tags refs #7688

- Event::AddTag tries each name once per event, so a tag that can't be
  saved is not looked up and logged on every frame, and cuts names to
  the 64 characters of Tags.Name. It no longer holds tags_mutex_ over
  the database work, and the Events_Tags row goes through dbQueue, so
  the analysis thread waits on at most the tag lookup.
- Tag::save returns the existing Id when another process created the
  same tag first, instead of failing on the unique Name.
- Event_Tag::save ignores only the duplicate key, not other errors.
- An ONVIF message whose first state item is inactive and a later one
  active (Tapo IsVehicle=false, IsPeople=true) raises the alarm.
- The Is prefix of an item name is matched in any case.
- load_tag_names leaves the error to zmDbFetch, which has logged it.
- The help text says to restart the monitor after changing aliases.
- Re-indent two lines in ProcessPullResponse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: restart ONVIF tagging monitors when an AI class changes refs #7688

zmc reads the object class names and aliases when it starts listening
for ONVIF events, so an alias saved in Options, AI Classes did nothing
until the monitor was restarted by hand. Saving or deleting a class now
restarts the zmc of each monitor with ONVIF_Event_Listener and
ONVIF_Event_Tags set, as saving zones does for their monitor.

Add the Aliases label to en_gb so it can be translated like the other
strings, and say in the help text that saving restarts those monitors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: address Copilot review of the ONVIF event tags refs #7688

- Only a later alarm-state item (IsX, State, Alarm, ...) overrides an
  inactive first one. A later ObjectId or Count describes the object,
  so IsInside=false followed by ObjectId=3 stays an alarm-off.
- 1 is true for a flag item such as IsPeople, as it already was for
  State, so IsPeople=1 is tagged person rather than the topic.
- Cut tag names at 64 UTF-8 characters, the size of Tags.Name, without
  splitting a character, using a new Utf8Truncate helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: leave ONVIF detections out of the note when they are tagged refs #7688

With ONVIF_Event_Tags on, the tags already say what the camera
detected, and name the topic when no object is named, so the note
repeated them: "Motion: MyRuleDetector/PeopleDetect, ONVIF" next to a
person tag. Such a monitor's note now just says ONVIF. With tags off
the note still names the detection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: edit AI class aliases as tags refs #7688

A plain text field gave no hint that aliases are a comma list. Edit
them like an event's tags instead, with the same tag styles: each alias
is a removable tag, and Enter, space or comma adds the one typed. They
are still saved as the comma list zmc reads, so nothing else changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: split ONVIF class values on commas and drop the DogCat alias refs #7688

A camera listing its classes as ClassTypes="Human,Vehicle" was tagged
with neither, as values were split on spaces only. Split on commas too.

Drop DogCat from the animal aliases: no camera is known to send it,
Reolink sends DogCatDetect. Say in the seed where the starter aliases
come from, which of them have been seen from a camera, and that more
are added in Options, AI Classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: give a new AI class the next free index and refuse a taken one refs #7688

A class's index is the number its dataset's model gives it, which a
dataset with no model behind it (Camera) has no use for, yet the form
required one and took any number, so a second class could get 0.

Leave the index empty on a new class to get the next one in its
dataset, and refuse an index another class of the dataset already has,
naming that class.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: number the placeholders of ClassIndexInUse so translations can reorder them refs #7688

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor: source the camera class seed from the 1.39.55 migration refs #7688

The migration carried a copy of db/camera_classes.sql, so the starter
aliases lived in two places. Make it a .sql.in that sources the seed
file, as zm_update-1.39.26.sql.in does with triggers.sql, so fresh
installs and upgrades share one copy. Note in the seed that it must
keep working on a 1.39.55 database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Isaac Connor <isaac@zoneminder.com>
2026-11-27 21:11:06 -05:00
Jash Ambaliya 15514e6997 fix: Monitor Path strips percent-encoded credentials from the stored path refs #7600 (#7601) 2026-11-27 20:44:41 -05:00
Harsh Singh 2a33f27d7b fix: validStr gives an empty string for an array instead of a TypeError (#8443) 2026-11-27 08:52:31 -05:00
Jash Ambaliya b7385ba41d fix: a zone whose points are not a polygon says why it was not saved instead of redirecting to the zones list refs #8414 (#8415) 2026-11-27 08:41:52 -05:00
73aa1f56f7 fix: filter editor keeps every value of a multi-value Monitor, Server, Storage, Zone or Tags term refs #7271 (#7272)
Co-authored-by: Isaac Connor <isaac@zoneminder.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:15:48 -05:00
Jash Ambaliya 03ed383c16 fix: montage layout names are trimmed, so a blank name is refused and padding doesn't get past the preset and duplicate checks refs #7377 (#7378) 2026-11-27 08:15:05 -05:00
Jash Ambaliya 9e2c175b40 fix: reduce request ids to digits before building Report, Group and Control objects refs #7799 (#7800) 2026-11-26 22:33:17 -05:00
Jash Ambaliya b9845ecb18 fix: filter save stops the daemon only after the save succeeds refs #7753 (#7754) 2026-11-26 22:14:14 -05:00
Jash Ambaliya 4444dca629 fix: changes() and array_recursive_diff compare scalar values as strings so 0, null, '10' and '1e1' are not treated as unchanged refs #7773 (#7774) 2026-11-26 22:06:10 -05:00
Jash Ambaliya b8276d104a fix: Monitor stream url and html no longer divide by a zero view width or height refs #7781 (#7782) 2026-11-26 22:04:06 -05:00
Jash Ambaliya b9078d6b2f fix: auth hash cache tracks the age of each address slot separately refs #7823 (#7824) 2026-11-26 21:38:18 -05:00
Jash Ambaliya ec60196a65 fix: monitor action editor refuses array input and unknown trigger or action values refs #7815 (#7816) 2026-11-26 21:35:44 -05:00
Harsh Singh 7c4f7b11db fix: add monitors probe no longer calls curl_close deprecated in PHP 8.5 (#8381) 2026-11-26 19:00:05 -05:00
Harsh Singh ec514eb2d3 fix: forwarded control request reads the reply status from the stream, not $http_response_header deprecated in PHP 8.5 (#8379) 2026-11-26 18:59:49 -05:00
Jash Ambaliya 6989abebb7 fix: a cookie lifetime under a minute no longer regenerates the session on every request or purges every session refs #8372 (#8373) 2026-11-26 18:52:14 -05:00
Harsh Singh 780dc5ec2e fix: database connection no longer reads the PDO::MYSQL_ATTR constants deprecated in PHP 8.5 (#8377) 2026-11-26 18:37:13 -05:00
Jash Ambaliya bcc175a559 fix: ZM_AUTH_HASH_TTL of 0 means 2 hours on the web side, as it does in zms and zmu refs #8366 (#8367) 2026-11-26 17:56:55 -05:00
Harsh Singh 551e8c7140 fix: a failed AI dataset, class or model save shows its error on the options page (#7266) 2026-11-26 17:48:44 -05:00
Jash Ambaliya ddec4c32d2 feat: offer to clone the zones when cloning a monitor refs #2906 (#6666) 2026-11-26 17:47:56 -05:00
Harsh Singh 59c32b78e5 fix: a malformed JSON string no longer raises an undefined variable warning in checkJsonError (#8126) 2026-11-26 08:50:56 -05:00
Harsh Singh b8a31cff94 fix: console Source column shows the file of a File or cURL monitor instead of Monitor N (#8104) 2026-11-26 08:49:43 -05:00
Harsh Singh 799df89af9 fix: a missing conf.d folder no longer raises an undefined variable warning in loadConfigFiles (#8122) 2026-11-26 08:48:57 -05:00
Jash Ambaliya 00a1984092 fix: reports explain a refused save and disable New and Save for users who would be refused refs #8295 (#8296) 2026-11-25 20:42:30 -05:00
Harsh Singh 4974ec75a6 fix: renaming a monitor removes its old name link when the storage path goes through a symlink (#8120) 2026-11-25 20:35:32 -05:00
Jash Ambaliya b5e8459d45 feat: filters can select events by their Videoed, Uploaded, Emailed, Messaged and Executed flags refs #8214 (#8215) 2026-11-25 20:34:02 -05:00
Jash Ambaliya 938ff65491 feat: filter Execute reports whether the filter ran, and zmfilter logs the match count at Info for one-off runs refs #8218 (#8219) 2026-11-25 20:32:12 -05:00
Jash Ambaliya c0e12c3ba2 feat: API creates a snapshot from monitors as the web snapshot action does refs #8208 (#8209) 2026-11-25 20:31:24 -05:00
Jash Ambaliya 5b42f076d0 fix: stream seek and max fps round the fraction to microseconds instead of truncating it (#7396)
* fix: stream seek and max fps round the fraction to microseconds instead of truncating it refs #7395

* fix: seek rounds only the fraction so whole seconds stay within a 32-bit int refs #7395
2026-11-25 20:23:30 -05:00
Harsh Singh f74923c8d5 fix: saving a control capability that no longer exists reports it instead of inserting a new one (#8150) 2026-11-25 18:30:21 -05:00
Jash Ambaliya 6fbbd206a5 fix: saving a user that no longer exists reports it instead of creating a new account refs #8297 (#8298) 2026-11-25 18:20:39 -05:00
Jash Ambaliya b5db3eb59c fix: options save skips config rows marked System refs #7472 (#7473) 2026-11-25 18:19:24 -05:00
Jash Ambaliya d3e800dc5b fix: Groups view shows why a group was not deleted refs #8287 (#8288) 2026-11-25 18:19:01 -05:00
Jash Ambaliya 5ff3e2710a fix: user save accepts a language only as a file name in the lang directory (#7569)
* fix: user save accepts a language only as a file name in the lang directory refs #7568

* fix: API self edit also requires the Language to be a plain name, and an array Language gets the not-saved message refs #7568
2026-11-25 18:18:10 -05:00
Jash Ambaliya 2b51f24923 fix: a password change ends the web sessions that logged in with the old password (#7507)
* fix: a password change ends the web sessions that logged in with the old password refs #7506

* fix: a System edit user changing their own password keeps their session refs #7506
2026-11-25 18:17:11 -05:00
Jash Ambaliya 87e8a9a71d fix: user save stores and checks the filtered Username instead of the typed one refs #7556 (#7557) 2026-11-25 18:16:22 -05:00
Jash Ambaliya 7d0a578ae7 fix: X10 command refuses a key or command containing a semicolon or control character refs #7548 (#7549) 2026-11-25 18:15:29 -05:00
Jash Ambaliya 7fcb9f3dd5 feat: filters can tag the events they match refs #8239 (#8240) 2026-11-25 18:04:02 -05:00
Jash Ambaliya 46a9fdd56b fix: name exports after their owner and refuse downloads of other users' exports (#7463)
* fix: name exports after their owner and refuse downloads of other users' exports refs #7462

* fix: prefix exportEvents archives with the owner prefix so archive.php serves them refs #7462

* test: cover exportEvents to archive.php ownership round trip refs #7462
2026-11-25 18:03:26 -05:00
Jash Ambaliya d74e23c162 fix: Options dnsmasq save refuses directives that run programs or include files and values with line breaks (#7521)
* fix: Options dnsmasq save refuses directives that run programs or include files and values with line breaks refs #7520

* fix: dnsmasq save also refuses conf-script and dumpfile refs #7520
2026-11-25 17:48:32 -05:00
Jash Ambaliya a416073800 feat: monitor save refuses an Ffmpeg source path with no protocol refs #8186 (#8187) 2026-11-25 08:46:40 -05:00
Jash Ambaliya 863565df00 fix: a new camera model typed on the monitor form is looked up under the chosen manufacturer, not by name alone refs #7406 (#7407) 2026-11-25 08:39:08 -05:00
Jash Ambaliya 53a845742a feat: options refuse a zmwatch interval or delay below one second refs #8190 (#8191) 2026-11-25 08:38:46 -05:00
Jash Ambaliya 45e9e4ab76 fix: html_input and filter terms escape their values and attributes (#7459)
* fix: html_input and filter terms escape their values and attributes refs #7458

* fix: filter bar also escapes a term's id, placeholder and Date data-cookie refs #7458
2026-11-25 08:33:32 -05:00