Middleware fix
This commit is contained in:
parent
d240d988e4
commit
f026750353
2 changed files with 13 additions and 3 deletions
|
@ -5,6 +5,8 @@ import { Ratelimit } from "@upstash/ratelimit";
|
||||||
import { Redis } from "@upstash/redis";
|
import { Redis } from "@upstash/redis";
|
||||||
import { env } from "./env.mjs";
|
import { env } from "./env.mjs";
|
||||||
|
|
||||||
|
const shitList = ["ama.ab.ca"];
|
||||||
|
|
||||||
const rateLimit = new Ratelimit({
|
const rateLimit = new Ratelimit({
|
||||||
redis: Redis.fromEnv(),
|
redis: Redis.fromEnv(),
|
||||||
limiter: Ratelimit.slidingWindow(
|
limiter: Ratelimit.slidingWindow(
|
||||||
|
@ -35,9 +37,17 @@ export default authMiddleware({
|
||||||
|
|
||||||
if (auth.userId) {
|
if (auth.userId) {
|
||||||
const email = auth.sessionClaims.email as string;
|
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(
|
return NextResponse.redirect(
|
||||||
"https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
"https://www.youtube.com/watch?v=L_jWHffIx5E"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "sprintpadawan",
|
"name": "sprintpadawan",
|
||||||
"version": "3.3.0",
|
"version": "3.3.1",
|
||||||
"description": "Plan. Sprint. Repeat.",
|
"description": "Plan. Sprint. Repeat.",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue