mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-06 17:15:38 -08:00
Add DB fix and renamed Activity chart to Device presence over time
This commit is contained in:
4
.env
4
.env
@@ -2,5 +2,9 @@
|
||||
APP_DATA_LOCATION=/path/to/docker_appdata
|
||||
APP_CONFIG_LOCATION=/path/to/docker_config
|
||||
LOGS_LOCATION=/path/to/docker_logs
|
||||
TZ=Europe/Paris
|
||||
HOST_USER_ID=1000
|
||||
HOST_USER_GID=1000
|
||||
PORT=20211
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ JavaScript)*
|
||||
📚 [Dockerfile instructions](https://github.com/jokob-sk/Pi.Alert/blob/main//dockerfiles/README.md).
|
||||
|
||||
![Main screen dark][main_dark]
|
||||
Dark mode (and Activity over the last x scans) within this fork courtesy of [leiweibau](https://github.com/leiweibau/Pi.Alert)
|
||||
Dark mode (and Device presence over time) within this fork courtesy of [leiweibau](https://github.com/leiweibau/Pi.Alert)
|
||||
|
||||
## How it works
|
||||
The system continuously scans the network for:
|
||||
@@ -164,7 +164,7 @@ Linux distributions.
|
||||
|
||||
This code is a collaborative body of work, with special thanks to:
|
||||
|
||||
- [leiweibau](https://github.com/leiweibau/Pi.Alert): Dark mode (and Last X scans activity chart)
|
||||
- [leiweibau](https://github.com/leiweibau/Pi.Alert): Dark mode (and Device presence over time)
|
||||
- [Macleykun](https://github.com/Macleykun): Help with Dockerfile clean-up
|
||||
- [Final-Hawk](https://github.com/Final-Hawk): Help with NTFY, styling and other fixes
|
||||
- Please see the [Git commit history](https://github.com/jokob-sk/Pi.Alert/commits/main) for a full list of people and their contributions to the project
|
||||
|
||||
@@ -1480,17 +1480,31 @@ def send_email (pText, pHTML):
|
||||
#===============================================================================
|
||||
# DB
|
||||
#===============================================================================
|
||||
def upgradeDB ():
|
||||
def upgradeDB ():
|
||||
|
||||
openDB()
|
||||
|
||||
# check if table exists
|
||||
listOfTables = sql.execute(
|
||||
"""SELECT name FROM sqlite_master WHERE type='table'
|
||||
AND name='Online_History'; """).fetchall()
|
||||
# indicates, if Online_History table is available
|
||||
onlineHistoryAvailable = sql.execute("""
|
||||
SELECT name FROM sqlite_master WHERE type='table'
|
||||
AND name='Online_History';
|
||||
""").fetchall() != []
|
||||
|
||||
# Check if it is incompatible (Check if table has all required columns)
|
||||
isIncompatible = False
|
||||
|
||||
if listOfTables == []:
|
||||
print_log ('Upgrading DB (creating Online_History table)')
|
||||
if onlineHistoryAvailable :
|
||||
isIncompatible = sql.execute ("""
|
||||
SELECT COUNT(*) AS CNTREC FROM pragma_table_info('Online_History') WHERE name='Archived_Devices'
|
||||
""").fetchone()[0] == 0
|
||||
|
||||
# Drop table if available, but incompatible
|
||||
if onlineHistoryAvailable and isIncompatible:
|
||||
print_log ('Table is incompatible, Dropping the Online_History table)')
|
||||
sql.execute("DROP TABLE Online_History;")
|
||||
onlineHistoryAvailable = False
|
||||
|
||||
if onlineHistoryAvailable == False :
|
||||
sql.execute("""
|
||||
CREATE TABLE "Online_History" (
|
||||
"Index" INTEGER,
|
||||
@@ -1503,6 +1517,7 @@ def upgradeDB ():
|
||||
);
|
||||
""")
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
def openDB ():
|
||||
|
||||
@@ -10,7 +10,7 @@ services:
|
||||
- ${APP_DATA_LOCATION}/pialert/db/pialert.db:/home/pi/pialert/db/pialert.db
|
||||
- ${LOGS_LOCATION}/tmp:/home/pi/pialert/log
|
||||
environment:
|
||||
- TZ=Europe/London
|
||||
- PORT=20211
|
||||
- HOST_USER_ID=1000
|
||||
- HOST_USER_GID=1000
|
||||
- TZ=${TZ}
|
||||
- PORT=${PORT}
|
||||
- HOST_USER_ID=${HOST_USER_ID}
|
||||
- HOST_USER_GID=${HOST_USER_GID}
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
<div class="col-md-12">
|
||||
<div class="box" id="clients">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><?php echo $pia_lang['Device_Shortcut_OnlineChart_a'];?> <span class="maxlogage-interval">12</span> <?php echo $pia_lang['Device_Shortcut_OnlineChart_b'];?></h3>
|
||||
<h3 class="box-title"><?php echo $pia_lang['Device_Shortcut_OnlineChart'];?> </h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="chart">
|
||||
|
||||
@@ -15,8 +15,7 @@ $pia_lang['Device_Shortcut_NewDevices'] = 'Neue Geräte';
|
||||
$pia_lang['Device_Shortcut_DownAlerts'] = 'Down Meldungen';
|
||||
$pia_lang['Device_Shortcut_Archived'] = 'Archiviert';
|
||||
$pia_lang['Device_Shortcut_Devices'] = 'Geräte';
|
||||
$pia_lang['Device_Shortcut_OnlineChart_a'] = 'Netzwerkaktivität über die letzten';
|
||||
$pia_lang['Device_Shortcut_OnlineChart_b'] = 'Stunden';
|
||||
$pia_lang['Device_Shortcut_OnlineChart'] = 'Gerätepräsenz im Laufe der Zeit';
|
||||
$pia_lang['Device_TableHead_Name'] = 'Name';
|
||||
$pia_lang['Device_TableHead_Owner'] = 'Eigentümer';
|
||||
$pia_lang['Device_TableHead_Type'] = 'Typ';
|
||||
|
||||
@@ -15,8 +15,7 @@ $pia_lang['Device_Shortcut_NewDevices'] = 'New Devices';
|
||||
$pia_lang['Device_Shortcut_DownAlerts'] = 'Down Alerts';
|
||||
$pia_lang['Device_Shortcut_Archived'] = 'Archived';
|
||||
$pia_lang['Device_Shortcut_Devices'] = 'Devices';
|
||||
$pia_lang['Device_Shortcut_OnlineChart_a'] = 'Network activity over last';
|
||||
$pia_lang['Device_Shortcut_OnlineChart_b'] = 'hours';
|
||||
$pia_lang['Device_Shortcut_OnlineChart'] = 'Device presence over time';
|
||||
$pia_lang['Device_TableHead_Name'] = 'Name';
|
||||
$pia_lang['Device_TableHead_Owner'] = 'Owner';
|
||||
$pia_lang['Device_TableHead_Type'] = 'Type';
|
||||
|
||||
@@ -15,8 +15,7 @@ $pia_lang['Device_Shortcut_NewDevices'] = 'Nuevos dispositivos';
|
||||
$pia_lang['Device_Shortcut_DownAlerts'] = 'Alertas de caídas';
|
||||
$pia_lang['Device_Shortcut_Archived'] = 'Archivada';
|
||||
$pia_lang['Device_Shortcut_Devices'] = 'Dispositivos';
|
||||
$pia_lang['Device_Shortcut_OnlineChart_a'] = 'Actividad de la red durante el último';
|
||||
$pia_lang['Device_Shortcut_OnlineChart_b'] = 'horas';
|
||||
$pia_lang['Device_Shortcut_OnlineChart'] = 'Presencia del dispositivo a lo largo del tiempo';
|
||||
$pia_lang['Device_TableHead_Name'] = 'Nombre';
|
||||
$pia_lang['Device_TableHead_Owner'] = 'Propietario';
|
||||
$pia_lang['Device_TableHead_Type'] = 'Tipo';
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
<div class="col-md-12">
|
||||
<div class="box" id="clients">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><?php echo $pia_lang['Device_Shortcut_OnlineChart_a'];?> <span class="maxlogage-interval">12</span> <?php echo $pia_lang['Device_Shortcut_OnlineChart_b'];?></h3>
|
||||
<h3 class="box-title"><?php echo $pia_lang['Device_Shortcut_OnlineChart'];?></h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="chart">
|
||||
|
||||
Reference in New Issue
Block a user