mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
* feat: notifications backend & creation * feat: assign notification to backup schedule * refactor: status dot one component * chore(notification-details): remove refetchInterval
11 lines
563 B
TypeScript
11 lines
563 B
TypeScript
import type { NotificationConfig } from "~/schemas/notifications";
|
|
|
|
export function buildEmailShoutrrrUrl(config: Extract<NotificationConfig, { type: "email" }>): string {
|
|
const protocol = config.useTLS ? "smtps" : "smtp";
|
|
const auth = `${encodeURIComponent(config.username)}:${encodeURIComponent(config.password)}`;
|
|
const host = `${config.smtpHost}:${config.smtpPort}`;
|
|
const toRecipients = config.to.map((email) => encodeURIComponent(email)).join(",");
|
|
|
|
return `${protocol}://${auth}@${host}/?from=${encodeURIComponent(config.from)}&to=${toRecipients}`;
|
|
}
|