feat(core): add process facts to ordered account notifications (#539)
* feat(core): carry hook process status in notifications `offline` alone cannot tell an external supervisor whether the QQ session dropped (log back in) or the process is gone (restart the client). Resolve the hook process behind a UIN at notify time and expose `status`, `pid` and `error` as template variables; a failing lookup degrades to empty values so delivery is never blocked. The default webhook/email templates gain a process-status line; existing channels keep their stored template untouched. * fix(core): preserve notification lifecycle ordering and simplify state --------- Co-authored-by: zhngzhu <[email protected]> Co-authored-by: 手瓜一十雪 <[email protected]>
This commit is contained in:
19 files changed
+616
-387
No files matched your search
@@ -91,7 +91,14 @@ async function main() {
|
||||
|
||||
// Global notification subsystem (account up/down → webhook). Bound AFTER
|
||||
// OneBotManager so the nickname fallback is already populated when it observes.
|
||||
const notificationManager = createNotificationManager();
|
||||
// Lifecycle events identify their PID; an older process with the same UIN
|
||||
// must not supply facts for a recovered account.
|
||||
const notificationManager = createNotificationManager(async (uin, pid) => {
|
||||
const found = (await hookManager.listProcesses()).find(
|
||||
(p) => p.pid === pid && p.uin === uin,
|
||||
);
|
||||
return found ? { status: found.status, pid: found.pid, error: found.error } : undefined;
|
||||
});
|
||||
notificationManager.bind(bridgeManager);
|
||||
|
||||
let stopWebUI: (() => Promise<void>) | undefined;
|
||||
|
||||
Reference in new issue
Block a user