feat: add resend for send mail (#274)

This commit is contained in:
Dream Hunter
2024-05-26 12:37:11 +08:00
committed by GitHub
parent dc14338b69
commit 3b6736924b
15 changed files with 1576 additions and 65 deletions

View File

@@ -59,12 +59,14 @@ async function sendWebhook(settings: WebhookSettings, formatMap: WebhookMail): P
// send webhook
let body = settings.body;
for (const key of Object.keys(formatMap)) {
/* eslint-disable no-useless-escape */
body = body.replace(
new RegExp(`\\$\\{${key}\\}`, "g"),
JSON.stringify(
formatMap[key as keyof WebhookMail]
).replace(/^"(.*)"$/, '\$1')
);
/* eslint-enable no-useless-escape */
}
const response = await fetch(settings.url, {
method: settings.method,