The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
force logout bad actors
Steven Teyc2abe6d63f63
diff --git a/lib/constants/blacklist.ts b/lib/constants/blacklist.tsindex 4c21db016c..6e2af3a69a 100644--- a/lib/constants/blacklist.ts+++ b/lib/constants/blacklist.ts@@ -15,6 +15,7 @@ const BLACKLIST = new Set(["tgnewstv.it","secure.oldschool.com-os.cz","secure.oldschool.com-rr.cz",+ "secure.oldschool.com-i.cz","rfiptv.xyz","uiptv.ml","8wogq.app.link",diff --git a/lib/middleware/app.ts b/lib/middleware/app.tsindex 9ac4bad14c..776bb97c86 100644--- a/lib/middleware/app.ts+++ b/lib/middleware/app.ts@@ -5,9 +5,9 @@ import { parse } from "@/lib/middleware/utils";export default async function AppMiddleware(req: NextRequest) {const { path } = parse(req);const session = await getToken({ req, secret: process.env.NEXTAUTH_SECRET });- if (!session && path !== "/login" && path !== "/register") {+ if (!session?.email && path !== "/login" && path !== "/register") {return NextResponse.redirect(new URL("/login", req.url));- } else if (session && (path === "/login" || path === "/register")) {+ } else if (session?.email && (path === "/login" || path === "/register")) {return NextResponse.redirect(new URL("/", req.url));}return NextResponse.rewrite(new URL(`/app${path}`, req.url));diff --git a/pages/api/auth/[...nextauth].tsx b/pages/api/auth/[...nextauth].tsxindex eff76434fa..202050ec5d 100644--- a/pages/api/auth/[...nextauth].tsx+++ b/pages/api/auth/[...nextauth].tsx@@ -43,6 +43,16 @@ export const authOptions: NextAuthOptions = {}return true;},+ jwt: async ({ token, account, profile }) => {+ if (BLACKLISTED_EMAILS.has(token.email)) {+ return {};+ }+ if (account) {+ token.accessToken = account.access_token;+ token.id = profile?.id;+ }+ return token;+ },session: async ({ session, token }) => {session.user = {// @ts-ignore