backend: Introduce internal API routes for participants and recordings with updated base path

This commit is contained in:
Carlos Santos 2025-03-21 16:31:15 +01:00
parent ca348d1a47
commit c9dfdd8852
3 changed files with 23 additions and 16 deletions

View File

@ -63,6 +63,7 @@ export const {
} = process.env;
export const MEET_API_BASE_PATH = '/meet/api';
export const MEET_INTERNAL_API_BASE_PATH_V1 = '/meet/internal-api/v1';
export const MEET_API_BASE_PATH_V1 = MEET_API_BASE_PATH + '/v1';
export const PARTICIPANT_TOKEN_COOKIE_NAME = 'OvMeetParticipantToken';
export const ACCESS_TOKEN_COOKIE_NAME = 'OvMeetAccessToken';

View File

@ -6,19 +6,18 @@ import {
validateParticipantTokenRequest
} from '../middlewares/request-validators/participant-validator.middleware.js';
export const participantsInternalRouter = Router();
participantsInternalRouter.use(bodyParser.urlencoded({ extended: true }));
participantsInternalRouter.use(bodyParser.json());
export const internalParticipantsRouter = Router();
internalParticipantsRouter.use(bodyParser.urlencoded({ extended: true }));
internalParticipantsRouter.use(bodyParser.json());
participantsInternalRouter.post('/token', validateParticipantTokenRequest, participantCtrl.generateParticipantToken);
participantsInternalRouter.post(
internalParticipantsRouter.post('/token', validateParticipantTokenRequest, participantCtrl.generateParticipantToken);
internalParticipantsRouter.post(
'/token/refresh',
validateParticipantTokenRequest,
participantCtrl.refreshParticipantToken
);
export const participantsRouter = Router();
participantsRouter.use(bodyParser.urlencoded({ extended: true }));
participantsRouter.use(bodyParser.json());
participantsRouter.delete('/:participantName', validateParticipantDeletionRequest, participantCtrl.deleteParticipant);
internalParticipantsRouter.delete(
'/:participantName',
validateParticipantDeletionRequest,
participantCtrl.deleteParticipant
);

View File

@ -7,12 +7,19 @@ import {
SERVER_CORS_ORIGIN,
logEnvVars,
MEET_API_BASE_PATH_V1,
MEET_API_BASE_PATH
MEET_INTERNAL_API_BASE_PATH_V1
} from './environment.js';
import { openapiHtmlPath, indexHtmlPath, publicFilesPath, webcomponentBundlePath } from './utils/path-utils.js';
import { authRouter, livekitRouter, preferencesRouter, recordingRouter, roomRouter } from './routes/index.js';
import {
authRouter,
internalRecordingRouter,
livekitRouter,
preferencesRouter,
recordingRouter,
roomRouter
} from './routes/index.js';
import { GlobalPreferencesService, RoomService } from './services/index.js';
import { participantsInternalRouter, participantsRouter } from './routes/participants.routes.js';
import { internalParticipantsRouter } from './routes/participants.routes.js';
import cookieParser from 'cookie-parser';
const createApp = () => {
@ -37,13 +44,13 @@ const createApp = () => {
app.use(`${MEET_API_BASE_PATH_V1}/rooms`, /*mediaTypeValidatorMiddleware,*/ roomRouter);
app.use(`${MEET_API_BASE_PATH_V1}/recordings`, /*mediaTypeValidatorMiddleware,*/ recordingRouter);
app.use(`${MEET_API_BASE_PATH_V1}/auth`, /*mediaTypeValidatorMiddleware,*/ authRouter);
app.use(`${MEET_API_BASE_PATH_V1}/participants`, participantsRouter);
// TODO: This route should be part of the rooms router
app.use(`${MEET_API_BASE_PATH_V1}/preferences`, /*mediaTypeValidatorMiddleware,*/ preferencesRouter);
// Internal routes
app.use(`${MEET_API_BASE_PATH}/participants`, participantsInternalRouter);
app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/participants`, internalParticipantsRouter);
app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/recordings`, internalRecordingRouter);
app.use('/meet/health', (_req: Request, res: Response) => res.status(200).send('OK'));
app.use('/livekit/webhook', livekitRouter);