Fix minor errors and update default install version

This commit is contained in:
Bruno Bernardino 2025-12-20 12:01:16 +00:00
parent d547948865
commit a0935dd8b9
No known key found for this signature in database
GPG key ID: D1B0A69ADD114ECE
4 changed files with 23 additions and 17 deletions

View file

@ -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

View file

@ -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) {

View file

@ -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);

View file

@ -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;
};