From 0cc73050a8185c1f623f5726f58687c4eb17a17f Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Mon, 7 Apr 2025 17:39:58 +0200 Subject: [PATCH] backend: Moved global preference api to internal --- backend/src/routes/global-preferences.routes.ts | 12 ++++++------ backend/src/server.ts | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/backend/src/routes/global-preferences.routes.ts b/backend/src/routes/global-preferences.routes.ts index 6d2eb7d..6e18074 100644 --- a/backend/src/routes/global-preferences.routes.ts +++ b/backend/src/routes/global-preferences.routes.ts @@ -3,7 +3,7 @@ import bodyParser from 'body-parser'; import * as appearancePrefCtrl from '../controllers/global-preferences/appearance-preferences.controller.js'; import * as webhookPrefCtrl from '../controllers/global-preferences/webhook-preferences.controller.js'; import * as securityPrefCtrl from '../controllers/global-preferences/security-preferences.controller.js'; -import { withAuth, tokenAndRoleValidator, apiKeyValidator } from '../middlewares/auth.middleware.js'; +import { withAuth, tokenAndRoleValidator } from '../middlewares/auth.middleware.js'; import { UserRole } from '@typings-ce'; import { validateSecurityPreferences, @@ -17,20 +17,20 @@ preferencesRouter.use(bodyParser.json()); // Webhook preferences preferencesRouter.put( '/webhooks', - withAuth(apiKeyValidator, tokenAndRoleValidator(UserRole.ADMIN)), + withAuth(tokenAndRoleValidator(UserRole.ADMIN)), validateWebhookPreferences, webhookPrefCtrl.updateWebhookPreferences ); preferencesRouter.get( '/webhooks', - withAuth(apiKeyValidator, tokenAndRoleValidator(UserRole.ADMIN)), + withAuth(tokenAndRoleValidator(UserRole.ADMIN)), webhookPrefCtrl.getWebhookPreferences ); // Security preferences preferencesRouter.put( '/security', - withAuth(apiKeyValidator, tokenAndRoleValidator(UserRole.ADMIN)), + withAuth(tokenAndRoleValidator(UserRole.ADMIN)), validateSecurityPreferences, securityPrefCtrl.updateSecurityPreferences ); @@ -39,11 +39,11 @@ preferencesRouter.get('/security', securityPrefCtrl.getSecurityPreferences); // Appearance preferences preferencesRouter.put( '/appearance', - withAuth(apiKeyValidator, tokenAndRoleValidator(UserRole.ADMIN)), + withAuth(tokenAndRoleValidator(UserRole.ADMIN)), appearancePrefCtrl.updateAppearancePreferences ); preferencesRouter.get( '/appearance', - withAuth(apiKeyValidator, tokenAndRoleValidator(UserRole.ADMIN)), + withAuth(tokenAndRoleValidator(UserRole.ADMIN)), appearancePrefCtrl.getAppearancePreferences ); \ No newline at end of file diff --git a/backend/src/server.ts b/backend/src/server.ts index dffa7b3..0e53b26 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -50,7 +50,6 @@ const createApp = () => { app.use(`${MEET_API_BASE_PATH_V1}/docs`, (_req: Request, res: Response) => res.sendFile(publicApiHtmlFilePath)); 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}/preferences`, /*mediaTypeValidatorMiddleware,*/ preferencesRouter); // Internal API routes app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/docs`, (_req: Request, res: Response) => @@ -60,6 +59,8 @@ const createApp = () => { app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/rooms`, internalRoomRouter); app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/participants`, internalParticipantsRouter); app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/recordings`, internalRecordingRouter); + app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/preferences`, preferencesRouter); + app.use('/meet/health', (_req: Request, res: Response) => res.status(200).send('OK')); // LiveKit Webhook route