1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-08-10 22:31:47 +02:00

optimize as per review

(cherry picked from commit cdbfa4ee01)
This commit is contained in:
Florent Daigniere
2024-06-24 08:58:39 +02:00
committed by Mergify
parent 8e28050510
commit dc86008cb4

View File

@@ -257,18 +257,19 @@ class Domain(Base):
@cached_property
def dns_autoconfig(self):
""" return list of auto configuration records (RFC6186) """
ports = {port.strip() for port in app.config['PORTS'].split(',')}
hostname = app.config['HOSTNAME']
protocols = [
('imap', 143, 20 if '143' in app.config['PORTS'].split(',') else 0),
('pop3', 110, 20 if '110' in app.config['PORTS'].split(',') else 0),
('submission', 587, 20 if '587' in app.config['PORTS'].split(',') else 0),
('imap', 143, 20 if '143' in ports else 0),
('pop3', 110, 20 if '110' in ports else 0),
('submission', 587, 20 if '587' in ports else 0),
]
if app.config['TLS_FLAVOR'] != 'notls':
protocols.extend([
('autodiscover', 443, 10 if '443' in app.config['PORTS'].split(',') else 0),
('autodiscover', 443, 10 if '443' in ports else 0),
('submissions', 465, 10),
('imaps', 993, 10),
('pop3s', 995, 10 if '995' in app.config['PORTS'].split(',') else 0),
('pop3s', 995, 10 if '995' in ports else 0),
])
return [