Commit cf12428d authored by nanahira's avatar nanahira

don't proxy ws

parent 63c1029a
Pipeline #6150 passed with stages
in 36 seconds
{ {
"name": "koishi-nestjs", "name": "koishi-nestjs",
"version": "1.0.28", "version": "1.0.29",
"description": "Koishi.js as Nest.js Module", "description": "Koishi.js as Nest.js Module",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
......
...@@ -13,18 +13,14 @@ export class KoishiMiddleware ...@@ -13,18 +13,14 @@ export class KoishiMiddleware
async onModuleInit() { async onModuleInit() {
this.proxyMiddleware = createProxyMiddleware({ this.proxyMiddleware = createProxyMiddleware({
target: `http://localhost:${this.koishi._nestKoaTmpServerPort}`, target: `http://localhost:${this.koishi._nestKoaTmpServerPort}`,
ws: true, ws: false,
logLevel: 'silent', logLevel: 'silent',
}); });
} }
use(req: Request, res: Response, next: NextFunction) { use(req: Request, res: Response, next: NextFunction) {
const match = this.koishi.router.match(req.baseUrl, req.method); const match = this.koishi.router.match(req.baseUrl, req.method);
if ( if (!match.route) {
!match.route &&
// ws-reverse onebot goes here
!req.header('x-self-id')
) {
return next(); return next();
} }
return this.proxyMiddleware(req, res, next); return this.proxyMiddleware(req, res, next);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment