From fa7582135e6909b1740c8f26fa0dc482a63afe2a Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:09:01 +0200 Subject: [PATCH 1/8] Update reporting.py Added new code "VERSION" to report version in report file Added new code "BUILD" to report version in report file Updated "REPORT_DATE" comment tag Updated "SERVER_NAME" comment tag --- pialert/reporting.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pialert/reporting.py b/pialert/reporting.py index 761512df..6a1f24ab 100755 --- a/pialert/reporting.py +++ b/pialert/reporting.py @@ -150,14 +150,25 @@ def send_notifications (db): mail_html = template_file.read() template_file.close() - # Report Header & footer + # Report "REPORT_DATE" in Header & footer timeFormated = timeNowTZ().strftime ('%Y-%m-%d %H:%M') mail_text = mail_text.replace ('', timeFormated) mail_html = mail_html.replace ('', timeFormated) + # Report "SERVER_NAME" in Header & footer mail_text = mail_text.replace ('', socket.gethostname() ) mail_html = mail_html.replace ('', socket.gethostname() ) + # Report "VERSION" in Header & footer + VERSIONFILE = subprocess.check_output(['php', pialertPath + '/front/php/templates/version.php']).decode('utf-8') + mail_text = mail_text.replace ('', VERSIONFILE) + mail_html = mail_html.replace ('', VERSIONFILE) + + # Report "BUILD" in Header & footer + BUILDFILE = subprocess.check_output(['php', pialertPath + '/front/php/templates/build.php']).decode('utf-8') + mail_text = mail_text.replace ('', BUILDFILE) + mail_html = mail_html.replace ('', BUILDFILE) + mylog('verbose', ['[Notification] included sections: ', conf.INCLUDED_SECTIONS ]) if 'internet' in conf.INCLUDED_SECTIONS : @@ -541,4 +552,4 @@ def handle_test(testType): if testType == 'REPORT_PUSHSAFER': send_pushsafer (sample_msg) - mylog('minimal', ['[Test Publishers] END Test: ', testType]) \ No newline at end of file + mylog('minimal', ['[Test Publishers] END Test: ', testType]) From 25bdc3618302a89ddf54361034c05bf50dacd5b4 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:12:10 +0200 Subject: [PATCH 2/8] Create version.php Created file version.php Added new php code to search for version file and if it doesn't find it, it shows the file not found error. --- front/php/templates/version.php | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 front/php/templates/version.php diff --git a/front/php/templates/version.php b/front/php/templates/version.php new file mode 100644 index 00000000..379fb53c --- /dev/null +++ b/front/php/templates/version.php @@ -0,0 +1,10 @@ + From 56604f702f6a674493aa6e0ced775d02856b6e03 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:16:20 +0200 Subject: [PATCH 3/8] Create build.php Created build.php file Added new php code to search for build file and if it doesn't find it, it shows the file not found error --- front/php/templates/build.php | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 front/php/templates/build.php diff --git a/front/php/templates/build.php b/front/php/templates/build.php new file mode 100644 index 00000000..26240fab --- /dev/null +++ b/front/php/templates/build.php @@ -0,0 +1,8 @@ + From 9bdac0edbf41e4775fc724ac0483ef7bc26be675 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:44:40 +0200 Subject: [PATCH 4/8] Update version.php Created creators banner --- front/php/templates/version.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/front/php/templates/version.php b/front/php/templates/version.php index 379fb53c..efc8669f 100644 --- a/front/php/templates/version.php +++ b/front/php/templates/version.php @@ -1,4 +1,16 @@ - Date: Mon, 7 Aug 2023 18:14:21 +0200 Subject: [PATCH 5/8] Update build.php Added the creators banner Updated blank spaces --- front/php/templates/build.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/front/php/templates/build.php b/front/php/templates/build.php index 26240fab..137f8751 100644 --- a/front/php/templates/build.php +++ b/front/php/templates/build.php @@ -1,8 +1,21 @@ From 0b3b1e4ed4e44b81c431d08511b6f160b8a0bc4d Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:15:08 +0200 Subject: [PATCH 6/8] Update build.php Updated the creators banner --- front/php/templates/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/php/templates/build.php b/front/php/templates/build.php index 137f8751..cc72aa7e 100644 --- a/front/php/templates/build.php +++ b/front/php/templates/build.php @@ -3,7 +3,7 @@ # Pi.Alert # # Open Source Network Guard / WIFI & LAN intrusion detector # # # -# version.php - Templates module Template to display the current version # +# build.php - Templates module Template to display the current build version # #---------------------------------------------------------------------------------# # Puche 2021 pi.alert.application@gmail.com GNU GPLv3 # # jokob-sk 2022 jokob.sk@gmail.com GNU GPLv3 # From 3ca4e191990a724fef48412f460b721fa24ccf86 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:18:57 +0200 Subject: [PATCH 7/8] Update version.php Updated blank spaces --- front/php/templates/version.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/front/php/templates/version.php b/front/php/templates/version.php index efc8669f..19f630ab 100644 --- a/front/php/templates/version.php +++ b/front/php/templates/version.php @@ -1,4 +1,4 @@ - From a38d25487750da38405c1b64fda77e8111b3f6d6 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:30:41 +0200 Subject: [PATCH 8/8] Update version.php Update path file --- front/php/templates/version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/php/templates/version.php b/front/php/templates/version.php index 19f630ab..459faeca 100644 --- a/front/php/templates/version.php +++ b/front/php/templates/version.php @@ -11,7 +11,7 @@ # cvc90 2023 https://github.com/cvc90 GNU GPLv3 # #---------------------------------------------------------------------------------# - $filename = "/.VERSION"; + $filename = "/home/pi/pialert/.VERSION"; if(file_exists($filename)) { echo file_get_contents($filename); }