From 15c419dd28300c99fa43ea76d59d47e208c64c13 Mon Sep 17 00:00:00 2001
From: David <79108364+Phpvarious@users.noreply.github.com>
Date: Tue, 7 Jan 2025 17:36:02 +0100
Subject: [PATCH 1/2] Update camera.history.php
---
desktop/modal/camera.history.php | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/desktop/modal/camera.history.php b/desktop/modal/camera.history.php
index 3719990..d9ecce3 100644
--- a/desktop/modal/camera.history.php
+++ b/desktop/modal/camera.history.php
@@ -50,20 +50,25 @@
echo '
';
krsort($file);
foreach ($file as $time => $filename) {
- $fontType = 'fas-camera';
+ $fontType = 'fa-camera';
if (strpos($filename, '.mp4')) {
- $fontType = 'fas-video-camera';
+ $fontType = 'fa-video';
$i++;
}
- echo '
';
- echo '
' . str_replace('-', ':', $time) . '';
+ echo '
';
+ echo '
' . str_replace('-', ':', $time) . '';
if (strpos($filename, '.mp4')) {
echo '
';
} else {
echo '
 . ')
';
}
- echo '
';
- echo ' ';
+ echo '
';
+ echo '';
+ echo ' ';
+ if (strpos($filename, '.mp4')) {
+ echo ' ';
+ }
+ echo '';
echo '
';
}
echo '
';
From 3e5f0b49efca66731ce5bbf25d8b821998553d40 Mon Sep 17 00:00:00 2001
From: David <79108364+Phpvarious@users.noreply.github.com>
Date: Tue, 7 Jan 2025 18:12:04 +0100
Subject: [PATCH 2/2] Update camera.ajax.php
---
core/ajax/camera.ajax.php | 120 +++++++++++++++++++-------------------
1 file changed, 59 insertions(+), 61 deletions(-)
diff --git a/core/ajax/camera.ajax.php b/core/ajax/camera.ajax.php
index 79007c9..dd995ca 100644
--- a/core/ajax/camera.ajax.php
+++ b/core/ajax/camera.ajax.php
@@ -31,7 +31,7 @@
if(!is_object($camera)){
throw new \Exception(__('Impossible de trouver la camera : ',__FILE__).init('id'));
}
- $rtspScript = dirname(__FILE__) . '/../../3rdparty/rtsp-to-hls-' . ($camera->getConfiguration('encodeX264RTSP', 0) == 1 ? 'x264' : 'copy') . '.sh ';
+ $rtspScript = dirname(__FILE__) . '/../../3rdparty/rtsp-to-hls-' . ($camera->getConfiguration('encodeX264RTSP', 0) == 1 ? 'x264' : 'copy') . '.sh ';
if(count(system::ps('rtsp-to-hls-*.sh.*'.$camera->getConfiguration('localApiKey'))) == 0){
shell_exec('(ps ax || ps w) | grep ffmpeg.*'.$camera->getConfiguration('localApiKey').' | awk \'{print $2}\' | xargs sudo kill -9');
$replace = array(
@@ -57,72 +57,70 @@
}
$camera->setCache('lastStreamCall',strtotime('now'));
shell_exec(system::getCmdSudo().' find '.__DIR__.'/../../data/segments/'.$camera->getConfiguration('localApiKey').'-*.ts -mmin +5 -type f -exec rm -f {} \; 2>&1 > /dev/null');
- ajax::success();
- }
-
- if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
- }
-
-
-
- if (init('action') == 'addDiscoverCam') {
- camera::addDiscoverCam(json_decode(init('config'), true));
- ajax::success();
- }
-
- if (init('action') == 'removeRecord') {
- $file = init('file');
- $file = str_replace('..', '', $file);
- $record_dir = calculPath(config::byKey('recordDir', 'camera'));
- shell_exec('rm -rf ' . $record_dir . '/' . $file);
- ajax::success();
+ ajax::success();
+ }
+
+ if (init('action') == 'getCamera') {
+ if (init('object_id') == '') {
+ $object = jeeObject::byId($_SESSION['user']->getOptions('defaultDashboardObject'));
+ } else {
+ $object = jeeObject::byId(init('object_id'));
}
-
- if (init('action') == 'removeAllSnapshot') {
- $camera = camera::byId(init('id'));
- if (!is_object($camera)) {
- throw new Exception(__('Impossible de trouver la caméra : ' . init('id'), __FILE__));
- }
- $camera->removeAllSnapshot();
- ajax::success();
+ if (!is_object($object)) {
+ $object = jeeObject::rootObject();
}
-
- if (init('action') == 'getCamera') {
- if (init('object_id') == '') {
- $object = jeeObject::byId($_SESSION['user']->getOptions('defaultDashboardObject'));
- } else {
- $object = jeeObject::byId(init('object_id'));
- }
- if (!is_object($object)) {
- $object = jeeObject::rootObject();
- }
- $return = array();
- $return['eqLogics'] = array();
- if (init('object_id') == '') {
- foreach (jeeObject::all() as $object) {
- foreach ($object->getEqLogic(true, false, 'camera') as $camera) {
- $return['eqLogics'][] = $camera->toHtml(init('version'));
- }
- }
- } else {
+ $return = array();
+ $return['eqLogics'] = array();
+ if (init('object_id') == '') {
+ foreach (jeeObject::all() as $object) {
foreach ($object->getEqLogic(true, false, 'camera') as $camera) {
$return['eqLogics'][] = $camera->toHtml(init('version'));
}
- foreach (jeeObject::buildTree($object) as $child) {
- $cameras = $child->getEqLogic(true, false, 'camera');
- if (count($cameras) > 0) {
- foreach ($cameras as $camera) {
- $return['eqLogics'][] = $camera->toHtml(init('version'));
- }
+ }
+ } else {
+ foreach ($object->getEqLogic(true, false, 'camera') as $camera) {
+ $return['eqLogics'][] = $camera->toHtml(init('version'));
+ }
+ foreach (jeeObject::buildTree($object) as $child) {
+ $cameras = $child->getEqLogic(true, false, 'camera');
+ if (count($cameras) > 0) {
+ foreach ($cameras as $camera) {
+ $return['eqLogics'][] = $camera->toHtml(init('version'));
}
}
}
- ajax::success($return);
}
-
- throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action'));
- /* * *********Catch exeption*************** */
- } catch (Exception $e) {
- ajax::error(displayException($e), $e->getCode());
- }
\ No newline at end of file
+ ajax::success($return);
+ }
+
+ if (!isConnect('admin')) {
+ throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ }
+
+ if (init('action') == 'addDiscoverCam') {
+ camera::addDiscoverCam(json_decode(init('config'), true));
+ ajax::success();
+ }
+
+ if (init('action') == 'removeRecord') {
+ $file = init('file');
+ $file = str_replace('..', '', $file);
+ $record_dir = calculPath(config::byKey('recordDir', 'camera'));
+ shell_exec('rm -rf ' . $record_dir . '/' . $file);
+ ajax::success();
+ }
+
+ if (init('action') == 'removeAllSnapshot') {
+ $camera = camera::byId(init('id'));
+ if (!is_object($camera)) {
+ throw new Exception(__('Impossible de trouver la caméra : ' . init('id'), __FILE__));
+ }
+ $camera->removeAllSnapshot();
+ ajax::success();
+ }
+
+ throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action'));
+ /* * *********Catch exeption*************** */
+} catch (Exception $e) {
+ ajax::error(displayException($e), $e->getCode());
+}