Use protobuf_encode for OIDB envelopes

Replace the encodeOidbEnv wrapper with direct protobuf_encode<OidbBase<T>> calls across bridge modules. Updated many bridge action files (extras, friend, group-admin, group-file, group-message, interaction, misc, profile, bridge-contacts, highway pipeline, etc.) to import protobuf_encode and OidbBase and to pass encoded OIDB envelopes via protobuf_encode. Removed the encodeOidbEnv implementation from bridge-oidb and restructured proton OIDB definitions by adding new proto/proton/oidb-actions modules (base, group-album, group-file, media, index) and adjusting proton proto usage. This centralizes envelope encoding for better monomorphization and simplifies the OIDB encoding flow.
This commit is contained in:
手瓜一十雪 committed 2026-05-20 18:03:57 +08:00
1 parent ca0a888003
commit bf4c130641
19 files changed
+367 -1760

No files matched your search

+12 -10
View File
@@ -3,8 +3,10 @@
// schemas live in proto/oidb-action.ts. Nothing in this file touches
// the NTQQ NodeIKernel — every wire trip is one runOidb round-trip.
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
import type { Bridge } from '../bridge';
import { runOidb, makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from '../bridge-oidb';
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
import { OidbBase } from '../proto/proton/oidb';
import type {
OidbAiVoiceListReq,
OidbAiVoiceListResp,
@@ -20,17 +22,17 @@ import type { MediaIndexNode } from './shared';
export async function setGroupTodo(bridge: Bridge, groupId: number, msgSeq: bigint): Promise<void> {
const env = makeOidbEnvelope<OidbGroupTodo>(0xF90, 1, { groupUin: groupId, msgSeq });
await runOidb(bridge, 'OidbSvcTrpcTcp.0xf90_1', encodeOidbEnv<OidbGroupTodo>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0xf90_1', protobuf_encode<OidbBase<OidbGroupTodo>>(env));
}
export async function completeGroupTodo(bridge: Bridge, groupId: number, msgSeq: bigint): Promise<void> {
const env = makeOidbEnvelope<OidbGroupTodo>(0xF90, 2, { groupUin: groupId, msgSeq });
await runOidb(bridge, 'OidbSvcTrpcTcp.0xf90_2', encodeOidbEnv<OidbGroupTodo>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0xf90_2', protobuf_encode<OidbBase<OidbGroupTodo>>(env));
}
export async function cancelGroupTodo(bridge: Bridge, groupId: number, msgSeq: bigint): Promise<void> {
const env = makeOidbEnvelope<OidbGroupTodo>(0xF90, 3, { groupUin: groupId, msgSeq });
await runOidb(bridge, 'OidbSvcTrpcTcp.0xf90_3', encodeOidbEnv<OidbGroupTodo>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0xf90_3', protobuf_encode<OidbBase<OidbGroupTodo>>(env));
}
// ─────────────── Stranger online/ext status (0xFE1_2) ───────────────
@@ -58,8 +60,8 @@ export async function getStrangerStatus(bridge: Bridge, uin: number): Promise<St
// QQ NT rejects with `[oidb] one of uid/openid is invaild`.
true,
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xfe1_2', encodeOidbEnv<OidbStrangerStatusReq>(env));
const resp = decodeOidbEnv<OidbStrangerStatusResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xfe1_2', protobuf_encode<OidbBase<OidbStrangerStatusReq>>(env));
const resp = protobuf_decode<OidbBase<OidbStrangerStatusResp>>(respBytes).body;
const raw = resp?.data?.status?.value;
if (raw === undefined || raw === null) return null;
const extBig = typeof raw === 'bigint' ? raw : BigInt(raw);
@@ -99,8 +101,8 @@ export async function fetchAiVoiceList(
chatType: AiVoiceChatType,
): Promise<AiVoiceCategory[]> {
const env = makeOidbEnvelope<OidbAiVoiceListReq>(0x929D, 0, { groupUin: groupId, chatType });
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x929d_0', encodeOidbEnv<OidbAiVoiceListReq>(env));
const resp = decodeOidbEnv<OidbAiVoiceListResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x929d_0', protobuf_encode<OidbBase<OidbAiVoiceListReq>>(env));
const resp = protobuf_decode<OidbBase<OidbAiVoiceListResp>>(respBytes).body;
return (resp?.content as AiVoiceCategory[] | undefined) ?? [];
}
@@ -128,8 +130,8 @@ export async function fetchAiVoice(
0x929B, 0,
{ groupUin: groupId, voiceId, text, chatType, session: { sessionId } },
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x929b_0', encodeOidbEnv<OidbAiVoiceReq>(env));
const resp = decodeOidbEnv<OidbAiVoiceResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x929b_0', protobuf_encode<OidbBase<OidbAiVoiceReq>>(env));
const resp = protobuf_decode<OidbBase<OidbAiVoiceResp>>(respBytes).body;
const node = resp?.msgInfo?.msgInfoBody?.[0]?.index as MediaIndexNode | undefined;
if (node) return node;
}
+6 -4
View File
@@ -2,13 +2,15 @@
// local remark label. Each one resolves a UID first because the OIDB
// protocol uses opaque UIDs rather than QQ uin numbers.
import { protobuf_encode } from '@snowluma/proton';
import type { Bridge } from '../bridge';
import { runOidb, makeOidbEnvelope, encodeOidbEnv } from '../bridge-oidb';
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
import type {
OidbDeleteFriend,
OidbFriendRequestAction,
OidbSetFriendRemark,
} from '../proto/proton/oidb-action';
import { OidbBase } from '../proto/proton/oidb';
export async function setFriendAddRequest(bridge: Bridge, uidOrFlag: string, approve: boolean): Promise<void> {
let targetUid = uidOrFlag;
@@ -16,7 +18,7 @@ export async function setFriendAddRequest(bridge: Bridge, uidOrFlag: string, app
targetUid = await bridge.resolveUserUid(parseInt(uidOrFlag, 10));
}
const env = makeOidbEnvelope<OidbFriendRequestAction>(0xB5D, 44, { accept: approve ? 3 : 5, targetUid });
await runOidb(bridge, 'OidbSvcTrpcTcp.0xb5d_44', encodeOidbEnv<OidbFriendRequestAction>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0xb5d_44', protobuf_encode<OidbBase<OidbFriendRequestAction>>(env));
}
export async function deleteFriend(bridge: Bridge, userId: number, block = false): Promise<void> {
@@ -37,7 +39,7 @@ export async function deleteFriend(bridge: Bridge, userId: number, block = false
field4: false,
},
});
await runOidb(bridge, 'OidbSvcTrpcTcp.0x126b_0', encodeOidbEnv<OidbDeleteFriend>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x126b_0', protobuf_encode<OidbBase<OidbDeleteFriend>>(env));
// Refresh friend cache after deletion so subsequent reads don't
// surface a ghost entry. Best-effort: a transient OIDB hiccup here
@@ -48,5 +50,5 @@ export async function deleteFriend(bridge: Bridge, userId: number, block = false
export async function setFriendRemark(bridge: Bridge, userId: number, remark: string): Promise<void> {
const uid = await bridge.resolveUserUid(userId);
const env = makeOidbEnvelope<OidbSetFriendRemark>(0xB6E, 2, { targetUid: uid, remark });
await runOidb(bridge, 'OidbSvcTrpcTcp.0xb6e_2', encodeOidbEnv<OidbSetFriendRemark>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0xb6e_2', protobuf_encode<OidbBase<OidbSetFriendRemark>>(env));
}
+18 -16
View File
@@ -3,8 +3,10 @@
// names match the OneBot action names (set_group_kick, set_group_ban, ...)
// so callers can grep across the two layers.
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
import type { Bridge } from '../bridge';
import { runOidb, makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from '../bridge-oidb';
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
import { OidbBase } from '../proto/proton/oidb';
import type {
Oidb0x89a_0AddOption,
Oidb0x89a_0Search,
@@ -30,14 +32,14 @@ export async function muteGroupMember(bridge: Bridge, groupId: number, userId: n
const env = makeOidbEnvelope<OidbMuteMember>(0x1253, 1, {
groupUin: groupId, type: 1, body: { targetUid: uid, duration },
});
await runOidb(bridge, 'OidbSvcTrpcTcp.0x1253_1', encodeOidbEnv<OidbMuteMember>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x1253_1', protobuf_encode<OidbBase<OidbMuteMember>>(env));
}
export async function muteGroupAll(bridge: Bridge, groupId: number, enable: boolean): Promise<void> {
const env = makeOidbEnvelope<OidbMuteAll>(0x89A, 0, {
groupUin: groupId, muteState: { state: enable ? 0xFFFFFFFF : 0 },
});
await runOidb(bridge, 'OidbSvcTrpcTcp.0x89a_0', encodeOidbEnv<OidbMuteAll>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x89a_0', protobuf_encode<OidbBase<OidbMuteAll>>(env));
}
// ─────────────── join-policy ───────────────
@@ -46,14 +48,14 @@ export async function setGroupAddOption(bridge: Bridge, groupId: number, addType
const env = makeOidbEnvelope<Oidb0x89a_0AddOption>(0x89A, 0, {
groupUin: BigInt(groupId), settings: { addType }, field12: 0,
});
await runOidb(bridge, 'OidbSvcTrpcTcp.0x89a_0', encodeOidbEnv<Oidb0x89a_0AddOption>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x89a_0', protobuf_encode<OidbBase<Oidb0x89a_0AddOption>>(env));
}
export async function setGroupSearch(bridge: Bridge, groupId: number): Promise<void> {
const env = makeOidbEnvelope<Oidb0x89a_0Search>(0x89A, 0, {
groupUin: BigInt(groupId), settings: new Uint8Array(0), field12: 0,
});
await runOidb(bridge, 'OidbSvcTrpcTcp.0x89a_0', encodeOidbEnv<Oidb0x89a_0Search>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x89a_0', protobuf_encode<OidbBase<Oidb0x89a_0Search>>(env));
}
export async function setGroupAddRequest(
@@ -67,7 +69,7 @@ export async function setGroupAddRequest(
{ accept: approve ? 1 : 2, body: { sequence: BigInt(sequence), eventType, groupUin: groupId, message: reason } },
true,
);
await runOidb(bridge, cmd, encodeOidbEnv<OidbGroupRequestAction>(env));
await runOidb(bridge, cmd, protobuf_encode<OidbBase<OidbGroupRequestAction>>(env));
}
// ─────────────── kick / leave ───────────────
@@ -77,7 +79,7 @@ export async function kickGroupMember(bridge: Bridge, groupId: number, userId: n
const env = makeOidbEnvelope<OidbKickMember>(0x8A0, 1, {
groupUin: groupId, targetUid: uid, rejectAddRequest: reject, reason,
});
await runOidb(bridge, 'OidbSvcTrpcTcp.0x8a0_1', encodeOidbEnv<OidbKickMember>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x8a0_1', protobuf_encode<OidbBase<OidbKickMember>>(env));
}
export async function kickGroupMembers(bridge: Bridge, groupId: number, userIds: number[], reject: boolean): Promise<void> {
@@ -85,12 +87,12 @@ export async function kickGroupMembers(bridge: Bridge, groupId: number, userIds:
const env = makeOidbEnvelope<Oidb0x8a0Req>(0x8A0, 1, {
groupId: BigInt(groupId), targetUids, rejectAddRequest: reject ? 1 : 0, kickReason: new Uint8Array(0), field12: 0,
});
await runOidb(bridge, 'OidbSvcTrpcTcp.0x8a0_1', encodeOidbEnv<Oidb0x8a0Req>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x8a0_1', protobuf_encode<OidbBase<Oidb0x8a0Req>>(env));
}
export async function leaveGroup(bridge: Bridge, groupId: number): Promise<void> {
const env = makeOidbEnvelope<OidbLeaveGroup>(0x1097, 1, { groupUin: groupId });
await runOidb(bridge, 'OidbSvcTrpcTcp.0x1097_1', encodeOidbEnv<OidbLeaveGroup>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x1097_1', protobuf_encode<OidbBase<OidbLeaveGroup>>(env));
}
// ─────────────── role / display name ───────────────
@@ -98,7 +100,7 @@ export async function leaveGroup(bridge: Bridge, groupId: number): Promise<void>
export async function setGroupAdmin(bridge: Bridge, groupId: number, userId: number, enable: boolean): Promise<void> {
const uid = await bridge.resolveUserUid(userId, groupId);
const env = makeOidbEnvelope<OidbSetAdmin>(0x1096, 1, { groupUin: groupId, uid, isAdmin: enable });
await runOidb(bridge, 'OidbSvcTrpcTcp.0x1096_1', encodeOidbEnv<OidbSetAdmin>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x1096_1', protobuf_encode<OidbBase<OidbSetAdmin>>(env));
}
export async function setGroupCard(bridge: Bridge, groupId: number, userId: number, card: string): Promise<void> {
@@ -106,12 +108,12 @@ export async function setGroupCard(bridge: Bridge, groupId: number, userId: numb
const env = makeOidbEnvelope<OidbRenameMember>(0x8FC, 3, {
groupUin: groupId, body: { targetUid: uid, targetName: card },
});
await runOidb(bridge, 'OidbSvcTrpcTcp.0x8fc_3', encodeOidbEnv<OidbRenameMember>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x8fc_3', protobuf_encode<OidbBase<OidbRenameMember>>(env));
}
export async function setGroupName(bridge: Bridge, groupId: number, name: string): Promise<void> {
const env = makeOidbEnvelope<OidbRenameGroup>(0x89A, 15, { groupUin: groupId, body: { targetName: name } });
await runOidb(bridge, 'OidbSvcTrpcTcp.0x89a_15', encodeOidbEnv<OidbRenameGroup>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x89a_15', protobuf_encode<OidbBase<OidbRenameGroup>>(env));
}
export async function setGroupSpecialTitle(bridge: Bridge, groupId: number, userId: number, title: string): Promise<void> {
@@ -119,7 +121,7 @@ export async function setGroupSpecialTitle(bridge: Bridge, groupId: number, user
const env = makeOidbEnvelope<OidbSpecialTitle>(0x8FC, 2, {
groupUin: groupId, body: { targetUid: uid, specialTitle: title, expireTime: -1 },
});
await runOidb(bridge, 'OidbSvcTrpcTcp.0x8fc_2', encodeOidbEnv<OidbSpecialTitle>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x8fc_2', protobuf_encode<OidbBase<OidbSpecialTitle>>(env));
}
// ─────────────── personal-side metadata ───────────────
@@ -129,7 +131,7 @@ export async function setGroupSpecialTitle(bridge: Bridge, groupId: number, user
// group" rather than "operate on a contact list".
export async function setGroupRemark(bridge: Bridge, groupId: number, remark: string): Promise<void> {
const env = makeOidbEnvelope<Oidb0xf16Req>(0xF16, 1, { inner: { groupId: BigInt(groupId), remark }, field12: 0 });
await runOidb(bridge, 'OidbSvcTrpcTcp.0xf16_1', encodeOidbEnv<Oidb0xf16Req>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0xf16_1', protobuf_encode<OidbBase<Oidb0xf16Req>>(env));
}
// ─────────────── group-level quota query ───────────────
@@ -148,8 +150,8 @@ export async function getGroupAtAllRemain(
};
const env = makeOidbEnvelope<Oidb0x8a7Req>(0x8A7, 0, req);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x8a7_0', encodeOidbEnv<Oidb0x8a7Req>(env));
const result = decodeOidbEnv<Oidb0x8a7Resp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x8a7_0', protobuf_encode<OidbBase<Oidb0x8a7Req>>(env));
const result = protobuf_decode<OidbBase<Oidb0x8a7Resp>>(respBytes).body;
if (!result) {
throw new Error('get group at all remain result empty');
+28 -27
View File
@@ -6,8 +6,8 @@
// stay as separate functions.
import type { Bridge } from '../bridge';
import { protobuf_encode } from '@snowluma/proton';
import { runOidb, makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from '../bridge-oidb';
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
import { fetchHighwaySession, uploadHighwayHttp } from '../highway/highway-client';
import { computeHashes, computeMd5, FILE_UPLOAD_MAX_BYTES, loadBinarySource } from '../highway/utils';
import type {
@@ -31,6 +31,7 @@ import type { FileUploadExt } from '../proto/proton/highway';
import { toHexUpper } from '../../utils/hex';
import { createLogger } from '../../utils/logger';
import { ensureRetCodeZero, resolveSelfUid, toInt, type MediaIndexNode } from './shared';
import { OidbBase } from '../proto/proton/oidb';
const log = createLogger('GroupFile');
@@ -260,8 +261,8 @@ async function fetchNtv2DownloadUrl(
payload: Record<string, unknown>,
): Promise<string> {
const env = makeOidbEnvelope<NTV2RichMediaReq>(oidbCmd, 200, payload as any, true);
const respBytes = await runOidb(bridge, serviceCmd, encodeOidbEnv<NTV2RichMediaReq>(env));
const resp = decodeOidbEnv<NTV2RichMediaResp>(respBytes).body;
const respBytes = await runOidb(bridge, serviceCmd, protobuf_encode<OidbBase<NTV2RichMediaReq>>(env));
const resp = protobuf_decode<OidbBase<NTV2RichMediaResp>>(respBytes).body;
ensureRetCodeZero('ntv2 download', resp?.respHead?.retCode, resp?.respHead?.message, undefined);
const domain = typeof resp?.download?.info?.domain === 'string' ? resp.download.info.domain : '';
@@ -313,7 +314,7 @@ export async function sendGroupFileMessage(bridge: Bridge, groupId: number, file
});
// The envelope-level errorCode peek inside `runOidb` covers the
// happy-path validation; failures surface as a thrown OIDB error.
await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d9_4', encodeOidbEnv<OidbGroupSendFileReq>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d9_4', protobuf_encode<OidbBase<OidbGroupSendFileReq>>(env));
}
// ─────────────── file count ───────────────
@@ -323,8 +324,8 @@ export async function fetchGroupFileCount(bridge: Bridge, groupId: number): Prom
0x6D8, 3,
{ count: { groupUin: groupId, appId: 7, busId: 0 } },
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d8_3', encodeOidbEnv<OidbGroupFileCountViewReq>(env));
const resp = decodeOidbEnv<OidbGroupFileCountViewResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d8_3', protobuf_encode<OidbBase<OidbGroupFileCountViewReq>>(env));
const resp = protobuf_decode<OidbBase<OidbGroupFileCountViewResp>>(respBytes).body;
return {
fileCount: toInt(resp?.count?.fileCount ?? 0),
maxCount: toInt(resp?.count?.maxCount ?? 10000),
@@ -369,8 +370,8 @@ export async function uploadGroupFile(
},
true,
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d6_0', encodeOidbEnv<OidbGroupFileReq>(env));
const resp = decodeOidbEnv<OidbGroupFileResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d6_0', protobuf_encode<OidbBase<OidbGroupFileReq>>(env));
const resp = protobuf_decode<OidbBase<OidbGroupFileResp>>(respBytes).body;
const upload = resp?.upload;
if (!upload) throw new Error('group file upload response missing');
@@ -499,8 +500,8 @@ export async function uploadPrivateFile(
clientType: 1,
flagSupportMediaPlatform: 1,
});
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xe37_1700', encodeOidbEnv<OidbPrivateFileUploadReq>(env));
const resp = decodeOidbEnv<OidbPrivateFileUploadResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xe37_1700', protobuf_encode<OidbBase<OidbPrivateFileUploadReq>>(env));
const resp = protobuf_decode<OidbBase<OidbPrivateFileUploadResp>>(respBytes).body;
const upload = resp?.upload;
if (!upload) throw new Error('private file upload response missing');
@@ -663,8 +664,8 @@ export async function fetchGroupFiles(bridge: Bridge, groupId: number, folderId
},
true,
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d8_1', encodeOidbEnv<OidbGroupFileViewReq>(env));
const resp = decodeOidbEnv<OidbGroupFileViewResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d8_1', protobuf_encode<OidbBase<OidbGroupFileViewReq>>(env));
const resp = protobuf_decode<OidbBase<OidbGroupFileViewResp>>(respBytes).body;
const list = resp?.list;
if (!list) break;
@@ -731,8 +732,8 @@ export async function fetchGroupFileUrl(bridge: Bridge, groupId: number, fileId:
},
true,
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d6_2', encodeOidbEnv<OidbGroupFileReq>(env));
const resp = decodeOidbEnv<OidbGroupFileResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d6_2', protobuf_encode<OidbBase<OidbGroupFileReq>>(env));
const resp = protobuf_decode<OidbBase<OidbGroupFileResp>>(respBytes).body;
const download = resp?.download;
if (!download) throw new Error('group file url response missing');
@@ -773,8 +774,8 @@ export async function fetchPrivateFileUrl(bridge: Bridge, userId: number, fileId
field200: 1,
field99999: new Uint8Array([0xC0, 0x85, 0x2C, 0x01]),
});
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xe37_1200', encodeOidbEnv<OidbPrivateFileDownloadReq>(env), 5000);
const resp = decodeOidbEnv<OidbPrivateFileDownloadResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xe37_1200', protobuf_encode<OidbBase<OidbPrivateFileDownloadReq>>(env), 5000);
const resp = protobuf_decode<OidbBase<OidbPrivateFileDownloadResp>>(respBytes).body;
const result = resp?.body?.result;
const server = typeof result?.server === 'string' ? result.server : '';
@@ -800,8 +801,8 @@ export async function deleteGroupFile(bridge: Bridge, groupId: number, fileId: s
},
true,
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d6_3', encodeOidbEnv<OidbGroupFileReq>(env));
const resp = decodeOidbEnv<OidbGroupFileResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d6_3', protobuf_encode<OidbBase<OidbGroupFileReq>>(env));
const resp = protobuf_decode<OidbBase<OidbGroupFileResp>>(respBytes).body;
const result = resp?.delete;
if (!result) throw new Error('group file delete response missing');
@@ -829,8 +830,8 @@ export async function moveGroupFile(
},
true,
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d6_5', encodeOidbEnv<OidbGroupFileReq>(env));
const resp = decodeOidbEnv<OidbGroupFileResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d6_5', protobuf_encode<OidbBase<OidbGroupFileReq>>(env));
const resp = protobuf_decode<OidbBase<OidbGroupFileResp>>(respBytes).body;
const result = resp?.move;
if (!result) throw new Error('group file move response missing');
@@ -851,8 +852,8 @@ export async function createGroupFileFolder(bridge: Bridge, groupId: number, nam
},
true,
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d7_0', encodeOidbEnv<OidbGroupFileFolderReq>(env));
const resp = decodeOidbEnv<OidbGroupFileFolderResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d7_0', protobuf_encode<OidbBase<OidbGroupFileFolderReq>>(env));
const resp = protobuf_decode<OidbBase<OidbGroupFileFolderResp>>(respBytes).body;
const result = resp?.create;
if (!result) throw new Error('group folder create response missing');
@@ -870,8 +871,8 @@ export async function deleteGroupFileFolder(bridge: Bridge, groupId: number, fol
},
true,
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d7_1', encodeOidbEnv<OidbGroupFileFolderReq>(env));
const resp = decodeOidbEnv<OidbGroupFileFolderResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d7_1', protobuf_encode<OidbBase<OidbGroupFileFolderReq>>(env));
const resp = protobuf_decode<OidbBase<OidbGroupFileFolderResp>>(respBytes).body;
const result = resp?.delete;
if (!result) throw new Error('group folder delete response missing');
@@ -890,8 +891,8 @@ export async function renameGroupFileFolder(bridge: Bridge, groupId: number, fol
},
true,
);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d7_2', encodeOidbEnv<OidbGroupFileFolderReq>(env));
const resp = decodeOidbEnv<OidbGroupFileFolderResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x6d7_2', protobuf_encode<OidbBase<OidbGroupFileFolderReq>>(env));
const resp = protobuf_decode<OidbBase<OidbGroupFileFolderResp>>(respBytes).body;
const result = resp?.rename;
if (!result) throw new Error('group folder rename response missing');
@@ -5,13 +5,15 @@
import type { Bridge } from '../bridge';
import { protoEncode } from '../../protobuf/decode';
import { runOidb, makeOidbEnvelope, encodeOidbEnv } from '../bridge-oidb';
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
import {
C2CRecallRequestSchema,
GroupRecallRequestSchema,
SsoReadedReportReqSchema,
} from '../proto/oidb-action';
import type { OidbEssence } from '../proto/proton/oidb-action';
import { protobuf_encode } from '@snowluma/proton';
import { OidbBase } from '../proto/proton/oidb';
export async function recallGroupMessage(bridge: Bridge, groupId: number, sequence: number): Promise<void> {
const request = protoEncode({
@@ -97,5 +99,5 @@ export async function setGroupEssence(bridge: Bridge, groupId: number, sequence:
const subCmd = enable ? 1 : 2;
const cmd = enable ? 'OidbSvcTrpcTcp.0xeac_1' : 'OidbSvcTrpcTcp.0xeac_2';
const env = makeOidbEnvelope<OidbEssence>(0xEAC, subCmd, { groupUin: groupId, sequence, random });
await runOidb(bridge, cmd, encodeOidbEnv<OidbEssence>(env));
await runOidb(bridge, cmd, protobuf_encode<OidbBase<OidbEssence>>(env));
}
@@ -2,8 +2,9 @@
// and the related read-side "who reacted with X" query. None of these
// edit message content — they're purely social signals.
import { protobuf_encode } from '@snowluma/proton';
import type { Bridge } from '../bridge';
import { runOidb, makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from '../bridge-oidb';
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
import type {
Oidb0x9083Req,
Oidb0x9083Resp,
@@ -11,6 +12,7 @@ import type {
OidbLike,
OidbPoke,
} from '../proto/proton/oidb-action';
import { OidbBase } from '../proto/proton/oidb';
export async function sendPoke(bridge: Bridge, isGroup: boolean, peerUin: number, targetUin?: number): Promise<void> {
const env = makeOidbEnvelope<OidbPoke>(0xED3, 1, {
@@ -19,12 +21,12 @@ export async function sendPoke(bridge: Bridge, isGroup: boolean, peerUin: number
friendUin: isGroup ? 0 : peerUin,
ext: 0,
});
await runOidb(bridge, 'OidbSvcTrpcTcp.0xed3_1', encodeOidbEnv<OidbPoke>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0xed3_1', protobuf_encode<OidbBase<OidbPoke>>(env));
}
export async function sendLike(bridge: Bridge, userId: number, count: number): Promise<void> {
const env = makeOidbEnvelope<OidbLike>(0x7E5, 104, { targetUin: userId, count });
await runOidb(bridge, 'OidbSvcTrpcTcp.0x7e5_104', encodeOidbEnv<OidbLike>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x7e5_104', protobuf_encode<OidbBase<OidbLike>>(env));
}
export async function setGroupReaction(bridge: Bridge, groupId: number, sequence: number, code: string, isSet: boolean): Promise<void> {
@@ -36,7 +38,7 @@ export async function setGroupReaction(bridge: Bridge, groupId: number, sequence
// unicode reactions silently fail.
const type = code.length > 3 ? 2 : 1;
const env = makeOidbEnvelope<OidbGroupReaction>(0x9082, subCmd, { groupUin: groupId, sequence, code, type });
await runOidb(bridge, cmd, encodeOidbEnv<OidbGroupReaction>(env));
await runOidb(bridge, cmd, protobuf_encode<OidbBase<OidbGroupReaction>>(env));
}
export async function getEmojiLikes(
@@ -59,8 +61,8 @@ export async function getEmojiLikes(
field12: 1,
};
const env = makeOidbEnvelope<Oidb0x9083Req>(0x9083, 1, req);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x9083_1', encodeOidbEnv<Oidb0x9083Req>(env));
const resp = decodeOidbEnv<Oidb0x9083Resp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x9083_1', protobuf_encode<OidbBase<Oidb0x9083Req>>(env));
const resp = protobuf_decode<OidbBase<Oidb0x9083Resp>>(respBytes).body;
const uin = resp?.inner?.userInfo?.uin;
const users = uin ? [{ uin: Number(uin) }] : [];
const respCookie = resp?.cookie ? Buffer.from(resp.cookie).toString('base64') : '';
+9 -7
View File
@@ -4,7 +4,7 @@
import type { Bridge } from '../bridge';
import { protoDecode, protoEncode } from '../../protobuf/decode';
import { runOidb, makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from '../bridge-oidb';
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
import {
MiniAppShareReqSchema,
MiniAppShareRespSchema,
@@ -17,6 +17,8 @@ import type {
Oidb0xeb7Req,
Oidb0xeb7Resp,
} from '../proto/proton/oidb-action';
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
import { OidbBase } from '../proto/proton/oidb';
export async function translateEn2Zh(
bridge: Bridge,
@@ -33,8 +35,8 @@ export async function translateEn2Zh(
};
const env = makeOidbEnvelope<Oidb0x990Req>(0x990, 2, req);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x990_2', encodeOidbEnv<Oidb0x990Req>(env));
const result = decodeOidbEnv<Oidb0x990Resp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x990_2', protobuf_encode<OidbBase<Oidb0x990Req>>(env));
const result = protobuf_decode<OidbBase<Oidb0x990Resp>>(respBytes).body;
const resp = result?.translateResp;
if (!resp) {
@@ -122,8 +124,8 @@ export async function clickInlineKeyboardButton(
};
const env = makeOidbEnvelope<Oidb0x112eReq>(0x112E, 1, req);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x112e_1', encodeOidbEnv<Oidb0x112eReq>(env));
const result = decodeOidbEnv<Oidb0x112eResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x112e_1', protobuf_encode<OidbBase<Oidb0x112eReq>>(env));
const result = protobuf_decode<OidbBase<Oidb0x112eResp>>(respBytes).body;
if (!result) {
throw new Error('click inline keyboard button result empty');
@@ -152,7 +154,7 @@ export async function sendGroupSign(
};
const env = makeOidbEnvelope<Oidb0xeb7Req>(0xEB7, 1, req);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xEB7_1', encodeOidbEnv<Oidb0xeb7Req>(env));
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xEB7_1', protobuf_encode<OidbBase<Oidb0xeb7Req>>(env));
// Decode just to maintain the original behaviour of "consume the response".
decodeOidbEnv<Oidb0xeb7Resp>(respBytes);
protobuf_decode<OidbBase<Oidb0xeb7Resp>>(respBytes);
}
+12 -10
View File
@@ -4,7 +4,7 @@
import type { Bridge } from '../bridge';
import { protoDecode, protoEncode } from '../../protobuf/decode';
import { runOidb, makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from '../bridge-oidb';
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
import { fetchHighwaySession, uploadHighwayHttp } from '../highway/highway-client';
import { computeHashes, loadBinarySource } from '../highway/utils';
import {
@@ -26,6 +26,8 @@ import type {
OidbSetProfile,
} from '../proto/proton/oidb-action';
import { resolveSelfUid } from './shared';
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
import { OidbBase } from '../proto/proton/oidb';
// ─────────────── status / profile setters ───────────────
@@ -113,7 +115,7 @@ export async function setProfile(
};
const env = makeOidbEnvelope<OidbSetProfile>(0x112A, 2, req);
await runOidb(bridge, 'OidbSvcTrpcTcp.0x112a_2', encodeOidbEnv<OidbSetProfile>(env));
await runOidb(bridge, 'OidbSvcTrpcTcp.0x112a_2', protobuf_encode<OidbBase<OidbSetProfile>>(env));
}
export async function setSelfLongNick(
@@ -129,9 +131,9 @@ export async function setSelfLongNick(
};
const env = makeOidbEnvelope<Oidb0x112aReq>(0x112A, 2, req);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x112a_2', encodeOidbEnv<Oidb0x112aReq>(env));
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x112a_2', protobuf_encode<OidbBase<Oidb0x112aReq>>(env));
// Decode just to maintain the original behaviour of "consume the response".
decodeOidbEnv<Oidb0x112aResp>(respBytes);
protobuf_decode<OidbBase<Oidb0x112aResp>>(respBytes);
}
export async function setInputStatus(
@@ -154,9 +156,9 @@ export async function setInputStatus(
};
const env = makeOidbEnvelope<Oidb0xcd4Req>(0xCD4, 1, req);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xcd4_1', encodeOidbEnv<Oidb0xcd4Req>(env));
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xcd4_1', protobuf_encode<OidbBase<Oidb0xcd4Req>>(env));
// Decode just to maintain the original behaviour of "consume the response".
decodeOidbEnv<Oidb0xcd4Resp>(respBytes);
protobuf_decode<OidbBase<Oidb0xcd4Resp>>(respBytes);
}
export async function setAvatar(
@@ -228,8 +230,8 @@ export async function getProfileLike(
};
const env = makeOidbEnvelope<Oidb0x7edReq>(0x7ED, 12, req);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x7ed_12', encodeOidbEnv<Oidb0x7edReq>(env));
const result = decodeOidbEnv<Oidb0x7edResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x7ed_12', protobuf_encode<OidbBase<Oidb0x7edReq>>(env));
const result = protobuf_decode<OidbBase<Oidb0x7edResp>>(respBytes).body;
const data = result?.userLikeInfos?.[0];
if (!data) {
@@ -270,8 +272,8 @@ export async function getUnidirectionalFriendList(
};
const env = makeOidbEnvelope<Oidb0xe17Req>(0xE17, 0, req);
const respBytes = await runOidb(bridge, 'MQUpdateSvc_com_qq_ti.web.OidbSvc.0xe17_0', encodeOidbEnv<Oidb0xe17Req>(env));
const result = decodeOidbEnv<Oidb0xe17Resp>(respBytes).body;
const respBytes = await runOidb(bridge, 'MQUpdateSvc_com_qq_ti.web.OidbSvc.0xe17_0', protobuf_encode<OidbBase<Oidb0xe17Req>>(env));
const result = protobuf_decode<OidbBase<Oidb0xe17Resp>>(respBytes).body;
if (!result || !result.jsonBody) {
throw new Error('get unidirectional friend list empty');
+15 -13
View File
@@ -4,13 +4,14 @@ import type { Bridge } from './bridge';
import type { DownloadRKeyInfo } from './bridge';
import type { FriendInfo, QQGroupInfo, GroupMemberInfo, UserProfileInfo, GroupRequestInfo } from './qq-info';
import { protoDecode } from '../protobuf/decode';
import { runOidb, makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from './bridge-oidb';
import { runOidb, makeOidbEnvelope } from './bridge-oidb';
import { AvatarInfoSchema } from './proto/oidb-action';
import type {
OidbSvcTrpcTcp0xFD4_1Response,
OidbSvcTrpcTcp0xFE5_2Response,
OidbSvcTrpcTcp0xFE7_3Response,
OidbSvcTrpcTcp0x10C0Response,
OidbBase,
} from './proto/proton/oidb';
import type {
OidbFriendListRequest,
@@ -22,6 +23,7 @@ import type {
NTV2RichMediaReq,
NTV2RichMediaResp,
} from './proto/proton/oidb-action';
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
// ---------------------------------------------------------------------------
// Helpers
@@ -72,8 +74,8 @@ export async function fetchFriendList(bridge: Bridge): Promise<FriendInfo[]> {
}
const env = makeOidbEnvelope<OidbFriendListRequest>(0xFD4, 1, body);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xfd4_1', encodeOidbEnv<OidbFriendListRequest>(env));
const resp = decodeOidbEnv<OidbSvcTrpcTcp0xFD4_1Response>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xfd4_1', protobuf_encode<OidbBase<OidbFriendListRequest>>(env));
const resp = protobuf_decode<OidbBase<OidbSvcTrpcTcp0xFD4_1Response>>(respBytes).body;
if (resp?.friends) {
for (const raw of resp.friends) {
@@ -135,8 +137,8 @@ export async function fetchGroupList(bridge: Bridge): Promise<QQGroupInfo[]> {
};
const env = makeOidbEnvelope<OidbGroupListRequest>(0xFE5, 2, body, true);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xfe5_2', encodeOidbEnv<OidbGroupListRequest>(env));
const resp = decodeOidbEnv<OidbSvcTrpcTcp0xFE5_2Response>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xfe5_2', protobuf_encode<OidbBase<OidbGroupListRequest>>(env));
const resp = protobuf_decode<OidbBase<OidbSvcTrpcTcp0xFE5_2Response>>(respBytes).body;
const groups: QQGroupInfo[] = [];
if (resp?.groups) {
@@ -179,8 +181,8 @@ export async function fetchGroupMemberList(bridge: Bridge, groupId: number): Pro
if (token) body.token = token;
const env = makeOidbEnvelope<OidbGroupMemberListRequest>(0xFE7, 3, body);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xfe7_3', encodeOidbEnv<OidbGroupMemberListRequest>(env));
const resp = decodeOidbEnv<OidbSvcTrpcTcp0xFE7_3Response>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xfe7_3', protobuf_encode<OidbBase<OidbGroupMemberListRequest>>(env));
const resp = protobuf_decode<OidbBase<OidbSvcTrpcTcp0xFE7_3Response>>(respBytes).body;
if (resp?.members) {
for (const raw of resp.members) {
@@ -226,8 +228,8 @@ export async function fetchUserProfile(bridge: Bridge, uin: number): Promise<Use
// and bounce the request with `[oidb] one of uid/openid is invaild`.
// Matches Lagrange.Core's FetchStrangerByUin (Reserved = 1).
const env = makeOidbEnvelope<OidbUserInfoRequest>(0xFE1, 2, body, true);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xfe1_2', encodeOidbEnv<OidbUserInfoRequest>(env));
const resp = decodeOidbEnv<OidbUserInfoResponse>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0xfe1_2', protobuf_encode<OidbBase<OidbUserInfoRequest>>(env));
const resp = protobuf_decode<OidbBase<OidbUserInfoResponse>>(respBytes).body;
if (!resp?.body) throw new Error('user info response body missing');
@@ -280,8 +282,8 @@ export async function fetchGroupRequests(bridge: Bridge, filtered = false): Prom
const subCmd = filtered ? 2 : 1;
const cmd = filtered ? 'OidbSvcTrpcTcp.0x10c0_2' : 'OidbSvcTrpcTcp.0x10c0_1';
const env = makeOidbEnvelope<OidbGroupRequestList>(0x10C0, subCmd, { count: 20, field2: 0 });
const respBytes = await runOidb(bridge, cmd, encodeOidbEnv<OidbGroupRequestList>(env));
const resp = decodeOidbEnv<OidbSvcTrpcTcp0x10C0Response>(respBytes).body;
const respBytes = await runOidb(bridge, cmd, protobuf_encode<OidbBase<OidbGroupRequestList>>(env));
const resp = protobuf_decode<OidbBase<OidbSvcTrpcTcp0x10C0Response>>(respBytes).body;
const requests: GroupRequestInfo[] = [];
for (const raw of resp?.requests ?? []) {
@@ -329,8 +331,8 @@ export async function fetchDownloadRKeys(bridge: Bridge): Promise<DownloadRKeyIn
};
const env = makeOidbEnvelope<NTV2RichMediaReq>(0x9067, 202, body, true);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x9067_202', encodeOidbEnv<NTV2RichMediaReq>(env));
const resp = decodeOidbEnv<NTV2RichMediaResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x9067_202', protobuf_encode<OidbBase<NTV2RichMediaReq>>(env));
const resp = protobuf_decode<OidbBase<NTV2RichMediaResp>>(respBytes).body;
if (resp?.respHead?.retCode && resp.respHead.retCode !== 0) {
throw new Error(resp.respHead.message ?? 'fetch download rkey failed');
-20
View File
@@ -44,26 +44,6 @@ export function makeOidbEnvelope<T>(
};
}
/**
* Pass-through encoder for the OIDB envelope. Single type param, body
* literally forwards its arg to `protobuf_encode<OidbBase<T>>` — proton
* wrapper-binds this and replaces every `encodeOidbEnv<MyReq>(env)` call
* site with `protobuf_encode_OidbBase__MyReq(env)` at build time.
*/
export function encodeOidbEnv<T>(env: OidbBase<T>): Uint8Array {
return protobuf_encode<OidbBase<T>>(env);
}
/**
* Pass-through decoder for the OIDB envelope. Mirror of `encodeOidbEnv`
* — proton monomorphizes `OidbBase<TResp>` per call site.
*
* Returns the full envelope; the caller usually wants `.body`.
*/
export function decodeOidbEnv<T>(bytes: Uint8Array): OidbBase<T> {
return protobuf_decode<OidbBase<T>>(bytes);
}
/**
* Issue one OIDB request and return the raw response bytes.
*
+5 -4
View File
@@ -17,8 +17,8 @@
import crypto from 'crypto';
import type { Bridge } from '../bridge';
import { protobuf_encode } from '@snowluma/proton';
import { makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from '../bridge-oidb';
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
import { makeOidbEnvelope } from '../bridge-oidb';
import type {
EncodableMediaMsgInfo,
NTV2UploadRichMediaReq,
@@ -26,6 +26,7 @@ import type {
} from '../proto/proton/highway';
import { buildHighwayExtend, fetchHighwaySession, uploadHighwayHttp } from './highway-client';
import { createLogger } from '../../utils/logger';
import { OidbBase } from '../proto/proton/oidb';
const moduleLog = createLogger('Highway');
@@ -160,14 +161,14 @@ export async function runNtv2Upload(params: NtV2UploadParams): Promise<any> {
};
const env = makeOidbEnvelope<NTV2UploadRichMediaReq>(oidbCmd, 100, body, true);
const requestBytes = encodeOidbEnv<NTV2UploadRichMediaReq>(env);
const requestBytes = protobuf_encode<OidbBase<NTV2UploadRichMediaReq>>(env);
const result = await bridge.sendRawPacket(serviceCmd, requestBytes);
if (!result.success || !result.gotResponse || !result.responseData) {
throw new Error(result.errorMessage || `${label} upload request failed`);
}
const resp = decodeOidbEnv<NTV2UploadRichMediaResp>(result.responseData);
const resp = protobuf_decode<OidbBase<NTV2UploadRichMediaResp>>(result.responseData);
if (!resp) throw new Error(`failed to decode ${label} upload response`);
if (resp.errorCode && resp.errorCode !== 0) {
throw new Error(`OIDB error ${resp.errorCode}: ${resp.errorMsg ?? ''}`);
-3
View File
@@ -1,6 +1,3 @@
// Proto schemas for outgoing message actions.
// Port of src/bridge/include/bridge/proto/action.h
import type { ProtoSchema } from '../../protobuf/decode';
import { ElemSchema } from './element';
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,121 @@
import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton';
// Re-exported from the legacy oidb-action module while large protocol groups
// are split into focused files.
export interface OidbMuteMemberBody { targetUid?: pb<1, string>; duration?: pb<2, uint_32>; }
export interface OidbMuteMember { groupUin?: pb<1, uint_32>; type?: pb<2, uint_32>; body?: pb<3, OidbMuteMemberBody>; }
export interface OidbMuteAllState { state?: pb<17, uint_32>; }
export interface OidbMuteAll { groupUin?: pb<1, uint_32>; muteState?: pb<2, OidbMuteAllState>; }
export interface Oidb0x89a_0AddOptionSettings { addType?: pb<16, uint_32>; }
export interface Oidb0x89a_0AddOption { groupUin?: pb<1, uint_64>; settings?: pb<2, Oidb0x89a_0AddOptionSettings>; field12?: pb<12, uint_32>; }
export interface Oidb0x89a_0Search { groupUin?: pb<1, uint_64>; settings?: pb<2, bytes>; field12?: pb<12, uint_32>; }
export interface OidbKickMember { groupUin?: pb<1, uint_32>; targetUid?: pb<3, string>; rejectAddRequest?: pb<4, bool>; reason?: pb<5, string>; }
export interface OidbLeaveGroup { groupUin?: pb<1, uint_32>; }
export interface OidbFriendRequestAction { accept?: pb<1, uint_32>; targetUid?: pb<2, string>; }
export interface OidbDeleteFriendField2Field3 { field1?: pb<1, uint_32>; field2?: pb<2, uint_32>; field3?: pb<3, uint_32>; }
export interface OidbDeleteFriendField2 { field1?: pb<1, uint_32>; field2?: pb<2, uint_32>; field3?: pb<3, OidbDeleteFriendField2Field3>; }
export interface OidbDeleteFriendField1 { targetUid?: pb<1, string>; field2?: pb<2, OidbDeleteFriendField2>; block?: pb<3, bool>; field4?: pb<4, bool>; }
export interface OidbDeleteFriend { field1?: pb<1, OidbDeleteFriendField1>; }
export interface OidbGroupRequestBody { sequence?: pb<1, uint_64>; eventType?: pb<2, uint_32>; groupUin?: pb<3, uint_32>; message?: pb<4, string>; }
export interface OidbGroupRequestAction { accept?: pb<1, uint_32>; body?: pb<2, OidbGroupRequestBody>; }
export interface OidbPoke { uin?: pb<1, uint_32>; groupUin?: pb<2, uint_32>; friendUin?: pb<5, uint_32>; ext?: pb<6, uint_32>; }
export interface OidbEssence { groupUin?: pb<1, uint_32>; sequence?: pb<2, uint_32>; random?: pb<3, uint_32>; }
export interface OidbSetAdmin { groupUin?: pb<1, uint_32>; uid?: pb<2, string>; isAdmin?: pb<3, bool>; }
export interface OidbRenameMemberBody { targetUid?: pb<1, string>; targetName?: pb<2, string>; }
export interface OidbRenameMember { groupUin?: pb<1, uint_32>; body?: pb<2, OidbRenameMemberBody>; }
export interface OidbRenameGroupBody { targetName?: pb<1, string>; }
export interface OidbRenameGroup { groupUin?: pb<1, uint_32>; body?: pb<2, OidbRenameGroupBody>; }
export interface OidbSpecialTitleBody { targetUid?: pb<1, string>; specialTitle?: pb<5, string>; expireTime?: pb<6, int_32>; }
export interface OidbSpecialTitle { groupUin?: pb<1, uint_32>; body?: pb<2, OidbSpecialTitleBody>; }
export interface OidbLike { targetUin?: pb<1, uint_32>; count?: pb<2, uint_32>; }
export interface OidbGroupRequestList { count?: pb<1, uint_32>; field2?: pb<2, uint_32>; }
export interface OidbUserInfoKey { key?: pb<1, uint_32>; }
export interface OidbUserInfoRequest { uin?: pb<1, uint_32>; keys?: pb_repeated<3, OidbUserInfoKey>; }
export interface OidbTwoNumber { number1?: pb<1, uint_32>; number2?: pb<2, uint_32>; }
export interface OidbByteProperty { code?: pb<1, uint_32>; value?: pb<2, bytes>; }
export interface OidbUserInfoProperty { numberProperties?: pb_repeated<1, OidbTwoNumber>; bytesProperties?: pb_repeated<2, OidbByteProperty>; }
export interface OidbUserInfoResponseBody { uid?: pb<1, string>; properties?: pb<2, OidbUserInfoProperty>; uin?: pb<3, uint_32>; }
export interface OidbUserInfoResponse { body?: pb<1, OidbUserInfoResponseBody>; }
export interface AvatarInfo { url?: pb<5, string>; }
export interface OidbFriendListNumber { numbers?: pb_repeated<1, uint_32>; }
export interface OidbFriendListBodyItem { type?: pb<1, uint_32>; number?: pb<2, OidbFriendListNumber>; }
export interface OidbFriendListNextUin { uin?: pb<1, uint_32>; }
export interface OidbFriendListRequest { friendCount?: pb<2, uint_32>; field4?: pb<4, uint_32>; nextUin?: pb<5, OidbFriendListNextUin>; field6?: pb<6, uint_32>; field7?: pb<7, uint_32>; body?: pb_repeated<10001, OidbFriendListBodyItem>; field10002?: pb_repeated<10002, uint_32>; field10003?: pb<10003, uint_32>; }
export interface OidbGroupListConfig1 { groupOwner?: pb<1, bool>; field2?: pb<2, bool>; memberMax?: pb<3, bool>; memberCount?: pb<4, bool>; groupName?: pb<5, bool>; field8?: pb<8, bool>; field9?: pb<9, bool>; field10?: pb<10, bool>; field11?: pb<11, bool>; field12?: pb<12, bool>; field13?: pb<13, bool>; field14?: pb<14, bool>; field15?: pb<15, bool>; field16?: pb<16, bool>; field17?: pb<17, bool>; field18?: pb<18, bool>; question?: pb<19, bool>; field20?: pb<20, bool>; field22?: pb<22, bool>; field23?: pb<23, bool>; field24?: pb<24, bool>; field25?: pb<25, bool>; field26?: pb<26, bool>; field27?: pb<27, bool>; field28?: pb<28, bool>; field29?: pb<29, bool>; field30?: pb<30, bool>; field31?: pb<31, bool>; field32?: pb<32, bool>; field5001?: pb<5001, bool>; field5002?: pb<5002, bool>; field5003?: pb<5003, bool>; }
export interface OidbGroupListConfig2 { field1?: pb<1, bool>; field2?: pb<2, bool>; field3?: pb<3, bool>; field4?: pb<4, bool>; field5?: pb<5, bool>; field6?: pb<6, bool>; field7?: pb<7, bool>; field8?: pb<8, bool>; }
export interface OidbGroupListConfig3 { field5?: pb<5, bool>; field6?: pb<6, bool>; }
export interface OidbGroupListConfig { config1?: pb<1, OidbGroupListConfig1>; config2?: pb<2, OidbGroupListConfig2>; config3?: pb<3, OidbGroupListConfig3>; }
export interface OidbGroupListRequest { config?: pb<1, OidbGroupListConfig>; }
export interface OidbGroupMemberListBody { memberName?: pb<10, bool>; memberCard?: pb<11, bool>; level?: pb<12, bool>; field13?: pb<13, bool>; field16?: pb<16, bool>; specialTitle?: pb<17, bool>; field18?: pb<18, bool>; field20?: pb<20, bool>; field21?: pb<21, bool>; joinTimestamp?: pb<100, bool>; lastMsgTimestamp?: pb<101, bool>; shutUpTimestamp?: pb<102, bool>; field103?: pb<103, bool>; field104?: pb<104, bool>; field105?: pb<105, bool>; field106?: pb<106, bool>; permission?: pb<107, bool>; field200?: pb<200, bool>; field201?: pb<201, bool>; }
export interface OidbGroupMemberListRequest { groupUin?: pb<1, uint_32>; field2?: pb<2, uint_32>; field3?: pb<3, uint_32>; body?: pb<4, OidbGroupMemberListBody>; token?: pb<15, string>; }
export interface GroupRecallInfo { sequence?: pb<1, uint_32>; random?: pb<2, uint_32>; field3?: pb<3, uint_32>; }
export interface GroupRecallSettings { field1?: pb<1, uint_32>; }
export interface GroupRecallRequest { type?: pb<1, uint_32>; groupUin?: pb<2, uint_32>; info?: pb<3, GroupRecallInfo>; settings?: pb<4, GroupRecallSettings>; }
export interface C2CRecallInfo { clientSequence?: pb<1, uint_32>; random?: pb<2, uint_32>; messageId?: pb<3, uint_64>; timestamp?: pb<4, uint_32>; field5?: pb<5, uint_32>; messageSequence?: pb<6, uint_32>; }
export interface C2CRecallSettings { field1?: pb<1, bool>; field2?: pb<2, bool>; }
export interface C2CRecallRequest { type?: pb<1, uint_32>; targetUid?: pb<3, string>; info?: pb<4, C2CRecallInfo>; settings?: pb<5, C2CRecallSettings>; field6?: pb<6, bool>; }
export interface OidbGroupReaction { groupUin?: pb<1, uint_32>; sequence?: pb<2, uint_32>; code?: pb<3, string>; type?: pb<4, uint_32>; }
export interface GroupReadedReportItem { groupUin?: pb<1, uint_64>; lastReadSeq?: pb<2, uint_64>; }
export interface C2CReadedReportItem { uid?: pb<2, string>; lastReadTime?: pb<3, uint_64>; lastReadSeq?: pb<4, uint_64>; }
export interface SsoReadedReportReq { groupList?: pb_repeated<1, GroupReadedReportItem>; c2cList?: pb_repeated<2, C2CReadedReportItem>; }
export interface OidbClientKeyReq {}
export interface OidbClientKeyResp { keyIndex?: pb<2, uint_32>; clientKey?: pb<3, string>; expireTime?: pb<4, uint_32>; }
export interface OidbGetPskeyReq { domainList?: pb_repeated<1, string>; }
export interface OidbPskeyItem { domain?: pb<1, string>; pskey?: pb<2, string>; expireTime?: pb<3, uint_64>; }
export interface OidbGetPskeyResp { pskeyItems?: pb_repeated<1, OidbPskeyItem>; }
export interface SetStatusCustomExt { faceId?: pb<1, uint_32>; text?: pb<2, string>; faceType?: pb<3, uint_32>; }
export interface SetStatusReq { status?: pb<1, int_32>; extStatus?: pb<2, int_32>; batteryStatus?: pb<3, int_32>; customExt?: pb<4, SetStatusCustomExt>; }
export interface SetStatusResp { errCode?: pb<1, int_32>; errMsg?: pb<2, string>; }
export interface OidbProfileStringItem { fieldId?: pb<1, uint_32>; value?: pb<2, string>; }
export interface OidbProfileIntItem { fieldId?: pb<1, uint_32>; value?: pb<2, uint_64>; }
export interface OidbSetProfile { uin?: pb<1, uint_64>; stringProfiles?: pb_repeated<2, OidbProfileStringItem>; intProfiles?: pb_repeated<3, OidbProfileIntItem>; }
export interface Oidb0x7edInteraction { totalCount?: pb<1, uint_32>; newCount?: pb<2, uint_32>; todayCount?: pb<3, uint_32>; lastTime?: pb<4, uint_64>; }
export interface Oidb0x7edUserLikeInfo { uid?: pb<1, string>; time?: pb<2, uint_64>; favoriteInfo?: pb<3, Oidb0x7edInteraction>; voteInfo?: pb<4, Oidb0x7edInteraction>; }
export interface Oidb0x7edReq { targetUid?: pb<1, string>; basic?: pb<2, uint_32>; vote?: pb<3, uint_32>; favorite?: pb<4, uint_32>; start?: pb<12, uint_32>; limit?: pb<103, uint_32>; }
export interface Oidb0x7edResp { userLikeInfos?: pb_repeated<1, Oidb0x7edUserLikeInfo>; }
export interface Oidb0x8a7Req { basic1?: pb<1, uint_32>; basic2?: pb<2, uint_32>; basic3?: pb<3, uint_32>; uin?: pb<4, uint_64>; groupId?: pb<5, uint_64>; type?: pb<12, uint_32>; }
export interface Oidb0x8a7Resp { uinRemain?: pb<2, uint_32>; groupRemain?: pb<3, uint_32>; msg?: pb<4, string>; canAtAll?: pb<6, bool>; }
export interface Oidb0xe17Req { jsonBody?: pb<3, string>; }
export interface Oidb0xe17Resp { jsonBody?: pb<4, string>; }
export interface Oidb0x112aProfileInfo { tag?: pb<1, uint_32>; value?: pb<2, string>; }
export interface Oidb0x112aReq { uin?: pb<1, uint_64>; profile?: pb<2, Oidb0x112aProfileInfo>; }
export interface Oidb0x112aResp {}
export interface Oidb0xcd4ReqBody { uid?: pb<1, string>; chatType?: pb<2, uint_32>; eventType?: pb<3, uint_32>; }
export interface Oidb0xcd4Req { reqBody?: pb<1, Oidb0xcd4ReqBody>; }
export interface Oidb0xcd4Resp {}
export interface Oidb0x990TranslateReq { srcLang?: pb<1, string>; dstLang?: pb<2, string>; words?: pb_repeated<3, string>; }
export interface Oidb0x990Req { translateReq?: pb<2, Oidb0x990TranslateReq>; tag10?: pb<10, uint_32>; tag12?: pb<12, uint_32>; }
export interface Oidb0x990TranslateResp { errorCode?: pb<1, uint_32>; errorMsg?: pb<2, string>; srcLang?: pb<3, string>; dstLang?: pb<4, string>; srcWords?: pb_repeated<5, string>; dstWords?: pb_repeated<6, string>; }
export interface Oidb0x990Resp { translateResp?: pb<2, Oidb0x990TranslateResp>; }
export interface MiniAppShareReqBody { appid?: pb<2, string>; title?: pb<3, string>; desc?: pb<4, string>; picUrl?: pb<9, string>; jumpUrl?: pb<11, string>; iconUrl?: pb<12, string>; }
export interface MiniAppShareReq { sdkVersion?: pb<2, string>; body?: pb<4, MiniAppShareReqBody>; }
export interface MiniAppShareRespBody { jsonStr?: pb<2, string>; }
export interface MiniAppShareResp { status?: pb<2, uint_32>; msg?: pb<3, string>; body?: pb<4, MiniAppShareRespBody>; }
export interface Oidb0x112eReq { botAppid?: pb<3, uint_64>; msgSeq?: pb<4, uint_64>; buttonId?: pb<5, string>; callbackData?: pb<6, string>; unknown7?: pb<7, uint_32>; groupId?: pb<8, uint_64>; unknown9?: pb<9, uint_32>; }
export interface Oidb0x112eResp { result?: pb<3, uint_32>; promptText?: pb<4, string>; errMsg?: pb<5, string>; }
export interface Oidb0xeb7SignInInfo { uin?: pb<1, string>; groupId?: pb<2, string>; version?: pb<3, string>; }
export interface Oidb0xeb7Req { signInInfo?: pb<2, Oidb0xeb7SignInInfo>; }
export interface Oidb0xeb7Resp {}
export interface FaceroamOpReqInner { field1?: pb<1, uint_32>; osVersion?: pb<2, string>; qqVersion?: pb<3, string>; }
export interface FaceroamOpReq { inner?: pb<1, FaceroamOpReqInner>; uin?: pb<2, uint_64>; field3?: pb<3, uint_32>; field6?: pb<6, uint_32>; }
export interface FaceroamOpRespItem { faceIds?: pb_repeated<1, string>; category?: pb<3, string>; totalCount?: pb<4, uint_32>; }
export interface FaceroamOpResp { retCode?: pb<1, uint_32>; message?: pb<2, string>; field3?: pb<3, uint_32>; item?: pb<4, FaceroamOpRespItem>; }
export interface Oidb0x9083Req { groupId?: pb<2, uint_64>; sequence?: pb<3, uint_32>; emojiType?: pb<4, uint_32>; emojiId?: pb<5, string>; cookie?: pb<6, bytes>; field7?: pb<7, uint_32>; count?: pb<8, uint_32>; field12?: pb<12, uint_32>; }
export interface Oidb0x9083RespUserInfo { uin?: pb<1, uint_64>; field3?: pb<3, uint_32>; }
export interface Oidb0x9083RespInner { userInfo?: pb<1, Oidb0x9083RespUserInfo>; field4?: pb<4, uint_32>; }
export interface Oidb0x9083Resp { inner?: pb<4, Oidb0x9083RespInner>; cookie?: pb<5, bytes>; }
export interface Oidb0x8a0Req { groupId?: pb<1, uint_64>; targetUids?: pb_repeated<3, string>; rejectAddRequest?: pb<4, uint_32>; kickReason?: pb<5, bytes>; field12?: pb<12, uint_32>; }
export interface Oidb0x8a0Resp {}
export interface Oidb0xf16Inner { groupId?: pb<1, uint_64>; remark?: pb<3, string>; }
export interface Oidb0xf16Req { inner?: pb<1, Oidb0xf16Inner>; field12?: pb<12, uint_32>; }
export interface Oidb0xf16Resp {}
export interface OidbGroupTodo { groupUin?: pb<1, uint_32>; msgSeq?: pb<2, uint_64>; }
export interface OidbStrangerStatusKey { key?: pb<1, uint_32>; }
export interface OidbStrangerStatusReq { uin?: pb<1, uint_32>; key?: pb_repeated<3, OidbStrangerStatusKey>; }
export interface OidbSetFriendRemark { targetUid?: pb<1, string>; remark?: pb<2, string>; }
export interface OidbStrangerStatusRespStatus { key?: pb<1, uint_32>; value?: pb<2, uint_64>; }
export interface OidbStrangerStatusRespData { status?: pb<2, OidbStrangerStatusRespStatus>; }
export interface OidbStrangerStatusResp { data?: pb<1, OidbStrangerStatusRespData>; }
export interface GroupAvatarExtraField3 { field1?: pb<1, uint_32>; }
export interface GroupAvatarExtra { type?: pb<1, uint_32>; groupUin?: pb<2, uint_32>; field3?: pb<3, GroupAvatarExtraField3>; field5?: pb<5, uint_32>; field6?: pb<6, uint_32>; }
@@ -0,0 +1,43 @@
import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton';
export interface ExtMapEntry { key?: pb<1, string>; value?: pb<2, string>; }
export interface ReqInfo { groupId?: pb<1, string>; albumId?: pb<2, string>; field3?: pb<3, int_32>; attachInfo?: pb<4, string>; field5?: pb<5, string>; }
export interface GetMediaListRequest { field1?: pb<1, int_32>; field2?: pb<2, bytes>; field3?: pb<3, bytes>; reqInfo?: pb<4, ReqInfo>; traceId?: pb<5, string>; extMap?: pb_repeated<10, ExtMapEntry>; }
export interface UrlInfo { url?: pb<1, string>; width?: pb<2, uint_32>; height?: pb<3, uint_32>; }
export interface PhotoUrl { spec?: pb<1, uint_32>; url?: pb<2, UrlInfo>; }
export interface ImageInfo { name?: pb<1, string>; sloc?: pb<2, string>; lloc?: pb<3, string>; photoUrls?: pb_repeated<4, PhotoUrl>; defaultUrl?: pb<5, UrlInfo>; isGif?: pb<6, bool>; hasRaw?: pb<7, bool>; }
export interface MediaInfo { type?: pb<1, uint_32>; image?: pb<2, ImageInfo>; uploader?: pb<6, string>; batchId?: pb<7, uint_64>; uploadTime?: pb<8, uint_64>; }
export interface GetMediaListAlbumInfo { albumId?: pb<1, string>; owner?: pb<2, string>; name?: pb<3, string>; }
export interface GetMediaListRspData { albumInfo?: pb<1, GetMediaListAlbumInfo>; mediaList?: pb_repeated<3, MediaInfo>; prevAttachInfo?: pb<4, string>; nextAttachInfo?: pb<5, string>; }
export interface GetMediaListResponse { field1?: pb<1, int_32>; field2?: pb<2, bytes>; field3?: pb<3, bytes>; data?: pb<4, GetMediaListRspData>; }
export interface CommentContentItem { type?: pb<1, uint_32>; content?: pb<2, string>; }
export interface CommentUser { uin?: pb<13, string>; }
export interface CommentReqContentMeta { field1?: pb<1, uint_32>; field2?: pb<2, string>; field3?: pb<3, string>; field4?: pb<4, string>; field5?: pb<5, uint_32>; field6?: pb<6, string>; }
export interface CommentReqContent { field2?: pb<2, CommentUser>; field3?: pb<3, CommentReqContentMeta>; clientKey?: pb<7, string>; }
export interface CommentReqPhotoMeta { field1?: pb<1, uint_32>; field2?: pb<2, string>; lloc?: pb<3, string>; field4?: pb<4, string>; field6?: pb<6, string>; field7?: pb<7, uint_32>; field8?: pb<8, uint_32>; field9?: pb<9, uint_32>; field14?: pb<14, uint_32>; field15?: pb<15, uint_32>; field17?: pb<17, uint_32>; }
export interface CommentReqPhotoWrap { field2?: pb<2, CommentReqPhotoMeta>; }
export interface CommentReqPhotoInfo { field1?: pb<1, CommentReqPhotoWrap>; albumId?: pb<3, string>; field5?: pb<5, uint_32>; }
export interface CommentReqBodyHeader { field3?: pb<3, uint_32>; field4?: pb<4, string>; }
export interface CommentReqBodyUserWrap { field1?: pb<1, CommentUser>; }
export interface CommentReqBody { field1?: pb<1, CommentReqBodyHeader>; field2?: pb<2, CommentReqBodyUserWrap>; field5?: pb<5, CommentReqPhotoInfo>; }
export interface DoQunCommentRequestBody { groupId?: pb<2, string>; field3?: pb<3, uint_32>; reqBody?: pb<4, CommentReqBody>; field5?: pb<5, CommentReqContent>; }
export interface DoQunCommentRequest { field1?: pb<1, int_32>; field2?: pb<2, bytes>; field3?: pb<3, bytes>; body?: pb<4, DoQunCommentRequestBody>; traceId?: pb<5, string>; extMap?: pb_repeated<10, ExtMapEntry>; }
export interface CommentRespUser { uin?: pb<13, string>; }
export interface CommentRespContent { type?: pb<1, uint_32>; content?: pb<2, string>; }
export interface CommentRespData { id?: pb<1, string>; user?: pb<2, CommentRespUser>; content?: pb_repeated<3, CommentRespContent>; time?: pb<4, uint_64>; clientKey?: pb<7, string>; }
export interface DoQunCommentResponseComment { data?: pb<2, CommentRespData>; }
export interface DoQunCommentResponse { field1?: pb<1, int_32>; comment?: pb<4, DoQunCommentResponseComment>; }
export interface DoQunLikeReqLikeInfo { id?: pb<1, string>; status?: pb<3, uint_32>; }
export interface DoQunLikeReqCellCommon { time?: pb<3, uint_64>; feedId?: pb<4, string>; }
export interface DoQunLikeReqCellUser { uin?: pb<13, string>; }
export interface DoQunLikeReqCellUserInfo { user?: pb<1, DoQunLikeReqCellUser>; }
export interface DoQunLikeReqCellQunInfo { qunId?: pb<1, string>; }
export interface DoQunLikeReqCellMedia { albumId?: pb<3, string>; batchId?: pb<5, uint_64>; }
export interface DoQunLikeReqFeedPublish { cellCommon?: pb<1, DoQunLikeReqCellCommon>; cellUserInfo?: pb<2, DoQunLikeReqCellUserInfo>; cellMedia?: pb<5, DoQunLikeReqCellMedia>; cellQunInfo?: pb<12, DoQunLikeReqCellQunInfo>; }
export interface DoQunLikeReqBody { type?: pb<2, uint_32>; like?: pb<3, DoQunLikeReqLikeInfo>; publish?: pb<4, DoQunLikeReqFeedPublish>; clientKey?: pb<5, string>; }
export interface DoQunLikeRequest { field1?: pb<1, int_32>; field2?: pb<2, string>; field3?: pb<3, string>; body?: pb<4, DoQunLikeReqBody>; extMap?: pb_repeated<10, ExtMapEntry>; }
export interface DoQunLikeRespBody { like?: pb<2, DoQunLikeReqLikeInfo>; }
export interface DoQunLikeResponse { field1?: pb<1, int_32>; body?: pb<4, DoQunLikeRespBody>; }
export interface DeleteMediasReqBody { groupId?: pb<1, string>; albumId?: pb<2, string>; lloc?: pb<3, string>; }
export interface DeleteMediasRequest { field1?: pb<1, int_32>; field2?: pb<2, string>; field3?: pb<3, string>; body?: pb<4, DeleteMediasReqBody>; traceId?: pb<5, string>; extMap?: pb_repeated<10, ExtMapEntry>; }
export interface DeleteMediasResponse { field1?: pb<1, int_32>; field2?: pb<2, int_32>; field3?: pb<3, string>; }
@@ -0,0 +1,31 @@
import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton';
export interface OidbGroupFileListReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; targetDirectory?: pb<3, string>; fileCount?: pb<5, uint_32>; sortBy?: pb<9, uint_32>; startIndex?: pb<13, uint_32>; field17?: pb<17, uint_32>; field18?: pb<18, uint_32>; }
export interface OidbGroupFileViewReq { list?: pb<2, OidbGroupFileListReq>; }
export interface OidbGroupFileListFolderResp { folderId?: pb<1, string>; parentDirectoryId?: pb<2, string>; folderName?: pb<3, string>; createTime?: pb<4, uint_32>; modifiedTime?: pb<5, uint_32>; creatorUin?: pb<6, uint_32>; creatorName?: pb<7, string>; totalFileCount?: pb<8, uint_32>; }
export interface OidbGroupFileListFileResp { fileId?: pb<1, string>; fileName?: pb<2, string>; fileSize?: pb<3, uint_64>; busId?: pb<4, uint_32>; uploadedTime?: pb<6, uint_32>; expireTime?: pb<7, uint_32>; modifiedTime?: pb<8, uint_32>; downloadedTimes?: pb<9, uint_32>; uploaderName?: pb<14, string>; uploaderUin?: pb<15, uint_32>; parentDirectory?: pb<16, string>; }
export interface OidbGroupFileListItemResp { type?: pb<1, uint_32>; folderInfo?: pb<2, OidbGroupFileListFolderResp>; fileInfo?: pb<3, OidbGroupFileListFileResp>; }
export interface OidbGroupFileListResp { retCode?: pb<1, uint_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; isEnd?: pb<4, bool>; items?: pb_repeated<5, OidbGroupFileListItemResp>; }
export interface OidbGroupFileViewResp { list?: pb<2, OidbGroupFileListResp>; }
export interface OidbGroupFileUploadReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; busId?: pb<3, uint_32>; entrance?: pb<4, uint_32>; targetDirectory?: pb<5, string>; fileName?: pb<6, string>; localDirectory?: pb<7, string>; fileSize?: pb<8, uint_64>; fileSha1?: pb<9, bytes>; fileSha3?: pb<10, bytes>; fileMd5?: pb<11, bytes>; field15?: pb<15, bool>; }
export interface OidbGroupFileDownloadReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; busId?: pb<3, uint_32>; fileId?: pb<4, string>; }
export interface OidbGroupFileDeleteReq { groupUin?: pb<1, uint_32>; busId?: pb<3, uint_32>; fileId?: pb<5, string>; }
export interface OidbGroupFileMoveReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; busId?: pb<3, uint_32>; fileId?: pb<4, string>; parentDirectory?: pb<5, string>; targetDirectory?: pb<6, string>; }
export interface OidbGroupFileReq { file?: pb<1, OidbGroupFileUploadReq>; download?: pb<3, OidbGroupFileDownloadReq>; delete?: pb<4, OidbGroupFileDeleteReq>; move?: pb<6, OidbGroupFileMoveReq>; }
export interface OidbGroupFileUploadResp { retCode?: pb<1, int_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; uploadIp?: pb<4, string>; serverDns?: pb<5, string>; busId?: pb<6, int_32>; fileId?: pb<7, string>; checkKey?: pb<8, bytes>; fileKey?: pb<9, bytes>; boolFileExist?: pb<10, bool>; uploadPort?: pb<14, uint_32>; }
export interface OidbGroupFileDownloadResp { retCode?: pb<1, uint_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; downloadIp?: pb<4, string>; downloadDns?: pb<5, string>; downloadUrl?: pb<6, bytes>; saveFileName?: pb<11, string>; }
export interface OidbGroupFileRetResp { retCode?: pb<1, uint_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; }
export interface OidbGroupFileResp { upload?: pb<1, OidbGroupFileUploadResp>; download?: pb<3, OidbGroupFileDownloadResp>; delete?: pb<4, OidbGroupFileRetResp>; move?: pb<6, OidbGroupFileRetResp>; }
export interface OidbGroupSendFileInfo { busiType?: pb<1, uint_32>; fileId?: pb<2, string>; field3?: pb<3, uint_32>; field4?: pb<4, string>; field5?: pb<5, bool>; }
export interface OidbGroupSendFileBody { groupUin?: pb<1, uint_32>; type?: pb<2, uint_32>; info?: pb<3, OidbGroupSendFileInfo>; }
export interface OidbGroupSendFileReq { body?: pb<5, OidbGroupSendFileBody>; }
export interface OidbGroupFileCreateFolderReq { groupUin?: pb<1, uint_32>; rootDirectory?: pb<3, string>; folderName?: pb<4, string>; }
export interface OidbGroupFileDeleteFolderReq { groupUin?: pb<1, uint_32>; folderId?: pb<3, string>; }
export interface OidbGroupFileRenameFolderReq { groupUin?: pb<1, uint_32>; folderId?: pb<3, string>; newFolderName?: pb<4, string>; }
export interface OidbGroupFileFolderReq { create?: pb<1, OidbGroupFileCreateFolderReq>; delete?: pb<2, OidbGroupFileDeleteFolderReq>; rename?: pb<3, OidbGroupFileRenameFolderReq>; }
export interface OidbGroupFileFolderRetResp { retcode?: pb<1, uint_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; }
export interface OidbGroupFileFolderResp { create?: pb<1, OidbGroupFileFolderRetResp>; delete?: pb<2, OidbGroupFileFolderRetResp>; rename?: pb<3, OidbGroupFileFolderRetResp>; }
export interface OidbGroupFileCountReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; busId?: pb<3, uint_32>; }
export interface OidbGroupFileCountResp { fileCount?: pb<1, uint_32>; maxCount?: pb<2, uint_32>; isEnd?: pb<3, bool>; }
export interface OidbGroupFileCountViewReq { count?: pb<3, OidbGroupFileCountReq>; }
export interface OidbGroupFileCountViewResp { count?: pb<3, OidbGroupFileCountResp>; }
@@ -0,0 +1,4 @@
export type * from './base';
export type * from './group-file';
export type * from './media';
export type * from './group-album';
@@ -0,0 +1,44 @@
import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton';
export interface OidbPrivateFileDownloadReqBody { receiverUid?: pb<10, string>; fileUuid?: pb<20, string>; type?: pb<30, uint_32>; fileHash?: pb<60, string>; t2?: pb<601, uint_32>; }
export interface OidbPrivateFileDownloadReq { subCommand?: pb<1, uint_32>; field2?: pb<2, uint_32>; body?: pb<14, OidbPrivateFileDownloadReqBody>; field101?: pb<101, uint_32>; field102?: pb<102, uint_32>; field200?: pb<200, uint_32>; field99999?: pb<99999, bytes>; }
export interface OidbPrivateFileDownloadRespResult { server?: pb<20, string>; port?: pb<40, uint_32>; url?: pb<50, string>; }
export interface OidbPrivateFileDownloadRespBody { state?: pb<20, string>; result?: pb<30, OidbPrivateFileDownloadRespResult>; }
export interface OidbPrivateFileDownloadResp { body?: pb<14, OidbPrivateFileDownloadRespBody>; }
export interface OidbPrivateFileUploadReqBody { senderUid?: pb<10, string>; receiverUid?: pb<20, string>; fileSize?: pb<30, uint_32>; fileName?: pb<40, string>; md510MCheckSum?: pb<50, bytes>; sha1CheckSum?: pb<60, bytes>; localPath?: pb<70, string>; md5CheckSum?: pb<110, bytes>; sha3CheckSum?: pb<120, bytes>; }
export interface OidbPrivateFileUploadReq { command?: pb<1, uint_32>; seq?: pb<2, int_32>; upload?: pb<19, OidbPrivateFileUploadReqBody>; businessId?: pb<101, int_32>; clientType?: pb<102, int_32>; flagSupportMediaPlatform?: pb<200, int_32>; }
export interface IPv4 { outIP?: pb<1, int_32>; outPort?: pb<2, int_32>; inIP?: pb<3, int_32>; inPort?: pb<4, int_32>; iPType?: pb<5, int_32>; }
export interface OidbPrivateFileUploadRespBody { retCode?: pb<10, int_32>; retMsg?: pb<20, string>; uploadIp?: pb<60, string>; uploadDomain?: pb<70, string>; uploadPort?: pb<80, uint_32>; uuid?: pb<90, string>; uploadKey?: pb<100, bytes>; boolFileExist?: pb<110, bool>; uploadIpList?: pb_repeated<130, string>; uploadHttpsPort?: pb<140, int_32>; uploadHttpsDomain?: pb<150, string>; uploadDns?: pb<160, string>; uploadLanip?: pb<170, string>; fileAddon?: pb<200, string>; rtpMediaPlatformUploadAddress?: pb_repeated<210, IPv4>; mediaPlatformUploadKey?: pb<220, bytes>; }
export interface OidbPrivateFileUploadResp { upload?: pb<19, OidbPrivateFileUploadRespBody>; }
export interface NTV2CommonHead { requestId?: pb<1, uint_32>; command?: pb<2, uint_32>; }
export interface NTV2C2CUserInfo { accountType?: pb<1, uint_32>; targetUid?: pb<2, string>; }
export interface NTV2GroupInfo { groupUin?: pb<1, uint_32>; }
export interface NTV2SceneInfo { requestType?: pb<101, uint_32>; businessType?: pb<102, uint_32>; sceneType?: pb<200, uint_32>; c2c?: pb<201, NTV2C2CUserInfo>; group?: pb<202, NTV2GroupInfo>; }
export interface NTV2ClientMeta { agentType?: pb<1, uint_32>; }
export interface NTV2ReqHead { common?: pb<1, NTV2CommonHead>; scene?: pb<2, NTV2SceneInfo>; client?: pb<3, NTV2ClientMeta>; }
export interface NTV2DownloadRKeyReq { types?: pb_repeated<1, uint_32>; }
export interface NTV2FileType { type?: pb<1, uint_32>; picFormat?: pb<2, uint_32>; videoFormat?: pb<3, uint_32>; voiceFormat?: pb<4, uint_32>; }
export interface NTV2FileInfo { fileSize?: pb<1, uint_32>; fileHash?: pb<2, string>; fileSha1?: pb<3, string>; fileName?: pb<4, string>; type?: pb<5, NTV2FileType>; width?: pb<6, uint_32>; height?: pb<7, uint_32>; time?: pb<8, uint_32>; original?: pb<9, uint_32>; }
export interface NTV2IndexNode { info?: pb<1, NTV2FileInfo>; fileUuid?: pb<2, string>; storeId?: pb<3, uint_32>; uploadTime?: pb<4, uint_32>; ttl?: pb<5, uint_32>; subType?: pb<6, uint_32>; }
export interface NTV2VideoDownloadExt { busiType?: pb<1, uint_32>; sceneType?: pb<2, uint_32>; subBusiType?: pb<3, uint_32>; }
export interface NTV2DownloadExt { video?: pb<2, NTV2VideoDownloadExt>; }
export interface NTV2DownloadReq { node?: pb<1, NTV2IndexNode>; download?: pb<2, NTV2DownloadExt>; }
export interface NTV2RichMediaReq { reqHead?: pb<1, NTV2ReqHead>; download?: pb<3, NTV2DownloadReq>; downloadRkey?: pb<4, NTV2DownloadRKeyReq>; }
export interface NTV2RespHead { common?: pb<1, NTV2CommonHead>; retCode?: pb<2, uint_32>; message?: pb<3, string>; }
export interface NTV2RKeyInfo { rkey?: pb<1, string>; rkeyTtlSec?: pb<2, uint_64>; storeId?: pb<3, uint_32>; rkeyCreateTime?: pb<4, uint_32>; type?: pb<5, uint_32>; }
export interface NTV2DownloadRKeyResp { rkeys?: pb_repeated<1, NTV2RKeyInfo>; }
export interface NTV2MediaDownloadInfo { domain?: pb<1, string>; urlPath?: pb<2, string>; httpsPort?: pb<3, uint_32>; }
export interface NTV2MediaDownloadResp { rKeyParam?: pb<1, string>; rKeyTtlSecond?: pb<2, uint_32>; info?: pb<3, NTV2MediaDownloadInfo>; rKeyCreateTime?: pb<4, uint_32>; }
export interface NTV2RichMediaResp { respHead?: pb<1, NTV2RespHead>; download?: pb<3, NTV2MediaDownloadResp>; downloadRkey?: pb<4, NTV2DownloadRKeyResp>; }
export interface OidbAiVoiceListReq { groupUin?: pb<1, uint_32>; chatType?: pb<2, uint_32>; }
export interface OidbAiVoiceListEntry { voiceId?: pb<1, string>; voiceDisplayName?: pb<2, string>; voiceExampleUrl?: pb<3, string>; }
export interface OidbAiVoiceListCategory { category?: pb<1, string>; voices?: pb_repeated<2, OidbAiVoiceListEntry>; }
export interface OidbAiVoiceListResp { content?: pb_repeated<1, OidbAiVoiceListCategory>; }
export interface OidbAiVoiceSession { sessionId?: pb<1, uint_32>; }
export interface OidbAiVoiceReq { groupUin?: pb<1, uint_32>; voiceId?: pb<2, string>; text?: pb<3, string>; chatType?: pb<4, uint_32>; session?: pb<5, OidbAiVoiceSession>; }
export interface OidbAiVoiceFileType { type?: pb<1, uint_32>; picFormat?: pb<2, uint_32>; videoFormat?: pb<3, uint_32>; voiceFormat?: pb<4, uint_32>; }
export interface OidbAiVoiceFileInfo { fileSize?: pb<1, uint_32>; fileHash?: pb<2, string>; fileSha1?: pb<3, string>; fileName?: pb<4, string>; type?: pb<5, OidbAiVoiceFileType>; width?: pb<6, uint_32>; height?: pb<7, uint_32>; time?: pb<8, uint_32>; original?: pb<9, uint_32>; }
export interface OidbAiVoiceIndexNode { info?: pb<1, OidbAiVoiceFileInfo>; fileUuid?: pb<2, string>; storeId?: pb<3, uint_32>; uploadTime?: pb<4, uint_32>; ttl?: pb<5, uint_32>; subType?: pb<6, uint_32>; }
export interface OidbAiVoiceMsgInfoBody { index?: pb<1, OidbAiVoiceIndexNode>; }
export interface OidbAiVoiceMsgInfo { msgInfoBody?: pb_repeated<1, OidbAiVoiceMsgInfoBody>; }
export interface OidbAiVoiceResp { statusCode?: pb<1, uint_32>; field2?: pb<2, uint_32>; field3?: pb<3, uint_32>; msgInfo?: pb<4, OidbAiVoiceMsgInfo>; }
@@ -3,8 +3,10 @@
// roughly: forceFetchClientKey -> ptlogin2 jump -> cookie dict ->
// thread the cookies into a qun.qq.com REST endpoint.
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
import type { Bridge } from '../bridge';
import { runOidb, makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from '../bridge-oidb';
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
import { OidbBase } from '../proto/proton/oidb';
import type {
OidbClientKeyReq,
OidbClientKeyResp,
@@ -15,8 +17,8 @@ import { RequestUtil } from '../web/request-util';
export async function forceFetchClientKey(bridge: Bridge) {
const env = makeOidbEnvelope<OidbClientKeyReq>(0x102A, 1, {});
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x102a_1', encodeOidbEnv<OidbClientKeyReq>(env));
const resp = decodeOidbEnv<OidbClientKeyResp>(respBytes).body;
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x102a_1', protobuf_encode<OidbBase<OidbClientKeyReq>>(env));
const resp = protobuf_decode<OidbBase<OidbClientKeyResp>>(respBytes).body;
const clientKey = resp?.clientKey || '';
// keyIndex falls back to "19" — origin unknown but the value is what
@@ -32,7 +34,7 @@ export async function forceFetchClientKey(bridge: Bridge) {
export async function getPSkey(bridge: Bridge, domainList: string[]) {
const env = makeOidbEnvelope<OidbGetPskeyReq>(0x102A, 0, { domainList });
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x102a_0', encodeOidbEnv<OidbGetPskeyReq>(env));
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x102a_0', protobuf_encode<OidbBase<OidbGetPskeyReq>>(env));
const resp = decodeOidbEnv<OidbGetPskeyResp>(respBytes).body;
const domainPskeyMap = new Map<string, string>();