Add public/private news system with homepage display
This commit is contained in:
@@ -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()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user