mirror of https://github.com/Nofated095/Q2TG.git
feat: 添加使用签名服务器登录功能
This commit is contained in:
parent
fb234caa71
commit
7d7c237f3a
|
@ -84,9 +84,15 @@ export default class SetupController {
|
|||
[Button.text('macOS', true, true)],
|
||||
]);
|
||||
const platform = setupHelper.convertTextToPlatform(platformText);
|
||||
|
||||
let signApi = await this.setupService.waitForOwnerInput('请输入签名服务器地址', [
|
||||
[Button.text('不需要签名服务器', true, true)],
|
||||
]);
|
||||
signApi = setupHelper.checkSignApiAddress(signApi)
|
||||
|
||||
let password = await this.setupService.waitForOwnerInput('请输入密码', undefined, true);
|
||||
password = md5Hex(password);
|
||||
this.oicq = await this.setupService.createOicq(uin, password, platform);
|
||||
this.oicq = await this.setupService.createOicq(uin, password, platform, signApi);
|
||||
this.instance.qqBotId = this.oicq.id;
|
||||
await this.setupService.informOwner(`登录成功`);
|
||||
}
|
||||
|
|
|
@ -26,4 +26,12 @@ export default {
|
|||
return '';
|
||||
}
|
||||
},
|
||||
checkSignApiAddress(signApi: string) {
|
||||
try {
|
||||
new URL(signApi);
|
||||
return signApi;
|
||||
} catch (err) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -83,11 +83,11 @@ export default class SetupService {
|
|||
});
|
||||
}
|
||||
|
||||
public async createOicq(uin: number, password: string, platform: Platform) {
|
||||
const dbQQBot = await db.qqBot.create({ data: { uin, password, platform } });
|
||||
public async createOicq(uin: number, password: string, platform: Platform, signApi: string) {
|
||||
const dbQQBot = await db.qqBot.create({ data: { uin, password, platform, signApi } });
|
||||
return await OicqClient.create({
|
||||
id: dbQQBot.id,
|
||||
uin, password, platform,
|
||||
uin, password, platform, signApi,
|
||||
onQrCode: async (file) => {
|
||||
await this.owner.sendMessage({
|
||||
message: '请使用已登录这个账号的手机 QQ 扫描这个二维码授权',
|
||||
|
|
Loading…
Reference in New Issue