Merge branch 'master' of github.com:ZoneMinder/zoneminder

pull/3195/merge
Isaac Connor 2024-10-23 19:06:37 -04:00
commit bc5000ec06
10 changed files with 40 additions and 154 deletions

View File

@ -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")
@ -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")

View File

@ -1,83 +0,0 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is equal to the requested version.
# The tweak version component is ignored.
# The variable CVF_VERSION must be set before calling configure_file().
if (PACKAGE_FIND_VERSION_RANGE)
message(AUTHOR_WARNING
"`find_package()` specify a version range but the version strategy "
"(ExactVersion) of the module `${PACKAGE_FIND_NAME}` is incompatible "
"with this request. Only the lower endpoint of the range will be used.")
endif()
set(PACKAGE_VERSION "0.7.0")
if("0.7.0" MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") # strip the tweak version
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
set(CVF_VERSION_PATCH "${CMAKE_MATCH_3}")
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
endif()
if(NOT CVF_VERSION_MINOR VERSION_EQUAL 0)
string(REGEX REPLACE "^0+" "" CVF_VERSION_MINOR "${CVF_VERSION_MINOR}")
endif()
if(NOT CVF_VERSION_PATCH VERSION_EQUAL 0)
string(REGEX REPLACE "^0+" "" CVF_VERSION_PATCH "${CVF_VERSION_PATCH}")
endif()
set(CVF_VERSION_NO_TWEAK "${CVF_VERSION_MAJOR}.${CVF_VERSION_MINOR}.${CVF_VERSION_PATCH}")
else()
set(CVF_VERSION_NO_TWEAK "0.7.0")
endif()
if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") # strip the tweak version
set(REQUESTED_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(REQUESTED_VERSION_MINOR "${CMAKE_MATCH_2}")
set(REQUESTED_VERSION_PATCH "${CMAKE_MATCH_3}")
if(NOT REQUESTED_VERSION_MAJOR VERSION_EQUAL 0)
string(REGEX REPLACE "^0+" "" REQUESTED_VERSION_MAJOR "${REQUESTED_VERSION_MAJOR}")
endif()
if(NOT REQUESTED_VERSION_MINOR VERSION_EQUAL 0)
string(REGEX REPLACE "^0+" "" REQUESTED_VERSION_MINOR "${REQUESTED_VERSION_MINOR}")
endif()
if(NOT REQUESTED_VERSION_PATCH VERSION_EQUAL 0)
string(REGEX REPLACE "^0+" "" REQUESTED_VERSION_PATCH "${REQUESTED_VERSION_PATCH}")
endif()
set(REQUESTED_VERSION_NO_TWEAK
"${REQUESTED_VERSION_MAJOR}.${REQUESTED_VERSION_MINOR}.${REQUESTED_VERSION_PATCH}")
else()
set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}")
endif()
if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
math(EXPR installedBits "8 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View File

@ -1,43 +0,0 @@
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was jwt-cpp-config.cmake.in ########
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE)
macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
endif()
endmacro()
macro(check_required_components _NAME)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
####################################################################################
set(JWT_EXTERNAL_PICOJSON OFF)
set(JWT_SSL_LIBRARY OpenSSL)
include(CMakeFindDependencyMacro)
if(${JWT_SSL_LIBRARY} MATCHES "wolfSSL")
find_dependency(PkgConfig REQUIRED)
pkg_check_modules(wolfssl REQUIRED IMPORTED_TARGET wolfssl)
list(TRANSFORM wolfssl_INCLUDE_DIRS APPEND "/wolfssl") # This is required to access OpenSSL compatibility API
else()
find_dependency(${JWT_SSL_LIBRARY} REQUIRED)
endif()
if(JWT_EXTERNAL_PICOJSON)
find_dependency(picojson REQUIRED)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/jwt-cpp-targets.cmake")

View File

@ -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 ) {

View File

@ -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"
@ -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
@ -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++;

View File

@ -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();
}
@ -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) {

View File

@ -33,8 +33,20 @@ if ($action == 'delete') {
$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 {

View File

@ -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 {
@ -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));
@ -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);
@ -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);
@ -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;
@ -1036,7 +1038,7 @@ function progressBarNav() {
indicator.style.left = x+'px';
indicator.setAttribute('title', seekTime);
});
}
} // end function progressBarNav
function handleClick(event) {
if (panZoomEnabled) {

View File

@ -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;
}
}

View File

@ -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