From 956acfbcf50169008ef9ce3d3814c87a41b0aa2e Mon Sep 17 00:00:00 2001 From: Kaity A Date: Mon, 19 Dec 2022 11:20:10 +0000 Subject: [PATCH] allow finding compatibility endpoints --- packages/backend/src/server/api/call.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/call.ts b/packages/backend/src/server/api/call.ts index 9458d15fe0..c20443ca60 100644 --- a/packages/backend/src/server/api/call.ts +++ b/packages/backend/src/server/api/call.ts @@ -5,6 +5,7 @@ import { AccessToken } from '@/models/entities/access-token.js'; import { getIpHash } from '@/misc/get-ip-hash.js'; import { limiter } from './limiter.js'; import endpoints, { IEndpointMeta } from './endpoints.js'; +import compatibility from './compatibility.js'; import { ApiError } from './error.js'; import { apiLogger } from './logger.js'; import { AccessToken } from '@/models/entities/access-token.js'; @@ -20,7 +21,8 @@ export default async (endpoint: string, user: CacheableLocalUser | null | undefi const isSecure = user != null && token == null; const isModerator = user != null && (user.isModerator || user.isAdmin); - const ep = endpoints.find(e => e.name === endpoint); + const ep = endpoints.find(e => e.name === endpoint) || + compatibility.find(e => e.name === endpoint); if (ep == null) { throw new ApiError({