mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 04:45:46 +00:00
chore: 二维码登录与刷新1
This commit is contained in:
parent
35e75be0d0
commit
ca5abc635c
@ -109,6 +109,9 @@ export async function NCoreInitShell() {
|
||||
});
|
||||
|
||||
loginListener.onQRCodeGetPicture = ({ pngBase64QrcodeData, qrcodeUrl }) => {
|
||||
//设置WebuiQrcode
|
||||
WebUiDataRuntime.setQQLoginQrcodeURL(qrcodeUrl);
|
||||
|
||||
const realBase64 = pngBase64QrcodeData.replace(/^data:image\/\w+;base64,/, '');
|
||||
const buffer = Buffer.from(realBase64, 'base64');
|
||||
logger.logWarn('请扫描下面的二维码,然后在手Q上授权登录:');
|
||||
@ -125,6 +128,16 @@ export async function NCoreInitShell() {
|
||||
});
|
||||
});
|
||||
};
|
||||
loginListener.onQRCodeSessionFailed = (errType: number, errCode: number, errMsg: string) => {
|
||||
logger.logError('登录失败(onQRCodeSessionFailed)', errMsg);
|
||||
if (errType == 1 && errCode == 3) {
|
||||
// 二维码过期刷新
|
||||
}
|
||||
loginService.getQRCodePicture();
|
||||
};
|
||||
loginListener.onLoginFailed = (args) => {
|
||||
logger.logError('登录失败(onLoginFailed)', args);
|
||||
};
|
||||
|
||||
loginService.addKernelLoginListener(new wrapper.NodeIKernelLoginListener(
|
||||
proxiedListenerOf(loginListener, logger)));
|
||||
|
Loading…
Reference in New Issue
Block a user