fix(protocol): support image replies in existing temp sessions

Allow image replies in existing group temporary conversations while preserving passive-only restrictions. Missing, expired, or mismatched sessions remain rejected before media processing, and sending never creates or refreshes a session.

Fixes #471
This commit is contained in:
DrSmoothl committed 2026-09-26 16:30:54 +08:00
1 parent ad360c8eba
commit 1914880df4
11 files changed
+210 -30

No files matched your search

+7 -1
View File
@@ -27,6 +27,8 @@ export interface SendContext {
bridge: BridgeContext;
groupId?: number;
userUid?: string;
/** Source group of an already authorized passive temp-session reply. */
tempGroupId?: number;
/** Explicit transport scene used by scene-limited message elements. */
scene?: OutboundMessageScene;
/**
@@ -386,7 +388,11 @@ async function makeImageElem(ctx: SendContext, element: MessageElement): Promise
throw new Error('private image target uid is missing');
}
const msgInfo = await uploadImageMsgInfo(ctx.bridge, isGroup, targetIdOrUid, element);
const tempGroupId = ctx.scene === 'group-temp' ? ctx.tempGroupId : undefined;
if (ctx.scene === 'group-temp' && tempGroupId === undefined) {
throw new Error('temp-session image source group is missing');
}
const msgInfo = await uploadImageMsgInfo(ctx.bridge, isGroup, targetIdOrUid, element, tempGroupId);
const nt: ProtoElem = {
commonElem: {
serviceType: 48,