mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: add QQLogin
This commit is contained in:
parent
fb1daa0e21
commit
fc337292bc
@ -1,8 +1,9 @@
|
||||
import { Router } from 'express';
|
||||
import { LoginHandler, LogoutHandler } from '../api/Auth';
|
||||
import { LoginHandler, LogoutHandler, checkHandler } from '../api/Auth';
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.post('/login', LoginHandler);
|
||||
router.post('/check', checkHandler);
|
||||
router.post('/logout', LogoutHandler);
|
||||
export { router as AuthRouter };
|
@ -161,6 +161,59 @@
|
||||
<p id="message"></p>
|
||||
</div>
|
||||
<script>
|
||||
async function CheckQQLoginStatus(retCredential) {
|
||||
let QQLoginResponse = await fetch('/api/QQLogin/CheckLoginStatus', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': "Bearer " + retCredential,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
if (QQLoginResponse.status == 200) {
|
||||
let QQLoginResponseJson = await QQLoginResponse.json();
|
||||
if (QQLoginResponseJson.code == 0) {
|
||||
if (QQLoginResponseJson.data.isLogin) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async function GetQQQucickLoginList(retCredential) {
|
||||
let QQLoginResponse = await fetch('/api/QQLogin/GetQQQucickLoginList', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': "Bearer " + retCredential,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
if (QQLoginResponse.status == 200) {
|
||||
let QQLoginResponseJson = await QQLoginResponse.json();
|
||||
if (QQLoginResponseJson.code == 0) {
|
||||
return QQLoginResponseJson?.data;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
async function GetQQQucickLoginList(retCredential) {
|
||||
let QQLoginResponse = await fetch('/api/QQLogin/GetQQLoginQrcode', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': "Bearer " + retCredential,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
if (QQLoginResponse.status == 200) {
|
||||
let QQLoginResponseJson = await QQLoginResponse.json();
|
||||
if (QQLoginResponseJson.code == 0) {
|
||||
return QQLoginResponseJson?.data;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
document.getElementById('quick-login').addEventListener('click', function () {
|
||||
let quickLoginOptions = document.querySelector('#quick-login-dropdown');
|
||||
let qrcode = document.querySelector('#qrcode');
|
||||
|
Loading…
x
Reference in New Issue
Block a user