Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ZoneMinder/zoneminder
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Oct 23, 2024
2 parents 1b08c6d + 93953ce commit bc5000e
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 154 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ if(NOT ZM_NO_MQTT)
find_package(MOSQUITTO)
if(MOSQUITTO_FOUND)
include_directories(${MOSQUITTO_INCLUDE_DIRS})
list(APPEND ZM_BIN_LIBS "${MOSQUITTO_LIBRARIES}")
list(APPEND ZM_BIN_LIBS "${MOSQUITTO_LIBRARY}")
set(optlibsfound "${optlibsfound} Mosquitto")
else()
set(optlibsnotfound "${optlibsnotfound} Mosquitto")
Expand All @@ -454,7 +454,7 @@ if(NOT ZM_NO_MQTT)
find_package(MOSQUITTOPP)
if(MOSQUITTOPP_FOUND)
include_directories(${MOSQUITTOPP_INCLUDE_DIRS})
list(APPEND ZM_BIN_LIBS "${MOSQUITTOPP_LIBRARIES}")
list(APPEND ZM_BIN_LIBS "${MOSQUITTOPP_LIBRARY}")
set(optlibsfound "${optlibsfound} Mosquittopp")
else()
set(optlibsnotfound "${optlibsnotfound} Mosquittopp")
Expand Down
83 changes: 0 additions & 83 deletions dep/jwt-cpp/jwt-cpp-config-version.cmake

This file was deleted.

43 changes: 0 additions & 43 deletions dep/jwt-cpp/jwt-cpp-config.cmake

This file was deleted.

5 changes: 0 additions & 5 deletions scripts/zmupdate.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,6 @@ if ( $version ) {
my ( $detaint_version ) = $version =~ /^([\w.]+)$/;
$version = $detaint_version;

if ( ZM_VERSION eq $version ) {
print("\nDatabase already at version $version, update skipped.\n\n");
exit(0);
}

my $start_zm = 0;
print("\nInitiating database upgrade to version ".ZM_VERSION." from version $version\n");
if ( $interactive ) {
Expand Down
4 changes: 3 additions & 1 deletion src/zm_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "zm_fifo.h"
#include "zm_file_camera.h"
#include "zm_monitorlink_expression.h"
#include "zm_mqtt.h"
#include "zm_remote_camera.h"
#include "zm_remote_camera_http.h"
#include "zm_remote_camera_nvsocket.h"
Expand All @@ -35,7 +36,6 @@
#include "zm_uri.h"
#include "zm_zone.h"


#if ZM_HAS_V4L2
#include "zm_local_camera.h"
#endif // ZM_HAS_V4L2
Expand Down Expand Up @@ -717,6 +717,8 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) {
mqtt_subscriptions = Split(mqtt_subscriptions_string, ',');
col++;
Error("MQTT enabled ? %d, subs %s", mqtt_enabled, mqtt_subscriptions_string.c_str());
#else
Debug(1, "Not compiled with MQTT");
#endif
startup_delay = dbrow[col] ? atoi(dbrow[col]) : 0;
col++;
Expand Down
14 changes: 8 additions & 6 deletions src/zm_mqtt.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@

#ifdef MOSQUITTOPP_FOUND
#include "zm.h"
#include "zm_logger.h"
#include "zm_mqtt.h"
#include "zm_monitor.h"
#include "zm_mqtt.h"
#ifdef MOSQUITTOPP_FOUND
#include "zm_time.h"

#include <sstream>
#include <string.h>

MQTT::MQTT(Monitor *monitor) :
mosquittopp("ZoneMinder"),
monitor_(monitor),
connected_(false) {
connected_(false)
{
std::string name="ZoneMinder"+std::to_string(monitor->Id());
mosquittopp(name.c_str());

mosqpp::lib_init();
connect();
}
Expand Down Expand Up @@ -51,7 +53,7 @@ void MQTT::on_connect(int rc) {
}

void MQTT::on_message(const struct mosquitto_message *message) {
Debug(1, "MQTT: Have message %s: %s", message->topic, message->payload);
Debug(1, "MQTT: Have message %s: %s", message->topic, static_cast<const char *>(message->payload));
}

void MQTT::on_subscribe(int mid, int qos_count, const int *granted_qos) {
Expand Down
14 changes: 13 additions & 1 deletion web/includes/actions/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,20 @@
$error_message .= 'You do not have System Edit permissions, you cannot delete files.<br/>';
return;
} // end if canEdit(System)

$path = (!empty($_REQUEST['path'])) ? detaintPathAllowAbsolute($_REQUEST['path']) : ZM_DIR_EVENTS;
$is_ok_path = false;
foreach (ZM\Storage::find() as $storage) {
$rc = strstr($path, $storage->Path(), true);
if ((false !== $rc) and ($rc == '')) {
# Must be at the beginning
$is_ok_path = true;
}
}
$path_parts = pathinfo($path);

foreach ($_REQUEST['files'] as $file) {
$full_path = $_REQUEST['path'].'/'.$file;
$full_path = $path.'/'.detaintPath($file);
if (is_file($full_path)) {
unlink($full_path);
} else {
Expand Down
18 changes: 10 additions & 8 deletions web/skins/classic/views/js/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ function getCmdResponse(respObj, respText) {
}
$j('#progressValue').html(secsToTime(parseInt(streamStatus.progress)));
//$j('#zoomValue').html(streamStatus.zoom);
$j('#zoomValue').html(zmPanZoom.panZoom[eventData.MonitorId].getScale().toFixed(1));
const pz = zmPanZoom.panZoom[eventData.MonitorId];
if (pz) $j('#zoomValue').html(pz.getScale().toFixed(1));
//if (streamStatus.zoom == '1.0') {
// setButtonState('zoomOutBtn', 'unavail');
//} else {
Expand Down Expand Up @@ -969,12 +970,12 @@ function drawProgressBar() {

// Shows current stream progress.
function updateProgressBar() {
if (!eventData) return;
if (vid) {
if (!eventData) return;
var currentTime = vid.currentTime();
var progressDate = new Date(currentTime);
} else {
if (!(eventData && streamStatus)) return;
if (!streamStatus) return;
var currentTime = streamStatus.progress;
var progressDate = new Date(eventData.StartDateTime);
progressDate.setTime(progressDate.getTime() + (streamStatus.progress*1000));
Expand All @@ -990,7 +991,8 @@ function updateProgressBar() {
// Handles seeking when clicking on the progress bar.
function progressBarNav() {
console.log('progress');
$j('#progressBar').click(function(e) {
const progressBar = $j('#progressBar');
progressBar.click(function(e) {
let x = e.pageX - $j(this).offset().left;
if (x<0) x=0;
const seekTime = (x / $j('#progressBar').width()) * parseFloat(eventData.Length);
Expand All @@ -1000,7 +1002,7 @@ function progressBarNav() {
console.log("clicked at ", x, seekTime, date.toLocaleTimeString(), "from pageX", e.pageX, "offsetleft", $j(this).offset().left );
streamSeek(seekTime);
});
$j('#progressBar').mouseover(function(e) {
progressBar.mouseover(function(e) {
let x = e.pageX - $j(this).offset().left;
if (x<0) x=0;
const seekTime = (x / $j('#progressBar').width()) * parseFloat(eventData.Length);
Expand All @@ -1014,11 +1016,11 @@ function progressBarNav() {
indicator.style.left = x + 'px';
indicator.setAttribute('title', seekTime);
});
$j('#progressBar').mouseout(function(e) {
progressBar.mouseout(function(e) {
const indicator = document.getElementById('indicator');
indicator.style.display = 'none';
});
$j('#progressBar').mousemove(function(e) {
progressBar.mousemove(function(e) {
const bar = $j(this);

let x = e.pageX - bar.offset().left;
Expand All @@ -1036,7 +1038,7 @@ function progressBarNav() {
indicator.style.left = x+'px';
indicator.setAttribute('title', seekTime);
});
}
} // end function progressBarNav

function handleClick(event) {
if (panZoomEnabled) {
Expand Down
7 changes: 2 additions & 5 deletions web/skins/classic/views/js/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,8 @@ function initPage() {
});

const Janus_Use_RTSP_Restream = form.elements['newMonitor[Janus_Use_RTSP_Restream]'];
if (Janus_Use_RTSP_Restream.length) {
Janus_Use_RTSP_Restream[0].onclick = Janus_Use_RTSP_Restream_onclick;
console.log("Setup Janus_RTSP_Restream.onclick");
} else {
console.log("newMonitor[Janus_Use_RTSP_Restream] not found");
if (Janus_Use_RTSP_Restream) {
Janus_Use_RTSP_Restream.onclick = Janus_Use_RTSP_Restream_onclick;
}
}

Expand Down
2 changes: 2 additions & 0 deletions zoneminder-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#cmakedefine HAVE_RFB_RFB_H 1
#cmakedefine HAVE_LIBJWT 1
#cmakedefine HAVE_RTSP_SERVER 1
#cmakedefine MOSQUITTO_FOUND 1
#cmakedefine MOSQUITTOPP_FOUND 1

/* Few ZM options that are needed by the source code */
#cmakedefine ZM_MEM_MAPPED 1
Expand Down

0 comments on commit bc5000e

Please sign in to comment.