mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-04-24 23:16:53 +00:00
新增撤回消息推送
This commit is contained in:
@@ -290,7 +290,8 @@ class HttpService {
|
||||
broadcastMessagePush(payload: Record<string, unknown>): void {
|
||||
if (!this.running) return
|
||||
const eventId = this.nextMessagePushEventId()
|
||||
const eventBody = `id: ${eventId}\nevent: message.new\ndata: ${JSON.stringify(payload)}\n\n`
|
||||
const eventName = this.getMessagePushEventName(payload)
|
||||
const eventBody = `id: ${eventId}\nevent: ${eventName}\ndata: ${JSON.stringify(payload)}\n\n`
|
||||
this.rememberMessagePushEvent(eventId, eventBody)
|
||||
if (this.messagePushClients.size === 0) return
|
||||
|
||||
@@ -308,6 +309,11 @@ class HttpService {
|
||||
}
|
||||
}
|
||||
|
||||
private getMessagePushEventName(payload: Record<string, unknown>): string {
|
||||
const eventName = String(payload?.event || '').trim()
|
||||
return /^[a-z0-9._-]+$/i.test(eventName) ? eventName : 'message.new'
|
||||
}
|
||||
|
||||
async autoStart(): Promise<void> {
|
||||
const enabled = this.configService.get('httpApiEnabled')
|
||||
if (enabled) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user