moved to /dispatch and fixed Voice chat
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||
import { ROOMS } from "data/livekitRooms";
|
||||
import { ROOMS } from "_data/livekitRooms";
|
||||
import { AccessToken } from "livekit-server-sdk";
|
||||
import { prisma } from "../../../../../../packages/database/prisma/client";
|
||||
import { NextRequest } from "next/server";
|
||||
|
||||
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");
|
||||
|
||||
export const GET = async () => {
|
||||
export const GET = async (request: NextRequest) => {
|
||||
const roomName = request.nextUrl.searchParams.get("roomName");
|
||||
|
||||
if (!roomName)
|
||||
return Response.json({ message: "Missing roomName" }, { status: 400 });
|
||||
|
||||
const session = await getServerSession();
|
||||
|
||||
if (!session)
|
||||
@@ -32,8 +38,12 @@ export const GET = async () => {
|
||||
ttl: "1d",
|
||||
},
|
||||
);
|
||||
ROOMS.forEach((roomName) => {
|
||||
at.addGrant({ roomJoin: true, room: roomName, canPublish: true });
|
||||
|
||||
at.addGrant({
|
||||
room: roomName,
|
||||
roomJoin: true,
|
||||
canPublish: true,
|
||||
canSubscribe: true,
|
||||
});
|
||||
|
||||
const token = await at.toJwt();
|
||||
|
||||
Reference in New Issue
Block a user