Skip to content

Provide the user with up-to-date information about the supported version of audioMotionAnalyzer#4753

Open
IgorA100 wants to merge 6 commits intoZoneMinder:masterfrom
IgorA100:patch-546864
Open

Provide the user with up-to-date information about the supported version of audioMotionAnalyzer#4753
IgorA100 wants to merge 6 commits intoZoneMinder:masterfrom
IgorA100:patch-546864

Conversation

@IgorA100
Copy link
Copy Markdown
Contributor

@IgorA100 IgorA100 commented Apr 25, 2026

When the user is in the Viewing tab on the Monitor page, we'll provide them with useful information about audioMotionAnalyzer (supported version number, download links, etc.).

1p 1p 1pp

This is necessary to determine whether we are using the analyzer, and if so, what version it is. We will then provide the user with useful information when they are in the Viewing tab.
- Now we only specify the supported analyzer version in one place in the audioMotionAnalyzer.js file
- Added translations for three cases: when the analyzer is not installed, the wrong version is installed, or everything is fine.
@IgorA100 IgorA100 marked this pull request as ready for review April 26, 2026 20:36
@IgorA100
Copy link
Copy Markdown
Contributor Author

Done

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds UI messaging on the Monitor “Viewing” tab to inform users whether the installed audioMotionAnalyzer matches the supported version, and provides install/update guidance.

Changes:

  • Adds a “WhatDisplayInfo” help text area under the “Show” selector on the Monitor Viewing tab and populates it via JS based on detected analyzer version.
  • Exposes new i18n strings for “OK / not installed / wrong version” messaging, plus version template substitution in the UI.
  • Loads the audioMotionAnalyzer module on the Monitor page and updates bundled help text to avoid hardcoding a specific CDN version.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
web/skins/classic/views/monitor.php Adds #WhatDisplayInfo placeholder below the “Show” control.
web/skins/classic/views/js/monitor.js.php Exports new translated strings to JS for version-status messaging.
web/skins/classic/views/js/monitor.js Adds version-check logic and template replacement for display under “Show”.
web/skins/classic/js/audioMotionAnalyzer.js Introduces supported-version constant and sets a global “current version” for UI consumption; adjusts custom element registration.
web/skins/classic/includes/functions.php Ensures audioMotionAnalyzer.js is loaded on the Monitor page.
web/skins/classic/assets/audioMotion-analyzer/src/help.txt Generalizes CDN URL instructions to not hardcode a specific version.
web/lang/ru_ru.php Adds RU translations for analyzer version status messages; updates related help text.
web/lang/en_gb.php Adds EN translations for analyzer version status messages; updates related help text.
web/includes/lang.php Changes translate() to convert ~~ into <br/>.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web/lang/en_gb.php Outdated
Comment thread web/skins/classic/js/audioMotionAnalyzer.js
Comment thread web/skins/classic/js/audioMotionAnalyzer.js Outdated
Comment thread web/skins/classic/js/audioMotionAnalyzer.js Outdated
Comment thread web/skins/classic/views/js/monitor.js
Comment thread web/skins/classic/views/js/monitor.js
Comment thread web/includes/lang.php
Comment on lines 21 to +27
function translate($name) {
global $SLANG;
// The isset is more performant
if ( isset($SLANG[$name]) || array_key_exists($name, $SLANG) )
return $SLANG[$name];
return preg_replace('/~~/', '<br/>', $SLANG[$name]);
else
return $name;
return preg_replace('/~~/', '<br/>', $name);
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes translate() to always replace ~~ with <br/>, which makes translate() return HTML markup rather than plain text. The existing pattern for handling ~~ line breaks is localized to option-help rendering (e.g., web/ajax/modals/optionhelp.php:21), so this global change can create inconsistent behavior in contexts that expect plain strings (JS alerts, placeholders, htmlspecialchars(translate(...)), etc.). Consider reverting this global behavior change and instead performing the ~~<br/> conversion only at the specific render sites that use innerHTML (e.g., for the new audioMotion messages).

Copilot uses AI. Check for mistakes.
Comment thread web/lang/en_gb.php Outdated
Comment on lines +125 to +126
'AudioMotionVersionNotInstalled' => 'Requires audio motion analyzer version "{AudioMotionVersionRequired}" to be installed~~Download link: https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired} or https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}',
'AudioMotionVersionWrongVersion' => 'The required analyzer version is "{AudioMotionVersionRequired}", but you have it installed "{AudioMotionVersionInstalled}"~~Download link: https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired} or https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}',
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message text says "Download link:" but the URLs are rendered as plain text (and then inserted via innerHTML), so they won’t be clickable links in most browsers. Consider rendering these as actual <a href=...> anchors (ideally created via DOM APIs rather than embedding raw HTML in translations) so they behave like real download links and are keyboard/screen-reader accessible.

Suggested change
'AudioMotionVersionNotInstalled' => 'Requires audio motion analyzer version "{AudioMotionVersionRequired}" to be installed~~Download link: https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired} or https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}',
'AudioMotionVersionWrongVersion' => 'The required analyzer version is "{AudioMotionVersionRequired}", but you have it installed "{AudioMotionVersionInstalled}"~~Download link: https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired} or https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}',
'AudioMotionVersionNotInstalled' => 'Requires audio motion analyzer version "{AudioMotionVersionRequired}" to be installed~~Download link: <a href="https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired}">https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired}</a> or <a href="https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}">https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}</a>',
'AudioMotionVersionWrongVersion' => 'The required analyzer version is "{AudioMotionVersionRequired}", but you have it installed "{AudioMotionVersionInstalled}"~~Download link: <a href="https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired}">https://cdn.jsdelivr.net/npm/audiomotion-analyzer@{AudioMotionVersionRequired}</a> or <a href="https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}">https://github.com/hvianna/audioMotion-analyzer/releases/tag/{AudioMotionVersionRequired}</a>',

Copilot uses AI. Check for mistakes.
Oh, my bad English :(

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@IgorA100 IgorA100 marked this pull request as draft April 29, 2026 13:16
IgorA100 and others added 3 commits April 29, 2026 17:27
We check for the file's existence, and if it does, we set AUDIO_MOTION_ENABLED = true.
Okay, let's do an additional check in case the import fails for some reason.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@IgorA100
Copy link
Copy Markdown
Contributor Author

@connortechnology
I've made the necessary changes and left my comments.
I consider this PR project complete.

@IgorA100 IgorA100 marked this pull request as ready for review April 29, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants