Repository navigation
Expand file tree
/
Copy pathnext.config.ts
More file actions
224 lines (221 loc) · 6.62 KB
/
Copy pathnext.config.ts
File metadata and controls
224 lines (221 loc) · 6.62 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
import type { NextConfig } from "next";
import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
if (process.env.NODE_ENV === "development") {
initOpenNextCloudflareForDev();
}
const nextConfig: NextConfig = {
compress: true,
poweredByHeader: false,
experimental: {
staleTimes: {
dynamic: 180,
static: 600,
},
// ── Build memory budget ──
webpackMemoryOptimizations: true,
webpackBuildWorker: true,
memoryBasedWorkersCount: true,
optimizePackageImports: [
"lucide-react",
"framer-motion",
"motion",
"date-fns",
"@tiptap/react",
"@tiptap/starter-kit",
"sonner",
"swr",
"@radix-ui/react-icons",
"@animateicons/react",
],
},
images: {
formats: ["image/avif", "image/webp"],
remotePatterns: [
{ protocol: "https", hostname: "media.giphy.com" },
{ protocol: "https", hostname: "i.giphy.com" },
{ protocol: "https", hostname: "i.ibb.co" },
{ protocol: "https", hostname: "images.unsplash.com" },
{ protocol: "https", hostname: "avatars.githubusercontent.com" },
{ protocol: "https", hostname: "api.dicebear.com" },
],
},
async headers() {
return [
{
// Login with CampusLoop consent screen must never be framed (clickjacking).
source: "/oauth/:path*",
headers: [
{ key: "Content-Security-Policy", value: "frame-ancestors 'none'" },
{ key: "X-Frame-Options", value: "DENY" },
{ key: "Referrer-Policy", value: "no-referrer" },
],
},
{
source: "/icons/:path*",
headers: [
{
key: "Cache-Control",
value: "public, max-age=31536000, immutable",
},
],
},
{
// Launch video, poster and captions (Workers assets use public/_headers in production).
// Unversioned filenames, so a week plus SWR rather than immutable.
source: "/launch/:path*",
headers: [
{
key: "Cache-Control",
value: "public, max-age=604800, stale-while-revalidate=2592000",
},
{ key: "Accept-Ranges", value: "bytes" },
],
},
{
source: "/sw.js",
headers: [
{
key: "Cache-Control",
value: "public, max-age=0, must-revalidate",
},
{
key: "Service-Worker-Allowed",
value: "/",
},
],
},
{
source: "/manifest.json",
headers: [
{
key: "Content-Type",
value: "application/manifest+json",
},
{
key: "Cache-Control",
value: "public, max-age=86400, stale-while-revalidate=604800",
},
],
},
{
source: "/:path*",
headers: [
{
key: "X-DNS-Prefetch-Control",
value: "on",
},
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-Frame-Options",
value: "SAMEORIGIN",
},
{
key: "Referrer-Policy",
value: "strict-origin-when-cross-origin",
},
{
key: "Permissions-Policy",
value: "camera=(self), microphone=(self), geolocation=(), interest-cohort=()",
},
{
key: "X-Permitted-Cross-Domain-Policies",
value: "none",
},
{
key: "X-XSS-Protection",
value: "1; mode=block",
},
],
},
];
},
async redirects() {
return [
{
// Academics moved under /academics/study-material (Oct 2026); /academics is now the hub.
source: "/academics/:path((?!study-material).+)",
destination: "/academics/study-material/:path",
permanent: true,
},
{
source: "/c/:id",
destination: "/communities/:id",
permanent: true,
},
{
source: "/discover",
destination: "/explore",
permanent: true,
},
{
source: "/search",
destination: "/explore",
permanent: true,
},
{
source: "/app",
destination: "/feeds",
permanent: true,
},
{
source: "/u/:username",
destination: "/@:username",
permanent: true,
},
{
source: "/academics/playlists",
destination: "/academics",
permanent: false,
},
// Old and duplicate app routes. Keep in sync with LEGACY_ROUTE_REDIRECTS
// in src/constants/navigation.ts. Query strings are passed through.
...[
["/streak", "/streaks"],
["/ecosystem", "/more"],
["/overview", "/pitch"],
["/dating", "/matching"],
["/dating/discover", "/matching"],
["/dating/:path(filters|likes|matches|requests|settings)", "/matching/:path"],
].map(([source, destination]) => ({ source, destination, permanent: true })),
// Focus release (Nov 2026): campus list pages merged into /board, and
// removed features (random chat, gaming, atlas, living, capsules, AI,
// marketplace, merchant portal) send visitors to the nearest kept page.
// Temporary so the paths can be reused later. Only the list index pages
// of the board sections redirect; /new and detail pages stay.
...[
["/rideshare", "/board?tab=rides"],
["/ride-share", "/board?tab=rides"],
["/housing", "/board?tab=housing"],
["/housing-and-flats", "/board?tab=housing"],
["/lost-and-found", "/board?tab=lost-found"],
["/buy-and-sell", "/board?tab=sell"],
["/living/:path*", "/board"],
["/utilities", "/board"],
["/campus", "/board"],
["/hub", "/board"],
["/random/:path*", "/feeds"],
["/gaming/:path*", "/feeds"],
["/gaming-arena", "/feeds"],
["/atlas/:path*", "/feeds"],
["/capsule/:path*", "/feeds"],
["/ai/:path*", "/feeds"],
["/marketplace/:path*", "/feeds"],
["/merchant-portal/:path*", "/"],
["/admin/marketplace/:path*", "/admin"],
["/docs/time-capsule", "/docs"],
[
"/guide/:slug(random-loop|gaming|time-capsule|campus-ai-and-atlas|campus-marketplace|online-payments|bike-rentals|merchant-portal)",
"/guide",
],
].map(([source, destination]) => ({ source, destination, permanent: false })),
];
},
};
export default nextConfig;