feat(onebot): TierB ③ — RE'd OIDB actions (ark share / doubt friends / robot-add)
All recovered from QQNT wrapper.linux.node via IDA — NapCat ships these as
kernel-only with no portable packet wire, so each cmd + protobuf was traced
from the binary (worker ctor cmd/subcmd via BaseOidbWorker::DoSendOidbReq;
field tags from the per-feature EncodeRequest). All uin-form OIDB (envelope
reserved=1, matching the NT worker flag=1). One commit for easy rollback.
New OIDB services + byte-oracle tests (fixed-wire, mutation-resistant):
- 0x9130_0 getBuddyRecommendContactArkJson → share_peer/send_ark_share (user)
- 0x8b7_5 getGroupRecommendContactArkJson → share_peer/send_ark_share (group),
share_group_ex/send_group_ark_share (NapCat's getArkJsonGroupShare
was NOT RE'd; routed to this confident equivalent — documented)
- 0xd69_0 getDoubtBuddyReq → get_doubt_friends_add_request
- 0xd69_0 approvalDoubtBuddyReq → set_doubt_friends_add_request (approve only)
- 0xf00_3 modifyGroupExtInfoV2 → set_group_robot_add_option (EXTInfo tags
30/31; GroupExtFilter is client-side gating, not on the wire)
NOT shipped (kernel-.so-side, no static cmd recoverable from this binary —
honest, no guessed packets): get_robot_uin_range (trpc method-routed),
create_collection/get_collection_list (Weiyun multi-step), trans_group_file.
Doubt-list string field NAMES (nick/source/msg) are medium-confidence
(generic serializer); uid+reqTime are high. READ path, so a mislabel is
cosmetic, never a wire/ban risk. Wired through bridge friend/contacts/
groupAdmin apis; proto-defs + per-file subpath exports registered.
This commit is contained in:
21 files changed
+931
No files matched your search
@@ -0,0 +1,40 @@
|
||||
// 0x9130_0 — getBuddyRecommendContactArkJson: ask the server to build a
|
||||
// "recommend contact" ARK share card for a friend (by uin). Returns the
|
||||
// ark JSON string the card is rendered from. RE'd from QQNT
|
||||
// buddy_recommend_contact_ark_json.cc (EncodeRequest writes uin/phone/jump_url;
|
||||
// DecodeResponse reads field 1 = ark json). uin-form OIDB (envelope reserved=1).
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type {
|
||||
OidbBuddyRecommendArkReq, OidbBuddyRecommendArkResp,
|
||||
} from '@snowluma/proto-defs/oidb-actions/contact-ark';
|
||||
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
||||
|
||||
export namespace GetBuddyRecommendArk {
|
||||
export const command = 0x9130;
|
||||
export const subCommand = 0;
|
||||
export const uinForm = true;
|
||||
|
||||
export interface Params { userId: number; phoneNumber?: string }
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const serialize = (_ctx: Deps, p: Params): OidbBuddyRecommendArkReq => ({
|
||||
uin: p.userId,
|
||||
phoneNum: p.phoneNumber ?? '',
|
||||
// Client-side jump_url the kernel hard-codes alongside the uin; the
|
||||
// server echoes it into the card. Mirrors the NT template exactly.
|
||||
jumpUrl: `mqqapi://card/show_pslcard?src_type=internal&source=sharecard&version=1&uin=${p.userId}`,
|
||||
});
|
||||
|
||||
export const deserialize = (_ctx: Deps, body: OidbBuddyRecommendArkResp): string => body.arkJson ?? '';
|
||||
|
||||
export const encode = (env: OidbBase<OidbBuddyRecommendArkReq>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<OidbBuddyRecommendArkReq>>(env);
|
||||
|
||||
export const decode = (bytes: Uint8Array): OidbBase<OidbBuddyRecommendArkResp> =>
|
||||
protobuf_decode<OidbBase<OidbBuddyRecommendArkResp>>(bytes);
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<string> =>
|
||||
invokeOidb(deps, GetBuddyRecommendArk, params);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// 0x8b7_5 — getGroupRecommendContactArkJson: ask the server to build a
|
||||
// "recommend contact" ARK share card for a group (by group code). Returns the
|
||||
// ark JSON string. RE'd from QQNT group_get_ark_json_worker.cc (EncodeRequest
|
||||
// writes {1:reqType=1, 2:groupCode, 5:flag=1}); response read in
|
||||
// group_info_mgr.cc `[gp_get_ark_json]` as {1:bussness_error_code, 5:ark_json}.
|
||||
// uin-form OIDB (envelope reserved=1).
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type {
|
||||
OidbGroupRecommendArkReq, OidbGroupRecommendArkResp,
|
||||
} from '@snowluma/proto-defs/oidb-actions/contact-ark';
|
||||
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
||||
|
||||
export namespace GetGroupRecommendArk {
|
||||
export const command = 0x8B7;
|
||||
export const subCommand = 5;
|
||||
export const uinForm = true;
|
||||
|
||||
export interface Params { groupId: number }
|
||||
export type Deps = OidbSender;
|
||||
|
||||
// reqType and flag are constants the NT encoder always sends (1 and 1).
|
||||
export const serialize = (_ctx: Deps, p: Params): OidbGroupRecommendArkReq => ({
|
||||
reqType: 1,
|
||||
groupCode: p.groupId,
|
||||
flag: 1,
|
||||
});
|
||||
|
||||
export const deserialize = (_ctx: Deps, body: OidbGroupRecommendArkResp): string => body.arkJson ?? '';
|
||||
|
||||
export const encode = (env: OidbBase<OidbGroupRecommendArkReq>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<OidbGroupRecommendArkReq>>(env);
|
||||
|
||||
export const decode = (bytes: Uint8Array): OidbBase<OidbGroupRecommendArkResp> =>
|
||||
protobuf_decode<OidbBase<OidbGroupRecommendArkResp>>(bytes);
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<string> =>
|
||||
invokeOidb(deps, GetGroupRecommendArk, params);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// 0xd69_0 — approvalDoubtBuddyReq: approve a doubtful friend-add request
|
||||
// (可能认识的人). RE'd from QQNT doubt_codec.cc EncodeRequest sub_3F3EC90:
|
||||
// {1:uid, 2:uid, [3:u32], [4:str]} — tags 3/4 emitted only when present, and
|
||||
// NapCat passes empty str1/str2, so the approve flow is just {1:uid, 2:uid}.
|
||||
// Same OIDB cmd as the getter; the server discriminates by body shape.
|
||||
// uin-form OIDB (envelope reserved=1). NapCat only supports approve (no
|
||||
// reject — rejection would be a separate delDoubtBuddyReq cmd, not RE'd here).
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase, OidbEmpty } from '@snowluma/proto-defs/oidb';
|
||||
import type { OidbDoubtApprovalReq } from '@snowluma/proto-defs/oidb-actions/doubt-buddy';
|
||||
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
||||
|
||||
export namespace ApproveDoubtBuddyReq {
|
||||
export const command = 0xD69;
|
||||
export const subCommand = 0;
|
||||
export const uinForm = true;
|
||||
|
||||
export interface Params { uid: string }
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const serialize = (_ctx: Deps, p: Params): OidbDoubtApprovalReq => ({
|
||||
uid: p.uid,
|
||||
targetUid: p.uid,
|
||||
});
|
||||
|
||||
export const deserialize = (_ctx: Deps, _: OidbEmpty): void => {};
|
||||
|
||||
export const encode = (env: OidbBase<OidbDoubtApprovalReq>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<OidbDoubtApprovalReq>>(env);
|
||||
|
||||
export const decode = (bytes: Uint8Array): OidbBase<OidbEmpty> =>
|
||||
protobuf_decode<OidbBase<OidbEmpty>>(bytes);
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<void> =>
|
||||
invokeOidb(deps, ApproveDoubtBuddyReq, params);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// 0xd69_0 — getDoubtBuddyReq: list the "doubtful" friend-add requests
|
||||
// (可能认识的人 / 被过滤的好友申请). RE'd from QQNT doubt_codec.cc.
|
||||
// Request {1:1, 2:{1:num, 2:uk}} (reqId is NOT on the wire). Response body
|
||||
// holds a repeated item list; we surface the fields NapCat exposes.
|
||||
// READ-only: the string field names (nick/source/msg) are MEDIUM confidence
|
||||
// (generic serializer), so a mislabel is cosmetic, never a wire/ban risk.
|
||||
// uid (tag1) and reqTime (tag9) are HIGH confidence.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type {
|
||||
OidbDoubtGetReq, OidbDoubtGetResp,
|
||||
} from '@snowluma/proto-defs/oidb-actions/doubt-buddy';
|
||||
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
||||
|
||||
export interface DoubtBuddyRequest {
|
||||
[key: string]: import('@snowluma/common/json').JsonValue;
|
||||
/** Opaque uid — pass back as `flag` to set_doubt_friends_add_request. */
|
||||
uid: string;
|
||||
nick: string;
|
||||
source: string;
|
||||
msg: string;
|
||||
reqTime: number;
|
||||
}
|
||||
|
||||
export namespace GetDoubtBuddyReq {
|
||||
export const command = 0xD69;
|
||||
export const subCommand = 0;
|
||||
export const uinForm = true;
|
||||
|
||||
export interface Params { count: number; cookie?: string }
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const serialize = (_ctx: Deps, p: Params): OidbDoubtGetReq => ({
|
||||
field1: 1,
|
||||
inner: { num: p.count, uk: p.cookie ?? '' },
|
||||
});
|
||||
|
||||
export const deserialize = (_ctx: Deps, body: OidbDoubtGetResp): DoubtBuddyRequest[] =>
|
||||
(body.body?.list ?? []).map((it) => ({
|
||||
uid: it.uid ?? '',
|
||||
nick: it.nick ?? '',
|
||||
source: it.source ?? '',
|
||||
msg: it.msg ?? '',
|
||||
reqTime: Number(it.reqTime ?? 0),
|
||||
}));
|
||||
|
||||
export const encode = (env: OidbBase<OidbDoubtGetReq>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<OidbDoubtGetReq>>(env);
|
||||
|
||||
export const decode = (bytes: Uint8Array): OidbBase<OidbDoubtGetResp> =>
|
||||
protobuf_decode<OidbBase<OidbDoubtGetResp>>(bytes);
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<DoubtBuddyRequest[]> =>
|
||||
invokeOidb(deps, GetDoubtBuddyReq, params);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// 0xf00_3 — modifyGroupExtInfoV2, used for set_group_robot_add_option.
|
||||
// RE'd from QQNT group_ext_list_modify_codec.cc:
|
||||
// ModifyGroupExtInfoReq{ 1:groupCode, 2:GroupExtInfo{ 1:groupCode,
|
||||
// 2:EXTInfo{ 30:inviteRobotMemberSwitch, 31:inviteRobotMemberExamine } } }
|
||||
// The NT GroupExtFilter (2nd kernel arg) is client-side only — it just gates
|
||||
// which EXTInfo fields the encoder emits — so we mirror that by only setting
|
||||
// the fields the caller provides. uin-form OIDB (envelope reserved=1).
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type {
|
||||
OidbModifyGroupExtReq, OidbModifyGroupExtResp, OidbGroupExtBody,
|
||||
} from '@snowluma/proto-defs/oidb-actions/group-ext';
|
||||
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
||||
|
||||
export namespace ModifyGroupExtInfo {
|
||||
export const command = 0xF00;
|
||||
export const subCommand = 3;
|
||||
export const uinForm = true;
|
||||
|
||||
export interface Params {
|
||||
groupId: number;
|
||||
/** undefined → leave unchanged (field not emitted). */
|
||||
robotMemberSwitch?: number;
|
||||
robotMemberExamine?: number;
|
||||
}
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const serialize = (_ctx: Deps, p: Params): OidbModifyGroupExtReq => {
|
||||
const ext: OidbGroupExtBody = {};
|
||||
if (p.robotMemberSwitch !== undefined) ext.inviteRobotMemberSwitch = p.robotMemberSwitch;
|
||||
if (p.robotMemberExamine !== undefined) ext.inviteRobotMemberExamine = p.robotMemberExamine;
|
||||
return {
|
||||
groupCode: p.groupId,
|
||||
info: { groupCode: p.groupId, ext },
|
||||
};
|
||||
};
|
||||
|
||||
export const deserialize = (_ctx: Deps, body: OidbModifyGroupExtResp): void => {
|
||||
// Envelope-level OIDB errors are already thrown by invokeOidb; this is the
|
||||
// body-level ack. 0 (or absent) = success.
|
||||
if (body.result && body.result !== 0) {
|
||||
throw new Error(`modifyGroupExtInfo failed: result=${body.result}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const encode = (env: OidbBase<OidbModifyGroupExtReq>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<OidbModifyGroupExtReq>>(env);
|
||||
|
||||
export const decode = (bytes: Uint8Array): OidbBase<OidbModifyGroupExtResp> =>
|
||||
protobuf_decode<OidbBase<OidbModifyGroupExtResp>>(bytes);
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<void> =>
|
||||
invokeOidb(deps, ModifyGroupExtInfo, params);
|
||||
}
|
||||
Reference in new issue
Block a user