Merge remote-tracking branch 'origin/main'

This commit is contained in:
linyuchen 2024-04-26 01:27:10 +08:00
commit fe3ac3060a
4 changed files with 37 additions and 9 deletions

View File

@ -2,6 +2,9 @@
# LLOneBot API
LiteLoaderQQNT插件使你的NTQQ支持OneBot11协议进行QQ机器人开发
> [!CAUTION]\
> **请不要在 QQ 官方群聊和任何影响力较大的简中互联网平台(包括但不限于:B站微博知乎抖音等发布和讨论*任何*与本插件存在相关性的信息**
TG群<https://t.me/+nLZEnpne-pQ1OWFl>
## 安装方法

21
package-lock.json generated
View File

@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"compressing": "^1.10.0",
"cors": "^2.8.5",
"express": "^4.18.2",
"fast-xml-parser": "^4.3.6",
"file-type": "^19.0.0",
@ -2663,6 +2664,18 @@
"resolved": "https://registry.npmmirror.com/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
},
"node_modules/cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"dependencies": {
"object-assign": "^4",
"vary": "^1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/create-require": {
"version": "1.1.1",
"resolved": "https://mirrors.cloud.tencent.com/npm/create-require/-/create-require-1.1.1.tgz",
@ -5100,6 +5113,14 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/object-inspect": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",

View File

@ -15,6 +15,7 @@
"license": "ISC",
"dependencies": {
"compressing": "^1.10.0",
"cors": "^2.8.5",
"express": "^4.18.2",
"fast-xml-parser": "^4.3.6",
"file-type": "^19.0.0",

View File

@ -1,5 +1,6 @@
import express, { Express, Request, Response } from "express";
import http from "http";
import cors from 'cors';
import { log } from "../utils/log";
import { getConfigUtil } from "../config";
import { llonebotError } from "../data";
@ -13,6 +14,8 @@ export abstract class HttpServerBase {
constructor() {
this.expressAPP = express();
// 添加 CORS 中间件
this.expressAPP.use(cors());
this.expressAPP.use(express.urlencoded({ extended: true, limit: "5000mb" }));
this.expressAPP.use((req, res, next) => {
// 兼容处理没有带content-type的请求