mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-09-28 04:05:12 +00:00
fix: http server cors
This commit is contained in:
parent
662813cc58
commit
24a1ffd652
@ -21,6 +21,7 @@
|
||||
"@rollup/plugin-commonjs": "^25.0.7",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/figlet": "^1.5.8",
|
||||
"@types/fluent-ffmpeg": "^2.1.24",
|
||||
@ -47,6 +48,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": "^12.0.0",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^5.0.0-beta.2",
|
||||
"file-type": "^19.0.0",
|
||||
"fluent-ffmpeg": "^2.1.2",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import express, { Express, Request, Response } from 'express';
|
||||
import cors from 'cors';
|
||||
import http from 'http';
|
||||
import { log } from '../utils/log';
|
||||
import { ob11Config } from '@/onebot11/config';
|
||||
@ -12,6 +13,7 @@ export abstract class HttpServerBase {
|
||||
|
||||
constructor() {
|
||||
this.expressAPP = express();
|
||||
this.expressAPP.use(cors());
|
||||
this.expressAPP.use(express.urlencoded({ extended: true, limit: '5000mb' }));
|
||||
this.expressAPP.use((req, res, next) => {
|
||||
// 兼容处理没有带content-type的请求
|
||||
|
@ -7,7 +7,7 @@ import qrcode from 'qrcode-terminal';
|
||||
import * as readline from 'node:readline';
|
||||
import fs from 'fs/promises';
|
||||
import path from 'node:path';
|
||||
import { noifyLoginStatus } from '@/common/utils/umami';
|
||||
import { postLoginStatus } from '@/common/utils/umami';
|
||||
import { checkVersion } from '@/common/utils/version';
|
||||
|
||||
program
|
||||
@ -36,7 +36,7 @@ checkVersion().then((remoteVersion: string) => {
|
||||
new NapCatOnebot11();
|
||||
napCatCore.addLoginSuccessCallback(() => {
|
||||
console.log('login success');
|
||||
noifyLoginStatus();
|
||||
postLoginStatus();
|
||||
const msgListener = new MsgListener();
|
||||
msgListener.onRecvMsg = (msg) => {
|
||||
// console.log("onRecvMsg", msg)
|
||||
|
Loading…
Reference in New Issue
Block a user