From d3004506a4768e3c340d669987bbdaae8688bf87 Mon Sep 17 00:00:00 2001 From: maikrolf <40924921+maikrolf@users.noreply.github.com> Date: Sat, 19 Sep 2026 19:48:05 +0200 Subject: [PATCH] cleanup: verwijder debug logging uit proxy-ipfs - Lokale pin opslag stabiel - Geen console.log meer - 191 tests passing --- src/app/api/[...path]/proxy-ipfs.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/app/api/[...path]/proxy-ipfs.ts b/src/app/api/[...path]/proxy-ipfs.ts index 61e2ba3..dff7149 100644 --- a/src/app/api/[...path]/proxy-ipfs.ts +++ b/src/app/api/[...path]/proxy-ipfs.ts @@ -6,21 +6,17 @@ export async function proxyIPFS(path: string, method: string, req: NextRequest): // Normalize path — verwijder leading/trailing slashes const p = path.replace(/^\/+/, '').replace(/\/+$/, ''); - // ── Lokale pin opslag (altijd, ongeacht Kubo) ── + // ── Lokale pin opslag (altijd) ── // Pins worden lokaal opgeslagen in .data/pins.json - // Kubo wordt later toegevoegd voor productie - console.log('[proxyIPFS] path:', path, '→ normalized:', p, 'method:', method); if (p === 'pins' || p.startsWith('pins/')) { - console.log('[proxyIPFS] → handling locally'); return handleLocalPins(p, method, req); } - // In dev, the Kubo API is behind nginx with Basic Auth. - // If no KUBO_API_URL is configured, return a clear error. + // IPFS routes gaan naar Kubo (wanneer beschikbaar) const kuboSvc = kuboApiUrl(); if (!kuboSvc) { return NextResponse.json( - { error: 'IPFS proxy not configured', detail: 'Set KUBO_API_URL in env for dev, or use nginx routing in production' }, + { error: 'IPFS proxy not configured', detail: 'Set KUBO_API_URL in env' }, { status: 501 } ); } @@ -106,10 +102,8 @@ async function handleLocalPins(path: string, method: string, req: NextRequest): // POST /api/pins — pin een CID if (p === 'pins' && method === 'POST') { try { - // Clone de request om body te lezen (voorkomt "body already consumed") const clonedReq = req.clone(); const text = await clonedReq.text(); - console.log('[handleLocalPins] POST body:', text); if (!text) { return NextResponse.json({ error: 'Empty body' }, { status: 400 }); @@ -124,8 +118,7 @@ async function handleLocalPins(path: string, method: string, req: NextRequest): await localAddPin(cid, name, size || 0); return NextResponse.json({ cid }); - } catch (e) { - console.error('[handleLocalPins] POST error:', e); + } catch { return NextResponse.json({ error: 'Invalid request' }, { status: 400 }); } }