Added notifications for actual news
This commit is contained in:
@@ -3,6 +3,7 @@ import { promises as fs } from 'fs'
|
||||
import path from 'path'
|
||||
import { createContactRequest } from '../utils/contact-requests.js'
|
||||
import { readUsers, migrateUserRoles, isHiddenUser } from '../utils/auth.js'
|
||||
import { sendNewContactRequestPush } from '../utils/push-notifications.js'
|
||||
|
||||
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
|
||||
// filename is always a hardcoded constant ('config.json'), never user input
|
||||
@@ -111,13 +112,17 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
|
||||
// Anfrage immer speichern, auch wenn E-Mail-Versand fehlschlägt.
|
||||
await createContactRequest({
|
||||
const contactRequest = {
|
||||
name: String(body.name).trim(),
|
||||
email: String(body.email).trim(),
|
||||
phone: body.phone ? String(body.phone).trim() : '',
|
||||
subject: String(body.subject).trim(),
|
||||
message: String(body.message).trim()
|
||||
})
|
||||
}
|
||||
await createContactRequest(contactRequest)
|
||||
sendNewContactRequestPush(contactRequest)
|
||||
.then(result => console.info('Kontaktanfrage-Push Ergebnis:', { subject: contactRequest.subject, ...result }))
|
||||
.catch(error => console.error('Kontaktanfrage-Push fehlgeschlagen:', error))
|
||||
|
||||
const config = await loadConfig()
|
||||
const recipients = await collectRecipients(config)
|
||||
|
||||
Reference in New Issue
Block a user