16 lines
534 B
TypeScript
16 lines
534 B
TypeScript
import { connection } from "next/server";
|
|
|
|
import { createRedisEventResponse } from "@/lib/events/redis-stream";
|
|
import { errorResponse } from "@/lib/security/http";
|
|
import { limitRequest, trustedClientAddress } from "@/lib/security/rate-limit";
|
|
|
|
export async function GET(request: Request) {
|
|
await connection();
|
|
try {
|
|
await limitRequest("stream-open", trustedClientAddress(request.headers), 60);
|
|
return await createRedisEventResponse("stygian", request.signal);
|
|
} catch (cause) {
|
|
return errorResponse(cause);
|
|
}
|
|
}
|