Migrate dependencies: bcrypt→@node-rs/argon2, sanitize-html→isomorphic-dompurify, remove nodemailer/next-view-transitions
Deploy / release (push) Skipped
Deploy / deploy (push) Failing after 27s

This commit is contained in:
openhands committed 2026-07-28 19:03:04 +02:00
1 parent 3827f3e686
commit a513d9b7bd
8 files changed
+564 -1132

No files matched your search

+1 -31
View File
@@ -1,29 +1,12 @@
import { exec } from "node:child_process";
import { mkdir, writeFile } from "node:fs/promises";
import { resolve } from "node:path";
import nodemailer, { type Transporter } from "nodemailer";
import { Resend } from "resend";
import { env } from "@/env";
import { logger } from "@/lib/logger";
let transporter: Transporter | null = null;
let resend: Resend | null = null;
function getTransport(): Transporter | null {
if (!env.SMTP_HOST) return null;
if (!transporter) {
transporter = nodemailer.createTransport({
host: env.SMTP_HOST,
port: env.SMTP_PORT ?? 587,
secure: env.SMTP_SECURE,
auth: env.SMTP_USER
? { user: env.SMTP_USER, pass: env.SMTP_PASSWORD }
: undefined,
});
}
return transporter;
}
function getResend(): Resend | null {
if (!env.RESEND_API_KEY) return null;
if (!resend) resend = new Resend(env.RESEND_API_KEY);
@@ -90,7 +73,7 @@ async function writeToFile(
}
}
/** Send an HTML email. Tries Resend → SMTP → local sendmail → file fallback. Always returns true. */
/** Send an HTML email. Tries Resend → local sendmail → file fallback. Always returns true. */
export async function sendMail(
to: string,
subject: string,
@@ -111,19 +94,6 @@ export async function sendMail(
}
}
const t = getTransport();
if (t) {
try {
await t.sendMail({ from, to, subject, html });
return true;
} catch (e) {
logger.error("SMTP failed", {
module: "email",
error: (e as Error).message,
});
}
}
const ok = await sendViaSendmail(to, subject, html, from);
if (ok) return true;