mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-06 16:53:58 +09:00
wip
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user