feat: webui getQrcode

This commit is contained in:
手瓜一十雪
2024-05-07 12:23:58 +08:00
parent aa037cc3d9
commit caab998212
3 changed files with 30 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import { log, logDebug, logError, LogLevel, setLogLevel } from '@/common/utils/l
import { NapCatOnebot11 } from '@/onebot11/main';
import { hookApi } from '@/core/external/hook';
import { InitWebUi } from './webui/index';
import { DataRuntime } from './webui/src/helper/Data';
program
.option('-q, --qq <type>', 'QQ号')
.parse(process.argv);
@@ -43,9 +44,11 @@ checkVersion().then((remoteVersion: string) => {
new NapCatOnebot11();
napCatCore.onLoginSuccess(() => {
console.log('登录成功!');
DataRuntime.setQQLoginStatus(true);
postLoginStatus();
});
const showQRCode = (qrCodeData: { url: string, base64: string, buffer: Buffer }) => {
const showQRCode = async (qrCodeData: { url: string, base64: string, buffer: Buffer }) => {
await DataRuntime.setQQLoginQrcodeURL(qrCodeData.url);
console.log('请扫描下面的二维码然后在手Q上授权登录');
const qrcodePath = path.join(__dirname, 'qrcode.png');
qrcode.generate(qrCodeData.url, { small: true }, (res) => {