From 562fd4f7f9c271796604777c3bead43d2dd81289 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 18 May 2026 14:58:58 +0800 Subject: [PATCH] fix(oidb): set envelope reserved=1 on OIDB 0xFE1_2 (user / stranger) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to c62f517. Dropping the obsolete field 2 from the body was necessary but insufficient: newer QQ NT still rejects the request with [oidb] one of uid/openid is invaild The actual trigger is the OIDB envelope-level `reserved` flag. Lagrange.Core's FetchStrangerByUin sets `Reserved = 1`, our call sent `Reserved = 0`. The server uses that bit to pick its validation path: - reserved=1 → UIN-form variant: server translates body.uin to the internal uid itself - reserved=0 → UID-form variant: server expects a uid/openid string in the body and rejects when it can't find one Our request body has only `uin` + `keys`, so the UID-form path was always going to fail. Setting `isUid: true` (which is the existing flag that flips envelope `reserved` to 1; the parameter name is historical and misleading) puts the call onto the correct branch. Applied to both call sites that target OidbSvcTrpcTcp.0xfe1_2: - fetchUserProfile (bridge-contacts.ts) — fixes the "failed to load self profile for UIN N" warmup warning. - getStrangerStatus (actions/extras.ts) — same OIDB cmd; would have failed identically if exercised against newer QQ NT. Also updated the `isUid` JSDoc on OidbCall to spell out the actual semantic (UIN-form variant marker, not "this call uses UID-keyed data") since the name will keep tripping people otherwise. --- packages/core/src/bridge/actions/extras.ts | 3 +++ packages/core/src/bridge/bridge-contacts.ts | 8 +++++++- packages/core/src/bridge/bridge-oidb.ts | 14 ++++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/core/src/bridge/actions/extras.ts b/packages/core/src/bridge/actions/extras.ts index 38a082a0..3aca81ae 100644 --- a/packages/core/src/bridge/actions/extras.ts +++ b/packages/core/src/bridge/actions/extras.ts @@ -66,6 +66,9 @@ export async function getStrangerStatus(bridge: Bridge, uin: number): Promise ({ key: k })), }; + // Set OIDB envelope `reserved = 1` (the `isUid: true` flag — the + // name is historical, the wire semantic is "this is the UIN-form + // variant of the call"). Without it newer QQ NT versions take the + // UID-form validation path, find neither uid nor openid in the body + // and bounce the request with `[oidb] one of uid/openid is invaild`. + // Matches Lagrange.Core's FetchStrangerByUin (Reserved = 1). const resp = await runOidb(bridge, { cmd: 'OidbSvcTrpcTcp.0xfe1_2', oidbCmd: 0xFE1, subCmd: 2, - request: { schema: OidbUserInfoRequestSchema, value: body }, + request: { schema: OidbUserInfoRequestSchema, value: body, isUid: true }, response: { schema: OidbUserInfoResponseSchema }, }); diff --git a/packages/core/src/bridge/bridge-oidb.ts b/packages/core/src/bridge/bridge-oidb.ts index ac7d78c2..23e71579 100644 --- a/packages/core/src/bridge/bridge-oidb.ts +++ b/packages/core/src/bridge/bridge-oidb.ts @@ -20,10 +20,16 @@ export interface OidbCall { schema: ProtoSchema; value: any; /** - * Sets the OIDB envelope `reserved` field to 1 when true. A handful - * of commands (group/friend list, rkey download) operate on - * UID-keyed data and require this flag — the wire format is - * otherwise identical. + * Sets the OIDB envelope `reserved` field to 1 when true. + * + * The name is historical and misleading: empirically (see Lagrange + * FetchStrangerByUin vs FetchStrangerByUid, fetchGroupList, our own + * highway uploads) the `reserved = 1` flag indicates the UIN-form + * variant of an OIDB call — it tells newer QQ NT to translate the + * UIN in the body to an internal UID rather than running the + * UID-form validator that expects a uid/openid string in the body. + * + * Omit (default false) for genuinely UID-keyed calls. */ isUid?: boolean; };