diff --git a/docker-compose.yml b/docker-compose.yml index fbb5ee5..1fa751c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: website: - image: ghcr.io/bewcloud/bewcloud:v3.2.0 + image: ghcr.io/bewcloud/bewcloud:v3.2.1 restart: always ports: - 127.0.0.1:8000:8000 diff --git a/lib/config.ts b/lib/config.ts index 957d84e..d5a4544 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -100,7 +100,9 @@ export class AppConfig { console.info('\nConfig loaded from bewcloud.config.ts', JSON.stringify(this.config, null, 2), '\n'); if (this.config.email.port !== 465 && this.config.email.tlsMode === null) { - console.warn("DEPRECATION WARNING: When using `config.email.port` with a value other than `465`, please set `config.email.tlsMode` to either `'starttls'` or `'none'` to explicitly enable or disable usage of StartTLS! Support for legacy opportunistic StartTLS will be removed in bewCloud 4!"); + console.warn( + "DEPRECATION WARNING: When using `config.email.port` with a value other than `465`, please set `config.email.tlsMode` to either `'starttls'` or `'none'` to explicitly enable or disable usage of StartTLS! Support for legacy opportunistic StartTLS will be removed in a future version of bewCloud!", + ); } if (this.config.core.enabledApps.length === 0) { diff --git a/lib/models/email.ts b/lib/models/email.ts index 7a67d73..e350848 100644 --- a/lib/models/email.ts +++ b/lib/models/email.ts @@ -17,29 +17,33 @@ export class EmailModel { let tlsMode = emailConfig.tlsMode; if (tlsMode === null) { - // Value “default” will be ignored below causing the nodemailer default behaviour of using opportunistic StartTLS - tlsMode = Number(emailConfig.port) === 465 ? "immediate" : "default"; - } else if (!["immediate", "starttls", "none"].includes(tlsMode)) { - tlsMode = Number(emailConfig.port) === 465 ? "immediate" : "starttls"; + // Value `null` will be ignored below causing the nodemailer default behaviour of using opportunistic StartTLS + tlsMode = Number(emailConfig.port) === 465 ? 'immediate' : null; + } else if (!['immediate', 'starttls', 'none'].includes(tlsMode)) { + tlsMode = Number(emailConfig.port) === 465 ? 'immediate' : 'starttls'; } const transporterConfig = { host: emailConfig.host, port: emailConfig.port, - secure: tlsMode === "immediate", - requireTLS: tlsMode === "starttls", - ignoreTLS: tlsMode === "none", + secure: tlsMode === 'immediate', + requireTLS: tlsMode === 'starttls', + ignoreTLS: tlsMode === 'none', tls: ( - emailConfig.tlsVerify === false ? { rejectUnauthorized: false } : - emailConfig.tlsVerify !== true ? { servername: emailConfig.tlsVerify } : - {} + emailConfig.tlsVerify === false + ? { rejectUnauthorized: false } + : emailConfig.tlsVerify !== true + ? { servername: emailConfig.tlsVerify } + : {} ), - auth: (SMTP_USERNAME || SMTP_PASSWORD) ? { - user: SMTP_USERNAME, - pass: SMTP_PASSWORD, - } : null, + auth: (SMTP_USERNAME || SMTP_PASSWORD) + ? { + user: SMTP_USERNAME, + pass: SMTP_PASSWORD, + } + : null, }; const transporter = nodemailer.createTransport(transporterConfig); diff --git a/lib/types.ts b/lib/types.ts index 9b95a74..988da64 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -207,7 +207,7 @@ export interface Config { /** The SMTP port to send emails from */ port: number; /** “auto” means “immediate” on port 465, “starttls” otherwise; `null` is legacy behaviour that will be removed in v4: on port 465 it also means “immediate”, otherwise it will use opportunistic StartTLS falling back to plain transmission */ - tlsMode: null | "auto" | "immediate" | "starttls" | "none"; + tlsMode: null | 'auto' | 'immediate' | 'starttls' | 'none'; /** Whether to verify the TLS certificate. If a string is used the hostname will be verified using that name. */ tlsVerify: boolean | string; };