fix: enforce strict draft vs publish isolation on all editor API endpoints
All checks were successful
Production Build & Deploy / build-and-deploy (push) Successful in 46s

This commit is contained in:
Daniel S
2026-08-09 23:55:16 +02:00
parent 28473bbcdc
commit 950497311c
5 changed files with 0 additions and 5 deletions

View File

@@ -73,7 +73,6 @@ export const POST: APIRoute = async ({ request }) => {
targetPage.sections.push(newSection);
await fs.mkdir(DATA_DIR, { recursive: true });
await fs.writeFile(livePath, JSON.stringify(config, null, 2), 'utf-8');
await fs.writeFile(draftPath, JSON.stringify(config, null, 2), 'utf-8');
return new Response(JSON.stringify({ success: true, section: newSection }), { status: 201 });

View File

@@ -35,7 +35,6 @@ export const POST: APIRoute = async ({ request }) => {
targetPage.sections = targetPage.sections.filter((sec: any) => sec.id !== section_id);
await fs.mkdir(DATA_DIR, { recursive: true });
await fs.writeFile(livePath, JSON.stringify(config, null, 2), 'utf-8');
await fs.writeFile(draftPath, JSON.stringify(config, null, 2), 'utf-8');
return new Response(JSON.stringify({ success: true, message: 'Sektion gelöscht' }), { status: 200 });

View File

@@ -26,7 +26,6 @@ export const POST: APIRoute = async ({ request }) => {
const updatedConfig = { ...baseConfig, ...draftBody, updated_at: new Date().toISOString() };
await fs.mkdir(DATA_DIR, { recursive: true });
await fs.writeFile(livePath, JSON.stringify(updatedConfig, null, 2), 'utf-8');
await fs.writeFile(draftPath, JSON.stringify(updatedConfig, null, 2), 'utf-8');
return new Response(JSON.stringify({ success: true, message: 'Entwurf erfolgreich gespeichert' }), { status: 200 });

View File

@@ -40,7 +40,6 @@ export const POST: APIRoute = async ({ request }) => {
targetSection.settings = { ...targetSection.settings, ...settings };
await fs.mkdir(DATA_DIR, { recursive: true });
await fs.writeFile(livePath, JSON.stringify(config, null, 2), 'utf-8');
await fs.writeFile(draftPath, JSON.stringify(config, null, 2), 'utf-8');
return new Response(JSON.stringify({ success: true, settings: targetSection.settings }), { status: 200 });

View File

@@ -37,7 +37,6 @@ export const POST: APIRoute = async ({ request }) => {
// 3. Speichere ausschließlich in site.config.draft.json
await fs.mkdir(DATA_DIR, { recursive: true });
await fs.writeFile(livePath, JSON.stringify(config, null, 2), 'utf-8');
await fs.writeFile(draftPath, JSON.stringify(config, null, 2), 'utf-8');
return new Response(