www/next.config.ts
2026-09-01 21:08:40 +09:00

36 lines
888 B
TypeScript

import type { NextConfig } from 'next';
const isDev = process.env.NODE_ENV === 'development';
const cspHeader = `
default-src 'self';
connect-src 'self' https://api.bitdori.org wss://api.bitdori.org;
script-src 'self' 'unsafe-inline'${isDev ? " 'unsafe-eval'" : ''};
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
img-src 'self' blob: data:;
font-src 'self' https://fonts.gstatic.com;
object-src 'none';
base-uri 'self';
form-action 'self';
frame-ancestors 'none';
upgrade-insecure-requests;
`;
const nextConfig: NextConfig = {
/* config options here */
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: cspHeader.replaceAll(/\n/g, ''),
},
],
},
];
},
};
export default nextConfig;