* Update all Yarn dependencies (2022-07-29) * Adds syncpack config * Fixes mismatches * Update yarn.lock * RRule fixes * Locking dayjs to fix build * Type fixes * Fixes mismatches * Submodule sync * Update yarn.lock * Update event.ts * Conflict fixes * Fixes prisma warnings * Liting * Upgrade next, zod * Prevents articfact overwriting * Yarn fixes * Jest fixes * Submodule sync * Formatting * Submodule sync * Adds provider for react-tooltip * Removed dotenv-cli * Readds dotenv-cli * Skips getSchedule tests Until prisma is mocked properly * Fixes * Revert prisma seed script * E2E fixes * test * Removed deprecated req.page in middleware * Make tests stable * Unskip getSchedule tests * fixed 404 logo on cal video (#3885) * Removed PW aliases as aren't needed anymore Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com>
26 lines
789 B
TypeScript
26 lines
789 B
TypeScript
import { collectEvents } from "next-collect/server";
|
|
import { NextMiddleware, NextResponse } from "next/server";
|
|
|
|
import { extendEventData, nextCollectBasicSettings } from "@calcom/lib/telemetry";
|
|
|
|
const V2_WHITELIST = ["/settings/admin"];
|
|
|
|
const middleware: NextMiddleware = async (req) => {
|
|
const url = req.nextUrl;
|
|
|
|
/** Display available V2 pages to users who opted-in to early access */
|
|
if (req.cookies.has("calcom-v2-early-access") && V2_WHITELIST.some((p) => url.pathname.startsWith(p))) {
|
|
// rewrite to the current subdomain under the pages/sites folder
|
|
url.pathname = `/v2${url.pathname}`;
|
|
}
|
|
|
|
return NextResponse.rewrite(url);
|
|
};
|
|
|
|
export default collectEvents({
|
|
middleware,
|
|
...nextCollectBasicSettings,
|
|
cookieName: "__clnds",
|
|
extend: extendEventData,
|
|
});
|