summaryrefslogtreecommitdiff
path: root/src/api/api-handler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/api-handler.ts')
-rw-r--r--src/api/api-handler.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/api/api-handler.ts b/src/api/api-handler.ts
index 45b3c6123e..4cde538ae1 100644
--- a/src/api/api-handler.ts
+++ b/src/api/api-handler.ts
@@ -1,12 +1,12 @@
import * as express from 'express';
-import { IEndpoint } from './endpoints';
+import { Endpoint } from './endpoints';
import authenticate from './authenticate';
import { IAuthContext } from './authenticate';
import _reply from './reply';
import limitter from './limitter';
-export default async (endpoint: IEndpoint, req: express.Request, res: express.Response) => {
+export default async (endpoint: Endpoint, req: express.Request, res: express.Response) => {
const reply = _reply.bind(null, res);
let ctx: IAuthContext;
@@ -21,7 +21,7 @@ export default async (endpoint: IEndpoint, req: express.Request, res: express.Re
return reply(403, 'ACCESS_DENIED');
}
- if (endpoint.shouldBeSignin && ctx.user == null) {
+ if (endpoint.withCredential && ctx.user == null) {
return reply(401, 'PLZ_SIGNIN');
}
@@ -31,7 +31,7 @@ export default async (endpoint: IEndpoint, req: express.Request, res: express.Re
}
}
- if (endpoint.shouldBeSignin) {
+ if (endpoint.withCredential && endpoint.limit) {
try {
await limitter(endpoint, ctx); // Rate limit
} catch (e) {