feat: 微信内退群监控以及撤回

This commit is contained in:
Wxw-Gu committed 2026-10-12 15:48:14 +08:00
1 parent e5f0aa59f4
commit 632ec9ee13
15 files changed
+1944 -12

No files matched your search

+22
View File
@@ -105,6 +105,11 @@ import type {
ScheduledRuleRunOutcome
} from '../shared/automation'
import type { ActionLogEntry } from '../shared/action-log'
import type {
MsgInsertApplyResult,
MsgInsertSwitchName,
MsgInsertSwitchesSnapshot
} from '../shared/msg-insert-switch'
import type {
AppUpdateCheckResult,
AppUpdateInstallResult,
@@ -326,6 +331,23 @@ declare global {
saveLeaveNotificationRule: (draft: AutomationRuleDraft) => Promise<AutomationRule>
/** 「指定好友」的可选项;已在 main 侧过滤掉群聊 / 公众号 / 文件传输助手 / 自己。 */
listSendableContacts: () => Promise<Array<{ id: string; name: string }>>
/**
* 微信消息插入开关:读取当前状态。
*
* 逐目标会话返回 desiredEnabled / effectiveEnabled —— 开关值写成功不等于
* 功能真的生效(规则可能没装齐),界面不能只看前者。
*/
getMsgInsertSwitches: () => Promise<MsgInsertSwitchesSnapshot>
/**
* 微信消息插入开关:打开 / 关闭。
*
* 开的时候先补规则再写值;写入由一次性 helper 子进程完成,
* 失败会带 failedShards / notReadyRooms 回来,不伪装成功。
*/
setMsgInsertSwitch: (
name: MsgInsertSwitchName,
enabled: boolean
) => Promise<MsgInsertApplyResult>
onGroupExitMonitorState: (callback: (state: GroupExitMonitorState) => void) => () => void
search: (keyword: string) => Promise<string | null>
searchKnowledge: (request: KnowledgeSearchIpcRequest) => Promise<KnowledgeSearchIpcResult>
+26
View File
@@ -75,6 +75,11 @@ import type {
} from '../shared/automation'
import type { GroupMemberStatsQuery, GroupMemberStatsResult } from '../shared/group-stats'
import type { ActionLogEntry } from '../shared/action-log'
import type {
MsgInsertApplyResult,
MsgInsertSwitchName,
MsgInsertSwitchesSnapshot
} from '../shared/msg-insert-switch'
import type { CacheClearScope, CacheSummary } from '../shared/cache'
import type { ExportRequest, ExportJobProgress } from '../shared/export'
import type { ImageDecoderSelectionResult, ImageDecoderStatus } from '../shared/image-decryption'
@@ -222,6 +227,27 @@ const api = {
*/
listSendableContacts: (): Promise<Array<{ id: string; name: string }>> =>
ipcRenderer.invoke('automation:listSendableContacts'),
/**
* 微信消息插入开关 —— 读取当前状态。
*
* 返回的是**逐目标会话**的状态:desiredEnabled(开关值)与 effectiveEnabled
* (真的会生效)是两个概念,界面不能只看前者。数据库未连接时 `success=false`。
*/
getMsgInsertSwitches: (): Promise<MsgInsertSwitchesSnapshot> =>
ipcRenderer.invoke('automation:getMsgInsertSwitches'),
/**
* 微信消息插入开关 —— 打开 / 关闭。
*
* 开的时候会先把目标会话的规则补齐、确认 ready 才写开关值;写不进本进程,
* 由一次性 helper 子进程完成。失败不伪装成功:`status.failedShards > 0`
* 表示真的有分片写失败,`status.readyTargetRooms < status.totalTargetRooms`
* 表示只是规则没装齐。
*/
setMsgInsertSwitch: (
name: MsgInsertSwitchName,
enabled: boolean
): Promise<MsgInsertApplyResult> =>
ipcRenderer.invoke('automation:setMsgInsertSwitch', { name, enabled }),
onGroupExitMonitorState: (callback: (state: GroupExitMonitorState) => void) => {
const listener = (_event: Electron.IpcRendererEvent, state: GroupExitMonitorState): void =>
callback(state)