mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-12-05 00:53:37 +01:00
- docker-compose.relay.yml: default MESH_ONLY=true with the Infonet sync workers kept on (SHADOWBROKER_MESH_NODE_RUNTIME=true), like meshnode.sh. Measured: the full backend takes 37 s to answer and settles around 1.5 GB RSS at 30-50% CPU; mesh-only answers in 3 s at about 145 MB. The relay's 2 GB limit left the full mode little headroom. Both stay overridable from .env. - Next.js 16.2.7 -> 16.3.8: fixes the App Router proxy bypass advisory; proxy.ts is the CSRF boundary for privileged API routes. - PostCSS override 8.5.15 -> 8.5.28: fixes the source-map path traversal advisories. npm audit (production) now reports only maplibre-gl, whose fix needs a major upgrade; the app does not pass HTML to MapLibre. - Next 16.3 type-checks every file tsconfig includes, so test-only typing errors failed the build; build against tsconfig.build.json (tests excluded) as before. Tests remain type-checked by Vitest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UeX9wuqeVAQNr22zQHWj2H
80 lines
2.6 KiB
TypeScript
80 lines
2.6 KiB
TypeScript
import type { NextConfig } from 'next';
|
|
|
|
// /api/* requests are proxied to the backend by the catch-all route handler at
|
|
// src/app/api/[...path]/route.ts, which reads BACKEND_URL at request time.
|
|
// Do NOT add rewrites for /api/* here — next.config is evaluated at build time,
|
|
// so any URL baked in here ignores the runtime BACKEND_URL env var.
|
|
|
|
const skipTypecheck = process.env.NEXT_SKIP_TYPECHECK === '1';
|
|
|
|
// Desktop packaging: set NEXT_OUTPUT=export to produce a static export
|
|
// (frontend/out/) suitable for Tauri bundling and companion server hosting.
|
|
// This disables API routes, proxy, and server-side image optimization —
|
|
// all handled by the Tauri shell and companion server in packaged mode.
|
|
// Default remains 'standalone' for the web deployment (Docker/Vercel).
|
|
const isDesktopExport = process.env.NEXT_OUTPUT === 'export';
|
|
|
|
// CSP is now emitted dynamically by src/proxy.ts (Phase 5F-A) so that
|
|
// each document response carries a unique per-request nonce. Non-CSP
|
|
// security headers remain here because they are static and benefit from
|
|
// next.config's catch-all source matcher.
|
|
const securityHeaders = [
|
|
{
|
|
key: 'Referrer-Policy',
|
|
value: 'no-referrer',
|
|
},
|
|
{
|
|
key: 'X-Content-Type-Options',
|
|
value: 'nosniff',
|
|
},
|
|
{
|
|
key: 'X-Frame-Options',
|
|
value: 'DENY',
|
|
},
|
|
];
|
|
|
|
const nextConfig: NextConfig = {
|
|
transpilePackages: ['react-map-gl', 'maplibre-gl'],
|
|
output: isDesktopExport ? 'export' : 'standalone',
|
|
devIndicators: false,
|
|
experimental: isDesktopExport
|
|
? {
|
|
webpackBuildWorker: false,
|
|
parallelServerCompiles: false,
|
|
parallelServerBuildTraces: false,
|
|
workerThreads: false,
|
|
}
|
|
: undefined,
|
|
images: {
|
|
unoptimized: isDesktopExport,
|
|
remotePatterns: [
|
|
{ protocol: 'https', hostname: 'upload.wikimedia.org' },
|
|
{ protocol: 'https', hostname: 'via.placeholder.com' },
|
|
{ protocol: 'https', hostname: 'services.sentinel-hub.com' },
|
|
{ protocol: 'https', hostname: 'data.sentinel-hub.com' },
|
|
{ protocol: 'https', hostname: 'sentinel-hub.com' },
|
|
{ protocol: 'https', hostname: 'dataspace.copernicus.eu' },
|
|
],
|
|
},
|
|
typescript: {
|
|
ignoreBuildErrors: skipTypecheck,
|
|
// Next 16.3+ type-checks every file tsconfig includes; keep the build on
|
|
// app code. Tests are type-checked by Vitest/tsc separately.
|
|
tsconfigPath: 'tsconfig.build.json',
|
|
},
|
|
...(!isDesktopExport
|
|
? {
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: '/:path*',
|
|
headers: securityHeaders,
|
|
},
|
|
];
|
|
},
|
|
}
|
|
: {}),
|
|
};
|
|
|
|
export default nextConfig;
|