Added notifications for actual news
Some checks failed
Code Analysis and Production Deploy / analyze (push) Failing after 5m59s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Has been skipped

This commit is contained in:
Torsten Schulz (local)
2026-06-11 09:02:58 +02:00
parent c7a306e8fa
commit da1efa5a74
7 changed files with 497 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
import { readUsers, writeUsers, hashPassword } from '../../utils/auth.js'
import { sendRegistrationNotification } from '../../utils/email-service.js'
import { assertPasswordNotPwned } from '../../utils/hibp.js'
import { sendNewUserRegistrationPush } from '../../utils/push-notifications.js'
export default defineEventHandler(async (event) => {
try {
@@ -59,6 +60,10 @@ export default defineEventHandler(async (event) => {
users.push(newUser)
await writeUsers(users)
sendNewUserRegistrationPush(newUser)
.then(result => console.info('Registrierungs-Push Ergebnis:', { userId: newUser.id, ...result }))
.catch(error => console.error('Registrierungs-Push fehlgeschlagen:', error))
// Send notification to Vorstand/admin via central email service
try {
await sendRegistrationNotification({ name, email, phone })

View File

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

View File

@@ -1,5 +1,6 @@
import { verifyToken, getUserById, hasAnyRole } from '../utils/auth.js'
import { saveTermin } from '../utils/termine.js'
import { sendNewEventPush } from '../utils/push-notifications.js'
export default defineEventHandler(async (event) => {
try {
@@ -41,13 +42,17 @@ export default defineEventHandler(async (event) => {
})
}
await saveTermin({
const termin = {
datum,
uhrzeit: uhrzeit || '',
titel,
beschreibung: beschreibung || '',
kategorie: kategorie || 'Sonstiges'
})
}
await saveTermin(termin)
sendNewEventPush(termin)
.then(result => console.info('Termin-Push Ergebnis:', { titel: termin.titel, ...result }))
.catch(error => console.error('Termin-Push fehlgeschlagen:', error))
return {
success: true,