chore: CSP script nonces, deploy health check, dead-code cleanup

Add per-request CSP nonces (drop script unsafe-inline), post-deploy /api/health gate, bump next-auth to beta.32, and remove unused motion/cache/permission helpers.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-21 20:27:08 +02:00
1 parent c46dadeda4
commit 9b47668fe9
20 files changed
+141 -358

No files matched your search

-23
View File
@@ -32,29 +32,6 @@ export function calcPagination(total: number, page: number, perPage: number) {
};
}
/** Generate CSV content from rows */
export function generateCsv(
rows: Record<string, unknown>[],
columns: { key: string; label: string }[],
): string {
const BOM = "\uFEFF";
const header = columns.map((c) => escapeCsv(c.label)).join(",");
const body = rows
.map((row) =>
columns.map((c) => escapeCsv(String(row[c.key] ?? ""))).join(","),
)
.join("\n");
return `${BOM + header}\n${body}`;
}
function escapeCsv(value: string): string {
if (value.includes(",") || value.includes('"') || value.includes("\n")) {
return `"${value.replace(/"/g, '""')}"`;
}
return value;
}
export function formatTimestamp(ts: number): string {
if (!ts) return "N/A";
return new Date(ts * 1000).toLocaleString();