From fd21d47bbb159863a37dee26f2e4b590115542de Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 23 Jan 2021 16:28:39 -0500 Subject: [PATCH 1/5] Merge pull request #3113 from pliablepixels/feature-api-daemon-control new api to control daemon --- web/api/app/Controller/HostController.php | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/web/api/app/Controller/HostController.php b/web/api/app/Controller/HostController.php index cf6e99b53..3d3a23c6e 100644 --- a/web/api/app/Controller/HostController.php +++ b/web/api/app/Controller/HostController.php @@ -21,6 +21,30 @@ class HostController extends AppController { )); } + // an interface to individually control the various ZM daemons + // invocation: https://server/zm/api/host/daemonControl/.pl/.json + // note that this API is only for interaction with a specific + // daemon. zmdc also allows other functions like logrot/etc + public function daemonControl($daemon_name, $command) { + global $user; + if ($command == 'check' || $command == 'status') { + $permission = 'View'; + } else { + $permission = 'Edit'; + } + $allowed = (!$user) || ($user['System'] == $permission ); + if ( !$allowed ) { + throw new UnauthorizedException(__("Insufficient privileges")); + return; + } + $string = ZM_PATH_BIN."/zmdc.pl $command $daemon_name"; + $result = exec($string); + $this->set(array( + 'result' => $result, + '_serialize' => array('result') + )); + } + function getLoad() { $load = sys_getloadavg(); From 73c1264771b4f63320f11af1dbf8b21a842baacf Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 23 Jan 2021 17:31:19 -0500 Subject: [PATCH 2/5] bump version for release --- distros/redhat/zoneminder.spec | 2 +- version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index e0de33c96..59b7cd1bb 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -28,7 +28,7 @@ %global _hardened_build 1 Name: zoneminder -Version: 1.34.22 +Version: 1.34.23 Release: 1%{?dist} Summary: A camera monitoring and analysis tool Group: System Environment/Daemons diff --git a/version b/version index 9bda6b214..a0e1e3085 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.34.22 +1.34.23 From 86fd86a72356f3f9d1d7362fd9d64e3114d205bc Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 24 Jan 2021 12:29:16 -0500 Subject: [PATCH 3/5] Switch to FriendsOfCake branch 3.0 --- web/api/app/Plugin/Crud | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/api/app/Plugin/Crud b/web/api/app/Plugin/Crud index 2ab7e23fb..14292374c 160000 --- a/web/api/app/Plugin/Crud +++ b/web/api/app/Plugin/Crud @@ -1 +1 @@ -Subproject commit 2ab7e23fb4f5b31a2f043ba9b9f607a518007f75 +Subproject commit 14292374ccf1328f2d5db20897bd06f99ba4d938 From 7dd9188b3bb4ee4cd77df88ea7c7325ecfbfb4ba Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 26 Jan 2021 18:09:19 -0500 Subject: [PATCH 4/5] fix eslint --- web/skins/classic/views/js/watch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index ed4f370ae..820150457 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -858,7 +858,7 @@ function initPage() { } else if ( monitorRefresh > 0 ) { setInterval(reloadWebSite, monitorRefresh*1000); } -} // initPage +} // initPage // Kick everything off window.addEventListener('DOMContentLoaded', initPage); From e6358290b4167c8ab39339efb82dccd979efc0cf Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 2 Feb 2021 17:30:42 -0500 Subject: [PATCH 5/5] this=>self --- scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm index f69441aff..8c1f2114e 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm @@ -65,7 +65,7 @@ sub sendCmd { my $self = shift; my $cmd = shift; my $result = undef; - $this->printMsg($cmd, 'Tx'); + $self->printMsg($cmd, 'Tx'); my $req = HTTP::Request->new(GET=>'http://'.$self->{Monitor}->{ControlAddress}.'/'.$cmd); my $res = $self->{ua}->request($req);