allow finding compatibility endpoints

This commit is contained in:
Kaity A 2022-12-19 11:20:10 +00:00
parent 0a34d92130
commit 956acfbcf5
1 changed files with 3 additions and 1 deletions

View File

@ -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({