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:
11 files changed
+210
-30
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user