Skip to content

Commit c193572

Browse files
Merge remote-tracking branch 'upstream/master' into ai_server
2 parents 11047d9 + 2b2efab commit c193572

File tree

18 files changed

+162
-57
lines changed

18 files changed

+162
-57
lines changed

.github/workflows/build-native-packages.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: |
3737
set -eux
3838
apt install -y --no-install-recommends \
39-
git ca-certificates gnupg lsb-release tzdata \
39+
git ca-certificates gnupg lsb-release \
4040
build-essential devscripts debhelper equivs fakeroot \
4141
cmake pkg-config ccache
4242
apt install -y debhelper sphinx-doc dh-linktree dh-apache2 cmake \
@@ -51,18 +51,15 @@ jobs:
5151
uses: actions/checkout@v5
5252
with:
5353
fetch-depth: 0
54-
- name: Import GPG key (Debian)
55-
run: |
56-
set -eux
57-
mkdir -p ~/.gnupg
58-
chmod 700 ~/.gnupg
59-
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
60-
echo "$GPG_PRIVATE_KEY_B64" | base64 -d > /tmp/priv.asc
61-
gpg --batch --import /tmp/priv.asc
62-
gpg --batch --yes --edit-key "$GPG_KEY_ID" trust quit <<< "5\ny"
63-
gpg --batch --armor --export "$GPG_KEY_ID" --output public.asc
64-
chmod 600 ~/.gnupg/*
65-
export GPG_TTY=$(tty || true)
54+
55+
- name: Import GPG key
56+
uses: crazy-max/ghaction-import-gpg@v6
57+
with:
58+
gpg_private_key: ${{ secrets.ZMREPO_GPG_PRIVATE_KEY }}
59+
passphrase: ${{ secrets.ZMREPO_GPG_PASSPHRASE }}
60+
git_user_signingkey: true
61+
git_commit_gpgsign: true
62+
6663
- name: Install build-deps from debian/control
6764
run: |
6865
set -eux
@@ -110,7 +107,7 @@ jobs:
110107
runs-on: ubuntu-latest
111108
steps:
112109
- name: Download artifacts
113-
uses: actions/download-artifact@v5
110+
uses: actions/download-artifact@v6
114111
with:
115112
path: dist
116113
- name: Create release

misc/zoneminder.gortc.service

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ WorkingDirectory=/opt/go2rtc
1111
# This first entry will get overwritten when you add streams and can get wiped out. Place the permanent config in the second file
1212
ExecStart=/opt/go2rtc/go2rtc_linux_arm64 -c go2rtc.yaml -c /etc/zm/go2rtc.yaml
1313
Restart=always
14-
RuntimeMaxSec=1d
1514
RestartSec=10
1615
Environment=TZ=:/etc/localtime
1716
TimeoutSec=600

scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Debug("Have " . $+{PASSWORD});
118118
}
119119
# Save the base url
120120
$self->{BaseURL} = "http://$$self{host}:$$self{port}";
121-
$ChannelID = $self->{Monitor}{ControlDevice} if $self->{Monitor}{ControlDevice} =~ /^\d+$/;
121+
$ChannelID = $self->{Monitor}{ControlDevice} if $self->{Monitor}{ControlDevice} and ($self->{Monitor}{ControlDevice} =~ /^\d+$/);
122122
$$self{realm} = defined($self->{Monitor}->{ControlDevice}) ? $self->{Monitor}->{ControlDevice} : '';
123123

124124
# Save and test the credentials

scripts/ZoneMinder/lib/ZoneMinder/Filter.pm

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ sub Sql {
186186
} elsif ( $term->{attr} eq 'FilterServerId' ) {
187187
$self->{Sql} .= (defined($Config{ZM_SERVER_ID}) ? $Config{ZM_SERVER_ID}: '0').' /* ZM_SERVER_ID */';
188188
# StartTime options
189+
} elsif ( $term->{attr} eq 'CurrentDateTime' ) {
190+
$self->{Sql} .= 'NOW()';
191+
} elsif ( $term->{attr} eq 'CurrentTime' ) {
192+
$self->{Sql} .= 'extract( hour_second from NOW())';
193+
} elsif ( $term->{attr} eq 'CurrentDate' ) {
194+
$self->{Sql} .= 'to_days(NOW())';
189195
} elsif ( $term->{attr} eq 'DateTime' ) {
190196
$self->{Sql} .= 'E.StartDateTime';
191197
} elsif ( $term->{attr} eq 'Date' ) {
@@ -268,7 +274,7 @@ sub Sql {
268274
$temp_value = '%'.$temp_value.'%' if $temp_value !~ /%/;
269275
}
270276
$value = "'$temp_value'";
271-
} elsif ( $term->{attr} eq 'DateTime' or $term->{attr} eq 'StartDateTime' or $term->{attr} eq 'EndDateTime' ) {
277+
} elsif ( $term->{attr} eq 'DateTime' or $term->{attr} eq 'StartDateTime' or $term->{attr} eq 'EndDateTime' or $term->{attr} eq 'CurrentDateTime') {
272278
if ( uc($temp_value) eq 'NULL' ) {
273279
$value = $temp_value;
274280
} else {
@@ -279,7 +285,7 @@ sub Sql {
279285
}
280286
$value = "'$value'";
281287
}
282-
} elsif ( $term->{attr} eq 'Date' or $term->{attr} eq 'StartDate' or $term->{attr} eq 'EndDate' ) {
288+
} elsif ( $term->{attr} eq 'Date' or $term->{attr} eq 'StartDate' or $term->{attr} eq 'EndDate' or $term->{attr} eq 'CurrentDate') {
283289
if ( uc($temp_value) eq 'NULL' ) {
284290
$value = $temp_value;
285291
} elsif ( $temp_value eq 'CURDATE()' or $temp_value eq 'NOW()' ) {
@@ -292,7 +298,7 @@ sub Sql {
292298
}
293299
$value = "to_days( '$value' )";
294300
}
295-
} elsif ( $term->{attr} eq 'Time' or $term->{attr} eq 'StartTime' or $term->{attr} eq 'EndTime' ) {
301+
} elsif ( $term->{attr} eq 'Time' or $term->{attr} eq 'StartTime' or $term->{attr} eq 'EndTime' or $term->{attr} eq 'CurrentTime') {
296302
if ( uc($temp_value) eq 'NULL' ) {
297303
$value = $temp_value;
298304
} else {

scripts/zmwatch.pl.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ while (!$zm_terminate) {
132132
Debug("Monitor $monitor->{Id} $monitor->{Name}, startup time $now - $startup_time $startup_elapsed <? $Config{ZM_WATCH_MAX_DELAY}");
133133
if ($monitor->ControlId()) {
134134
my $control = $monitor->Control();
135-
if ($control and $control->CanReboot() and $control->ping() and $control->open()) {
135+
if ($control and $control->CanReboot() and $control->open()) {
136136
$control->reboot();
137137
}
138138
}

src/zm_ffmpeg.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,15 +450,18 @@ void zm_dump_codecpar(const AVCodecParameters *par) {
450450
}
451451

452452
const std::string get_codecpar_string(const AVCodecParameters *par) {
453-
return stringtf("codec_type %d %s codec_id %d %s codec_tag %" PRIu32
453+
return stringtf("codec_type %d %s codec_id %d %s codec_tag %c%c%c%c"
454454
" width %d height %d bit_rate%" PRIu64 " bpcs %d bprs %d format%d %s"
455455
" extradata:%d:%s profile %d level %d field order %d color_range %d"
456456
" color_primaries %d color_trc %d color_space %d location %d video_delay %d",
457457
static_cast<int>(par->codec_type),
458458
av_get_media_type_string(par->codec_type),
459459
static_cast<int>(par->codec_id),
460460
avcodec_get_name(par->codec_id),
461-
par->codec_tag,
461+
(char)(par->codec_tag& 0xFF),
462+
(char)((par->codec_tag >> 8) & 0xFF),
463+
(char)((par->codec_tag >> 16) & 0xFF),
464+
(char)((par->codec_tag >> 24) & 0xFF),
462465
par->width,
463466
par->height,
464467
par->bit_rate,
@@ -487,12 +490,16 @@ const std::string get_codecpar_string(const AVCodecParameters *par) {
487490
}
488491

489492
void zm_dump_codec(const AVCodecContext *codec) {
490-
Debug(1, "Dumping codec_context codec_type %d %s codec_id %d %s width %d height %d timebase %d/%d format %s profile %d level %d "
493+
Debug(1, "Dumping codec_context codec_type %d %s codec_id %d %s tag %c%c%c%c width %d height %d timebase %d/%d format %s profile %d level %d "
491494
"gop_size %d has_b_frames %d max_b_frames %d me_cmp %d me_range %d qmin %d qmax %d bit_rate %" PRId64 " qcompress %f extradata:%d:%s",
492495
codec->codec_type,
493496
av_get_media_type_string(codec->codec_type),
494497
codec->codec_id,
495498
avcodec_get_name(codec->codec_id),
499+
(char)(codec->codec_tag& 0xFF),
500+
(char)((codec->codec_tag >> 8) & 0xFF),
501+
(char)((codec->codec_tag >> 16) & 0xFF),
502+
(char)((codec->codec_tag >> 24) & 0xFF),
496503
codec->width,
497504
codec->height,
498505
codec->time_base.num,

src/zm_image.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@ int Image::PopulateFrame(AVFrame *frame) const {
374374

375375
bool Image::Assign(const AVFrame *frame) {
376376
/* Assume the dimensions etc are correct. FIXME */
377+
if (!frame) {
378+
Error("Null frame passed to Image::Assign");
379+
return false;
380+
}
381+
zm_dump_video_frame(frame, "source frame in Image::Assign");
377382

378383
// Desired format
379384
AVPixelFormat format = (AVPixelFormat)AVPixFormat();

src/zm_monitor_onvif.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,10 @@ void Monitor::ONVIF::WaitForMessage() {
341341
void Monitor::ONVIF::set_credentials(struct soap *soap) {
342342
soap_wsse_delete_Security(soap);
343343
soap_wsse_add_Timestamp(soap, "Time", 10);
344-
soap_wsse_add_UsernameTokenDigest(soap, "Auth", parent->onvif_username.c_str(), parent->onvif_password.c_str());
344+
soap_wsse_add_UsernameTokenDigest(soap, "Auth",
345+
(parent->onvif_username.empty() ? parent->user.c_str() : parent->onvif_username.c_str()),
346+
(parent->onvif_username.empty() ? parent->pass.c_str() : parent->onvif_password.c_str())
347+
);
345348
}
346349

347350
//GSOAP boilerplate

web/api/app/Controller/EventsController.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,29 @@ public function index() {
6666
}
6767
}
6868
$conditions = $this->FilterComponent->buildFilter($named_params);
69+
foreach ($conditions as $k=>$v) {
70+
if ( 0 === strpos($k, 'DateTime') ) {
71+
$new_start = preg_replace('/DateTime/', 'StartDateTime', $k);
72+
$new_end = preg_replace('/DateTime/', 'EndDateTime', $k);
73+
if (isset($conditions['OR'])) {
74+
$conditions['AND'] = [
75+
['OR' => $conditions['OR']],
76+
[
77+
[$new_start => $conditions[$k]],
78+
[$new_end => $conditions[$k]]
79+
]
80+
];
81+
unset($conditions['OR']);
82+
} else {
83+
$conditions['OR'] = [
84+
[$new_start => $conditions[$k]],
85+
[$new_end => $conditions[$k]]
86+
];
87+
}
88+
unset($conditions[$k]);
89+
}
90+
} // end foreach condition
91+
6992
} else {
7093
$conditions = $this->FilterComponent->buildFilter($_REQUEST);
7194
}
@@ -147,6 +170,11 @@ public function view($id = null) {
147170

148171
$options = array('conditions' => array(array('Event.' . $this->Event->primaryKey => $id), $mon_options));
149172
$event = $this->Event->find('first', $options);
173+
$EventObj = new ZM\Event($event['Event']);
174+
if (!$EventObj->canView()) {
175+
throw new UnauthorizedException(__('Insufficient Privileges'));
176+
return;
177+
}
150178

151179
# Get the previous and next events for any monitor
152180
$this->Event->id = $id;
@@ -156,8 +184,6 @@ public function view($id = null) {
156184

157185
$event['Event']['fileExists'] = $this->Event->fileExists($event['Event']);
158186
$event['Event']['fileSize'] = $this->Event->fileSize($event['Event']);
159-
160-
$EventObj = new ZM\Event($id);
161187
$event['Event']['FileSystemPath'] = $EventObj->Path();
162188

163189
# Also get the previous and next events for the same monitor

web/includes/Filter.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,22 @@ function tree() {
460460
case 'FilterServerId':
461461
$sqlValue .= ZM_SERVER_ID;
462462
break;
463+
case 'CurrentDateTime':
464+
$sqlValue = 'NOW()';
465+
$dtAttr = true;
466+
break;
467+
case 'CurrentDate':
468+
$sqlValue = 'to_days(NOW())';
469+
$dtAttr = true;
470+
break;
471+
case 'CurrentTime':
472+
$sqlValue = 'extract(hour_second FROM NOW())';
473+
$dtAttr = true;
474+
break;
475+
case 'CurrentWeekday':
476+
$sqlValue = 'weekday(NOW())';
477+
$dtAttr = true;
478+
break;
463479
case 'DateTime':
464480
case 'StartDateTime':
465481
$sqlValue = 'E.StartDateTime';
@@ -806,6 +822,10 @@ public static function attrTypes() {
806822
'DiskPercent' => translate('AttrDiskPercent'),
807823
#'StorageDiskSpace' => translate('AttrStorageDiskSpace'),
808824
'DiskSpace' => translate('AttrEventDiskSpace'),
825+
'CurrentDateTime' => translate('Current DateTime'),
826+
'CurrentDate' => translate('Current Date'),
827+
'CurrentTime' => translate('Current Time'),
828+
'CurrentWeekday' => translate('Current Weekday'),
809829
'DateTime' => translate('Date Time'),
810830
'EndDateTime' => translate('AttrEndDateTime'),
811831
'EndDate' => translate('AttrEndDate'),
@@ -1126,7 +1146,7 @@ public function simple_widget() {
11261146
$html .= htmlSelect("filter[Query][terms][$i][val]", $archiveTypes, $term['val'],['id'=>'filterArchived', 'class'=>'chosen chosen-auto-width']).PHP_EOL;
11271147
$html .= '</span>';
11281148
} else if ( $term['attr'] == 'Tags' ) {
1129-
$selected = explode(',', $term['val']);
1149+
$selected = empty($term['val']) ? [] : json_decode($term['val']);
11301150
// echo '<pre>selected: '; print_r($selected); echo '</pre>';
11311151
if (count($selected) == 1 and !$selected[0]) {
11321152
$selected = null;
@@ -1136,7 +1156,7 @@ public function simple_widget() {
11361156
$options['data-cookie'] = $term['cookie'];
11371157

11381158
if (!$selected and isset($_COOKIE[$term['cookie']]) and $_COOKIE[$term['cookie']])
1139-
$selected = explode(',', $_COOKIE[$term['cookie']]);
1159+
$selected = json_decode($_COOKIE[$term['cookie']]);
11401160
}
11411161
// These echo statements print these variables at the top of the view.
11421162
// echo '<pre>availableTags: '; print_r($availableTags); echo '</pre>';

0 commit comments

Comments
 (0)