From 67c20cabc3436fe7f3116ff8ededa0b0cb11a4db Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Sat, 10 Jun 2023 10:57:26 +1000 Subject: [PATCH] Upgrade DB fixes + NTFY fix --- README.md | 6 ++++-- docker-compose.yml | 2 +- pialert/database.py | 6 +++--- pialert/publishers/ntfy.py | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f0666661..7ab7fa97 100755 --- a/README.md +++ b/README.md @@ -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 - DB maintenance, Backup, Restore tools and CSV Export / Import - 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. - 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: - Detecting Rogue DHCP servers via NMAP - Monitoring HTTP status changes of domains/URLs - 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] | |----------------------|----------------------| ----------------------| @@ -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) - [Macleykun](https://github.com/Macleykun): Help with Dockerfile clean-up - [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 ## ☕ Support me diff --git a/docker-compose.yml b/docker-compose.yml index b1814592..782409d7 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: - ${APP_DATA_LOCATION}/pialert/dhcp_samples/dhcp1.leases:/mnt/dhcp1.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}/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_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 diff --git a/pialert/database.py b/pialert/database.py index 3345aba5..d39c7054 100755 --- a/pialert/database.py +++ b/pialert/database.py @@ -135,7 +135,7 @@ class DB(): """ Check the current tables in the DB and upgrade them if neccessary """ - + # indicates, if Online_History table is available onlineHistoryAvailable = self.sql.execute(""" SELECT name FROM sqlite_master WHERE type='table' @@ -146,7 +146,7 @@ class DB(): isIncompatible = False if onlineHistoryAvailable : - isIncompatible = sql.execute (""" + isIncompatible = self.sql.execute (""" SELECT COUNT(*) AS CNTREC FROM pragma_table_info('Online_History') WHERE name='Archived_Devices' """).fetchone()[0] == 0 @@ -182,7 +182,7 @@ class DB(): """) # 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' """).fetchone()[0] == 0 diff --git a/pialert/publishers/ntfy.py b/pialert/publishers/ntfy.py index a9ce2500..957657cf 100755 --- a/pialert/publishers/ntfy.py +++ b/pialert/publishers/ntfy.py @@ -34,7 +34,7 @@ def send (msg: noti_struc): try: requests.post("{}/{}".format( conf.NTFY_HOST, conf.NTFY_TOPIC), - data=msg.html, + data=msg.text, headers=headers) except requests.exceptions.RequestException as e: mylog('none', ['[NTFY] Error: ', e])