chore(interaction): probe 7 OIDB cmd candidates per fetch_emoji_like call
Replace the env-driven probe with an unconditional round-robin across
the candidate list every fetch_emoji_like invocation:
0x9083_1 baseline (returns 4-byte ack, known not to be fetch)
0x9082_3 sibling of set/unset reaction
0x9082_4
0x9083_0
0x9083_2
0x9083_3
0x9084_1 exploratory
For each candidate the cmd, response length, parsed user count,
request hex, and response hex are dumped at debug level. The first
candidate that surfaces users wins and is returned; failures inside
runOidb (server-side error code, no handler) are caught + continued
so a bad cmd in the middle doesn't tank the whole probe.
fetch_emoji_like is user-triggered ("view who reacted"), so the
extra SSO traffic on each call is acceptable for a debug build —
we only need one production hit to identify the real cmd.
This commit is contained in:
1 file changed
+41
-35
@@ -91,52 +91,58 @@ export class InteractionApi {
|
|||||||
count,
|
count,
|
||||||
field12: 1,
|
field12: 1,
|
||||||
};
|
};
|
||||||
// Wire-level investigation against macOS NTQQ confirmed:
|
// Wire-level investigation against macOS NTQQ confirmed 0x9083_1 is
|
||||||
// - cmd 0x9083_1 is a real, server-recognized OIDB endpoint
|
// a real server endpoint (routed, errorCode=0, trace string echoes
|
||||||
// - our request fields (groupId/sequence/emojiId/emojiType/count) are
|
// "OidbSvcTrpcTcp.0x9083_1") but its reply is always a 4-byte
|
||||||
// encoded correctly per the schema
|
// minimal ack `18 01 20 01` — not a user list. The real fetch cmd
|
||||||
// - BUT the server reply for 0x9083_1 is always exactly `18 01 20 01`
|
// must be a sibling. To find it, on every call we round-robin a
|
||||||
// (field 3 = 1, field 4 = 1) — a 4-byte minimal ack, no user list
|
// small candidate list of (cmd, subcmd) tuples, log each result, and
|
||||||
// That means 0x9083_1's semantics aren't "fetch emoji-like users". To
|
// return the first one that surfaces users. Frequencies are low
|
||||||
// probe the real cmd/subcmd, allow an env override so deployment can
|
// (user-triggered "view who reacted") so the extra SSO traffic is
|
||||||
// round-robin across candidates (0x9082_3, 0x9082_4, 0x9083_2, …)
|
// acceptable for a debug build.
|
||||||
// without rebuilding. Format: `SNOWLUMA_EMOJI_FETCH_CMD=0x9082_3`.
|
const candidates: Array<readonly [number, number]> = [
|
||||||
let cmdHex = 0x9083;
|
[0x9083, 1], // historic / baseline (we know returns 4-byte ack)
|
||||||
let subCmd = 1;
|
[0x9082, 3], // 0x9082_1=set / _2=unset → _3 might be list
|
||||||
const envOverride = process.env.SNOWLUMA_EMOJI_FETCH_CMD;
|
[0x9082, 4],
|
||||||
if (envOverride) {
|
[0x9083, 0],
|
||||||
const m = /^0x([0-9a-fA-F]+)_(\d+)$/.exec(envOverride.trim());
|
[0x9083, 2],
|
||||||
if (m) {
|
[0x9083, 3],
|
||||||
cmdHex = parseInt(m[1], 16);
|
[0x9084, 1],
|
||||||
subCmd = parseInt(m[2], 10);
|
];
|
||||||
} else {
|
|
||||||
log.warn(`SNOWLUMA_EMOJI_FETCH_CMD malformed: ${JSON.stringify(envOverride)} (expected 0xNNNN_N); falling back to 0x9083_1`);
|
let winner: { users: Array<{ uin: number }>; cookie: string; isLast: boolean } | null = null;
|
||||||
}
|
log.debug(
|
||||||
}
|
`getEmojiLikes probe START: group=${groupId} seq=${sequence} `
|
||||||
|
+ `emojiId=${emojiId} emojiType=${emojiType} count=${count} `
|
||||||
|
+ `cookieIn=${cookie ? 'yes' : 'no'}`,
|
||||||
|
);
|
||||||
|
for (const [cmdHex, subCmd] of candidates) {
|
||||||
const wireName = `OidbSvcTrpcTcp.0x${cmdHex.toString(16)}_${subCmd}`;
|
const wireName = `OidbSvcTrpcTcp.0x${cmdHex.toString(16)}_${subCmd}`;
|
||||||
const env = makeOidbEnvelope<Oidb0x9083Req>(cmdHex, subCmd, req);
|
const env = makeOidbEnvelope<Oidb0x9083Req>(cmdHex, subCmd, req);
|
||||||
const reqBytes = protobuf_encode<OidbBase<Oidb0x9083Req>>(env);
|
const reqBytes = protobuf_encode<OidbBase<Oidb0x9083Req>>(env);
|
||||||
const respBytes = await runOidb(bridge, wireName, reqBytes);
|
let respBytes: Uint8Array;
|
||||||
|
try {
|
||||||
|
respBytes = await runOidb(bridge, wireName, reqBytes);
|
||||||
|
} catch (e) {
|
||||||
|
log.debug(` ${wireName} threw: ${e instanceof Error ? e.message : String(e)}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const resp = protobuf_decode<OidbBase<Oidb0x9083Resp>>(respBytes).body;
|
const resp = protobuf_decode<OidbBase<Oidb0x9083Resp>>(respBytes).body;
|
||||||
// userInfo is repeated on the wire — one entry per liker. The pre-fix
|
|
||||||
// schema treated it as single, which made multi-user responses collapse
|
|
||||||
// into one and (when paired with the swapped req fields) yield [].
|
|
||||||
const users: Array<{ uin: number }> = (resp?.inner?.userInfo ?? [])
|
const users: Array<{ uin: number }> = (resp?.inner?.userInfo ?? [])
|
||||||
.map(u => ({ uin: Number(u?.uin ?? 0) }))
|
.map(u => ({ uin: Number(u?.uin ?? 0) }))
|
||||||
.filter(u => u.uin > 0);
|
.filter(u => u.uin > 0);
|
||||||
const respCookie = resp?.cookie ? Buffer.from(resp.cookie).toString('base64') : '';
|
const respCookie = resp?.cookie ? Buffer.from(resp.cookie).toString('base64') : '';
|
||||||
// Always dump req/resp hex (debug level) while we're probing the real
|
|
||||||
// cmd. Once we land on a working (cmd, subcmd) tuple, this branch can
|
|
||||||
// be tightened back to "only on empty users".
|
|
||||||
log.debug(
|
log.debug(
|
||||||
`getEmojiLikes ${users.length === 0 ? 'empty' : 'ok'} via ${wireName}: `
|
` ${wireName}: respLen=${respBytes.length} users=${users.length} `
|
||||||
+ `group=${groupId} seq=${sequence} emojiId=${emojiId} `
|
+ `respCookie=${respCookie || '(empty)'}`,
|
||||||
+ `emojiType=${emojiType} count=${count} `
|
|
||||||
+ `cookieIn=${cookie ? 'yes' : 'no'} respCookieOut=${respCookie || '(empty)'} `
|
|
||||||
+ `users=${users.length}`,
|
|
||||||
);
|
);
|
||||||
log.debug(` req hex: ${toHexUpper(reqBytes)}`);
|
log.debug(` req hex: ${toHexUpper(reqBytes)}`);
|
||||||
log.debug(` resp hex: ${toHexUpper(respBytes)}`);
|
log.debug(` resp hex: ${toHexUpper(respBytes)}`);
|
||||||
return { users, cookie: respCookie, isLast: !respCookie };
|
if (!winner && users.length > 0) {
|
||||||
|
winner = { users, cookie: respCookie, isLast: !respCookie };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.debug(`getEmojiLikes probe END: winner=${winner ? `users=${winner.users.length}` : 'none'}`);
|
||||||
|
return winner ?? { users: [], cookie: '', isLast: true };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user