feat(login, zulip): 引入 JWT 验证并重构 API 密钥管理 #33

Closed
ANGJustinl wants to merge 13 commits from ANGJustinl/whale-town-end:master into main
Showing only changes of commit e282c9dd16 - Show all commits

View File

@@ -116,6 +116,9 @@ export class ZulipService {
private readonly configManager: IZulipConfigService, private readonly configManager: IZulipConfigService,
) { ) {
this.logger.log('ZulipService初始化完成'); this.logger.log('ZulipService初始化完成');
// 启动事件处理
this.initializeEventProcessing();
} }
/** /**
@@ -757,5 +760,42 @@ export class ZulipService {
async getSocketsInMap(mapId: string): Promise<string[]> { async getSocketsInMap(mapId: string): Promise<string[]> {
return this.sessionManager.getSocketsInMap(mapId); return this.sessionManager.getSocketsInMap(mapId);
} }
/**
* 获取事件处理器实例
*
* 功能描述:
* 返回ZulipEventProcessorService实例用于设置消息分发器
*
* @returns ZulipEventProcessorService 事件处理器实例
*/
getEventProcessor(): ZulipEventProcessorService {
return this.eventProcessor;
}
/**
* 初始化事件处理
*
* 功能描述:
* 启动Zulip事件处理循环用于接收和处理从Zulip服务器返回的消息
*
* @private
*/
private async initializeEventProcessing(): Promise<void> {
try {
this.logger.log('开始初始化Zulip事件处理');
// 启动事件处理循环
await this.eventProcessor.startEventProcessing();
this.logger.log('Zulip事件处理初始化完成');
} catch (error) {
const err = error as Error;
this.logger.error('初始化Zulip事件处理失败', {
operation: 'initializeEventProcessing',
error: err.message,
}, err.stack);
}
}
} }