Merge branch 'master' into add_manufacturer_model_to_monitors

This commit is contained in:
Isaac Connor 2021-09-10 18:24:44 -04:00
commit 15adc47c61
6 changed files with 14 additions and 14 deletions

2
misc/fail2ban.rules Normal file
View File

@ -0,0 +1,2 @@
failregex = ^\s*web_php\[\d+\]\.ERR \[<HOST>\].*includes/auth.php
datepattern = ^%%m/%%d/%%y %%H:%%M:%%S(?:\.%%f)

View File

@ -843,7 +843,7 @@ sub sendEmail {
return 0; return 0;
} }
Info('Creating notification email'); Debug('Creating notification email');
my $subject = substituteTags($$filter{EmailSubject}, $filter, $Event); my $subject = substituteTags($$filter{EmailSubject}, $filter, $Event);
return 0 if !$subject; return 0 if !$subject;
@ -851,7 +851,7 @@ sub sendEmail {
my $body = substituteTags($$filter{EmailBody}, $filter, $Event, \@attachments); my $body = substituteTags($$filter{EmailBody}, $filter, $Event, \@attachments);
return 0 if !$body; return 0 if !$body;
Info("Sending notification email '$subject'"); Debug("Sending notification email '$subject'");
eval { eval {
if ( $Config{ZM_NEW_MAIL_MODULES} ) { if ( $Config{ZM_NEW_MAIL_MODULES} ) {
@ -864,7 +864,7 @@ sub sendEmail {
); );
### Add the text message part ### Add the text message part
$mail->attach ( $mail->attach (
Type => 'TEXT', Type => (($body=~/<html/)?'text/html':'text/plain'),
Data => $body Data => $body
); );
### Add the attachments ### Add the attachments
@ -886,9 +886,7 @@ sub sendEmail {
if ( $Config{ZM_SSMTP_MAIL} ) { if ( $Config{ZM_SSMTP_MAIL} ) {
my $ssmtp_location = $Config{ZM_SSMTP_PATH}; my $ssmtp_location = $Config{ZM_SSMTP_PATH};
if ( !$ssmtp_location ) { if ( !$ssmtp_location ) {
if ( logDebugging() ) {
Debug("which ssmtp: $ssmtp_location - set ssmtp path in options to suppress this message"); Debug("which ssmtp: $ssmtp_location - set ssmtp path in options to suppress this message");
}
$ssmtp_location = qx('which ssmtp'); $ssmtp_location = qx('which ssmtp');
} }
if ( !$ssmtp_location ) { if ( !$ssmtp_location ) {
@ -916,7 +914,7 @@ sub sendEmail {
foreach my $attachment ( @attachments ) { foreach my $attachment ( @attachments ) {
my $size = -s $attachment->{path}; my $size = -s $attachment->{path};
$total_size += $size; $total_size += $size;
Info("Attaching '$attachment->{path}' which is $size bytes"); Debug("Attaching '$attachment->{path}' which is $size bytes");
$mail->attach( $mail->attach(
Path => $attachment->{path}, Path => $attachment->{path},
@ -934,7 +932,7 @@ sub sendEmail {
Error("Unable to send email: $@"); Error("Unable to send email: $@");
return 0; return 0;
} else { } else {
Info('Notification email sent'); Info("Notification email sent to $$filter{EmailTo}");
} }
my $sql = 'UPDATE `Events` SET `Emailed` = 1 WHERE `Id` = ?'; my $sql = 'UPDATE `Events` SET `Emailed` = 1 WHERE `Id` = ?';
my $sth = $dbh->prepare_cached($sql) my $sth = $dbh->prepare_cached($sql)

View File

@ -1723,7 +1723,7 @@ bool Monitor::Analyse() {
// if have event, send frames until we find a video packet, at which point do analysis. Adaptive skip should only affect which frames we do analysis on. // if have event, send frames until we find a video packet, at which point do analysis. Adaptive skip should only affect which frames we do analysis on.
// get_analysis_packet will lock the packet and may wait if analysis_it is at the end // get_analysis_packet will lock the packet and may wait if analysis_it is at the end
ZMLockedPacket *packet_lock = packetqueue.get_packet(analysis_it); ZMLockedPacket *packet_lock = packetqueue.get_packet_and_increment_it(analysis_it);
if (!packet_lock) return false; if (!packet_lock) return false;
std::shared_ptr<ZMPacket> snap = packet_lock->packet_; std::shared_ptr<ZMPacket> snap = packet_lock->packet_;
@ -1731,13 +1731,11 @@ bool Monitor::Analyse() {
if (snap->score != -1) { if (snap->score != -1) {
Error("skipping because score was %d", snap->score); Error("skipping because score was %d", snap->score);
packetqueue.unlock(packet_lock); packetqueue.unlock(packet_lock);
packetqueue.increment_it(analysis_it);
return false; return false;
} }
// Store the it that points to our snap we will need it later // Store the it that points to our snap we will need it later
packetqueue_iterator snap_it = *analysis_it; packetqueue_iterator snap_it = std::prev(*analysis_it);
packetqueue.increment_it(analysis_it);
// signal is set by capture // signal is set by capture
bool signal = shared_data->signal; bool signal = shared_data->signal;

View File

@ -751,6 +751,8 @@ void MonitorStream::runStream() {
} // end if actual_delta_time > 5 } // end if actual_delta_time > 5
} // end if change in zoom } // end if change in zoom
} // end if paused or not } // end if paused or not
} else {
frame_count++;
} // end if should send frame } // end if should send frame
if (buffered_playback && !paused) { if (buffered_playback && !paused) {

@ -1 +1 @@
Subproject commit 0bd63fb464957080ead342db58ca9e01532cf1ef Subproject commit 14292374ccf1328f2d5db20897bd06f99ba4d938

View File

@ -776,7 +776,7 @@ function exportFileList(
ZM\Error("Empty event passed to exportFileList"); ZM\Error("Empty event passed to exportFileList");
return; return;
} }
if (!$event->canView('Events')) { if (!$event->canView()) {
ZM\Error('Can\'t view event '.$event->Id()); ZM\Error('Can\'t view event '.$event->Id());
return; return;
} }