Upgrade DB fixes + NTFY fix

This commit is contained in:
Jokob-sk
2023-06-10 10:57:26 +10:00
parent 5867961383
commit 67c20cabc3
4 changed files with 9 additions and 7 deletions

View File

@@ -51,13 +51,14 @@ The system continuously scans the network for, **New devices**, **New connection
- Theme Selection (blue, red, green, yellow, black, purple) and Light/Dark-Mode Switch - Theme Selection (blue, red, green, yellow, black, purple) and Light/Dark-Mode Switch
- DB maintenance, Backup, Restore tools and CSV Export / Import - DB maintenance, Backup, Restore tools and CSV Export / Import
- Simple login Support - Simple login Support
- 🌟(Experimental) [Plugin system](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins) - 🌟[Plugin system](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins)
- Create custom plugins with automatically generated settings and UI. - Create custom plugins with automatically generated settings and UI.
- Monitor anything for changes - Monitor anything for changes
- Check the [instructions](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins) carefully if you are up for a challenge! Current plugins include: - Check the [instructions](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins) carefully if you are up for a challenge! Current plugins include:
- Detecting Rogue DHCP servers via NMAP - Detecting Rogue DHCP servers via NMAP
- Monitoring HTTP status changes of domains/URLs - Monitoring HTTP status changes of domains/URLs
- Import devices from DHCP.leases files, a UniFi controller, or an SNMP enabled router - Import devices from DHCP.leases files, a UniFi controller, or an SNMP enabled router
- Creation of dummy devices to visualize your [network map](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/NETWORK_TREE.md)
| ![Screen 1][screen1] | ![Screen 2][screen2] | ![Screen 5][screen5] | | ![Screen 1][screen1] | ![Screen 2][screen2] | ![Screen 5][screen5] |
|----------------------|----------------------| ----------------------| |----------------------|----------------------| ----------------------|
@@ -86,7 +87,8 @@ The system continuously scans the network for, **New devices**, **New connection
- [leiweibau](https://github.com/leiweibau/Pi.Alert): Dark mode (and much more) - [leiweibau](https://github.com/leiweibau/Pi.Alert): Dark mode (and much more)
- [Macleykun](https://github.com/Macleykun): Help with Dockerfile clean-up - [Macleykun](https://github.com/Macleykun): Help with Dockerfile clean-up
- [Final-Hawk](https://github.com/Final-Hawk): Help with NTFY, styling and other fixes - [Final-Hawk](https://github.com/Final-Hawk): Help with NTFY, styling and other fixes
- [TeroRERO](https://github.com/terorero): Spanish translation - [TeroRERO](https://github.com/terorero): Spanish translation
- [Data-Monkey] (https://github.com/Data-Monkey): Split-up of the python.py file and more
- Please see the [Git contributors](https://github.com/jokob-sk/Pi.Alert/graphs/contributors) for a full list of people and their contributions to the project - Please see the [Git contributors](https://github.com/jokob-sk/Pi.Alert/graphs/contributors) for a full list of people and their contributions to the project
## ☕ Support me ## ☕ Support me

View File

@@ -16,7 +16,7 @@ services:
- ${APP_DATA_LOCATION}/pialert/dhcp_samples/dhcp1.leases:/mnt/dhcp1.leases - ${APP_DATA_LOCATION}/pialert/dhcp_samples/dhcp1.leases:/mnt/dhcp1.leases
- ${APP_DATA_LOCATION}/pialert/dhcp_samples/dhcp2.leases:/mnt/dhcp2.leases - ${APP_DATA_LOCATION}/pialert/dhcp_samples/dhcp2.leases:/mnt/dhcp2.leases
# - ${DEV_LOCATION}/back/pialert.py:/home/pi/pialert/back/pialert.py # - ${DEV_LOCATION}/back/pialert.py:/home/pi/pialert/back/pialert.py
- ${DEV_LOCATION}/pialert:/home/pi/pialert/pialert - ${DEV_LOCATION}/pialert:/home/pi/pialert/pialert
# - ${DEV_LOCATION}/back/report_template.html:/home/pi/pialert/back/report_template.html # - ${DEV_LOCATION}/back/report_template.html:/home/pi/pialert/back/report_template.html
# - ${DEV_LOCATION}/back/report_template_new_version.html:/home/pi/pialert/back/report_template_new_version.html # - ${DEV_LOCATION}/back/report_template_new_version.html:/home/pi/pialert/back/report_template_new_version.html
# - ${DEV_LOCATION}/back/report_template.txt:/home/pi/pialert/back/report_template.txt # - ${DEV_LOCATION}/back/report_template.txt:/home/pi/pialert/back/report_template.txt

View File

@@ -135,7 +135,7 @@ class DB():
""" """
Check the current tables in the DB and upgrade them if neccessary Check the current tables in the DB and upgrade them if neccessary
""" """
# indicates, if Online_History table is available # indicates, if Online_History table is available
onlineHistoryAvailable = self.sql.execute(""" onlineHistoryAvailable = self.sql.execute("""
SELECT name FROM sqlite_master WHERE type='table' SELECT name FROM sqlite_master WHERE type='table'
@@ -146,7 +146,7 @@ class DB():
isIncompatible = False isIncompatible = False
if onlineHistoryAvailable : if onlineHistoryAvailable :
isIncompatible = sql.execute (""" isIncompatible = self.sql.execute ("""
SELECT COUNT(*) AS CNTREC FROM pragma_table_info('Online_History') WHERE name='Archived_Devices' SELECT COUNT(*) AS CNTREC FROM pragma_table_info('Online_History') WHERE name='Archived_Devices'
""").fetchone()[0] == 0 """).fetchone()[0] == 0
@@ -182,7 +182,7 @@ class DB():
""") """)
# dev_Network_Node_port column # dev_Network_Node_port column
dev_Network_Node_port_missing = sql.execute (""" dev_Network_Node_port_missing = self.sql.execute ("""
SELECT COUNT(*) AS CNTREC FROM pragma_table_info('Devices') WHERE name='dev_Network_Node_port' SELECT COUNT(*) AS CNTREC FROM pragma_table_info('Devices') WHERE name='dev_Network_Node_port'
""").fetchone()[0] == 0 """).fetchone()[0] == 0

View File

@@ -34,7 +34,7 @@ def send (msg: noti_struc):
try: try:
requests.post("{}/{}".format( conf.NTFY_HOST, conf.NTFY_TOPIC), requests.post("{}/{}".format( conf.NTFY_HOST, conf.NTFY_TOPIC),
data=msg.html, data=msg.text,
headers=headers) headers=headers)
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
mylog('none', ['[NTFY] Error: ', e]) mylog('none', ['[NTFY] Error: ', e])