* add team profile * first version for team members page * finish up design of member list item * fix dialog buttons * add missing seats and upgrading information * add v2 dialog for changing role * finish basic version of member's schedule * remove modalContainer * design fixes team profile page * show only team info to non admins * allow all member to check availabilities * make time available heading sticky * add dropdown for mobile view * create team appearance view * finish appearance page * use settings layout and add danger zone for member * add fallback logo * Add teams to sidebar and fix UI * add team invitations * Clean up * code clean up * add impersontation and disable autofocus on calendar * improve team info * refactor teaminvitelist code and fix leaving a team * add team pages to settings shell * add link to create new team * small fixes * clean up comments * V2 Multi-select (Team Select) (#4324) * --init * design improved * further fine tuning * more fixes * removed extra JSX tag * added story * NIT * revert to use of CheckedTeamSelect * Removes comments Co-authored-by: Peer Richelsen <peeroke@gmail.com> * fix: toggle alligment (#4361) * fix: add checked tranform for switch (#4357) * fixed input size on mobile, fixed settings (#4360) * fix image uploader button in safari * code clean up * fixing type errors * Moved v2 team components to features Adds deprecation notices * Update SettingsLayout.tsx * Migrated to features and build fixes Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com> Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: zomars <zomars@me.com>
64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
import { collectEvents } from "next-collect/server";
|
|
import { NextMiddleware, NextResponse, userAgent } from "next/server";
|
|
|
|
import { CONSOLE_URL, WEBAPP_URL, WEBSITE_URL } from "@calcom/lib/constants";
|
|
import { isIpInBanlist } from "@calcom/lib/getIP";
|
|
import { extendEventData, nextCollectBasicSettings } from "@calcom/lib/telemetry";
|
|
|
|
const V2_WHITELIST = [
|
|
"/settings/admin",
|
|
"/settings/developer/webhooks",
|
|
"/settings/developer/api-keys",
|
|
"/settings/my-account",
|
|
"/settings/security",
|
|
"/settings/teams",
|
|
"/availability",
|
|
"/bookings",
|
|
"/event-types",
|
|
"/workflows",
|
|
"/apps",
|
|
"/success",
|
|
];
|
|
const V2_BLACKLIST = [
|
|
//
|
|
"/apps/routing_forms",
|
|
"/apps/installed",
|
|
];
|
|
|
|
const middleware: NextMiddleware = async (req) => {
|
|
const url = req.nextUrl;
|
|
|
|
if (["/api/collect-events", "/api/auth"].some((p) => url.pathname.startsWith(p))) {
|
|
const callbackUrl = url.searchParams.get("callbackUrl");
|
|
const { isBot } = userAgent(req);
|
|
|
|
if (
|
|
isBot ||
|
|
(callbackUrl && ![CONSOLE_URL, WEBAPP_URL, WEBSITE_URL].some((u) => callbackUrl.startsWith(u))) ||
|
|
isIpInBanlist(req)
|
|
) {
|
|
// DDOS Prevention: Immediately end request with no response - Avoids a redirect as well initiated by NextAuth on invalid callback
|
|
req.nextUrl.pathname = "/api/nope";
|
|
return NextResponse.redirect(req.nextUrl);
|
|
}
|
|
}
|
|
/** Display available V2 pages to users who opted-in to early access */
|
|
if (
|
|
req.cookies.has("calcom-v2-early-access") &&
|
|
!V2_BLACKLIST.some((p) => url.pathname.startsWith(p)) &&
|
|
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);
|
|
}
|
|
return NextResponse.next();
|
|
};
|
|
|
|
export default collectEvents({
|
|
middleware,
|
|
...nextCollectBasicSettings,
|
|
cookieName: "__clnds",
|
|
extend: extendEventData,
|
|
});
|