1
1
const { locales, defaultLocale } = require ( "./data/locales.js" )
2
2
3
+ function notIfProduction ( param ) {
4
+ if ( process . env . NODE_ENV === "production" ) return ""
5
+ else return param
6
+ }
7
+
3
8
/** @type {import('next').NextConfig } */
4
9
const nextConfig = {
5
10
reactStrictMode : true ,
@@ -21,15 +26,42 @@ const nextConfig = {
21
26
"/favicon-:all*(png)" ,
22
27
"/app-icon.png" ,
23
28
"/preview.png" ,
24
- ] . map ( ( source ) => ( {
25
- source,
26
- headers : [
27
- {
28
- key : "Cache-control" ,
29
- value : "max-age=3600, stale-while-revalidate" ,
30
- } ,
31
- ] ,
32
- } ) )
29
+ ]
30
+ . map ( ( source ) => ( {
31
+ source,
32
+ headers : [
33
+ {
34
+ key : "Cache-control" ,
35
+ value : "max-age=3600, stale-while-revalidate" ,
36
+ } ,
37
+ ] ,
38
+ } ) )
39
+ . concat ( {
40
+ source : "/(.*)?" ,
41
+ headers : [
42
+ {
43
+ key : "X-Frame-Options" ,
44
+ value : "SAMEORIGIN" ,
45
+ } ,
46
+ {
47
+ key : "X-Content-Type-Options" ,
48
+ value : "nosniff" ,
49
+ } ,
50
+ {
51
+ key : "Permissions-Policy" ,
52
+ value :
53
+ "camera=(), microphone=(), geolocation=(), browsing-topics=()" ,
54
+ } ,
55
+ {
56
+ key : "Referrer-Policy" ,
57
+ value : "origin-when-cross-origin" ,
58
+ } ,
59
+ {
60
+ key : "Content-Security-Policy" ,
61
+ value : `default-src 'self'; child-src 'none'; object-src 'none'; img-src 'self' proxy.joinmastodon.org blob: data:; style-src 'self' 'unsafe-inline'; script-src 'self' ${ notIfProduction ( "'unsafe-inline' 'unsafe-eval'" ) } ; connect-src 'self' api.joinmastodon.org; block-all-mixed-content` ,
62
+ } ,
63
+ ] ,
64
+ } )
33
65
} ,
34
66
async redirects ( ) {
35
67
return [
@@ -82,6 +114,7 @@ const nextConfig = {
82
114
fileLoaderRule . exclude = / \. s v g $ / i
83
115
return config
84
116
} ,
117
+ poweredByHeader : false ,
85
118
output : "standalone" ,
86
119
}
87
120
0 commit comments