Commit Graph

12688 Commits

Author SHA1 Message Date
Ben Dailey
a87e2d03a5 feat: replace Event_Summaries view with SWR snapshot table
Replace the Event_Summaries view with a physical snapshot table
refreshed via Stale-While-Revalidate (SWR) pattern. A stored
procedure (Refresh_Summaries_SWR) uses GET_LOCK for non-blocking
concurrency and atomic table rename for zero-downtime refresh.

Database changes (db/views.sql):
- Rename Event_Summaries view to VIEW_Event_Summaries (source view)
- Add Event_Summaries snapshot table and Event_Summaries_Metadata table
- Add Refresh_Summaries_SWR stored procedure with GET_LOCK and
  atomic rename pattern to prevent thundering herd
- Add MySQL EVENT for background refresh every 600 seconds

PHP call sites (web/):
- Add ensureSummariesFresh() helper in database.php with static
  per-request dedup and 60s staleness check
- Call ensureSummariesFresh() before Event_Summaries queries in
  console.php, _monitor_filters.php, and Monitor.php
- Add beforeFind() hook in CakePHP Event_Summary model

Perl call sites (scripts/):
- Add ensureSummariesFresh() sub in Event_Summary.pm with
  per-process 60s rate-limiting
- Call ensureSummariesFresh() in Monitor.pm Event_Summary accessor

Upgrade path (db/zm_update-1.37.78.sql.in):
- Drop any prior Event_Summaries view or table before recreating

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-07 12:53:42 -04:00
Ben Dailey
4fe2103fcd Replace Events_Hour/Day/Week/Month/Archived and Event_Summaries tables with views
Remove denormalized event summary tables and their associated triggers,
replacing them with views that query the Events table directly. This
eliminates trigger maintenance overhead and periodic reconciliation in
zmaudit/zmstats, since the views compute stats on the fly.

- Remove trigger definitions for event summary table maintenance
- Remove event summary table inserts from zm_event.cpp
- Remove event count reconciliation queries from zmaudit.pl
- Remove DELETE-on-views calls from zmstats.pl (views filter by date inherently)
- Remove Event_Summaries DELETE from Monitor.php (can't delete from a view)
- Add db/views.sql with view definitions and covering index
- Add upgrade script zm_update-1.37.78.sql.in (drop triggers, drop tables, create views)
- Update zm_create.sql.in to use views instead of tables for fresh installs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-07 11:29:30 -04:00
Isaac Connor
692b77b4da fix: guard against empty auth_relay producing double && in zms URLs
When auth is disabled or auth_relay is empty, appending '&'+auth_relay
produces a trailing '&' which results in double '&&' when the next
parameter is appended (e.g. ?monitor=2&&scale=41&mode=single).

Guard all 4 places in MonitorStream.js where auth_relay is concatenated
into URLs, consistent with EventStream.js which already guards this.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 12:27:56 -04:00
Isaac Connor
7c08e3157b Fix missing quotes 2026-03-31 09:28:54 -04:00
Isaac Connor
48dce0311e fix: guard against null websocket in VideoRTC.onopen
ondisconnect() nulls this.ws, but the WebSocket open event fires
asynchronously. If ondisconnect() runs between socket creation and
the open callback, onopen() hits a null this.ws when adding the
message listener. Add a null guard to bail out cleanly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 16:24:14 -04:00
Isaac Connor
df594cac62 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-03-30 09:07:04 -04:00
Isaac Connor
96aff8cbac Upgrade bootstrap-table to 1.27.1 2026-03-29 11:25:18 -04:00
Isaac Connor
58968a8f90 fix: clamp user bandwidth before defining ZM_WEB_* constants
The bandwidth limiter in skin.php ran after config.php was included,
so the ZM_WEB_* constants were defined using the unclamped cookie
value. When no cookie existed and ZM_BANDWIDTH_DEFAULT was 'high',
a user with MaxBandwidth='medium' would get high bandwidth config
values despite the navbar showing medium.

Move the MaxBandwidth clamp before the config.php include so the
switch statement sees the correct value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 16:45:46 -04:00
Isaac Connor
05cc6fcca7 chore: remove obsolete ZM_FILTER_EXECUTE_INTERVAL config option
Each filter now has its own ExecuteInterval column, making the global
ZM_FILTER_EXECUTE_INTERVAL unused. The DB row will be cleaned up
automatically by zmupdate.pl on the next upgrade.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 16:31:33 -04:00
Isaac Connor
b2f353f4a2 Merge pull request #4714 from IgorA100/patch-536184
Fix: A finger-shaped pointer cursor for the hide/show password buttons (skin.css)
2026-03-27 09:25:16 -04:00
Isaac Connor
0e78b5a6c6 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-03-26 17:20:23 -04:00
Isaac Connor
4603309e38 Include full path in warning when fail to cache bust 2026-03-26 17:20:20 -04:00
IgorA100
0998e9d766 When executing monitorChangeStreamChannel(), always write the new channel to the cookie and to monitorStream.currentChannelStream (watch.js).
This will allow "monitorStream.start()" to be executed correctly if the stream was stopped when the channel was switched.
2026-03-22 13:35:08 +03:00
Isaac Connor
fd8adee68c Merge pull request #4713 from IgorA100/patch-792734
Fix: Read from 'zmWatchMuted' cookies instead of 'zmWatchMute' on Watch page
2026-03-21 06:43:07 -04:00
Isaac Connor
16760f44b0 Merge pull request #4716 from IgorA100/patch-89150
Change the "Mute" icon in the volume slider based on the volume level, not just when the "muted" attribute changes (MonitorStream.js)
2026-03-21 06:42:25 -04:00
IgorA100
a685759885 Don't use "scrollTo" because it doesn't work properly. (console.js) 2026-03-21 11:58:00 +03:00
IgorA100
ac6dbe4ed6 Silent refresh bootstrapTable on Console page (console.js)
- The table refresh message will not appear briefly. The table will not "flicker."
Scrolling will attempt to return to the position it was in before the refresh.
2026-03-20 23:35:59 +03:00
Anton Vinogradov
b703a6be91 wip 2026-03-19 19:29:04 +03:00
Anton Vinogradov
30d48f2ec7 wip 2026-03-19 19:26:59 +03:00
IgorA100
f04a9075cc When starting a stream on the Watch page, don't execute controlMute() (watch.js)
When starting a stream on the Watch page, don't execute controlMute(), as this will cause the icon to be displayed before the stream actually starts playing.
We'll just set the "muted" property for the stream.
We'll manage the icon later.
2026-03-19 10:39:29 +03:00
IgorA100
1fc68a3e84 If the system volume was set to 0, change the state of the "Mute" icon in the volume slider (MonitorStream.js) 2026-03-18 13:32:01 +03:00
IgorA100
cf472c4a1c A finger-shaped pointer cursor for the hide/show password buttons (skin.css) 2026-03-17 21:53:29 +03:00
IgorA100
4a518c5708 Read from 'zmWatchMuted' cookies instead of 'zmWatchMute' (watch.js)
Because we store 'zmWatchMuted' in cookies, not 'zmWatchMute'

We can pass 'on' or 'off' to the "controlMute" function, but we store a Boolean value in cookies, so we need to convert it.
Also, if there's no cookie, getCookie will return "null," but for us, that doesn't equal "false."
2026-03-17 16:20:23 +03:00
Isaac Connor
5561829450 fix: include username in auth relay and fix stale auth in stream restart
- Add user= parameter to get_auth_relay() so zms can use the indexed
  Username column instead of iterating all users to validate the hash
- Apply the same fix to Event.php getStreamSrc() and getThumbnailSrc()
- Tighten Monitor.php from isset() to !empty() for consistency
- In MonitorStream.js start(), check if the auth hash in the img src
  matches the current auth_hash before resuming via CMD_PLAY. If stale,
  fall through to rebuild the URL with fresh auth_relay. This prevents
  long-running montage pages from spawning zms with expired credentials.
- Downgrade zms auth failure from Error to Warning

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 10:01:47 -04:00
Isaac Connor
dcb12e6f2a Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-03-15 17:25:17 -04:00
Isaac Connor
2ac16e835f Add br after USE ONVIF events 2026-03-15 17:25:08 -04:00
Isaac Connor
a52c9edf95 Merge pull request #4709 from IgorA100/patch-513027
Feat: When loading, pausing, or stopping a stream, display a corresponding caption in the center of the stream player.
2026-03-14 12:32:24 -04:00
IgorA100
f536252a85 Set "pointer-events: none" for "imgInfoBlock" and "infoBlock" to disable pointer events for them (MonitorStream.js) 2026-03-14 17:16:39 +03:00
IgorA100
94b1ead0f4 When stopping a stream, execute writeTextInfoBlock after checking the existence of the stream (MonitorStream.js) 2026-03-14 16:07:50 +03:00
IgorA100
d43dd30155 Normalizing text before assigning it to a DOM element
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-14 15:45:01 +03:00
Isaac Connor
7ec5edc2e2 feat: add ZM_WEB_SHOW_SERVER_STATS config to toggle navbar stats
Add a boolean web config option to control whether server statistics
(load, CPU, DB connections, storage, RAM) are rendered in the navbar.
When disabled, the HTML is not output at all, saving the polling overhead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 16:19:27 -04:00
IgorA100
040f461b86 Instead of "setTextSizeOnInfoBlock," we now use the new "setTextSizeOnInfoBlocks" function, which sets the text size for all blocks. (skin.js)
"setTextSizeOnInfoBlock" sets the text size for a specific block and is now used in MonitorStream.js.
2026-03-13 11:48:12 +03:00
IgorA100
dcd3ef06ad Instead of explicitly specifying the text size, we use a call to the new function "setTextSizeOnInfoBlock" (MonitorStream.js)
This will allow us to correctly specify the class for the block.
2026-03-13 11:43:42 +03:00
Isaac Connor
dca0f76468 feat: add ZM_WEB_SHOW_NAV_BUTTONS config to hide Back/Refresh buttons
Add a boolean web config option to control visibility of the Back and
Refresh navigation buttons shown at the top of most views. Uses a body
class and CSS rule so no individual view files need changes.

Also remove the ZM_WEB_BUTTON_STYLE INSERT from the migration SQL since
zmupdate.pl handles Config table inserts from ConfigData.pm.in.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 18:56:14 -04:00
Isaac Connor
217c415551 feat: add ZM_WEB_BUTTON_STYLE config for icons+text, icons, or text buttons
Add a web config option to control toolbar button display:
- icons+text (default): show both icon and label
- icons: show only the icon, hide text labels
- text: show only the label, hide icons on buttons that have labels

Body class (btn-icons-only / btn-text-only) is set in getBodyTopHTML() and
CSS rules in skin.css toggle visibility of .text spans and icon elements.
Add title tooltips to console.php buttons so they remain usable in icon-only
mode. Migration appended to zm_update-1.39.4.sql.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 18:04:14 -04:00
IgorA100
33783300bd Fix: Eslint (MonitorStream.js) 2026-03-12 23:58:27 +03:00
IgorA100
fc2022c651 Remove extra space (skin.js) 2026-03-12 23:51:36 +03:00
IgorA100
d00f56d036 When a stream is loaded, paused, or stopped, display a corresponding caption in the center of the stream player. (MonitorStream.js)
Additionally, when loading or stopping a stream using Go2RTC, RTSP2Web, or Janus, display a static image generated at that moment.
2026-03-12 23:41:32 +03:00
Isaac Connor
8044c80f9d feat: make Remember Me a tri-state option (None/Yes/No)
Change ZM_OPT_USE_REMEMBER_ME from a boolean to a tri-state string:
- None: checkbox hidden, sessions persist for ZM_COOKIE_LIFETIME (old disabled)
- Yes: checkbox shown and pre-checked by default
- No: checkbox shown and unchecked by default (old enabled behavior)

Update ConfigData.pm.in with new type definition, login.php to honor the
checked state, and session/action handlers to recognize the new values.
Migration in zm_update-1.39.4.sql maps old '1' to 'No' and '0' to 'None'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 16:35:41 -04:00
IgorA100
b319d2a2b3 Added styles for 3D text (skin.css) 2026-03-12 23:32:38 +03:00
IgorA100
2fd36161d0 Added calculation of the text size displayed in the information block (skin.js) 2026-03-12 23:21:26 +03:00
Isaac Connor
8f29a06ca7 fix: strip <br/> from bootstrap-table column picker labels
Column headers like "Alarm<br/>Frames" and "Avg.<br/>Score" show the literal
<br/> text in the column selection dropdown. Add data-switchable-label attributes
with the <br/> replaced by a space so the column picker shows clean labels while
the table headers still render the line break. Fix applied to events.php and
watch.php.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 16:16:46 -04:00
Isaac Connor
939c2c4a9e fix: compact montage header layout and move Show Zones to settings row
Switch filter labels from stacked (above dropdown) to inline (beside dropdown)
to reduce vertical space. Make sizeControl form use flex-wrap for proper flow.
Move Show Zones and Control links from floating headerButtons div into the
sizeControl form so they flow with the layout buttons. Fix chosen.js Ratio
dropdown being too narrow by setting min-width with !important to override
inline styles set by chosen on dynamically-populated selects.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 15:56:45 -04:00
Isaac Connor
c0029fe8d1 Don't add postLoginQuery to url if it is empty 2026-03-12 15:03:45 -04:00
Isaac Connor
286feece4c Move tag related commands to canView(Events) instead of canEdit(Events) 2026-03-12 15:03:29 -04:00
Isaac Connor
18ef01bd8d Increase potential config line size. HTML snippets can easily be larger than 256 2026-03-12 09:28:37 -04:00
Isaac Connor
6aa39892f6 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-03-11 17:22:26 -04:00
Isaac Connor
afcf4ecfd5 Remove pointless view_ variable 2026-03-11 17:22:23 -04:00
Isaac Connor
39ab3b225e Fix width=>Width 2026-03-11 16:25:54 -04:00
Isaac Connor
15807eb419 Handle event having no width or height 2026-03-11 16:25:49 -04:00