mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
SMTP timeout, threshold fixes
This commit is contained in:
@@ -127,13 +127,19 @@ function processColumnValue(dbColumnDef, value, index, type) {
|
|||||||
value = `<span class="anonymizeIp"><a href="#" onclick="navigateToDeviceWithIp('${value}')" >${value}</a><span>`;
|
value = `<span class="anonymizeIp"><a href="#" onclick="navigateToDeviceWithIp('${value}')" >${value}</a><span>`;
|
||||||
break;
|
break;
|
||||||
case 'threshold':
|
case 'threshold':
|
||||||
|
|
||||||
|
valueTmp = ''
|
||||||
|
|
||||||
$.each(dbColumnDef.options, function(index, obj) {
|
$.each(dbColumnDef.options, function(index, obj) {
|
||||||
if(Number(value) < obj.maximum && value == '')
|
if(Number(value) < obj.maximum && valueTmp == '')
|
||||||
{
|
{
|
||||||
value = `<div style="background-color:${obj.hexColor}">${value}</div>`
|
valueTmp = `<div style="background-color:${obj.hexColor}">${value}</div>`
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
value = valueTmp;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'replace':
|
case 'replace':
|
||||||
$.each(dbColumnDef.options, function(index, obj) {
|
$.each(dbColumnDef.options, function(index, obj) {
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ def send (msg: noti_struc):
|
|||||||
# Send mail
|
# Send mail
|
||||||
failedAt = print_log('Trying to open connection to ' + str(conf.SMTP_SERVER) + ':' + str(conf.SMTP_PORT))
|
failedAt = print_log('Trying to open connection to ' + str(conf.SMTP_SERVER) + ':' + str(conf.SMTP_PORT))
|
||||||
|
|
||||||
|
# Set a timeout for the SMTP connection (in seconds)
|
||||||
|
smtp_timeout = 30
|
||||||
|
|
||||||
if conf.SMTP_FORCE_SSL:
|
if conf.SMTP_FORCE_SSL:
|
||||||
failedAt = print_log('SMTP_FORCE_SSL == True so using .SMTP_SSL()')
|
failedAt = print_log('SMTP_FORCE_SSL == True so using .SMTP_SSL()')
|
||||||
if conf.SMTP_PORT == 0:
|
if conf.SMTP_PORT == 0:
|
||||||
@@ -49,7 +52,7 @@ def send (msg: noti_struc):
|
|||||||
smtp_connection = smtplib.SMTP_SSL(conf.SMTP_SERVER)
|
smtp_connection = smtplib.SMTP_SSL(conf.SMTP_SERVER)
|
||||||
else:
|
else:
|
||||||
failedAt = print_log('SMTP_PORT == 0 so sending .SMTP_SSL(SMTP_SERVER, SMTP_PORT)')
|
failedAt = print_log('SMTP_PORT == 0 so sending .SMTP_SSL(SMTP_SERVER, SMTP_PORT)')
|
||||||
smtp_connection = smtplib.SMTP_SSL(conf.SMTP_SERVER, conf.SMTP_PORT)
|
smtp_connection = smtplib.SMTP_SSL(conf.SMTP_SERVER, conf.SMTP_PORT, timeout=smtp_timeout)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
failedAt = print_log('SMTP_FORCE_SSL == False so using .SMTP()')
|
failedAt = print_log('SMTP_FORCE_SSL == False so using .SMTP()')
|
||||||
|
|||||||
Reference in New Issue
Block a user