mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: QQ Login Check
This commit is contained in:
@@ -13,14 +13,15 @@ export async function AuthApi(req: Request, res: Response, next: NextFunction) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
if (req.headers?.authorization) {
|
||||
let token = req.headers?.authorization.split(' ')[1];
|
||||
if (req.headers.authorization) {
|
||||
let token = req.headers.authorization.split(' ')[1];
|
||||
let Credential = JSON.parse(Buffer.from(token, 'base64').toString('utf-8'));
|
||||
let config = await WebUiConfig.GetWebUIConfig();
|
||||
let credentialJson = await AuthHelper.validateCredentialWithinOneHour(config.token, Credential);
|
||||
if (credentialJson) {
|
||||
//通过验证
|
||||
next();
|
||||
return;
|
||||
}
|
||||
res.json({
|
||||
code: -1,
|
||||
@@ -29,10 +30,7 @@ export async function AuthApi(req: Request, res: Response, next: NextFunction) {
|
||||
return;
|
||||
}
|
||||
} catch (e: any) {
|
||||
res.json({
|
||||
code: -1,
|
||||
msg: 'Server Error',
|
||||
});
|
||||
console.log(e);
|
||||
return;
|
||||
}
|
||||
res.json({
|
||||
|
@@ -252,8 +252,8 @@
|
||||
optionUinEle.value = QuickUin;
|
||||
QuickListSelect.appendChild(optionUinEle);
|
||||
});
|
||||
generateQrCode(await GetQQLoginQrcode(), document.querySelector('#qrcode-canvas'));
|
||||
setTimeout(HeartBeat, 3000);
|
||||
generateQrCode(await GetQQLoginQrcode(localStorage.getItem('auth')), document.querySelector('#qrcode-canvas'));
|
||||
setInterval(HeartBeat, 3000);
|
||||
}
|
||||
document.getElementById('quick-login').addEventListener('click', function () {
|
||||
let quickLoginOptions = document.querySelector('#quick-login-dropdown');
|
||||
@@ -272,7 +272,7 @@
|
||||
alert("登录失败," + errMsg);
|
||||
}
|
||||
//await (localStorage.getItem('auth'))
|
||||
document.getElementById('quick-login-options').classList.remove('show');
|
||||
//document.getElementById('quick-login-options').classList.remove('show');
|
||||
}
|
||||
document.getElementById('qrcode-login').addEventListener('click', function () {
|
||||
let loginForm = document.querySelector('#quick-login-dropdown');
|
||||
|
Reference in New Issue
Block a user