Middleware fix

This commit is contained in:
Atridad Lahiji 2023-11-19 22:53:49 -07:00
parent d240d988e4
commit f026750353
No known key found for this signature in database
2 changed files with 13 additions and 3 deletions

View file

@ -5,6 +5,8 @@ import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";
import { env } from "./env.mjs";
const shitList = ["ama.ab.ca"];
const rateLimit = new Ratelimit({
redis: Redis.fromEnv(),
limiter: Ratelimit.slidingWindow(
@ -35,9 +37,17 @@ export default authMiddleware({
if (auth.userId) {
const email = auth.sessionClaims.email as string;
if (email.includes("ama.ab.ca")) {
let isShit = false;
shitList.forEach((shitItem) => {
if (email.includes(shitItem)) {
isShit = true;
}
});
if (isShit) {
return NextResponse.redirect(
"https://www.youtube.com/watch?v=dQw4w9WgXcQ"
"https://www.youtube.com/watch?v=L_jWHffIx5E"
);
}
}

View file

@ -1,6 +1,6 @@
{
"name": "sprintpadawan",
"version": "3.3.0",
"version": "3.3.1",
"description": "Plan. Sprint. Repeat.",
"private": true,
"scripts": {