minor changes to Deployment
This commit is contained in:
@@ -4,20 +4,18 @@ import { AccessToken } from "livekit-server-sdk";
|
||||
import { NextRequest } from "next/server";
|
||||
import { prisma } from "@repo/db";
|
||||
|
||||
if (!process.env.LIVEKIT_API_KEY) throw new Error("LIVEKIT_API_KEY not set");
|
||||
/* if (!process.env.LIVEKIT_API_KEY) throw new Error("LIVEKIT_API_KEY not set");
|
||||
if (!process.env.LIVEKIT_API_SECRET)
|
||||
throw new Error("LIVEKIT_API_SECRET not set");
|
||||
throw new Error("LIVEKIT_API_SECRET not set"); */
|
||||
|
||||
export const GET = async (request: NextRequest) => {
|
||||
const roomName = request.nextUrl.searchParams.get("roomName");
|
||||
|
||||
if (!roomName)
|
||||
return Response.json({ message: "Missing roomName" }, { status: 400 });
|
||||
if (!roomName) return Response.json({ message: "Missing roomName" }, { status: 400 });
|
||||
|
||||
const session = await getServerSession();
|
||||
|
||||
if (!session)
|
||||
return Response.json({ message: "Unauthorized" }, { status: 401 });
|
||||
if (!session) return Response.json({ message: "Unauthorized" }, { status: 401 });
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: session.user.id,
|
||||
@@ -29,15 +27,11 @@ export const GET = async (request: NextRequest) => {
|
||||
|
||||
const participantName = user.publicId;
|
||||
|
||||
const at = new AccessToken(
|
||||
process.env.LIVEKIT_API_KEY,
|
||||
process.env.LIVEKIT_API_SECRET,
|
||||
{
|
||||
identity: participantName,
|
||||
// Token to expire after 10 minutes
|
||||
ttl: "1d",
|
||||
},
|
||||
);
|
||||
const at = new AccessToken(process.env.LIVEKIT_API_KEY, process.env.LIVEKIT_API_SECRET, {
|
||||
identity: participantName,
|
||||
// Token to expire after 10 minutes
|
||||
ttl: "1d",
|
||||
});
|
||||
|
||||
at.addGrant({
|
||||
room: roomName,
|
||||
|
||||
Reference in New Issue
Block a user