summaryrefslogtreecommitdiff
path: root/src/server/api/call.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-13 11:44:39 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-13 11:44:39 +0900
commite2e7babee0de35385eb74830c82eaccdb28f013a (patch)
treef86755ab4c60ae63e43039945a07a7ce09bc7a8e /src/server/api/call.ts
parentwip (diff)
downloadsharkey-e2e7babee0de35385eb74830c82eaccdb28f013a.tar.gz
sharkey-e2e7babee0de35385eb74830c82eaccdb28f013a.tar.bz2
sharkey-e2e7babee0de35385eb74830c82eaccdb28f013a.zip
wip
Diffstat (limited to 'src/server/api/call.ts')
-rw-r--r--src/server/api/call.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/server/api/call.ts b/src/server/api/call.ts
index cc40294657..713add566a 100644
--- a/src/server/api/call.ts
+++ b/src/server/api/call.ts
@@ -1,4 +1,3 @@
-import * as http from 'http';
import * as multer from 'koa-multer';
import endpoints, { Endpoint } from './endpoints';
@@ -6,7 +5,7 @@ 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?: http.IncomingMessage) => new Promise<any>(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;
const ep = typeof endpoint == 'string' ? endpoints.find(e => e.name == endpoint) : endpoint;
@@ -36,8 +35,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 as multer.MulterIncomingMessage).file);
+ if (ep.withFile && file) {
+ exec = exec.bind(null, file);
}
let res;