v1.2: E-Mail-Benachrichtigungen an Portal angeschlossen

- nginx-Proxy POST /api/mail/send -> mp-mail-api:8080 (nur POST, 64k Limit)
- Token serverseitig via envsubst-Template + portal.env (gitignored, nur Server)
- src/lib/mail.ts: fire-and-forget Versand, Empfaenger-Aufloesung (Verwaltung/Mieter)
- Benachrichtigung: neue Schadensmeldung -> Verwaltung, Nachrichten/Antworten -> Gegenstelle
- E2E live verifiziert (versandt: true an axel@hocks.eu), GET 403
- Doku (kimi.md, README) nachgefuehrt
This commit is contained in:
2026-10-02 12:21:12 +02:00
parent fbe033ebd6
commit 5503ce5fc5
9 changed files with 225 additions and 18 deletions
+43
View File
@@ -0,0 +1,43 @@
server {
listen 80;
server_name mieterportal.hocks.eu localhost _;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_types text/css application/javascript image/svg+xml application/json;
gzip_min_length 1024;
# HTML nie cachen (Assets sind hash-benannt → ein Reload genügt)
location = /index.html {
add_header Cache-Control "no-cache" always;
}
# Cache für gehashte Build-Assets
location /assets/ {
expires 30d;
add_header Cache-Control "public, immutable";
}
# Mail-API des Portals (Container mp-mail-api im selben Docker-Netz npm_default).
# Das Token kommt aus portal.env (envsubst beim Container-Start) und liegt
# NIE im Repo und NIE im Browser – der Endpunkt ist nur vom Server erreichbar.
location = /api/mail/send {
limit_except POST { deny all; }
proxy_pass http://mp-mail-api:8080/send;
proxy_set_header Host $host;
proxy_set_header X-Api-Token "${MAIL_API_TOKEN}";
proxy_set_header X-Request-Source mieterportal-nginx;
client_max_body_size 64k;
proxy_read_timeout 15s;
}
# SPA-Fallback für React Router
location / {
try_files $uri $uri/ /index.html;
}
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
}