mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Merge pull request #323 from cvc90/Pi.Alert-New-Function-Reporting
Add new function reporting
This commit is contained in:
21
front/php/templates/build.php
Normal file
21
front/php/templates/build.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
#---------------------------------------------------------------------------------#
|
||||
# Pi.Alert #
|
||||
# Open Source Network Guard / WIFI & LAN intrusion detector #
|
||||
# #
|
||||
# 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 #
|
||||
# leiweibau 2022 https://github.com/leiweibau GNU GPLv3 #
|
||||
# cvc90 2023 https://github.com/cvc90 GNU GPLv3 #
|
||||
#---------------------------------------------------------------------------------#
|
||||
|
||||
$file = "/home/pi/pialert/front/buildtimestamp.txt";
|
||||
if (file_exists($file)) {
|
||||
echo date("Y-m-d", ((int)file_get_contents($file)));
|
||||
}
|
||||
else {
|
||||
echo "File not found";
|
||||
}
|
||||
?>
|
||||
21
front/php/templates/version.php
Normal file
21
front/php/templates/version.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
#---------------------------------------------------------------------------------#
|
||||
# Pi.Alert #
|
||||
# Open Source Network Guard / WIFI & LAN intrusion detector #
|
||||
# #
|
||||
# version.php - Templates module Template to display the current version #
|
||||
#---------------------------------------------------------------------------------#
|
||||
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3 #
|
||||
# jokob-sk 2022 jokob.sk@gmail.com GNU GPLv3 #
|
||||
# leiweibau 2022 https://github.com/leiweibau GNU GPLv3 #
|
||||
# cvc90 2023 https://github.com/cvc90 GNU GPLv3 #
|
||||
#---------------------------------------------------------------------------------#
|
||||
|
||||
$filename = "/home/pi/pialert/.VERSION";
|
||||
if(file_exists($filename)) {
|
||||
echo file_get_contents($filename);
|
||||
}
|
||||
else{
|
||||
echo "File not found";
|
||||
}
|
||||
?>
|
||||
@@ -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 ('<REPORT_DATE>', timeFormated)
|
||||
mail_html = mail_html.replace ('<REPORT_DATE>', timeFormated)
|
||||
|
||||
# Report "SERVER_NAME" in Header & footer
|
||||
mail_text = mail_text.replace ('<SERVER_NAME>', socket.gethostname() )
|
||||
mail_html = mail_html.replace ('<SERVER_NAME>', 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 ('<VERSION_PIALERT>', VERSIONFILE)
|
||||
mail_html = mail_html.replace ('<VERSION_PIALERT>', 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 ('<BUILD_PIALERT>', BUILDFILE)
|
||||
mail_html = mail_html.replace ('<BUILD_PIALERT>', 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])
|
||||
mylog('minimal', ['[Test Publishers] END Test: ', testType])
|
||||
|
||||
Reference in New Issue
Block a user