diff options
Diffstat (limited to 'src/server/api/call.ts')
| -rw-r--r-- | src/server/api/call.ts | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/server/api/call.ts b/src/server/api/call.ts index 1bfe94bb74..fd3cea7743 100644 --- a/src/server/api/call.ts +++ b/src/server/api/call.ts @@ -1,15 +1,11 @@ -import * as express from 'express'; - import endpoints, { Endpoint } from './endpoints'; import limitter from './limitter'; import { IUser } from '../../models/user'; import { IApp } from '../../models/app'; -export default (endpoint: string | Endpoint, user: IUser, app: IApp, data: any, req?: express.Request) => new Promise(async (ok, rej) => { +export default (endpoint: string | Endpoint, user: IUser, app: IApp, data: any, file?: any) => new Promise<any>(async (ok, rej) => { const isSecure = user != null && app == null; - //console.log(endpoint, user, app, data); - const ep = typeof endpoint == 'string' ? endpoints.find(e => e.name == endpoint) : endpoint; if (ep.secure && !isSecure) { @@ -37,8 +33,8 @@ export default (endpoint: string | Endpoint, user: IUser, app: IApp, data: any, let exec = require(`${__dirname}/endpoints/${ep.name}`); - if (ep.withFile && req) { - exec = exec.bind(null, req.file); + if (ep.withFile && file) { + exec = exec.bind(null, file); } let res; |