remove invalid route handling
parent
fe4e737082
commit
f53eef62de
20
src/index.ts
20
src/index.ts
|
@ -166,25 +166,5 @@ media.get('/thumbnail/:serverName/:mediaId', async (ctx) => {
|
|||
|
||||
router.use('/media/r0', media.routes(), media.allowedMethods());
|
||||
|
||||
router.all('/:idc+', async (ctx) => {
|
||||
const req = await got(DEST_SERVER + ctx.path + '?' + ctx.querystring, {
|
||||
// @ts-ignore
|
||||
method: ctx.req.method,
|
||||
body: ctx.body,
|
||||
responseType: 'buffer',
|
||||
headers: {
|
||||
Authorization: ctx.headers['authorization'],
|
||||
},
|
||||
});
|
||||
ctx.res.statusCode = req.statusCode;
|
||||
Object.keys(req.headers).forEach((h) => {
|
||||
const val = req.headers[h];
|
||||
if (typeof val === 'undefined') return;
|
||||
ctx.res.setHeader(h, val);
|
||||
});
|
||||
ctx.res.write(req.body);
|
||||
ctx.res.end();
|
||||
});
|
||||
|
||||
koa.use(router.routes()).use(router.allowedMethods());
|
||||
koa.listen(parseInt(LISTENING_PORT || '8009', 10));
|
||||
|
|
Loading…
Reference in New Issue