fix: http server cors

This commit is contained in:
linyuchen
2024-04-17 17:06:24 +08:00
parent 662813cc58
commit 24a1ffd652
3 changed files with 6 additions and 2 deletions

View File

@@ -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的请求

View File

@@ -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)