Log WebUI panel URL on server start

Adds logging of the WebUI user panel URL with localhost address when the server starts. Also adjusts QQ login callback invocation in OneBot adapter for improved login flow.
This commit is contained in:
手瓜一十雪 2025-09-07 13:29:37 +08:00
parent 5c120a8231
commit 298b8b71c8
2 changed files with 5 additions and 1 deletions

View File

@ -106,6 +106,7 @@ export class NapCatOneBot11Adapter {
.then((user) => { .then((user) => {
selfInfo.nick = user.nick; selfInfo.nick = user.nick;
this.context.logger.setLogSelfInfo(selfInfo); this.context.logger.setLogSelfInfo(selfInfo);
WebUiDataRuntime.getQQLoginCallback()(true);
}) })
.catch(e => this.context.logger.logError(e)); .catch(e => this.context.logger.logError(e));
@ -180,7 +181,7 @@ export class NapCatOneBot11Adapter {
WebUiDataRuntime.setQQVersion(this.core.context.basicInfoWrapper.getFullQQVersion()); WebUiDataRuntime.setQQVersion(this.core.context.basicInfoWrapper.getFullQQVersion());
WebUiDataRuntime.setQQLoginInfo(selfInfo); WebUiDataRuntime.setQQLoginInfo(selfInfo);
WebUiDataRuntime.setQQLoginStatus(true); WebUiDataRuntime.setQQLoginStatus(true);
WebUiDataRuntime.getQQLoginCallback()(true);
let sendWebUiToken = async (token: string) => { let sendWebUiToken = async (token: string) => {
await this.core.apis.MsgApi.sendMsg( await this.core.apis.MsgApi.sendMsg(
{ chatType: ChatType.KCHATTYPEC2C, peerUid: selfInfo.uid, guildId: '' }, { chatType: ChatType.KCHATTYPEC2C, peerUid: selfInfo.uid, guildId: '' },

View File

@ -184,6 +184,9 @@ export async function InitWebUi(logger: LogWrapper, pathWrapper: NapCatPathWrapp
server.listen(port, host, async () => { server.listen(port, host, async () => {
// 启动后打印出相关地址 // 启动后打印出相关地址
let searchParams = { token: token }; let searchParams = { token: token };
logger.log(
`[NapCat] [WebUi] WebUi User Panel Url: ${createUrl('127.0.0.1', port.toString(), '/webui', searchParams)}`
);
if (host !== '') { if (host !== '') {
logger.log( logger.log(
`[NapCat] [WebUi] WebUi User Panel Url: ${createUrl(host, port.toString(), '/webui', searchParams)}` `[NapCat] [WebUi] WebUi User Panel Url: ${createUrl(host, port.toString(), '/webui', searchParams)}`