Sicherheits-, Stabilitaets- und Domainkorrekturen nach vollstaendiger Pruefung
Build & Deploy / deploy (push) Waiting to run
Build & Deploy / deploy (push) Waiting to run
- Absturzsicherheit: Express 4 faengt Fehler aus async-Handlern nicht ab, eine einzige fehlerhafte Anfrage konnte den ganzen Shop beenden - besonders heikel bei capture-order, wo das direkt nach der PayPal-Abbuchung passieren wuerde. Neu: lib/async-wrap.js um alle Handler, zentraler Fehler-Handler in index.js, .catch(next) in der Zugangsschranke, unhandledRejection/uncaughtException-Netz. - Fehlerhaftes JSON lieferte bisher Express' HTML-Fehlerseite mit komplettem Stacktrace und Serverpfaden (weil NODE_ENV nicht gesetzt war). Jetzt saubere JSON-Antwort, NODE_ENV=production in .env.example ergaenzt. - Sicherheits-Header und x-powered-by wie bei der DogFather-Seite. - Falsche Domain .de statt .com korrigiert: astro.config.mjs (betraf alle Canonical-URLs und die komplette Sitemap), robots.txt, Layout.astro sowie den Verwaltungs-Link in jeder Bestellbenachrichtigung (war ein toter Link). - Fehlende Uebersetzung nav.cart in EN/CH/FR ergaenzt: das Warenkorb-Symbol hatte in drei von vier Sprachen keinen Namen fuer Screenreader.
This commit is contained in:
@@ -4,26 +4,27 @@
|
||||
===================================================================== */
|
||||
|
||||
import { Router } from "express";
|
||||
import { wrap } from "../lib/async-wrap.js";
|
||||
import { getCustomer, clearCustomerCookie } from "../lib/customer-auth.js";
|
||||
import { db } from "../db.js";
|
||||
|
||||
export const accountRouter = Router();
|
||||
|
||||
accountRouter.get("/api/account/me", async (req, res) => {
|
||||
accountRouter.get("/api/account/me", wrap(async (req, res) => {
|
||||
const customer = await getCustomer(req);
|
||||
if (!customer) return res.json({ ok: false });
|
||||
return res.json({
|
||||
ok: true,
|
||||
customer: { email: customer.email, name: customer.name, provider: customer.provider, seit: customer.created_at },
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
accountRouter.post("/api/account/logout", (req, res) => {
|
||||
clearCustomerCookie(res);
|
||||
return res.json({ ok: true });
|
||||
});
|
||||
|
||||
accountRouter.post("/api/account/delete", async (req, res) => {
|
||||
accountRouter.post("/api/account/delete", wrap(async (req, res) => {
|
||||
const customer = await getCustomer(req);
|
||||
if (!customer) return res.status(401).json({ ok: false, error: "Nicht angemeldet." });
|
||||
|
||||
@@ -35,9 +36,9 @@ accountRouter.post("/api/account/delete", async (req, res) => {
|
||||
|
||||
clearCustomerCookie(res);
|
||||
return res.json({ ok: true });
|
||||
});
|
||||
}));
|
||||
|
||||
accountRouter.get("/api/account/export", async (req, res) => {
|
||||
accountRouter.get("/api/account/export", wrap(async (req, res) => {
|
||||
const customer = await getCustomer(req);
|
||||
if (!customer) return res.status(401).json({ ok: false, error: "Nicht angemeldet." });
|
||||
|
||||
@@ -51,4 +52,4 @@ accountRouter.get("/api/account/export", async (req, res) => {
|
||||
|
||||
res.setHeader("Content-Disposition", 'attachment; filename="meine-daten.json"');
|
||||
return res.status(200).json(daten);
|
||||
});
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user