-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
next.config.js
119 lines (109 loc) · 2.58 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import { withPlausibleProxy } from "next-plausible";
import makeBundleAnalyzer from "@next/bundle-analyzer";
const withBundleAnalyzer = makeBundleAnalyzer({
enabled: process.env.ANALYZE === "true",
openAnalyzer: false,
});
const csp = `
default-src 'self';
script-src 'self' umami.ryanccn.dev 'unsafe-inline' 'unsafe-eval';
style-src 'self' 'unsafe-inline';
img-src * blob: data:;
child-src 'none' www.youtube-nocookie.com;
media-src 'none';
font-src 'self';
connect-src *;
`;
const securityHeaders = [
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
{
key: "X-DNS-Prefetch-Control",
value: "off",
},
{
key: "X-XSS-Protection",
value: "1; mode=block",
},
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "Permissions-Policy",
value: "camera=(), microphone=(), geolocation=(), interest-cohort=()",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "Referrer-Policy",
value: "origin-when-cross-origin",
},
{
key: "Content-Security-Policy",
value: csp.replaceAll(/\s{2,}/g, " ").trim(),
},
];
/** @type {import('next').NextConfig} */
const nextConfig = withPlausibleProxy()(
withBundleAnalyzer({
reactStrictMode: true,
images: {
remotePatterns: [{ hostname: "cdn.modrinth.com" }, { hostname: "media.forgecdn.net" }],
},
experimental: {
optimizePackageImports: ["lucide-react", "@tremor/react", "date-fns"],
},
async headers() {
if (process.env.NODE_ENV === "development") return [];
return [
{
source: "/:path*",
headers: securityHeaders,
},
];
},
async redirects() {
return [
{
source: "/dashboard",
destination: "/lists",
permanent: false,
},
{
source: "/new/polymc",
destination: "/new/prism",
permanent: true,
},
{
source: "/blog/may-update",
destination: "/changelog/2023-05-12-may-update",
permanent: false,
},
{
source: "/blog/search",
destination: "/changelog/2023-08-18-search",
permanent: false,
},
{
source: "/blog/:match*",
destination: "/changelog/:match*",
permanent: false,
},
];
},
async rewrites() {
return [
{
source: "/list/:id/packwiz/:match*",
destination: "/api/packwiz/list/:id/:match*",
},
];
},
}),
);
export default nextConfig;