mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: ws url token parse
This commit is contained in:
parent
4f9682289c
commit
d54111ce94
@ -4,7 +4,7 @@
|
||||
"name": "LLOneBot",
|
||||
"slug": "LLOneBot",
|
||||
"description": "LiteLoaderQQNT的OneBotApi",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.1",
|
||||
"thumbnail": "./icon.png",
|
||||
"authors": [{
|
||||
"name": "linyuchen",
|
||||
|
@ -88,5 +88,5 @@ export function getStrangerByUin(uin: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export const version = "v3.2.0"
|
||||
export const version = "v3.2.1"
|
||||
export const heartInterval = 15000 // 毫秒
|
@ -33,7 +33,7 @@ export function log(...msg: any[]) {
|
||||
}
|
||||
logMsg += msgItem + " ";
|
||||
}
|
||||
logMsg = `${currentDateTime} ${userInfo}: ${logMsg}\n`
|
||||
logMsg = `${currentDateTime} ${userInfo}: ${logMsg}\n\n`
|
||||
// sendLog(...msg);
|
||||
// console.log(msg)
|
||||
fs.appendFile(path.join(CONFIG_DIR , `llonebot-${currentDate}.log`), logMsg, (err: any) => {
|
||||
|
@ -103,7 +103,7 @@ export function startWSServer(port: number) {
|
||||
}
|
||||
wsServer = new websocket.Server({port})
|
||||
wsServer.on("connection", (ws, req) => {
|
||||
const url = req.url;
|
||||
const url = req.url.split("?").shift();
|
||||
log("received ws connect", url)
|
||||
let token: string = ""
|
||||
const authHeader = req.headers['authorization'];
|
||||
@ -111,7 +111,7 @@ export function startWSServer(port: number) {
|
||||
token = authHeader.split("Bearer ").pop()
|
||||
log("receive ws header token", token);
|
||||
} else {
|
||||
const parsedUrl = urlParse.parse(url, true);
|
||||
const parsedUrl = urlParse.parse(req.url, true);
|
||||
const urlToken = parsedUrl.query.access_token;
|
||||
if (urlToken) {
|
||||
if (Array.isArray(urlToken)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user