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