SMTP timeout, threshold fixes

This commit is contained in:
Jokob-sk
2023-09-03 12:04:22 +10:00
parent 25b54d1f62
commit 0ab1f9e19a
2 changed files with 12 additions and 3 deletions

View File

@@ -127,13 +127,19 @@ function processColumnValue(dbColumnDef, value, index, type) {
value = `<span class="anonymizeIp"><a href="#" onclick="navigateToDeviceWithIp('${value}')" >${value}</a><span>`;
break;
case 'threshold':
valueTmp = ''
$.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;
}
});
value = valueTmp;
break;
case 'replace':
$.each(dbColumnDef.options, function(index, obj) {

View File

@@ -42,6 +42,9 @@ def send (msg: noti_struc):
# Send mail
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:
failedAt = print_log('SMTP_FORCE_SSL == True so using .SMTP_SSL()')
if conf.SMTP_PORT == 0:
@@ -49,7 +52,7 @@ def send (msg: noti_struc):
smtp_connection = smtplib.SMTP_SSL(conf.SMTP_SERVER)
else:
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:
failedAt = print_log('SMTP_FORCE_SSL == False so using .SMTP()')