Add public/private news system with homepage display

This commit is contained in:
Torsten Schulz (local)
2025-10-21 15:26:28 +02:00
parent f0b628d746
commit 72c1039aa3
28 changed files with 272 additions and 126 deletions

View File

@@ -1,5 +1,6 @@
import { promises } from 'fs';
import path from 'path';
import { randomUUID } from 'crypto';
const getDataPath = (filename) => {
const cwd = process.cwd();
@@ -46,8 +47,8 @@ async function saveNews(newsData) {
} else {
const newItem = {
...newsData,
id: `n${Date.now()}`,
// ID must come AFTER ...newsData to not be overwritten
id: randomUUID(),
// Cryptographically secure unique ID
created: (/* @__PURE__ */ new Date()).toISOString(),
updated: (/* @__PURE__ */ new Date()).toISOString()
};