chore: app router - all sub-pages in /apps (#16976)
* chore: apps/[slug] remove pages router * remove apps/[slug] pages from /future * chore: apps/installed remove pages router * chore: apps/installation remove pages router * remove Head element * fix metadata * fix test * fix another test * chore: apps/categories remove pages router * revert unneeded changes * update middleware * Remove <Head> * remove unused import and code * remove unused import and code again * fix * fix category page * add split icon * add /routing paths to middleware matcher * wip * remove HeadSeo from App.tsx * clean up head-seo test * add generateAppMetadata * use generateAppMetadata in apps/[slug] page * delete file * remove log * fix * fix * fix apps/installed pages * fix cateogires pages * fix * fix imports * wip * fix * fix * fix metadata * fix * redirect /apps/routing-forms to /routing * replace all usages of /apps/routing-forms to /routing * better naming * /routing -> /routing/forms * fix * fix * fix * fix * remove backPath as it is irrelevant when withoutMain is true * fix type checks * fix type check in apps/[slug] * refactors * fix * fix test * fix * fix * fix * Replace multiple leading slashes with a single slash * migrate routing-forms too * add re routing * fix * add redirection --------- Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Anik Dhabal Babu <[email protected]>
This commit is contained in:
68 files changed
+554
-561
No files matched your search
+14
-23
@@ -64,11 +64,9 @@ const middleware = async (req: NextRequest): Promise<NextResponse<unknown>> => {
|
||||
requestHeaders.set("x-csp-enforce", "true");
|
||||
}
|
||||
|
||||
if (url.pathname.startsWith("/future/apps/installed")) {
|
||||
if (url.pathname.startsWith("/apps/installed")) {
|
||||
const returnTo = req.cookies.get("return-to")?.value;
|
||||
if (returnTo !== undefined) {
|
||||
requestHeaders.set("Set-Cookie", "return-to=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT");
|
||||
|
||||
let validPathname = returnTo;
|
||||
|
||||
try {
|
||||
@@ -77,8 +75,14 @@ const middleware = async (req: NextRequest): Promise<NextResponse<unknown>> => {
|
||||
|
||||
const nextUrl = url.clone();
|
||||
nextUrl.pathname = validPathname;
|
||||
// TODO: Consider using responseWithHeaders here
|
||||
return NextResponse.redirect(nextUrl, { headers: requestHeaders });
|
||||
|
||||
const response = NextResponse.redirect(nextUrl);
|
||||
response.cookies.set("return-to", "", {
|
||||
expires: new Date(0),
|
||||
path: "/",
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,9 +112,10 @@ const routingForms = {
|
||||
handleRewrite: (url: URL) => {
|
||||
// Don't 404 old routing_forms links
|
||||
if (url.pathname.startsWith("/apps/routing_forms")) {
|
||||
url.pathname = url.pathname.replace(/^\/apps\/routing_forms($|\/)/, "/apps/routing-forms/");
|
||||
url.pathname = url.pathname.replace(/^\/apps\/routing_forms($|\/)/, "/routing/");
|
||||
return NextResponse.rewrite(url);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -168,25 +173,11 @@ export const config = {
|
||||
"/login",
|
||||
"/auth/login",
|
||||
"/future/auth/login",
|
||||
/**
|
||||
* Paths required by routingForms.handle
|
||||
*/
|
||||
"/apps/routing_forms/:path*",
|
||||
|
||||
"/event-types/:path*",
|
||||
"/apps/installed/:category/",
|
||||
"/future/apps/installed/:category/",
|
||||
"/apps/:slug/",
|
||||
"/future/apps/:slug/",
|
||||
"/apps/:slug/setup/",
|
||||
"/future/apps/:slug/setup/",
|
||||
"/apps/categories/",
|
||||
"/future/apps/categories/",
|
||||
"/apps/categories/:category/",
|
||||
"/future/apps/categories/:category/",
|
||||
"/workflows/:path*",
|
||||
"/getting-started/:path*",
|
||||
"/apps",
|
||||
"/event-types/:path*",
|
||||
"/apps/:path*",
|
||||
"/routing/:path*",
|
||||
"/bookings/:status/",
|
||||
"/video/:path*",
|
||||
"/teams",
|
||||
|
||||
Reference in new issue
Block a user