mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-17 13:50:36 +00:00
feat: add QQLogin
This commit is contained in:
parent
fb1daa0e21
commit
fc337292bc
@ -1,8 +1,9 @@
|
|||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
import { LoginHandler, LogoutHandler } from '../api/Auth';
|
import { LoginHandler, LogoutHandler, checkHandler } from '../api/Auth';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.post('/login', LoginHandler);
|
router.post('/login', LoginHandler);
|
||||||
|
router.post('/check', checkHandler);
|
||||||
router.post('/logout', LogoutHandler);
|
router.post('/logout', LogoutHandler);
|
||||||
export { router as AuthRouter };
|
export { router as AuthRouter };
|
||||||
@ -161,6 +161,59 @@
|
|||||||
<p id="message"></p>
|
<p id="message"></p>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<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 () {
|
document.getElementById('quick-login').addEventListener('click', function () {
|
||||||
let quickLoginOptions = document.querySelector('#quick-login-dropdown');
|
let quickLoginOptions = document.querySelector('#quick-login-dropdown');
|
||||||
let qrcode = document.querySelector('#qrcode');
|
let qrcode = document.querySelector('#qrcode');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user