mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Ignored IPs not applied #836
This commit is contained in:
1
front/plugins/unifi_import/full_run.lock
Executable file
1
front/plugins/unifi_import/full_run.lock
Executable file
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -463,7 +463,7 @@ def list_to_where(logical_operator, column_name, condition_operator, values_list
|
||||
"""
|
||||
|
||||
if not values_list:
|
||||
return "" # Return an empty string if the list is empty to avoid breaking the SQL condition.
|
||||
return " AND 1=1 " # Return a conditioneitehr way if the list is empty to avoid breaking the SQL condition.
|
||||
|
||||
# Replace {s-quote} with single quote in values_list
|
||||
values_list = [value.replace("{s-quote}", "'") for value in values_list]
|
||||
|
||||
@@ -61,11 +61,10 @@ def get_notifications (db):
|
||||
mylog('verbose', ['[Notification] Included sections: ', sections ])
|
||||
|
||||
if 'new_devices' in sections:
|
||||
# Compose New Devices Section
|
||||
# Compose New Devices Section (no empty lines in SQL queries!)
|
||||
sqlQuery = f"""SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices
|
||||
WHERE eve_PendingAlertEmail = 1
|
||||
AND eve_EventType = 'New Device'
|
||||
{get_setting_value('NTFPRCS_new_dev_condition').replace('{s-quote}',"'")}
|
||||
AND eve_EventType = 'New Device' {get_setting_value('NTFPRCS_new_dev_condition').replace('{s-quote}',"'")}
|
||||
ORDER BY eve_DateTime"""
|
||||
|
||||
mylog('debug', ['[Notification] new_devices SQL query: ', sqlQuery ])
|
||||
@@ -133,11 +132,10 @@ def get_notifications (db):
|
||||
mylog('debug', ['[Notification] json_down_reconnected: ', json.dumps(json_down_reconnected) ])
|
||||
|
||||
if 'events' in sections:
|
||||
# Compose Events Section
|
||||
# Compose Events Section (no empty lines in SQL queries!)
|
||||
sqlQuery = f"""SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices
|
||||
WHERE eve_PendingAlertEmail = 1
|
||||
AND eve_EventType IN ('Connected', 'Down Reconnected', 'Disconnected','IP Changed')
|
||||
{get_setting_value('NTFPRCS_event_condition').replace('{s-quote}',"'")}
|
||||
AND eve_EventType IN ('Connected', 'Down Reconnected', 'Disconnected','IP Changed') {get_setting_value('NTFPRCS_event_condition').replace('{s-quote}',"'")}
|
||||
ORDER BY eve_DateTime"""
|
||||
|
||||
mylog('debug', ['[Notification] events SQL query: ', sqlQuery ])
|
||||
|
||||
Reference in New Issue
Block a user