Skip to content

Commit 4ab2ece

Browse files
committed
fix: start webui before login
1 parent 846c035 commit 4ab2ece

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

package-dist.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"name":"llonebot-dist","version":"7.1.2","type":"module","description":"","main":"llonebot.js","author":"linyuchen"}
1+
{"name":"llonebot-dist","version":"7.1.3","type":"module","description":"","main":"llonebot.js","author":"linyuchen"}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'fs'
22
import packageJson from '../package-dist.json'
33

4-
export const version = '7.1.2'
4+
export const version = '7.1.3'
55

66
export const writeVersion = ()=>{
77
const pkgJsonPath = './package-dist.json'

src/webui/BE/server.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class WebUIServer extends Service {
8181
private connections = new Set<Socket>()
8282
private currentPort?: number
8383
public port?: number = undefined
84-
static inject = ['app', 'ntLoginApi', 'ntFriendApi', 'ntGroupApi']
84+
static inject = ['ntLoginApi', 'ntFriendApi', 'ntGroupApi']
8585

8686
constructor(ctx: Context, public config: WebUIServerConfig) {
8787
super(ctx, 'webuiServer', true)
@@ -279,7 +279,11 @@ export class WebUIServer extends Service {
279279
// 获取 Dashboard 统计数据
280280
this.app.get('/api/dashboard/stats', async (req, res) => {
281281
try {
282-
const app = this.ctx.app
282+
const app = this.ctx.get('app')
283+
if (!app) {
284+
res.status(503).json({ success: false, message: '服务尚未就绪,请等待登录完成' })
285+
return
286+
}
283287
const friends = await this.ctx.ntFriendApi.getBuddyList()
284288
const groups = await this.ctx.ntGroupApi.getGroups(false)
285289

@@ -409,6 +413,7 @@ export class WebUIServer extends Service {
409413
}
410414

411415
async start() {
416+
console.log('webui start')
412417
if (!this.config?.enable) {
413418
return
414419
}

0 commit comments

Comments
 (0)