Remove bridge proto schemas and parity test
Delete proto schema modules under packages/core/src/bridge/proto (action.ts, element.ts, highway.ts, longmsg.ts, message.ts, notify.ts, oidb-action.ts, oidb.ts) and the related test packages/core/tests/proton-parity.test.ts. These files contained protobuf schema definitions for the bridge layer; remove them as part of a cleanup/refactor. Update any imports or references to these modules to their new locations or replacements.
This commit is contained in:
1 parent
02bab710b8
commit
5ea1c3a961
45 files changed
+1361
-4230
No files matched your search
@@ -7,15 +7,17 @@ import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
|||||||
import type { Bridge } from '../bridge';
|
import type { Bridge } from '../bridge';
|
||||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||||
import { OidbBase } from '../proto/proton/oidb';
|
import { OidbBase } from '../proto/proton/oidb';
|
||||||
|
import type {
|
||||||
|
OidbGroupTodo,
|
||||||
|
OidbStrangerStatusReq,
|
||||||
|
OidbStrangerStatusResp,
|
||||||
|
} from '../proto/proton/oidb-actions/base';
|
||||||
import type {
|
import type {
|
||||||
OidbAiVoiceListReq,
|
OidbAiVoiceListReq,
|
||||||
OidbAiVoiceListResp,
|
OidbAiVoiceListResp,
|
||||||
OidbAiVoiceReq,
|
OidbAiVoiceReq,
|
||||||
OidbAiVoiceResp,
|
OidbAiVoiceResp,
|
||||||
OidbGroupTodo,
|
} from '../proto/proton/oidb-actions/media';
|
||||||
OidbStrangerStatusReq,
|
|
||||||
OidbStrangerStatusResp,
|
|
||||||
} from '../proto/proton/oidb-action';
|
|
||||||
import type { MediaIndexNode } from './shared';
|
import type { MediaIndexNode } from './shared';
|
||||||
|
|
||||||
// ─────────────── Group todo (0xF90) ───────────────
|
// ─────────────── Group todo (0xF90) ───────────────
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import type {
|
|||||||
OidbDeleteFriend,
|
OidbDeleteFriend,
|
||||||
OidbFriendRequestAction,
|
OidbFriendRequestAction,
|
||||||
OidbSetFriendRemark,
|
OidbSetFriendRemark,
|
||||||
} from '../proto/proton/oidb-action';
|
} from '../proto/proton/oidb-actions/base';
|
||||||
import { OidbBase } from '../proto/proton/oidb';
|
import { OidbBase } from '../proto/proton/oidb';
|
||||||
|
|
||||||
export async function setFriendAddRequest(bridge: Bridge, uidOrFlag: string, approve: boolean): Promise<void> {
|
export async function setFriendAddRequest(bridge: Bridge, uidOrFlag: string, approve: boolean): Promise<void> {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import type {
|
|||||||
OidbRenameMember,
|
OidbRenameMember,
|
||||||
OidbSetAdmin,
|
OidbSetAdmin,
|
||||||
OidbSpecialTitle,
|
OidbSpecialTitle,
|
||||||
} from '../proto/proton/oidb-action';
|
} from '../proto/proton/oidb-actions/base';
|
||||||
|
|
||||||
// ─────────────── mute / un-mute ───────────────
|
// ─────────────── mute / un-mute ───────────────
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import type {
|
|||||||
DoQunLikeResponse,
|
DoQunLikeResponse,
|
||||||
DeleteMediasRequest,
|
DeleteMediasRequest,
|
||||||
DeleteMediasResponse,
|
DeleteMediasResponse,
|
||||||
} from '../proto/proton/oidb-action';
|
} from '../proto/proton/oidb-actions/group-album';
|
||||||
|
|
||||||
export interface GroupAlbumMediaResult {
|
export interface GroupAlbumMediaResult {
|
||||||
mediaList: any[];
|
mediaList: any[];
|
||||||
|
|||||||
@@ -20,13 +20,15 @@ import type {
|
|||||||
OidbGroupFileViewReq,
|
OidbGroupFileViewReq,
|
||||||
OidbGroupFileViewResp,
|
OidbGroupFileViewResp,
|
||||||
OidbGroupSendFileReq,
|
OidbGroupSendFileReq,
|
||||||
|
} from '../proto/proton/oidb-actions/group-file';
|
||||||
|
import type {
|
||||||
OidbPrivateFileDownloadReq,
|
OidbPrivateFileDownloadReq,
|
||||||
OidbPrivateFileDownloadResp,
|
OidbPrivateFileDownloadResp,
|
||||||
OidbPrivateFileUploadReq,
|
OidbPrivateFileUploadReq,
|
||||||
OidbPrivateFileUploadResp,
|
OidbPrivateFileUploadResp,
|
||||||
NTV2RichMediaReq,
|
NTV2RichMediaReq,
|
||||||
NTV2RichMediaResp,
|
NTV2RichMediaResp,
|
||||||
} from '../proto/proton/oidb-action';
|
} from '../proto/proton/oidb-actions/media';
|
||||||
import type { FileUploadExt } from '../proto/proton/highway';
|
import type { FileUploadExt } from '../proto/proton/highway';
|
||||||
import { toHexUpper } from '../../utils/hex';
|
import { toHexUpper } from '../../utils/hex';
|
||||||
import { createLogger } from '../../utils/logger';
|
import { createLogger } from '../../utils/logger';
|
||||||
@@ -579,7 +581,7 @@ export async function uploadPrivateFile(
|
|||||||
// (or whether it returned nothing at all — which would point at
|
// (or whether it returned nothing at all — which would point at
|
||||||
// a request mismatch rather than a missing decoder).
|
// a request mismatch rather than a missing decoder).
|
||||||
const rtpDump = Array.isArray(upload.rtpMediaPlatformUploadAddress)
|
const rtpDump = Array.isArray(upload.rtpMediaPlatformUploadAddress)
|
||||||
? JSON.stringify(upload.rtpMediaPlatformUploadAddress.map((e) => ({
|
? JSON.stringify(upload.rtpMediaPlatformUploadAddress.map((e: any) => ({
|
||||||
outIP: e.outIP, outPort: e.outPort, inIP: e.inIP, inPort: e.inPort,
|
outIP: e.outIP, outPort: e.outPort, inIP: e.inIP, inPort: e.inPort,
|
||||||
iPType: e.iPType,
|
iPType: e.iPType,
|
||||||
})))
|
})))
|
||||||
|
|||||||
@@ -4,24 +4,18 @@
|
|||||||
// without producing a downstream observable event.
|
// without producing a downstream observable event.
|
||||||
|
|
||||||
import type { Bridge } from '../bridge';
|
import type { Bridge } from '../bridge';
|
||||||
import { protoEncode } from '../../protobuf/decode';
|
|
||||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||||
import {
|
import type { C2CRecallRequest, GroupRecallRequest, OidbEssence, SsoReadedReportReq } from '../proto/proton/oidb-actions/base';
|
||||||
C2CRecallRequestSchema,
|
|
||||||
GroupRecallRequestSchema,
|
|
||||||
SsoReadedReportReqSchema,
|
|
||||||
} from '../proto/oidb-action';
|
|
||||||
import type { OidbEssence } from '../proto/proton/oidb-action';
|
|
||||||
import { protobuf_encode } from '@snowluma/proton';
|
import { protobuf_encode } from '@snowluma/proton';
|
||||||
import { OidbBase } from '../proto/proton/oidb';
|
import { OidbBase } from '../proto/proton/oidb';
|
||||||
|
|
||||||
export async function recallGroupMessage(bridge: Bridge, groupId: number, sequence: number): Promise<void> {
|
export async function recallGroupMessage(bridge: Bridge, groupId: number, sequence: number): Promise<void> {
|
||||||
const request = protoEncode({
|
const request = protobuf_encode<GroupRecallRequest>({
|
||||||
type: 1,
|
type: 1,
|
||||||
groupUin: groupId,
|
groupUin: groupId,
|
||||||
info: { sequence, random: 0, field3: 0 },
|
info: { sequence, random: 0, field3: 0 },
|
||||||
settings: { field1: 0 },
|
settings: { field1: 0 },
|
||||||
}, GroupRecallRequestSchema);
|
});
|
||||||
const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoGroupRecallMsg', request);
|
const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoGroupRecallMsg', request);
|
||||||
if (!result.success) throw new Error(result.errorMessage || 'recall group message failed');
|
if (!result.success) throw new Error(result.errorMessage || 'recall group message failed');
|
||||||
}
|
}
|
||||||
@@ -31,7 +25,7 @@ export async function recallPrivateMessage(
|
|||||||
msgSeq: number, random: number, timestamp: number,
|
msgSeq: number, random: number, timestamp: number,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const targetUid = await bridge.resolveUserUid(userUin);
|
const targetUid = await bridge.resolveUserUid(userUin);
|
||||||
const request = protoEncode({
|
const request = protobuf_encode<C2CRecallRequest>({
|
||||||
type: 1,
|
type: 1,
|
||||||
targetUid,
|
targetUid,
|
||||||
info: {
|
info: {
|
||||||
@@ -44,7 +38,7 @@ export async function recallPrivateMessage(
|
|||||||
},
|
},
|
||||||
settings: { field1: false, field2: false },
|
settings: { field1: false, field2: false },
|
||||||
field6: false,
|
field6: false,
|
||||||
}, C2CRecallRequestSchema);
|
});
|
||||||
const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoC2CRecallMsg', request);
|
const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoC2CRecallMsg', request);
|
||||||
if (!result.success) throw new Error(result.errorMessage || 'recall private message failed');
|
if (!result.success) throw new Error(result.errorMessage || 'recall private message failed');
|
||||||
}
|
}
|
||||||
@@ -57,7 +51,7 @@ export async function markPrivateMessageRead(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const uid = await bridge.resolveUserUid(userId);
|
const uid = await bridge.resolveUserUid(userId);
|
||||||
|
|
||||||
const request = protoEncode({
|
const request = protobuf_encode<SsoReadedReportReq>({
|
||||||
c2cList: [
|
c2cList: [
|
||||||
{
|
{
|
||||||
uid,
|
uid,
|
||||||
@@ -65,7 +59,7 @@ export async function markPrivateMessageRead(
|
|||||||
lastReadSeq: BigInt(msgSeq),
|
lastReadSeq: BigInt(msgSeq),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}, SsoReadedReportReqSchema);
|
});
|
||||||
|
|
||||||
const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoReadedReport', request);
|
const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoReadedReport', request);
|
||||||
|
|
||||||
@@ -79,14 +73,14 @@ export async function markGroupMessageRead(
|
|||||||
groupId: number,
|
groupId: number,
|
||||||
msgSeq: number,
|
msgSeq: number,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const request = protoEncode({
|
const request = protobuf_encode<SsoReadedReportReq>({
|
||||||
groupList: [
|
groupList: [
|
||||||
{
|
{
|
||||||
groupUin: BigInt(groupId),
|
groupUin: BigInt(groupId),
|
||||||
lastReadSeq: BigInt(msgSeq),
|
lastReadSeq: BigInt(msgSeq),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}, SsoReadedReportReqSchema);
|
});
|
||||||
|
|
||||||
const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoReadedReport', request);
|
const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoReadedReport', request);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import type {
|
|||||||
OidbGroupReaction,
|
OidbGroupReaction,
|
||||||
OidbLike,
|
OidbLike,
|
||||||
OidbPoke,
|
OidbPoke,
|
||||||
} from '../proto/proton/oidb-action';
|
} from '../proto/proton/oidb-actions/base';
|
||||||
import { OidbBase } from '../proto/proton/oidb';
|
import { OidbBase } from '../proto/proton/oidb';
|
||||||
|
|
||||||
export async function sendPoke(bridge: Bridge, isGroup: boolean, peerUin: number, targetUin?: number): Promise<void> {
|
export async function sendPoke(bridge: Bridge, isGroup: boolean, peerUin: number, targetUin?: number): Promise<void> {
|
||||||
|
|||||||
@@ -3,20 +3,17 @@
|
|||||||
// related siblings, lift the whole group out into its own file.
|
// related siblings, lift the whole group out into its own file.
|
||||||
|
|
||||||
import type { Bridge } from '../bridge';
|
import type { Bridge } from '../bridge';
|
||||||
import { protoDecode, protoEncode } from '../../protobuf/decode';
|
|
||||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||||
import {
|
|
||||||
MiniAppShareReqSchema,
|
|
||||||
MiniAppShareRespSchema,
|
|
||||||
} from '../proto/oidb-action';
|
|
||||||
import type {
|
import type {
|
||||||
|
MiniAppShareReq,
|
||||||
|
MiniAppShareResp,
|
||||||
Oidb0x112eReq,
|
Oidb0x112eReq,
|
||||||
Oidb0x112eResp,
|
Oidb0x112eResp,
|
||||||
Oidb0x990Req,
|
Oidb0x990Req,
|
||||||
Oidb0x990Resp,
|
Oidb0x990Resp,
|
||||||
Oidb0xeb7Req,
|
Oidb0xeb7Req,
|
||||||
Oidb0xeb7Resp,
|
Oidb0xeb7Resp,
|
||||||
} from '../proto/proton/oidb-action';
|
} from '../proto/proton/oidb-actions/base';
|
||||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||||
import { OidbBase } from '../proto/proton/oidb';
|
import { OidbBase } from '../proto/proton/oidb';
|
||||||
|
|
||||||
@@ -64,7 +61,7 @@ export async function getMiniAppArk(
|
|||||||
throw new Error(`unsupported type: ${type}, only support bili and weibo`);
|
throw new Error(`unsupported type: ${type}, only support bili and weibo`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const request = protoEncode({
|
const request = protobuf_encode<MiniAppShareReq>({
|
||||||
sdkVersion: 'V1_PC_MINISDK_99.99.99_1_APP_A',
|
sdkVersion: 'V1_PC_MINISDK_99.99.99_1_APP_A',
|
||||||
body: {
|
body: {
|
||||||
appid,
|
appid,
|
||||||
@@ -74,7 +71,7 @@ export async function getMiniAppArk(
|
|||||||
jumpUrl,
|
jumpUrl,
|
||||||
iconUrl,
|
iconUrl,
|
||||||
},
|
},
|
||||||
}, MiniAppShareReqSchema);
|
});
|
||||||
|
|
||||||
const result = await bridge.sendRawPacket('LightAppSvc.mini_app_share.AdaptShareInfo', request);
|
const result = await bridge.sendRawPacket('LightAppSvc.mini_app_share.AdaptShareInfo', request);
|
||||||
|
|
||||||
@@ -82,7 +79,7 @@ export async function getMiniAppArk(
|
|||||||
throw new Error(result.errorMessage || 'get mini app ark failed');
|
throw new Error(result.errorMessage || 'get mini app ark failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
const decoded = protoDecode(result.responseData, MiniAppShareRespSchema);
|
const decoded = protobuf_decode<MiniAppShareResp>(result.responseData);
|
||||||
const jsonStr = decoded?.body?.jsonStr;
|
const jsonStr = decoded?.body?.jsonStr;
|
||||||
|
|
||||||
if (!jsonStr) {
|
if (!jsonStr) {
|
||||||
|
|||||||
@@ -3,18 +3,13 @@
|
|||||||
// All of these read/write fields on the self-uin via OIDB.
|
// All of these read/write fields on the self-uin via OIDB.
|
||||||
|
|
||||||
import type { Bridge } from '../bridge';
|
import type { Bridge } from '../bridge';
|
||||||
import { protoDecode, protoEncode } from '../../protobuf/decode';
|
|
||||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||||
import { fetchHighwaySession, uploadHighwayHttp } from '../highway/highway-client';
|
import { fetchHighwaySession, uploadHighwayHttp } from '../highway/highway-client';
|
||||||
import { computeHashes, loadBinarySource } from '../highway/utils';
|
import { computeHashes, loadBinarySource } from '../highway/utils';
|
||||||
import {
|
|
||||||
FaceroamOpReqSchema,
|
|
||||||
FaceroamOpRespSchema,
|
|
||||||
GroupAvatarExtraSchema,
|
|
||||||
SetStatusReqSchema,
|
|
||||||
SetStatusRespSchema,
|
|
||||||
} from '../proto/oidb-action';
|
|
||||||
import type {
|
import type {
|
||||||
|
FaceroamOpReq,
|
||||||
|
FaceroamOpResp,
|
||||||
|
GroupAvatarExtra,
|
||||||
Oidb0x112aReq,
|
Oidb0x112aReq,
|
||||||
Oidb0x112aResp,
|
Oidb0x112aResp,
|
||||||
Oidb0x7edReq,
|
Oidb0x7edReq,
|
||||||
@@ -24,7 +19,9 @@ import type {
|
|||||||
Oidb0xe17Req,
|
Oidb0xe17Req,
|
||||||
Oidb0xe17Resp,
|
Oidb0xe17Resp,
|
||||||
OidbSetProfile,
|
OidbSetProfile,
|
||||||
} from '../proto/proton/oidb-action';
|
SetStatusReq,
|
||||||
|
SetStatusResp,
|
||||||
|
} from '../proto/proton/oidb-actions/base';
|
||||||
import { resolveSelfUid } from './shared';
|
import { resolveSelfUid } from './shared';
|
||||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||||
import { OidbBase } from '../proto/proton/oidb';
|
import { OidbBase } from '../proto/proton/oidb';
|
||||||
@@ -69,7 +66,7 @@ async function dispatchSetStatus(
|
|||||||
customExt?: { faceId: number; text: string; faceType: number };
|
customExt?: { faceId: number; text: string; faceType: number };
|
||||||
},
|
},
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const request = protoEncode(value, SetStatusReqSchema);
|
const request = protobuf_encode<SetStatusReq>(value);
|
||||||
|
|
||||||
const result = await bridge.sendRawPacket('trpc.qq_new_tech.status_svc.StatusService.SetStatus', request);
|
const result = await bridge.sendRawPacket('trpc.qq_new_tech.status_svc.StatusService.SetStatus', request);
|
||||||
|
|
||||||
@@ -78,7 +75,7 @@ async function dispatchSetStatus(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result.responseData && result.responseData.length > 0) {
|
if (result.responseData && result.responseData.length > 0) {
|
||||||
const resp = protoDecode(result.responseData, SetStatusRespSchema);
|
const resp = protobuf_decode<SetStatusResp>(result.responseData);
|
||||||
if (!resp) {
|
if (!resp) {
|
||||||
throw new Error(result.errorMessage || 'set online status failed (network/timeout)');
|
throw new Error(result.errorMessage || 'set online status failed (network/timeout)');
|
||||||
}
|
}
|
||||||
@@ -193,13 +190,13 @@ export async function setGroupAvatar(
|
|||||||
|
|
||||||
const hashes = computeHashes(loaded.bytes);
|
const hashes = computeHashes(loaded.bytes);
|
||||||
const session = await fetchHighwaySession(bridge);
|
const session = await fetchHighwaySession(bridge);
|
||||||
const extra = protoEncode({
|
const extra = protobuf_encode<GroupAvatarExtra>({
|
||||||
type: 101,
|
type: 101,
|
||||||
groupUin: groupId,
|
groupUin: groupId,
|
||||||
field3: { field1: 1 },
|
field3: { field1: 1 },
|
||||||
field5: 3,
|
field5: 3,
|
||||||
field6: 1,
|
field6: 1,
|
||||||
}, GroupAvatarExtraSchema);
|
});
|
||||||
await uploadHighwayHttp(bridge, session, 3000, loaded.bytes, hashes.md5, extra);
|
await uploadHighwayHttp(bridge, session, 3000, loaded.bytes, hashes.md5, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,12 +287,12 @@ export async function fetchCustomFace(bridge: Bridge, count: number = 10): Promi
|
|||||||
field3: 1,
|
field3: 1,
|
||||||
field6: 1,
|
field6: 1,
|
||||||
};
|
};
|
||||||
const request = protoEncode(req, FaceroamOpReqSchema);
|
const request = protobuf_encode<FaceroamOpReq>(req);
|
||||||
const result = await bridge.sendRawPacket('Faceroam.OpReq', request);
|
const result = await bridge.sendRawPacket('Faceroam.OpReq', request);
|
||||||
if (!result.success || !result.gotResponse || !result.responseData) {
|
if (!result.success || !result.gotResponse || !result.responseData) {
|
||||||
throw new Error(result.errorMessage || 'fetch custom face failed');
|
throw new Error(result.errorMessage || 'fetch custom face failed');
|
||||||
}
|
}
|
||||||
const resp = protoDecode(result.responseData, FaceroamOpRespSchema);
|
const resp = protobuf_decode<FaceroamOpResp>(result.responseData);
|
||||||
if (!resp || (resp as any).retCode !== 0) {
|
if (!resp || (resp as any).retCode !== 0) {
|
||||||
throw new Error(`fetch custom face error: ${(resp as any)?.message || 'unknown'}`);
|
throw new Error(`fetch custom face error: ${(resp as any)?.message || 'unknown'}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
import type { Bridge } from './bridge';
|
import type { Bridge } from './bridge';
|
||||||
import type { DownloadRKeyInfo } from './bridge';
|
import type { DownloadRKeyInfo } from './bridge';
|
||||||
import type { FriendInfo, QQGroupInfo, GroupMemberInfo, UserProfileInfo, GroupRequestInfo } from './qq-info';
|
import type { FriendInfo, QQGroupInfo, GroupMemberInfo, UserProfileInfo, GroupRequestInfo } from './qq-info';
|
||||||
import { protoDecode } from '../protobuf/decode';
|
|
||||||
import { runOidb, makeOidbEnvelope } from './bridge-oidb';
|
import { runOidb, makeOidbEnvelope } from './bridge-oidb';
|
||||||
import { AvatarInfoSchema } from './proto/oidb-action';
|
|
||||||
import type {
|
import type {
|
||||||
OidbSvcTrpcTcp0xFD4_1Response,
|
OidbSvcTrpcTcp0xFD4_1Response,
|
||||||
OidbSvcTrpcTcp0xFE5_2Response,
|
OidbSvcTrpcTcp0xFE5_2Response,
|
||||||
@@ -20,9 +18,12 @@ import type {
|
|||||||
OidbUserInfoRequest,
|
OidbUserInfoRequest,
|
||||||
OidbUserInfoResponse,
|
OidbUserInfoResponse,
|
||||||
OidbGroupRequestList,
|
OidbGroupRequestList,
|
||||||
|
AvatarInfo,
|
||||||
|
} from './proto/proton/oidb-actions/base';
|
||||||
|
import type {
|
||||||
NTV2RichMediaReq,
|
NTV2RichMediaReq,
|
||||||
NTV2RichMediaResp,
|
NTV2RichMediaResp,
|
||||||
} from './proto/proton/oidb-action';
|
} from './proto/proton/oidb-actions/media';
|
||||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -261,7 +262,7 @@ export async function fetchUserProfile(bridge: Bridge, uin: number): Promise<Use
|
|||||||
|
|
||||||
const avatarBytes = bytesMap.get(101);
|
const avatarBytes = bytesMap.get(101);
|
||||||
if (avatarBytes) {
|
if (avatarBytes) {
|
||||||
const av = protoDecode(avatarBytes, AvatarInfoSchema);
|
const av = protobuf_decode<AvatarInfo>(avatarBytes);
|
||||||
if (av?.url) info.avatar = av.url + '640';
|
if (av?.url) info.avatar = av.url + '640';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ export class Bridge implements BridgeInterface {
|
|||||||
if (!response) {
|
if (!response) {
|
||||||
throw new Error('failed to decode SendMessageResponse');
|
throw new Error('failed to decode SendMessageResponse');
|
||||||
}
|
}
|
||||||
if (response.result !== undefined && response.result !== 0) {
|
if (response.result != null && response.result !== 0) {
|
||||||
throw new Error(`send group message rejected: result=${response.result} err=${response.errMsg ?? ''}`);
|
throw new Error(`send group message rejected: result=${response.result} err=${response.errMsg ?? ''}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,7 +455,7 @@ export class Bridge implements BridgeInterface {
|
|||||||
if (!response) {
|
if (!response) {
|
||||||
throw new Error('failed to decode SendMessageResponse');
|
throw new Error('failed to decode SendMessageResponse');
|
||||||
}
|
}
|
||||||
if (response.result !== undefined && response.result !== 0) {
|
if (response.result != null && response.result !== 0) {
|
||||||
throw new Error(`send private message rejected: result=${response.result} err=${response.errMsg ?? ''}`);
|
throw new Error(`send private message rejected: result=${response.result} err=${response.errMsg ?? ''}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,7 +569,7 @@ export class Bridge implements BridgeInterface {
|
|||||||
if (!response) {
|
if (!response) {
|
||||||
throw new Error('failed to decode SendMessageResponse');
|
throw new Error('failed to decode SendMessageResponse');
|
||||||
}
|
}
|
||||||
if (response.result !== undefined && response.result !== 0) {
|
if (response.result != null && response.result !== 0) {
|
||||||
throw new Error(`send c2c file message rejected: result=${response.result} err=${response.errMsg ?? ''}`);
|
throw new Error(`send c2c file message rejected: result=${response.result} err=${response.errMsg ?? ''}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,21 @@
|
|||||||
// Element Builder — converts internal MessageElement[] into proto Elem objects
|
// Element Builder — converts internal MessageElement[] into proto Elem objects
|
||||||
// for encoding with protoEncode(SendMessageRequestSchema).
|
// for encoding with protobuf_encode<SendMessageRequest>.
|
||||||
// Port of src/bridge/src/bridge_messages.cpp build_send_elems()
|
// Port of src/bridge/src/bridge_messages.cpp build_send_elems()
|
||||||
|
|
||||||
import type { Bridge } from './bridge';
|
import type { Bridge } from './bridge';
|
||||||
import type { MessageElement } from './events';
|
import type { MessageElement } from './events';
|
||||||
import type { ProtoDecoded } from '../protobuf/decode';
|
|
||||||
import { protobuf_encode } from '@snowluma/proton';
|
import { protobuf_encode } from '@snowluma/proton';
|
||||||
import {
|
|
||||||
ElemSchema,
|
|
||||||
} from './proto/element';
|
|
||||||
import type {
|
import type {
|
||||||
MentionExtraSend,
|
MentionExtraSend,
|
||||||
MarkdownData,
|
MarkdownData,
|
||||||
} from './proto/proton/action';
|
} from './proto/proton/action';
|
||||||
import type { GroupFileExtra } from './proto/proton/element';
|
import type { Elem, GroupFileExtra } from './proto/proton/element';
|
||||||
import { uploadImageMsgInfo } from './highway/image-upload';
|
import { uploadImageMsgInfo } from './highway/image-upload';
|
||||||
import { uploadPttMsgInfo } from './highway/ptt-upload';
|
import { uploadPttMsgInfo } from './highway/ptt-upload';
|
||||||
import { uploadVideoMsgInfo } from './highway/video-upload';
|
import { uploadVideoMsgInfo } from './highway/video-upload';
|
||||||
import { hexToBytes } from './highway/pipeline';
|
import { hexToBytes } from './highway/pipeline';
|
||||||
|
|
||||||
type ProtoElem = Partial<ProtoDecoded<typeof ElemSchema>>;
|
type ProtoElem = Partial<Elem>;
|
||||||
|
|
||||||
export interface SendContext {
|
export interface SendContext {
|
||||||
bridge: Bridge;
|
bridge: Bridge;
|
||||||
|
|||||||
@@ -2,17 +2,14 @@
|
|||||||
// One unified shape: notice decoders pick from `content`, message decoders
|
// One unified shape: notice decoders pick from `content`, message decoders
|
||||||
// pick from `body` / `responseHead`. Decoders ignore fields they don't need.
|
// pick from `body` / `responseHead`. Decoders ignore fields they don't need.
|
||||||
|
|
||||||
import { protoDecode } from '../../protobuf/decode';
|
import { protobuf_decode } from '@snowluma/proton';
|
||||||
import type { ProtoDecoded } from '../../protobuf/decode';
|
import type { ContentHead, MessageBody, PushMsg, ResponseHead } from '../proto/proton/message';
|
||||||
import {
|
|
||||||
PushMsgSchema, MessageBodySchema, ResponseHeadSchema, ContentHeadSchema,
|
|
||||||
} from '../proto/message';
|
|
||||||
import type { PacketInfo } from '../../protocol/types';
|
import type { PacketInfo } from '../../protocol/types';
|
||||||
import type { IdentityService } from '../identity-service';
|
import type { IdentityService } from '../identity-service';
|
||||||
|
|
||||||
export type PushMsgBody = ProtoDecoded<typeof MessageBodySchema>;
|
export type PushMsgBody = MessageBody;
|
||||||
export type PushMsgResponseHead = ProtoDecoded<typeof ResponseHeadSchema>;
|
export type PushMsgResponseHead = ResponseHead;
|
||||||
export type PushMsgContentHead = ProtoDecoded<typeof ContentHeadSchema>;
|
export type PushMsgContentHead = ContentHead;
|
||||||
|
|
||||||
export interface MsgPushHead {
|
export interface MsgPushHead {
|
||||||
readonly msgType: number;
|
readonly msgType: number;
|
||||||
@@ -36,7 +33,7 @@ export interface MsgPushContext {
|
|||||||
export function buildContext(pkt: PacketInfo, identity: IdentityService): MsgPushContext | null {
|
export function buildContext(pkt: PacketInfo, identity: IdentityService): MsgPushContext | null {
|
||||||
if (pkt.body.length === 0) return null;
|
if (pkt.body.length === 0) return null;
|
||||||
|
|
||||||
const push = protoDecode(Buffer.from(pkt.body), PushMsgSchema);
|
const push = protobuf_decode<PushMsg>(Buffer.from(pkt.body));
|
||||||
if (!push?.message) return null;
|
if (!push?.message) return null;
|
||||||
|
|
||||||
const msg = push.message;
|
const msg = push.message;
|
||||||
|
|||||||
@@ -4,23 +4,24 @@
|
|||||||
// lookups, no I/O. The single small interface `decodeRichBody` hides
|
// lookups, no I/O. The single small interface `decodeRichBody` hides
|
||||||
// ~400 lines of per-element-type decoding behind it.
|
// ~400 lines of per-element-type decoding behind it.
|
||||||
|
|
||||||
import { protoDecode } from '../../protobuf/decode';
|
import { protobuf_decode } from '@snowluma/proton';
|
||||||
import type { ProtoDecoded } from '../../protobuf/decode';
|
import type {
|
||||||
import { ElemSchema } from '../proto/element';
|
Elem,
|
||||||
import {
|
GroupFileExtra,
|
||||||
MentionExtraSchema, QFaceExtraSchema, QSmallFaceExtraSchema,
|
MentionExtra,
|
||||||
MsgInfoSchema, GroupFileExtraSchema, NotOnlineImageSchema,
|
MsgInfo,
|
||||||
} from '../proto/element';
|
NotOnlineImage,
|
||||||
import {
|
QFaceExtra,
|
||||||
MessageBodySchema, RichTextSchema, FileExtraSchema,
|
QSmallFaceExtra,
|
||||||
} from '../proto/message';
|
} from '../proto/proton/element';
|
||||||
|
import type { FileExtra, MessageBody, RichText } from '../proto/proton/message';
|
||||||
import type { MessageElement } from '../events';
|
import type { MessageElement } from '../events';
|
||||||
import { toHexUpper } from '../../utils/hex';
|
import { toHexUpper } from '../../utils/hex';
|
||||||
import { decompressData, makeImageUrl } from './helpers';
|
import { decompressData, makeImageUrl } from './helpers';
|
||||||
|
|
||||||
type ElemDecoded = ProtoDecoded<typeof ElemSchema>;
|
type ElemDecoded = Elem;
|
||||||
type RichTextDecoded = ProtoDecoded<typeof RichTextSchema>;
|
type RichTextDecoded = RichText;
|
||||||
export type PushMsgBody = ProtoDecoded<typeof MessageBodySchema>;
|
export type PushMsgBody = MessageBody;
|
||||||
|
|
||||||
export function decodeRichBody(body: PushMsgBody | undefined, isGroup: boolean): MessageElement[] {
|
export function decodeRichBody(body: PushMsgBody | undefined, isGroup: boolean): MessageElement[] {
|
||||||
const elements: MessageElement[] = [];
|
const elements: MessageElement[] = [];
|
||||||
@@ -50,9 +51,9 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] {
|
|||||||
// Text (with possible @ detection)
|
// Text (with possible @ detection)
|
||||||
if (elem.text) {
|
if (elem.text) {
|
||||||
const t = elem.text;
|
const t = elem.text;
|
||||||
let mention: ProtoDecoded<typeof MentionExtraSchema> | null = null;
|
let mention: MentionExtra | null = null;
|
||||||
if (t.pbReserve && t.pbReserve.length > 0) {
|
if (t.pbReserve && t.pbReserve.length > 0) {
|
||||||
mention = protoDecode(t.pbReserve, MentionExtraSchema);
|
mention = protobuf_decode<MentionExtra>(t.pbReserve);
|
||||||
}
|
}
|
||||||
const hasAttr6 = t.attr6Buf && t.attr6Buf.length > 11;
|
const hasAttr6 = t.attr6Buf && t.attr6Buf.length > 11;
|
||||||
const hasMention = mention && (mention.type === 1 || mention.type === 2);
|
const hasMention = mention && (mention.type === 1 || mention.type === 2);
|
||||||
@@ -172,7 +173,7 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] {
|
|||||||
const val = te.elemValue;
|
const val = te.elemValue;
|
||||||
const len = (val[1] << 8) | val[2];
|
const len = (val[1] << 8) | val[2];
|
||||||
if (val.length >= 3 + len) {
|
if (val.length >= 3 + len) {
|
||||||
const extra = protoDecode(val.subarray(3, 3 + len), GroupFileExtraSchema);
|
const extra = protobuf_decode<GroupFileExtra>(val.subarray(3, 3 + len));
|
||||||
if (extra?.inner?.info) {
|
if (extra?.inner?.info) {
|
||||||
const info = extra.inner.info;
|
const info = extra.inner.info;
|
||||||
result.push({
|
result.push({
|
||||||
@@ -243,7 +244,7 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] {
|
|||||||
if ((b & 0x80) === 0) break;
|
if ((b & 0x80) === 0) break;
|
||||||
}
|
}
|
||||||
if (pos + length <= pb.length) {
|
if (pos + length <= pb.length) {
|
||||||
const img = protoDecode(pb.subarray(pos, pos + length), NotOnlineImageSchema);
|
const img = protobuf_decode<NotOnlineImage>(pb.subarray(pos, pos + length));
|
||||||
if (img) {
|
if (img) {
|
||||||
const me: MessageElement = {
|
const me: MessageElement = {
|
||||||
type: 'image', fileId: img.filePath ?? '',
|
type: 'image', fileId: img.filePath ?? '',
|
||||||
@@ -260,7 +261,7 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] {
|
|||||||
skipNext = true;
|
skipNext = true;
|
||||||
} else if (ce.pbElem && (svcType === 48 || bizType === 10 || bizType === 20 || bizType === 11 || bizType === 21 || bizType === 12 || bizType === 22)) {
|
} else if (ce.pbElem && (svcType === 48 || bizType === 10 || bizType === 20 || bizType === 11 || bizType === 21 || bizType === 12 || bizType === 22)) {
|
||||||
// NTQQ new protocol image/record/video
|
// NTQQ new protocol image/record/video
|
||||||
const info = protoDecode(ce.pbElem, MsgInfoSchema);
|
const info = protobuf_decode<MsgInfo>(ce.pbElem);
|
||||||
if (info?.msgInfoBody && info.msgInfoBody.length > 0) {
|
if (info?.msgInfoBody && info.msgInfoBody.length > 0) {
|
||||||
const body = info.msgInfoBody[0];
|
const body = info.msgInfoBody[0];
|
||||||
if (body.index?.info) {
|
if (body.index?.info) {
|
||||||
@@ -368,11 +369,11 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] {
|
|||||||
}
|
}
|
||||||
} else if (svcType === 33 && ce.pbElem) {
|
} else if (svcType === 33 && ce.pbElem) {
|
||||||
// Small face
|
// Small face
|
||||||
const extra = protoDecode(ce.pbElem, QSmallFaceExtraSchema);
|
const extra = protobuf_decode<QSmallFaceExtra>(ce.pbElem);
|
||||||
if (extra) result.push({ type: 'face', faceId: extra.faceId ?? 0 });
|
if (extra) result.push({ type: 'face', faceId: extra.faceId ?? 0 });
|
||||||
} else if (svcType === 37 && ce.pbElem) {
|
} else if (svcType === 37 && ce.pbElem) {
|
||||||
// Big face
|
// Big face
|
||||||
const extra = protoDecode(ce.pbElem, QFaceExtraSchema);
|
const extra = protobuf_decode<QFaceExtra>(ce.pbElem);
|
||||||
if (extra?.qsid !== undefined) result.push({ type: 'face', faceId: extra.qsid });
|
if (extra?.qsid !== undefined) result.push({ type: 'face', faceId: extra.qsid });
|
||||||
skipNext = true;
|
skipNext = true;
|
||||||
}
|
}
|
||||||
@@ -443,7 +444,7 @@ function extractMsgContent(msgContent: Uint8Array, elements: MessageElement[]):
|
|||||||
// "incomplete metadata". After consolidating FileExtra to wrap
|
// "incomplete metadata". After consolidating FileExtra to wrap
|
||||||
// `NotOnlineFile` (Lagrange.Core's `FileExtra { File: NotOnlineFile }`),
|
// `NotOnlineFile` (Lagrange.Core's `FileExtra { File: NotOnlineFile }`),
|
||||||
// this reads the right tags.
|
// this reads the right tags.
|
||||||
const extra = protoDecode(msgContent, FileExtraSchema);
|
const extra = protobuf_decode<FileExtra>(msgContent);
|
||||||
if (!extra?.file) return;
|
if (!extra?.file) return;
|
||||||
const f = extra.file;
|
const f = extra.file;
|
||||||
if (!f.fileUuid) return;
|
if (!f.fileUuid) return;
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
import type { ProtoSchema } from '../../protobuf/decode';
|
|
||||||
import { ElemSchema } from './element';
|
|
||||||
|
|
||||||
// --- Routing ---
|
|
||||||
|
|
||||||
export const RoutingC2CSchema = {
|
|
||||||
uin: { field: 1, type: 'uint32' as const },
|
|
||||||
uid: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const RoutingGroupSchema = {
|
|
||||||
groupCode: { field: 1, type: 'uint64' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// `Trans0x211` is the c2c-file scene's routing header (Lagrange.Core
|
|
||||||
// `Routing/Trans0X211.cs`). See proton/action.ts:RoutingTrans0x211
|
|
||||||
// for the rationale — c2c file sends *must* route through this slot,
|
|
||||||
// not `c2c`, or the server rejects them.
|
|
||||||
export const RoutingTrans0x211Schema = {
|
|
||||||
toUin: { field: 1, type: 'uint64' as const },
|
|
||||||
ccCmd: { field: 2, type: 'uint32' as const },
|
|
||||||
uid: { field: 8, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const RoutingHeadSchema = {
|
|
||||||
c2c: { field: 1, type: 'message' as const, schema: RoutingC2CSchema },
|
|
||||||
grp: { field: 2, type: 'message' as const, schema: RoutingGroupSchema },
|
|
||||||
trans0x211: { field: 15, type: 'message' as const, schema: RoutingTrans0x211Schema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Content Head (for send) ---
|
|
||||||
|
|
||||||
export const SendContentHeadSchema = {
|
|
||||||
type: { field: 1, type: 'uint32' as const },
|
|
||||||
subType: { field: 2, type: 'uint32' as const },
|
|
||||||
c2cCmd: { field: 3, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Message Control ---
|
|
||||||
|
|
||||||
export const MessageControlSchema = {
|
|
||||||
msgFlag: { field: 1, type: 'int32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- RichText (for send — only elems) ---
|
|
||||||
|
|
||||||
export const SendRichTextSchema = {
|
|
||||||
elems: { field: 2, type: 'repeated_message' as const, schema: ElemSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- MessageBody (for send) ---
|
|
||||||
|
|
||||||
export const SendMessageBodySchema = {
|
|
||||||
richText: { field: 1, type: 'message' as const, schema: SendRichTextSchema },
|
|
||||||
// C2C file payload — serialised `FileExtra { file: NotOnlineFile }`
|
|
||||||
// bytes. See proton/action.ts:SendMessageBody for the WHY.
|
|
||||||
msgContent: { field: 2, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- SendMessageRequest ---
|
|
||||||
|
|
||||||
export const SendMessageRequestSchema = {
|
|
||||||
routingHead: { field: 1, type: 'message' as const, schema: RoutingHeadSchema },
|
|
||||||
contentHead: { field: 2, type: 'message' as const, schema: SendContentHeadSchema },
|
|
||||||
messageBody: { field: 3, type: 'message' as const, schema: SendMessageBodySchema },
|
|
||||||
clientSequence: { field: 4, type: 'uint32' as const },
|
|
||||||
random: { field: 5, type: 'uint32' as const },
|
|
||||||
syncCookie: { field: 6, type: 'bytes' as const },
|
|
||||||
via: { field: 8, type: 'uint32' as const },
|
|
||||||
dataStatist: { field: 9, type: 'uint32' as const },
|
|
||||||
ctrl: { field: 12, type: 'message' as const, schema: MessageControlSchema },
|
|
||||||
multiSendSeq: { field: 14, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- SendMessageResponse ---
|
|
||||||
|
|
||||||
export const SendMessageResponseSchema = {
|
|
||||||
result: { field: 1, type: 'int32' as const },
|
|
||||||
errMsg: { field: 2, type: 'string' as const },
|
|
||||||
timestamp1: { field: 3, type: 'uint32' as const },
|
|
||||||
field10: { field: 10, type: 'uint32' as const },
|
|
||||||
groupSequence: { field: 11, type: 'uint32' as const },
|
|
||||||
timestamp2: { field: 12, type: 'uint32' as const },
|
|
||||||
privateSequence: { field: 14, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- MentionExtra (for building @mention text element) ---
|
|
||||||
|
|
||||||
export const MentionExtraSendSchema = {
|
|
||||||
type: { field: 3, type: 'int32' as const },
|
|
||||||
uin: { field: 4, type: 'uint32' as const },
|
|
||||||
field5: { field: 5, type: 'int32' as const },
|
|
||||||
uid: { field: 9, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- MarkdownData ---
|
|
||||||
|
|
||||||
export const MarkdownDataSchema = {
|
|
||||||
content: { field: 1, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
@@ -1,428 +0,0 @@
|
|||||||
// Proto schemas for QQ message elements.
|
|
||||||
// Port of src/bridge/include/bridge/proto/element.h
|
|
||||||
|
|
||||||
import type { ProtoSchema } from '../../protobuf/decode';
|
|
||||||
|
|
||||||
// --- Nested / helper schemas ---
|
|
||||||
|
|
||||||
export const CustomFacePbReserveSchema = {
|
|
||||||
subType: { field: 1, type: 'int32' as const },
|
|
||||||
summary: { field: 9, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NotOnlineImagePbReserve2Schema = {
|
|
||||||
field1: { field: 1, type: 'int32' as const },
|
|
||||||
field2: { field: 2, type: 'string' as const },
|
|
||||||
field3: { field: 3, type: 'int32' as const },
|
|
||||||
field4: { field: 4, type: 'int32' as const },
|
|
||||||
field5: { field: 5, type: 'int32' as const },
|
|
||||||
field7: { field: 7, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NotOnlineImagePbReserveSchema = {
|
|
||||||
subType: { field: 1, type: 'int32' as const },
|
|
||||||
field3: { field: 3, type: 'int32' as const },
|
|
||||||
field4: { field: 4, type: 'int32' as const },
|
|
||||||
summary: { field: 8, type: 'string' as const },
|
|
||||||
field10: { field: 10, type: 'int32' as const },
|
|
||||||
field20: { field: 20, type: 'message' as const, schema: NotOnlineImagePbReserve2Schema },
|
|
||||||
url: { field: 30, type: 'string' as const },
|
|
||||||
md5Str: { field: 31, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Core element schemas ---
|
|
||||||
|
|
||||||
export const TextElemSchema = {
|
|
||||||
str: { field: 1, type: 'string' as const },
|
|
||||||
link: { field: 2, type: 'string' as const },
|
|
||||||
attr6Buf: { field: 3, type: 'bytes' as const },
|
|
||||||
attr7Buf: { field: 4, type: 'bytes' as const },
|
|
||||||
buf: { field: 11, type: 'bytes' as const },
|
|
||||||
pbReserve: { field: 12, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FaceElemSchema = {
|
|
||||||
index: { field: 1, type: 'int32' as const },
|
|
||||||
oldData: { field: 2, type: 'bytes' as const },
|
|
||||||
buf: { field: 11, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OnlineImageSchema = {
|
|
||||||
guid: { field: 1, type: 'bytes' as const },
|
|
||||||
filePath: { field: 2, type: 'bytes' as const },
|
|
||||||
oldVerSendFile: { field: 3, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NotOnlineImageSchema = {
|
|
||||||
filePath: { field: 1, type: 'string' as const },
|
|
||||||
fileLen: { field: 2, type: 'uint32' as const },
|
|
||||||
downloadPath: { field: 3, type: 'string' as const },
|
|
||||||
oldVerSendFile: { field: 4, type: 'bytes' as const },
|
|
||||||
imgType: { field: 5, type: 'int32' as const },
|
|
||||||
previewsImage: { field: 6, type: 'bytes' as const },
|
|
||||||
picMd5: { field: 7, type: 'bytes' as const },
|
|
||||||
picHeight: { field: 8, type: 'uint32' as const },
|
|
||||||
picWidth: { field: 9, type: 'uint32' as const },
|
|
||||||
resId: { field: 10, type: 'string' as const },
|
|
||||||
flag: { field: 11, type: 'bytes' as const },
|
|
||||||
thumbUrl: { field: 12, type: 'string' as const },
|
|
||||||
original: { field: 13, type: 'int32' as const },
|
|
||||||
bigUrl: { field: 14, type: 'string' as const },
|
|
||||||
origUrl: { field: 15, type: 'string' as const },
|
|
||||||
bizType: { field: 16, type: 'int32' as const },
|
|
||||||
result: { field: 17, type: 'int32' as const },
|
|
||||||
index: { field: 18, type: 'int32' as const },
|
|
||||||
opFaceBuf: { field: 19, type: 'bytes' as const },
|
|
||||||
oldPicMd5: { field: 20, type: 'bool' as const },
|
|
||||||
thumbWidth: { field: 21, type: 'int32' as const },
|
|
||||||
thumbHeight: { field: 22, type: 'int32' as const },
|
|
||||||
fileId: { field: 23, type: 'int32' as const },
|
|
||||||
showLen: { field: 24, type: 'uint32' as const },
|
|
||||||
downloadLen: { field: 25, type: 'uint32' as const },
|
|
||||||
x400Url: { field: 26, type: 'string' as const },
|
|
||||||
x400Width: { field: 27, type: 'int32' as const },
|
|
||||||
x400Height: { field: 28, type: 'int32' as const },
|
|
||||||
pbRes: { field: 29, type: 'message' as const, schema: NotOnlineImagePbReserveSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const TransElemSchema = {
|
|
||||||
elemType: { field: 1, type: 'int32' as const },
|
|
||||||
elemValue: { field: 2, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const MarketFaceSchema = {
|
|
||||||
faceName: { field: 1, type: 'string' as const },
|
|
||||||
itemType: { field: 2, type: 'uint32' as const },
|
|
||||||
faceInfo: { field: 3, type: 'uint32' as const },
|
|
||||||
faceId: { field: 4, type: 'bytes' as const },
|
|
||||||
tabId: { field: 5, type: 'uint32' as const },
|
|
||||||
subType: { field: 6, type: 'uint32' as const },
|
|
||||||
key: { field: 7, type: 'bytes' as const },
|
|
||||||
param: { field: 8, type: 'bytes' as const },
|
|
||||||
mediaType: { field: 9, type: 'uint32' as const },
|
|
||||||
imageWidth: { field: 10, type: 'uint32' as const },
|
|
||||||
imageHeight: { field: 11, type: 'uint32' as const },
|
|
||||||
mobileParam: { field: 12, type: 'bytes' as const },
|
|
||||||
pbReserve: { field: 13, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const CustomFaceSchema = {
|
|
||||||
guid: { field: 1, type: 'bytes' as const },
|
|
||||||
filePath: { field: 2, type: 'string' as const },
|
|
||||||
shortcut: { field: 3, type: 'string' as const },
|
|
||||||
buffer: { field: 4, type: 'bytes' as const },
|
|
||||||
flag: { field: 5, type: 'bytes' as const },
|
|
||||||
oldData: { field: 6, type: 'bytes' as const },
|
|
||||||
fileId: { field: 7, type: 'uint32' as const },
|
|
||||||
serverIp: { field: 8, type: 'int32' as const },
|
|
||||||
serverPort: { field: 9, type: 'int32' as const },
|
|
||||||
fileType: { field: 10, type: 'int32' as const },
|
|
||||||
signature: { field: 11, type: 'bytes' as const },
|
|
||||||
useful: { field: 12, type: 'int32' as const },
|
|
||||||
md5: { field: 13, type: 'bytes' as const },
|
|
||||||
thumbUrl: { field: 14, type: 'string' as const },
|
|
||||||
bigUrl: { field: 15, type: 'string' as const },
|
|
||||||
origUrl: { field: 16, type: 'string' as const },
|
|
||||||
bizType: { field: 17, type: 'int32' as const },
|
|
||||||
repeatIndex: { field: 18, type: 'int32' as const },
|
|
||||||
repeatImage: { field: 19, type: 'int32' as const },
|
|
||||||
imageType: { field: 20, type: 'int32' as const },
|
|
||||||
index: { field: 21, type: 'int32' as const },
|
|
||||||
width: { field: 22, type: 'int32' as const },
|
|
||||||
height: { field: 23, type: 'int32' as const },
|
|
||||||
source: { field: 24, type: 'int32' as const },
|
|
||||||
size: { field: 25, type: 'uint32' as const },
|
|
||||||
origin: { field: 26, type: 'int32' as const },
|
|
||||||
thumbWidth: { field: 27, type: 'int32' as const },
|
|
||||||
thumbHeight: { field: 28, type: 'int32' as const },
|
|
||||||
showLen: { field: 29, type: 'int32' as const },
|
|
||||||
downloadLen: { field: 30, type: 'int32' as const },
|
|
||||||
x400Url: { field: 31, type: 'string' as const },
|
|
||||||
x400Width: { field: 32, type: 'int32' as const },
|
|
||||||
x400Height: { field: 33, type: 'int32' as const },
|
|
||||||
pbRes: { field: 34, type: 'message' as const, schema: CustomFacePbReserveSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const RichMsgSchema = {
|
|
||||||
template1: { field: 1, type: 'bytes' as const },
|
|
||||||
serviceId: { field: 2, type: 'int32' as const },
|
|
||||||
msgResId: { field: 3, type: 'bytes' as const },
|
|
||||||
rand: { field: 4, type: 'int32' as const },
|
|
||||||
seq: { field: 5, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupFileElemSchema = {
|
|
||||||
filename: { field: 1, type: 'string' as const },
|
|
||||||
fileSize: { field: 2, type: 'uint64' as const },
|
|
||||||
fileId: { field: 3, type: 'string' as const },
|
|
||||||
batchId: { field: 4, type: 'string' as const },
|
|
||||||
fileKey: { field: 5, type: 'string' as const },
|
|
||||||
mark: { field: 6, type: 'bytes' as const },
|
|
||||||
sequence: { field: 7, type: 'uint64' as const },
|
|
||||||
batchItemId: { field: 8, type: 'bytes' as const },
|
|
||||||
feedMsgTime: { field: 9, type: 'int32' as const },
|
|
||||||
pbReserve: { field: 10, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const ExtraInfoSchema = {
|
|
||||||
nick: { field: 1, type: 'bytes' as const },
|
|
||||||
groupCard: { field: 2, type: 'bytes' as const },
|
|
||||||
level: { field: 3, type: 'int32' as const },
|
|
||||||
flags: { field: 4, type: 'int32' as const },
|
|
||||||
groupMask: { field: 5, type: 'int32' as const },
|
|
||||||
msgTailId: { field: 6, type: 'int32' as const },
|
|
||||||
senderTitle: { field: 7, type: 'bytes' as const },
|
|
||||||
apnsTips: { field: 8, type: 'bytes' as const },
|
|
||||||
uin: { field: 9, type: 'uint64' as const },
|
|
||||||
msgStateFlag: { field: 10, type: 'int32' as const },
|
|
||||||
apnsSoundType: { field: 11, type: 'int32' as const },
|
|
||||||
newGroupFlag: { field: 12, type: 'int32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const VideoFileSchema = {
|
|
||||||
fileUuid: { field: 1, type: 'string' as const },
|
|
||||||
fileMd5: { field: 2, type: 'bytes' as const },
|
|
||||||
fileName: { field: 3, type: 'string' as const },
|
|
||||||
fileFormat: { field: 4, type: 'int32' as const },
|
|
||||||
fileTime: { field: 5, type: 'int32' as const },
|
|
||||||
fileSize: { field: 6, type: 'int32' as const },
|
|
||||||
thumbWidth: { field: 7, type: 'int32' as const },
|
|
||||||
thumbHeight: { field: 8, type: 'int32' as const },
|
|
||||||
thumbFileMd5: { field: 9, type: 'bytes' as const },
|
|
||||||
source: { field: 10, type: 'bytes' as const },
|
|
||||||
thumbFileSize:{ field: 11, type: 'int32' as const },
|
|
||||||
busiType: { field: 12, type: 'int32' as const },
|
|
||||||
fromChatType: { field: 13, type: 'int32' as const },
|
|
||||||
toChatType: { field: 14, type: 'int32' as const },
|
|
||||||
supportProgressive: { field: 15, type: 'bool' as const },
|
|
||||||
fileWidth: { field: 16, type: 'int32' as const },
|
|
||||||
fileHeight: { field: 17, type: 'int32' as const },
|
|
||||||
subBusiType: { field: 18, type: 'int32' as const },
|
|
||||||
videoAttr: { field: 19, type: 'int32' as const },
|
|
||||||
pbReserve: { field: 24, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const SrcMsgSchema = {
|
|
||||||
origSeqs: { field: 1, type: 'repeated_uint32' as const },
|
|
||||||
senderUin: { field: 2, type: 'uint64' as const },
|
|
||||||
time: { field: 3, type: 'int32' as const },
|
|
||||||
flag: { field: 4, type: 'int32' as const },
|
|
||||||
elemsRaw: { field: 5, type: 'repeated_bytes' as const },
|
|
||||||
type: { field: 6, type: 'int32' as const },
|
|
||||||
richMsg: { field: 7, type: 'bytes' as const },
|
|
||||||
pbReserve: { field: 8, type: 'bytes' as const },
|
|
||||||
sourceMsg: { field: 9, type: 'bytes' as const },
|
|
||||||
toUin: { field: 10, type: 'uint64' as const },
|
|
||||||
troopName: { field: 11, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const LightAppElemSchema = {
|
|
||||||
data: { field: 1, type: 'bytes' as const },
|
|
||||||
msgResid: { field: 2, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const CommonElemSchema = {
|
|
||||||
serviceType: { field: 1, type: 'int32' as const },
|
|
||||||
pbElem: { field: 2, type: 'bytes' as const },
|
|
||||||
businessType: { field: 3, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GeneralFlagsSchema = {
|
|
||||||
bubbleDiyTextId: { field: 1, type: 'int32' as const },
|
|
||||||
groupFlagNew: { field: 2, type: 'int32' as const },
|
|
||||||
uin: { field: 3, type: 'uint64' as const },
|
|
||||||
longTextFlag: { field: 6, type: 'int32' as const },
|
|
||||||
longTextResId: { field: 7, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Elem (union of all element types) ---
|
|
||||||
|
|
||||||
export const ElemSchema = {
|
|
||||||
text: { field: 1, type: 'message' as const, schema: TextElemSchema },
|
|
||||||
face: { field: 2, type: 'message' as const, schema: FaceElemSchema },
|
|
||||||
onlineImage: { field: 3, type: 'message' as const, schema: OnlineImageSchema },
|
|
||||||
notOnlineImage: { field: 4, type: 'message' as const, schema: NotOnlineImageSchema },
|
|
||||||
transElem: { field: 5, type: 'message' as const, schema: TransElemSchema },
|
|
||||||
marketFace: { field: 6, type: 'message' as const, schema: MarketFaceSchema },
|
|
||||||
customFace: { field: 8, type: 'message' as const, schema: CustomFaceSchema },
|
|
||||||
richMsg: { field: 12, type: 'message' as const, schema: RichMsgSchema },
|
|
||||||
groupFile: { field: 13, type: 'message' as const, schema: GroupFileElemSchema },
|
|
||||||
extraInfo: { field: 16, type: 'message' as const, schema: ExtraInfoSchema },
|
|
||||||
videoFile: { field: 19, type: 'message' as const, schema: VideoFileSchema },
|
|
||||||
generalFlags: { field: 37, type: 'message' as const, schema: GeneralFlagsSchema },
|
|
||||||
srcMsg: { field: 45, type: 'message' as const, schema: SrcMsgSchema },
|
|
||||||
lightApp: { field: 51, type: 'message' as const, schema: LightAppElemSchema },
|
|
||||||
commonElem: { field: 53, type: 'message' as const, schema: CommonElemSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Extra decode types (for CommonElem.pbElem sub-messages) ---
|
|
||||||
|
|
||||||
export const MentionExtraSchema = {
|
|
||||||
type: { field: 3, type: 'int32' as const },
|
|
||||||
uin: { field: 4, type: 'uint32' as const },
|
|
||||||
field5: { field: 5, type: 'int32' as const },
|
|
||||||
uid: { field: 9, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const QFaceExtraSchema = {
|
|
||||||
packId: { field: 1, type: 'string' as const },
|
|
||||||
stickerId: { field: 2, type: 'string' as const },
|
|
||||||
qsid: { field: 3, type: 'int32' as const },
|
|
||||||
sourceType: { field: 4, type: 'int32' as const },
|
|
||||||
stickerType: { field: 5, type: 'int32' as const },
|
|
||||||
resultId: { field: 6, type: 'string' as const },
|
|
||||||
text: { field: 7, type: 'string' as const },
|
|
||||||
randomType: { field: 9, type: 'int32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const QSmallFaceExtraSchema = {
|
|
||||||
faceId: { field: 1, type: 'uint32' as const },
|
|
||||||
preview: { field: 2, type: 'string' as const },
|
|
||||||
preview2: { field: 3, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- NTQQ MsgInfo types (CommonElem service_type 48) ---
|
|
||||||
|
|
||||||
export const FileTypeSchema = {
|
|
||||||
type: { field: 1, type: 'uint32' as const },
|
|
||||||
picFormat: { field: 2, type: 'uint32' as const },
|
|
||||||
videoFormat: { field: 3, type: 'uint32' as const },
|
|
||||||
voiceFormat: { field: 4, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FileInfoSchema = {
|
|
||||||
fileSize: { field: 1, type: 'uint32' as const },
|
|
||||||
fileHash: { field: 2, type: 'string' as const },
|
|
||||||
fileSha1: { field: 3, type: 'string' as const },
|
|
||||||
fileName: { field: 4, type: 'string' as const },
|
|
||||||
type: { field: 5, type: 'message' as const, schema: FileTypeSchema },
|
|
||||||
width: { field: 6, type: 'uint32' as const },
|
|
||||||
height: { field: 7, type: 'uint32' as const },
|
|
||||||
time: { field: 8, type: 'uint32' as const },
|
|
||||||
original: { field: 9, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const IndexNodeSchema = {
|
|
||||||
info: { field: 1, type: 'message' as const, schema: FileInfoSchema },
|
|
||||||
fileUuid: { field: 2, type: 'string' as const },
|
|
||||||
storeId: { field: 3, type: 'uint32' as const },
|
|
||||||
uploadTime: { field: 4, type: 'uint32' as const },
|
|
||||||
ttl: { field: 5, type: 'uint32' as const },
|
|
||||||
subType: { field: 6, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const PicUrlExtInfoSchema = {
|
|
||||||
originalParameter: { field: 1, type: 'string' as const },
|
|
||||||
bigParameter: { field: 2, type: 'string' as const },
|
|
||||||
thumbParameter: { field: 3, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const PictureInfoSchema = {
|
|
||||||
urlPath: { field: 1, type: 'string' as const },
|
|
||||||
ext: { field: 2, type: 'message' as const, schema: PicUrlExtInfoSchema },
|
|
||||||
domain: { field: 3, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const PicExtDataSchema = {
|
|
||||||
subType: { field: 1, type: 'uint32' as const },
|
|
||||||
textSummary: { field: 9, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const PicExtBizInfoSchema = {
|
|
||||||
bizType: { field: 1, type: 'uint32' as const },
|
|
||||||
textSummary: { field: 2, type: 'string' as const },
|
|
||||||
bytesPbReserveC2c: { field: 11, type: 'bytes' as const },
|
|
||||||
extData: { field: 12, type: 'message' as const, schema: PicExtDataSchema },
|
|
||||||
fromScene: { field: 1001, type: 'uint32' as const },
|
|
||||||
toScene: { field: 1002, type: 'uint32' as const },
|
|
||||||
oldFileId: { field: 1003, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const VideoExtBizInfoSchema = {
|
|
||||||
fromScene: { field: 1, type: 'uint32' as const },
|
|
||||||
toScene: { field: 2, type: 'uint32' as const },
|
|
||||||
bytesPbReserve: { field: 3, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const PttExtBizInfoSchema = {
|
|
||||||
srcUin: { field: 1, type: 'uint64' as const },
|
|
||||||
pttScene: { field: 2, type: 'uint32' as const },
|
|
||||||
pttType: { field: 3, type: 'uint32' as const },
|
|
||||||
changeVoice: { field: 4, type: 'uint32' as const },
|
|
||||||
waveform: { field: 5, type: 'bytes' as const },
|
|
||||||
autoConvertText: { field: 6, type: 'uint32' as const },
|
|
||||||
bytesReserve: { field: 11, type: 'bytes' as const },
|
|
||||||
bytesPbReserve: { field: 12, type: 'bytes' as const },
|
|
||||||
bytesGeneralFlags: { field: 13, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const ExtBizInfoSchema = {
|
|
||||||
pic: { field: 1, type: 'message' as const, schema: PicExtBizInfoSchema },
|
|
||||||
video: { field: 2, type: 'message' as const, schema: VideoExtBizInfoSchema },
|
|
||||||
ptt: { field: 3, type: 'message' as const, schema: PttExtBizInfoSchema },
|
|
||||||
busiType: { field: 10, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const C2cSourceSchema = {
|
|
||||||
friendUid: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const TroopSourceSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const HashSumSchema = {
|
|
||||||
bytesPbReserveC2c: { field: 201, type: 'message' as const, schema: C2cSourceSchema },
|
|
||||||
troopSource: { field: 202, type: 'message' as const, schema: TroopSourceSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const MsgInfoBodySchema = {
|
|
||||||
index: { field: 1, type: 'message' as const, schema: IndexNodeSchema },
|
|
||||||
picture: { field: 2, type: 'message' as const, schema: PictureInfoSchema },
|
|
||||||
fileExist: { field: 5, type: 'bool' as const },
|
|
||||||
hashSum: { field: 6, type: 'message' as const, schema: HashSumSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const MsgInfoSchema = {
|
|
||||||
msgInfoBody: { field: 1, type: 'repeated_message' as const, schema: MsgInfoBodySchema },
|
|
||||||
extBizInfo: { field: 2, type: 'message' as const, schema: ExtBizInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- GroupFileExtra (TransElem type=24) ---
|
|
||||||
|
|
||||||
// Field numbers cross-checked against NapCat (component.ts:146) +
|
|
||||||
// acidify (GroupFileExtra.kt:Inner.Info). Old schema had fileSha at 5
|
|
||||||
// / extInfoString at 6 / fileMd5 at 7 which mismatched the real wire
|
|
||||||
// shape — the server rejected the chat post with `result=79` because
|
|
||||||
// fileSha bytes were landing where it expected a uint32 (field 5).
|
|
||||||
// See proton/element.ts for the WHY comment.
|
|
||||||
export const GroupFileInfoSchema = {
|
|
||||||
busId: { field: 1, type: 'uint32' as const },
|
|
||||||
fileId: { field: 2, type: 'string' as const },
|
|
||||||
fileSize: { field: 3, type: 'uint64' as const },
|
|
||||||
fileName: { field: 4, type: 'string' as const },
|
|
||||||
field5: { field: 5, type: 'uint32' as const },
|
|
||||||
fileSha: { field: 6, type: 'bytes' as const },
|
|
||||||
extInfoString: { field: 7, type: 'string' as const },
|
|
||||||
fileMd5: { field: 8, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupFileExtraInnerSchema = {
|
|
||||||
info: { field: 2, type: 'message' as const, schema: GroupFileInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupFileExtraSchema = {
|
|
||||||
field1: { field: 1, type: 'uint32' as const },
|
|
||||||
fileName: { field: 2, type: 'string' as const },
|
|
||||||
display: { field: 3, type: 'string' as const },
|
|
||||||
inner: { field: 7, type: 'message' as const, schema: GroupFileExtraInnerSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Preserve (for message receipt info) ---
|
|
||||||
|
|
||||||
export const PreserveSchema = {
|
|
||||||
messageId: { field: 3, type: 'uint64' as const },
|
|
||||||
senderUid: { field: 6, type: 'string' as const },
|
|
||||||
receiverUid: { field: 7, type: 'string' as const },
|
|
||||||
clientSequence: { field: 8, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
@@ -1,343 +0,0 @@
|
|||||||
// Proto schemas for highway upload protocol.
|
|
||||||
// Port of src/bridge/include/bridge/proto/highway.h + action.h (HttpConn)
|
|
||||||
|
|
||||||
import type { ProtoSchema } from '../../protobuf/decode';
|
|
||||||
import {
|
|
||||||
IndexNodeSchema,
|
|
||||||
PictureInfoSchema,
|
|
||||||
HashSumSchema,
|
|
||||||
PicExtBizInfoSchema,
|
|
||||||
VideoExtBizInfoSchema,
|
|
||||||
PttExtBizInfoSchema,
|
|
||||||
} from '../proto/element';
|
|
||||||
|
|
||||||
// --- DataHighwayHead ---
|
|
||||||
|
|
||||||
export const DataHighwayHeadSchema = {
|
|
||||||
version: { field: 1, type: 'uint32' as const },
|
|
||||||
uin: { field: 2, type: 'string' as const },
|
|
||||||
command: { field: 3, type: 'string' as const },
|
|
||||||
seq: { field: 4, type: 'uint32' as const },
|
|
||||||
retryTimes:{ field: 5, type: 'uint32' as const },
|
|
||||||
appId: { field: 6, type: 'uint32' as const },
|
|
||||||
dataFlag: { field: 7, type: 'uint32' as const },
|
|
||||||
commandId: { field: 8, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const SegHeadSchema = {
|
|
||||||
serviceId: { field: 1, type: 'uint32' as const },
|
|
||||||
filesize: { field: 2, type: 'uint64' as const },
|
|
||||||
dataOffset: { field: 3, type: 'uint64' as const },
|
|
||||||
dataLength: { field: 4, type: 'uint32' as const },
|
|
||||||
retCode: { field: 5, type: 'uint32' as const },
|
|
||||||
serviceTicket: { field: 6, type: 'bytes' as const },
|
|
||||||
flag: { field: 7, type: 'uint32' as const },
|
|
||||||
md5: { field: 8, type: 'bytes' as const },
|
|
||||||
fileMd5: { field: 9, type: 'bytes' as const },
|
|
||||||
cacheAddr: { field: 10, type: 'uint32' as const },
|
|
||||||
cachePort: { field: 13, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const LoginSigHeadSchema = {
|
|
||||||
loginSigType: { field: 1, type: 'uint32' as const },
|
|
||||||
appId: { field: 3, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const ReqDataHighwayHeadSchema = {
|
|
||||||
msgBaseHead: { field: 1, type: 'message' as const, schema: DataHighwayHeadSchema },
|
|
||||||
msgSegHead: { field: 2, type: 'message' as const, schema: SegHeadSchema },
|
|
||||||
bytesReqExtendInfo: { field: 3, type: 'bytes' as const },
|
|
||||||
timestamp: { field: 4, type: 'uint64' as const },
|
|
||||||
msgLoginSigHead: { field: 5, type: 'message' as const, schema: LoginSigHeadSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const RespDataHighwayHeadSchema = {
|
|
||||||
msgBaseHead: { field: 1, type: 'message' as const, schema: DataHighwayHeadSchema },
|
|
||||||
msgSegHead: { field: 2, type: 'message' as const, schema: SegHeadSchema },
|
|
||||||
errorCode: { field: 3, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Highway extend (NTV2RichMediaHighwayExt) ---
|
|
||||||
|
|
||||||
export const HighwayDomainSchema = {
|
|
||||||
isEnable: { field: 1, type: 'bool' as const },
|
|
||||||
ip: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const HighwayIPv4Schema = {
|
|
||||||
domain: { field: 1, type: 'message' as const, schema: HighwayDomainSchema },
|
|
||||||
port: { field: 2, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const HighwayNetworkSchema = {
|
|
||||||
ipv4s: { field: 1, type: 'repeated_message' as const, schema: HighwayIPv4Schema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const HighwayHashSchema = {
|
|
||||||
fileSha1: { field: 1, type: 'repeated_bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const HighwayMsgInfoBodySchema = {
|
|
||||||
index: { field: 1, type: 'message' as const, schema: IndexNodeSchema },
|
|
||||||
picture: { field: 2, type: 'message' as const, schema: PictureInfoSchema },
|
|
||||||
fileExist: { field: 5, type: 'bool' as const },
|
|
||||||
hashSum: { field: 6, type: 'message' as const, schema: HashSumSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2RichMediaHighwayExtSchema = {
|
|
||||||
fileUuid: { field: 1, type: 'string' as const },
|
|
||||||
uKey: { field: 2, type: 'string' as const },
|
|
||||||
network: { field: 5, type: 'message' as const, schema: HighwayNetworkSchema },
|
|
||||||
msgInfoBody: { field: 6, type: 'repeated_message' as const, schema: HighwayMsgInfoBodySchema },
|
|
||||||
blockSize: { field: 10, type: 'uint32' as const },
|
|
||||||
hash: { field: 11, type: 'message' as const, schema: HighwayHashSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- File upload extend (group/private file highway) ---
|
|
||||||
|
|
||||||
export const FileUploadUrlSchema = {
|
|
||||||
unknown: { field: 1, type: 'int32' as const },
|
|
||||||
host: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FileUploadHostSchema = {
|
|
||||||
url: { field: 1, type: 'message' as const, schema: FileUploadUrlSchema },
|
|
||||||
port: { field: 2, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FileUploadHostConfigSchema = {
|
|
||||||
hosts: { field: 200, type: 'repeated_message' as const, schema: FileUploadHostSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FileUploadNameInfoSchema = {
|
|
||||||
fileName: { field: 100, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FileUploadClientInfoSchema = {
|
|
||||||
clientType: { field: 100, type: 'int32' as const },
|
|
||||||
appId: { field: 200, type: 'string' as const },
|
|
||||||
terminalType: { field: 300, type: 'int32' as const },
|
|
||||||
clientVer: { field: 400, type: 'string' as const },
|
|
||||||
unknown: { field: 600, type: 'int32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FileUploadFileEntrySchema = {
|
|
||||||
fileSize: { field: 100, type: 'uint64' as const },
|
|
||||||
md5: { field: 200, type: 'bytes' as const },
|
|
||||||
checkKey: { field: 300, type: 'bytes' as const },
|
|
||||||
md5S2: { field: 400, type: 'bytes' as const },
|
|
||||||
fileId: { field: 600, type: 'string' as const },
|
|
||||||
uploadKey: { field: 700, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FileUploadBusiInfoSchema = {
|
|
||||||
busId: { field: 1, type: 'int32' as const },
|
|
||||||
senderUin: { field: 100, type: 'uint64' as const },
|
|
||||||
receiverUin: { field: 200, type: 'uint64' as const },
|
|
||||||
groupCode: { field: 400, type: 'uint64' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FileUploadEntrySchema = {
|
|
||||||
busiBuff: { field: 100, type: 'message' as const, schema: FileUploadBusiInfoSchema },
|
|
||||||
fileEntry: { field: 200, type: 'message' as const, schema: FileUploadFileEntrySchema },
|
|
||||||
clientInfo: { field: 300, type: 'message' as const, schema: FileUploadClientInfoSchema },
|
|
||||||
fileNameInfo: { field: 400, type: 'message' as const, schema: FileUploadNameInfoSchema },
|
|
||||||
host: { field: 500, type: 'message' as const, schema: FileUploadHostConfigSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FileUploadExtSchema = {
|
|
||||||
unknown1: { field: 1, type: 'int32' as const },
|
|
||||||
unknown2: { field: 2, type: 'int32' as const },
|
|
||||||
unknown3: { field: 3, type: 'int32' as const },
|
|
||||||
entry: { field: 100, type: 'message' as const, schema: FileUploadEntrySchema },
|
|
||||||
unknown200: { field: 200, type: 'int32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Encodable MsgInfo (for embedding in message element) ---
|
|
||||||
|
|
||||||
export const EncodableMediaExtBizInfoSchema = {
|
|
||||||
pic: { field: 1, type: 'message' as const, schema: PicExtBizInfoSchema },
|
|
||||||
video: { field: 2, type: 'message' as const, schema: VideoExtBizInfoSchema },
|
|
||||||
ptt: { field: 3, type: 'message' as const, schema: PttExtBizInfoSchema },
|
|
||||||
busiType: { field: 10, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const EncodableMediaMsgInfoSchema = {
|
|
||||||
msgInfoBody: { field: 1, type: 'repeated_message' as const, schema: HighwayMsgInfoBodySchema },
|
|
||||||
extBizInfo: { field: 2, type: 'message' as const, schema: EncodableMediaExtBizInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- HttpConn.0x6ff_501 (highway session) ---
|
|
||||||
|
|
||||||
export const HttpConnSchema = {
|
|
||||||
field1: { field: 1, type: 'int32' as const },
|
|
||||||
field2: { field: 2, type: 'int32' as const },
|
|
||||||
field3: { field: 3, type: 'int32' as const },
|
|
||||||
field4: { field: 4, type: 'int32' as const },
|
|
||||||
field6: { field: 6, type: 'int32' as const },
|
|
||||||
serviceTypes: { field: 7, type: 'repeated_uint32' as const },
|
|
||||||
field9: { field: 9, type: 'int32' as const },
|
|
||||||
field10: { field: 10, type: 'int32' as const },
|
|
||||||
field11: { field: 11, type: 'int32' as const },
|
|
||||||
ver: { field: 15, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const HttpConn0x6FF501RequestSchema = {
|
|
||||||
httpConn: { field: 0x501, type: 'message' as const, schema: HttpConnSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const ServerAddrSchema = {
|
|
||||||
type: { field: 1, type: 'uint32' as const },
|
|
||||||
ip: { field: 2, type: 'uint32' as const }, // fixed32 as uint32
|
|
||||||
port: { field: 3, type: 'uint32' as const },
|
|
||||||
area: { field: 4, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const ServerInfoSchema = {
|
|
||||||
serviceType: { field: 1, type: 'uint32' as const },
|
|
||||||
serverAddrs: { field: 2, type: 'repeated_message' as const, schema: ServerAddrSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const HttpConnResponseSchema = {
|
|
||||||
sigSession: { field: 1, type: 'bytes' as const },
|
|
||||||
sessionKey: { field: 2, type: 'bytes' as const },
|
|
||||||
serverInfos: { field: 3, type: 'repeated_message' as const, schema: ServerInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const HttpConn0x6FF501ResponseSchema = {
|
|
||||||
httpConn: { field: 0x501, type: 'message' as const, schema: HttpConnResponseSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- NTV2 Upload Request (for OIDB 0x11C4/0x11C5) ---
|
|
||||||
|
|
||||||
export const NTV2FileTypeSchema = {
|
|
||||||
type: { field: 1, type: 'uint32' as const },
|
|
||||||
picFormat: { field: 2, type: 'uint32' as const },
|
|
||||||
videoFormat: { field: 3, type: 'uint32' as const },
|
|
||||||
voiceFormat: { field: 4, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2FileInfoSchema = {
|
|
||||||
fileSize: { field: 1, type: 'uint32' as const },
|
|
||||||
fileHash: { field: 2, type: 'string' as const },
|
|
||||||
fileSha1: { field: 3, type: 'string' as const },
|
|
||||||
fileName: { field: 4, type: 'string' as const },
|
|
||||||
type: { field: 5, type: 'message' as const, schema: NTV2FileTypeSchema },
|
|
||||||
width: { field: 6, type: 'uint32' as const },
|
|
||||||
height: { field: 7, type: 'uint32' as const },
|
|
||||||
time: { field: 8, type: 'uint32' as const },
|
|
||||||
original: { field: 9, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2UploadInfoSchema = {
|
|
||||||
fileInfo: { field: 1, type: 'message' as const, schema: NTV2FileInfoSchema },
|
|
||||||
subFileType: { field: 2, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// The NTV2 upload request + response carry the same ExtBizInfo shape that
|
|
||||||
// element-side incoming-message decoding uses. Pulling those schemas in
|
|
||||||
// directly (instead of redefining stub copies) keeps the round-trip
|
|
||||||
// `server response → finalizeMediaMsgInfo → commonElem.pbElem` from
|
|
||||||
// silently dropping fields the QQ NT server later validates against —
|
|
||||||
// the video `fromScene`/`toScene` drop was already responsible for c2c
|
|
||||||
// `result=79` rejections on `send_private_msg [{type:'video'}]`.
|
|
||||||
export const NTV2ExtBizInfoSchema = {
|
|
||||||
pic: { field: 1, type: 'message' as const, schema: PicExtBizInfoSchema },
|
|
||||||
video: { field: 2, type: 'message' as const, schema: VideoExtBizInfoSchema },
|
|
||||||
ptt: { field: 3, type: 'message' as const, schema: PttExtBizInfoSchema },
|
|
||||||
busiType: { field: 10, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2UploadReqSchema = {
|
|
||||||
uploadInfo: { field: 1, type: 'repeated_message' as const, schema: NTV2UploadInfoSchema },
|
|
||||||
tryFastUploadCompleted: { field: 2, type: 'bool' as const },
|
|
||||||
srvSendMsg: { field: 3, type: 'bool' as const },
|
|
||||||
clientRandomId: { field: 4, type: 'uint64' as const },
|
|
||||||
compatQmsgSceneType: { field: 5, type: 'uint32' as const },
|
|
||||||
extBizInfo: { field: 6, type: 'message' as const, schema: NTV2ExtBizInfoSchema },
|
|
||||||
clientSeq: { field: 7, type: 'uint32' as const },
|
|
||||||
noNeedCompatMsg: { field: 8, type: 'bool' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2C2CUserInfoSchema = {
|
|
||||||
accountType: { field: 1, type: 'uint32' as const },
|
|
||||||
targetUid: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2GroupInfoSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2UploadSceneInfoSchema = {
|
|
||||||
requestType: { field: 101, type: 'uint32' as const },
|
|
||||||
businessType: { field: 102, type: 'uint32' as const },
|
|
||||||
sceneType: { field: 200, type: 'uint32' as const },
|
|
||||||
c2c: { field: 201, type: 'message' as const, schema: NTV2C2CUserInfoSchema },
|
|
||||||
group: { field: 202, type: 'message' as const, schema: NTV2GroupInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2CommonHeadSchema = {
|
|
||||||
requestId: { field: 1, type: 'uint32' as const },
|
|
||||||
command: { field: 2, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2ClientMetaSchema = {
|
|
||||||
agentType: { field: 1, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2UploadReqHeadSchema = {
|
|
||||||
common: { field: 1, type: 'message' as const, schema: NTV2CommonHeadSchema },
|
|
||||||
scene: { field: 2, type: 'message' as const, schema: NTV2UploadSceneInfoSchema },
|
|
||||||
client: { field: 3, type: 'message' as const, schema: NTV2ClientMetaSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2UploadRichMediaReqSchema = {
|
|
||||||
reqHead: { field: 1, type: 'message' as const, schema: NTV2UploadReqHeadSchema },
|
|
||||||
upload: { field: 2, type: 'message' as const, schema: NTV2UploadReqSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- NTV2 Upload Response ---
|
|
||||||
|
|
||||||
export const NTV2IPv4Schema = {
|
|
||||||
outIp: { field: 1, type: 'uint32' as const },
|
|
||||||
outPort: { field: 2, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2SubFileInfoRespSchema = {
|
|
||||||
subType: { field: 1, type: 'uint32' as const },
|
|
||||||
uKey: { field: 2, type: 'string' as const },
|
|
||||||
uKeyTtl: { field: 3, type: 'uint32' as const },
|
|
||||||
ipv4s: { field: 4, type: 'repeated_message' as const, schema: NTV2IPv4Schema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2UploadRespMsgInfoSchema = {
|
|
||||||
msgInfoBody: { field: 1, type: 'repeated_message' as const, schema: HighwayMsgInfoBodySchema },
|
|
||||||
extBizInfo: { field: 2, type: 'message' as const, schema: NTV2ExtBizInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2UploadRespBodySchema = {
|
|
||||||
uKey: { field: 1, type: 'string' as const },
|
|
||||||
uKeyTtl: { field: 2, type: 'uint32' as const },
|
|
||||||
ipv4s: { field: 3, type: 'repeated_message' as const, schema: NTV2IPv4Schema },
|
|
||||||
msgSeq: { field: 5, type: 'uint64' as const },
|
|
||||||
msgInfo: { field: 6, type: 'message' as const, schema: NTV2UploadRespMsgInfoSchema },
|
|
||||||
subFileInfos: { field: 10, type: 'repeated_message' as const, schema: NTV2SubFileInfoRespSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2UploadRespHeadSchema = {
|
|
||||||
common: { field: 1, type: 'message' as const, schema: NTV2CommonHeadSchema },
|
|
||||||
retCode: { field: 2, type: 'uint32' as const },
|
|
||||||
message: { field: 3, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NTV2UploadRichMediaRespSchema = {
|
|
||||||
respHead: { field: 1, type: 'message' as const, schema: NTV2UploadRespHeadSchema },
|
|
||||||
upload: { field: 2, type: 'message' as const, schema: NTV2UploadRespBodySchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// (The legacy `GroupAvatarUploadExtSchema` definition that briefly
|
|
||||||
// lived here in PR #31 was removed: it was a residual artifact of an
|
|
||||||
// alternative `setGroupAvatar` implementation that got dropped during
|
|
||||||
// review — the canonical Lagrange-derived `GroupAvatarExtraSchema`
|
|
||||||
// further up this file is the one `actions/profile.setGroupAvatar`
|
|
||||||
// actually uses.)
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
import type { ProtoSchema } from '../../protobuf/decode';
|
|
||||||
import { PushMsgBodySchema } from './message';
|
|
||||||
|
|
||||||
export const LongMsgUidSchema = {
|
|
||||||
uid: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const LongMsgSettingsSchema = {
|
|
||||||
field1: { field: 1, type: 'uint32' as const },
|
|
||||||
field2: { field: 2, type: 'uint32' as const },
|
|
||||||
field3: { field: 3, type: 'uint32' as const },
|
|
||||||
field4: { field: 4, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const SendLongMsgInfoSchema = {
|
|
||||||
type: { field: 1, type: 'uint32' as const },
|
|
||||||
uid: { field: 2, type: 'message' as const, schema: LongMsgUidSchema },
|
|
||||||
groupUin: { field: 3, type: 'uint32' as const },
|
|
||||||
payload: { field: 4, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const SendLongMsgReqSchema = {
|
|
||||||
info: { field: 2, type: 'message' as const, schema: SendLongMsgInfoSchema },
|
|
||||||
settings: { field: 15, type: 'message' as const, schema: LongMsgSettingsSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const SendLongMsgRespResultSchema = {
|
|
||||||
resId: { field: 3, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const SendLongMsgRespSchema = {
|
|
||||||
result: { field: 2, type: 'message' as const, schema: SendLongMsgRespResultSchema },
|
|
||||||
settings: { field: 15, type: 'message' as const, schema: LongMsgSettingsSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const RecvLongMsgInfoSchema = {
|
|
||||||
uid: { field: 1, type: 'message' as const, schema: LongMsgUidSchema },
|
|
||||||
resId: { field: 2, type: 'string' as const },
|
|
||||||
acquire: { field: 3, type: 'bool' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const RecvLongMsgReqSchema = {
|
|
||||||
info: { field: 1, type: 'message' as const, schema: RecvLongMsgInfoSchema },
|
|
||||||
settings: { field: 15, type: 'message' as const, schema: LongMsgSettingsSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const RecvLongMsgRespResultSchema = {
|
|
||||||
resId: { field: 3, type: 'string' as const },
|
|
||||||
payload: { field: 4, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const RecvLongMsgRespSchema = {
|
|
||||||
result: { field: 1, type: 'message' as const, schema: RecvLongMsgRespResultSchema },
|
|
||||||
settings: { field: 15, type: 'message' as const, schema: LongMsgSettingsSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const LongMsgContentSchema = {
|
|
||||||
msgBody: { field: 1, type: 'repeated_message' as const, schema: PushMsgBodySchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const LongMsgActionSchema = {
|
|
||||||
actionCommand: { field: 1, type: 'string' as const },
|
|
||||||
actionData: { field: 2, type: 'message' as const, schema: LongMsgContentSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const LongMsgResultSchema = {
|
|
||||||
action: { field: 2, type: 'repeated_message' as const, schema: LongMsgActionSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
// Proto schemas for message envelopes (PushMsg).
|
|
||||||
// Port of src/bridge/include/bridge/proto/message.h
|
|
||||||
|
|
||||||
import type { ProtoSchema } from '../../protobuf/decode';
|
|
||||||
import { ElemSchema } from './element';
|
|
||||||
|
|
||||||
// --- ResponseHead.Grp ---
|
|
||||||
|
|
||||||
export const ResponseGrpSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
memberName: { field: 2, type: 'string' as const },
|
|
||||||
groupName: { field: 4, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const ResponseForwardSchema = {
|
|
||||||
friendName: { field: 6, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- ResponseHead ---
|
|
||||||
|
|
||||||
export const ResponseHeadSchema = {
|
|
||||||
fromUin: { field: 1, type: 'uint32' as const },
|
|
||||||
fromUid: { field: 2, type: 'string' as const },
|
|
||||||
type: { field: 3, type: 'uint32' as const },
|
|
||||||
sigMap: { field: 4, type: 'uint32' as const },
|
|
||||||
toUin: { field: 5, type: 'uint32' as const },
|
|
||||||
toUid: { field: 6, type: 'string' as const },
|
|
||||||
forward: { field: 7, type: 'message' as const, schema: ResponseForwardSchema },
|
|
||||||
grp: { field: 8, type: 'message' as const, schema: ResponseGrpSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- ContentHead ---
|
|
||||||
|
|
||||||
export const ContentHeadSchema = {
|
|
||||||
msgType: { field: 1, type: 'uint32' as const },
|
|
||||||
subType: { field: 2, type: 'uint32' as const },
|
|
||||||
divSeq: { field: 3, type: 'uint32' as const },
|
|
||||||
msgId: { field: 4, type: 'uint32' as const },
|
|
||||||
sequence: { field: 5, type: 'uint32' as const },
|
|
||||||
timestamp: { field: 6, type: 'uint32' as const },
|
|
||||||
field7: { field: 7, type: 'uint64' as const },
|
|
||||||
newId: { field: 12, type: 'uint64' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Ptt (voice) ---
|
|
||||||
|
|
||||||
export const PttSchema = {
|
|
||||||
fileType: { field: 1, type: 'uint32' as const },
|
|
||||||
fileId: { field: 2, type: 'uint64' as const },
|
|
||||||
fileUuid: { field: 3, type: 'bytes' as const },
|
|
||||||
fileMd5: { field: 4, type: 'bytes' as const },
|
|
||||||
fileName: { field: 5, type: 'string' as const },
|
|
||||||
fileSize: { field: 6, type: 'uint32' as const },
|
|
||||||
groupFileKey: { field: 10, type: 'string' as const },
|
|
||||||
fileKey: { field: 14, type: 'bytes' as const },
|
|
||||||
time: { field: 19, type: 'uint32' as const },
|
|
||||||
format: { field: 29, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- NotOnlineFile (C2C file) ---
|
|
||||||
|
|
||||||
// Field numbers per `dev/Lagrange.Core/.../Component/NotOnlineFile.cs`.
|
|
||||||
// fields 9 (subcmd), 50 (dangerEvel), 55 (expireTime) are required
|
|
||||||
// on c2c file SEND (the receiver ignores them); the identification
|
|
||||||
// fields (1/3/4/5/6/57) are read both directions.
|
|
||||||
export const NotOnlineFileSchema = {
|
|
||||||
fileType: { field: 1, type: 'uint32' as const },
|
|
||||||
fileUuid: { field: 3, type: 'string' as const },
|
|
||||||
fileMd5: { field: 4, type: 'bytes' as const },
|
|
||||||
fileName: { field: 5, type: 'string' as const },
|
|
||||||
fileSize: { field: 6, type: 'uint64' as const },
|
|
||||||
subcmd: { field: 9, type: 'uint32' as const },
|
|
||||||
dangerEvel: { field: 50, type: 'uint32' as const },
|
|
||||||
expireTime: { field: 55, type: 'uint32' as const },
|
|
||||||
fileHash: { field: 57, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- RichText ---
|
|
||||||
|
|
||||||
export const RichTextSchema = {
|
|
||||||
elems: { field: 2, type: 'repeated_message' as const, schema: ElemSchema },
|
|
||||||
notOnlineFile: { field: 3, type: 'message' as const, schema: NotOnlineFileSchema },
|
|
||||||
ptt: { field: 4, type: 'message' as const, schema: PttSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- MessageBody ---
|
|
||||||
|
|
||||||
export const MessageBodySchema = {
|
|
||||||
richText: { field: 1, type: 'message' as const, schema: RichTextSchema },
|
|
||||||
msgContent: { field: 2, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- FileExtra (for C2C file in msg_content) ---
|
|
||||||
//
|
|
||||||
// `FileExtra { file: NotOnlineFile }` is the wrapper QQ-NT actually
|
|
||||||
// uses at `MessageBody.msgContent` for c2c file sends. The previous
|
|
||||||
// `FileExtraInfoSchema` had fileSize=1, fileName=2, fileMd5=3,
|
|
||||||
// fileUuid=4, fileHash=5 — every field at the wrong tag, so received
|
|
||||||
// c2c-file payloads silently failed to parse. Consolidated to the
|
|
||||||
// shared `NotOnlineFileSchema` (Lagrange.Core's `FileExtra.cs` does
|
|
||||||
// the same — `[ProtoMember(1)] public NotOnlineFile? File`).
|
|
||||||
|
|
||||||
export const FileExtraSchema = {
|
|
||||||
file: { field: 1, type: 'message' as const, schema: NotOnlineFileSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- PushMsgBody ---
|
|
||||||
|
|
||||||
export const PushMsgBodySchema = {
|
|
||||||
responseHead: { field: 1, type: 'message' as const, schema: ResponseHeadSchema },
|
|
||||||
contentHead: { field: 2, type: 'message' as const, schema: ContentHeadSchema },
|
|
||||||
body: { field: 3, type: 'message' as const, schema: MessageBodySchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- PushMsg (top-level) ---
|
|
||||||
|
|
||||||
export const PushMsgSchema = {
|
|
||||||
message: { field: 1, type: 'message' as const, schema: PushMsgBodySchema },
|
|
||||||
status: { field: 3, type: 'int32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
@@ -1,245 +0,0 @@
|
|||||||
// Proto schemas for notification types.
|
|
||||||
// Port of src/bridge/include/bridge/proto/notify.h
|
|
||||||
|
|
||||||
import type { ProtoSchema } from '../../protobuf/decode';
|
|
||||||
|
|
||||||
export const OperatorField1Schema = {
|
|
||||||
uid: { field: 1, type: 'string' as const },
|
|
||||||
field2: { field: 2, type: 'uint32' as const },
|
|
||||||
field3: { field: 3, type: 'bytes' as const },
|
|
||||||
field4: { field: 4, type: 'uint32' as const },
|
|
||||||
field5: { field: 5, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OperatorInfoSchema = {
|
|
||||||
operatorField: { field: 1, type: 'message' as const, schema: OperatorField1Schema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupChangeSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
flag: { field: 2, type: 'uint32' as const },
|
|
||||||
memberUid: { field: 3, type: 'string' as const },
|
|
||||||
decreaseType: { field: 4, type: 'uint32' as const },
|
|
||||||
operatorBytes: { field: 5, type: 'bytes' as const },
|
|
||||||
increaseType: { field: 6, type: 'uint32' as const },
|
|
||||||
field7: { field: 7, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupAdminExtraSchema = {
|
|
||||||
adminUid: { field: 1, type: 'string' as const },
|
|
||||||
isPromote: { field: 2, type: 'bool' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupAdminBodySchema = {
|
|
||||||
extraDisable: { field: 1, type: 'message' as const, schema: GroupAdminExtraSchema },
|
|
||||||
extraEnable: { field: 2, type: 'message' as const, schema: GroupAdminExtraSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupAdminSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
flag: { field: 2, type: 'uint32' as const },
|
|
||||||
isPromote: { field: 3, type: 'bool' as const },
|
|
||||||
body: { field: 4, type: 'message' as const, schema: GroupAdminBodySchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const InvitationInnerSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
field2: { field: 2, type: 'uint32' as const },
|
|
||||||
field3: { field: 3, type: 'uint32' as const },
|
|
||||||
field4: { field: 4, type: 'uint32' as const },
|
|
||||||
targetUid: { field: 5, type: 'string' as const },
|
|
||||||
invitorUid: { field: 6, type: 'string' as const },
|
|
||||||
field7: { field: 7, type: 'uint32' as const },
|
|
||||||
field9: { field: 9, type: 'uint32' as const },
|
|
||||||
field10: { field: 10, type: 'bytes' as const },
|
|
||||||
field11: { field: 11, type: 'uint32' as const },
|
|
||||||
field12: { field: 12, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const InvitationInfoSchema = {
|
|
||||||
inner: { field: 1, type: 'message' as const, schema: InvitationInnerSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupInvitationSchema = {
|
|
||||||
cmd: { field: 1, type: 'int32' as const },
|
|
||||||
info: { field: 2, type: 'message' as const, schema: InvitationInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupInviteSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
field2: { field: 2, type: 'uint32' as const },
|
|
||||||
field3: { field: 3, type: 'uint32' as const },
|
|
||||||
field4: { field: 4, type: 'uint32' as const },
|
|
||||||
invitorUid: { field: 5, type: 'string' as const },
|
|
||||||
hashes: { field: 6, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupJoinSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
field2: { field: 2, type: 'uint32' as const },
|
|
||||||
targetUid: { field: 3, type: 'string' as const },
|
|
||||||
field4: { field: 4, type: 'uint32' as const },
|
|
||||||
field6: { field: 6, type: 'uint32' as const },
|
|
||||||
field7: { field: 7, type: 'string' as const },
|
|
||||||
field8: { field: 8, type: 'uint32' as const },
|
|
||||||
field9: { field: 9, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FriendRequestInfoSchema = {
|
|
||||||
targetUid: { field: 1, type: 'string' as const },
|
|
||||||
sourceUid: { field: 2, type: 'string' as const },
|
|
||||||
newSource: { field: 5, type: 'string' as const },
|
|
||||||
message: { field: 10, type: 'string' as const },
|
|
||||||
source: { field: 11, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FriendRequestSchema = {
|
|
||||||
info: { field: 1, type: 'message' as const, schema: FriendRequestInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FriendRecallTipInfoSchema = {
|
|
||||||
tip: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FriendRecallInfoSchema = {
|
|
||||||
fromUid: { field: 1, type: 'string' as const },
|
|
||||||
toUid: { field: 2, type: 'string' as const },
|
|
||||||
clientSequence: { field: 3, type: 'uint32' as const },
|
|
||||||
newId: { field: 4, type: 'uint64' as const },
|
|
||||||
time: { field: 5, type: 'uint32' as const },
|
|
||||||
random: { field: 6, type: 'uint32' as const },
|
|
||||||
pkgNum: { field: 7, type: 'uint32' as const },
|
|
||||||
pkgIndex: { field: 8, type: 'uint32' as const },
|
|
||||||
divSeq: { field: 9, type: 'uint32' as const },
|
|
||||||
tipInfo: { field: 13, type: 'message' as const, schema: FriendRecallTipInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const FriendRecallSchema = {
|
|
||||||
info: { field: 1, type: 'message' as const, schema: FriendRecallInfoSchema },
|
|
||||||
instId: { field: 2, type: 'uint32' as const },
|
|
||||||
appId: { field: 3, type: 'uint32' as const },
|
|
||||||
longMessageFlag: { field: 4, type: 'uint32' as const },
|
|
||||||
reserved: { field: 5, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupMuteStateSchema = {
|
|
||||||
targetUid: { field: 1, type: 'string' as const },
|
|
||||||
duration: { field: 2, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupMuteDataSchema = {
|
|
||||||
timestamp: { field: 1, type: 'uint32' as const },
|
|
||||||
type: { field: 2, type: 'uint32' as const },
|
|
||||||
state: { field: 3, type: 'message' as const, schema: GroupMuteStateSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupMuteSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
subType: { field: 2, type: 'uint32' as const },
|
|
||||||
field3: { field: 3, type: 'uint32' as const },
|
|
||||||
operatorUid: { field: 4, type: 'string' as const },
|
|
||||||
data: { field: 5, type: 'message' as const, schema: GroupMuteDataSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const RecallMessageSchema = {
|
|
||||||
sequence: { field: 1, type: 'uint32' as const },
|
|
||||||
time: { field: 2, type: 'uint32' as const },
|
|
||||||
random: { field: 3, type: 'uint32' as const },
|
|
||||||
type: { field: 4, type: 'uint32' as const },
|
|
||||||
flag: { field: 5, type: 'uint32' as const },
|
|
||||||
authorUid: { field: 6, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupRecallTipInfoSchema = {
|
|
||||||
tip: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupRecallSchema = {
|
|
||||||
operatorUid: { field: 1, type: 'string' as const },
|
|
||||||
recallMessages: { field: 3, type: 'repeated_message' as const, schema: RecallMessageSchema },
|
|
||||||
userDef: { field: 5, type: 'bytes' as const },
|
|
||||||
groupType: { field: 6, type: 'int32' as const },
|
|
||||||
opType: { field: 7, type: 'int32' as const },
|
|
||||||
tipInfo: { field: 9, type: 'message' as const, schema: GroupRecallTipInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const TemplParamSchema = {
|
|
||||||
name: { field: 1, type: 'string' as const },
|
|
||||||
value: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GeneralGrayTipInfoSchema = {
|
|
||||||
busiType: { field: 1, type: 'uint64' as const },
|
|
||||||
busiId: { field: 2, type: 'uint64' as const },
|
|
||||||
ctrlFlag: { field: 3, type: 'uint32' as const },
|
|
||||||
c2cType: { field: 4, type: 'uint32' as const },
|
|
||||||
serviceType: { field: 5, type: 'uint32' as const },
|
|
||||||
templId: { field: 6, type: 'uint64' as const },
|
|
||||||
msgTemplParam: { field: 7, type: 'repeated_message' as const, schema: TemplParamSchema },
|
|
||||||
content: { field: 8, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const EssenceMessageSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
msgSequence: { field: 2, type: 'uint32' as const },
|
|
||||||
random: { field: 3, type: 'uint32' as const },
|
|
||||||
setFlag: { field: 4, type: 'uint32' as const },
|
|
||||||
memberUin: { field: 5, type: 'uint32' as const },
|
|
||||||
operatorUin: { field: 6, type: 'uint32' as const },
|
|
||||||
timestamp: { field: 7, type: 'uint32' as const },
|
|
||||||
msgSequence2: { field: 8, type: 'uint32' as const },
|
|
||||||
operatorNickname: { field: 9, type: 'string' as const },
|
|
||||||
memberNickname: { field: 10, type: 'string' as const },
|
|
||||||
setFlag2: { field: 11, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const NotifyMessageBodySchema = {
|
|
||||||
type: { field: 1, type: 'uint32' as const },
|
|
||||||
groupUin: { field: 4, type: 'uint32' as const },
|
|
||||||
eventParam: { field: 5, type: 'bytes' as const },
|
|
||||||
recall: { field: 11, type: 'message' as const, schema: GroupRecallSchema },
|
|
||||||
field13: { field: 13, type: 'uint32' as const },
|
|
||||||
operatorUid: { field: 21, type: 'string' as const },
|
|
||||||
generalGrayTip: { field: 26, type: 'message' as const, schema: GeneralGrayTipInfoSchema },
|
|
||||||
essenceMessage: { field: 33, type: 'message' as const, schema: EssenceMessageSchema },
|
|
||||||
msgSequence: { field: 37, type: 'uint32' as const },
|
|
||||||
field39: { field: 39, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// ─── Event0x2DC subType=16: GroupMsgEmojiLike ──────────────────────────────
|
|
||||||
//
|
|
||||||
// QQ pushes a Group message emoji reaction (someone tapped an emoji on a
|
|
||||||
// message in a group). The payload nesting matches NapCat's transformer
|
|
||||||
// (packet/transformer/proto/message/message.ts → GroupReactNotify); the
|
|
||||||
// outermost message is preceded by a 7-byte prefix that must be stripped
|
|
||||||
// before decoding (see the call site).
|
|
||||||
|
|
||||||
export const GroupReactionDataInnerDataTargetSchema = {
|
|
||||||
seq: { field: 1, type: 'uint64' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupReactionDataContentSchema = {
|
|
||||||
code: { field: 1, type: 'string' as const },
|
|
||||||
count: { field: 3, type: 'uint32' as const },
|
|
||||||
operatorUid: { field: 4, type: 'string' as const },
|
|
||||||
type: { field: 5, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupReactionDataInnerDataSchema = {
|
|
||||||
groupReactionTarget: { field: 2, type: 'message' as const, schema: GroupReactionDataInnerDataTargetSchema },
|
|
||||||
groupReactionDataContent: { field: 3, type: 'message' as const, schema: GroupReactionDataContentSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupReactionDataInnerSchema = {
|
|
||||||
data: { field: 1, type: 'message' as const, schema: GroupReactionDataInnerDataSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupReactionDataSchema = {
|
|
||||||
data: { field: 1, type: 'message' as const, schema: GroupReactionDataInnerSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const GroupReactNotifySchema = {
|
|
||||||
groupUin: { field: 4, type: 'uint64' as const },
|
|
||||||
field13: { field: 13, type: 'uint32' as const },
|
|
||||||
groupReactionData: { field: 44, type: 'message' as const, schema: GroupReactionDataSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,161 +0,0 @@
|
|||||||
// Proto schemas for OidbSvc service types.
|
|
||||||
// Port of src/bridge/include/bridge/proto/oidb.h
|
|
||||||
|
|
||||||
import type { ProtoSchema } from '../../protobuf/decode';
|
|
||||||
|
|
||||||
// --- OidbSvcTrpcTcpBase wrapper ---
|
|
||||||
|
|
||||||
export const OidbPropertySchema = {
|
|
||||||
key: { field: 1, type: 'string' as const },
|
|
||||||
value: { field: 2, type: 'bytes' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// Factory for OidbSvcTrpcTcpBase<T>
|
|
||||||
export function makeOidbBaseSchema(bodySchema: ProtoSchema): ProtoSchema {
|
|
||||||
return {
|
|
||||||
command: { field: 1, type: 'uint32' as const },
|
|
||||||
subCommand: { field: 2, type: 'uint32' as const },
|
|
||||||
errorCode: { field: 3, type: 'uint32' as const },
|
|
||||||
body: { field: 4, type: 'message' as const, schema: bodySchema },
|
|
||||||
errorMsg: { field: 5, type: 'string' as const },
|
|
||||||
properties: { field: 11, type: 'repeated_message' as const, schema: OidbPropertySchema },
|
|
||||||
reserved: { field: 12, type: 'int32' as const },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Friend list (0xFD4_1) ---
|
|
||||||
|
|
||||||
export const OidbFriendPropertySchema = {
|
|
||||||
code: { field: 1, type: 'uint32' as const },
|
|
||||||
value: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbFriendLayer1Schema = {
|
|
||||||
properties: { field: 2, type: 'repeated_message' as const, schema: OidbFriendPropertySchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbFriendAdditionalSchema = {
|
|
||||||
type: { field: 1, type: 'uint32' as const },
|
|
||||||
layer1: { field: 2, type: 'message' as const, schema: OidbFriendLayer1Schema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbFriendSchema = {
|
|
||||||
uid: { field: 1, type: 'string' as const },
|
|
||||||
customGroup:{ field: 2, type: 'uint32' as const },
|
|
||||||
uin: { field: 3, type: 'uint32' as const },
|
|
||||||
additional: { field: 10001, type: 'repeated_message' as const, schema: OidbFriendAdditionalSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFD4_1ResponseUinSchema = {
|
|
||||||
uin: { field: 1, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFD4_1ResponseSchema = {
|
|
||||||
next: { field: 2, type: 'message' as const, schema: OidbSvcTrpcTcp0xFD4_1ResponseUinSchema },
|
|
||||||
displayFriendCount: { field: 3, type: 'uint32' as const },
|
|
||||||
timestamp: { field: 6, type: 'uint32' as const },
|
|
||||||
selfUin: { field: 7, type: 'uint32' as const },
|
|
||||||
friends: { field: 101, type: 'repeated_message' as const, schema: OidbFriendSchema },
|
|
||||||
groups: { field: 102, type: 'repeated_message' as const, schema: OidbFriendPropertySchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Group list (0xFE5_2) ---
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFE5_2MemberSchema = {
|
|
||||||
uid: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFE5_2GroupInfoSchema = {
|
|
||||||
groupOwner: { field: 1, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE5_2MemberSchema },
|
|
||||||
createdTime: { field: 2, type: 'uint32' as const },
|
|
||||||
memberMax: { field: 3, type: 'uint32' as const },
|
|
||||||
memberCount: { field: 4, type: 'uint32' as const },
|
|
||||||
groupName: { field: 5, type: 'string' as const },
|
|
||||||
description: { field: 18, type: 'string' as const },
|
|
||||||
question: { field: 19, type: 'string' as const },
|
|
||||||
announcement: { field: 30, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFE5_2CustomInfoSchema = {
|
|
||||||
remark: { field: 3, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFE5_2GroupSchema = {
|
|
||||||
groupUin: { field: 3, type: 'uint32' as const },
|
|
||||||
info: { field: 4, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE5_2GroupInfoSchema },
|
|
||||||
customInfo: { field: 5, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE5_2CustomInfoSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFE5_2ResponseSchema = {
|
|
||||||
groups: { field: 2, type: 'repeated_message' as const, schema: OidbSvcTrpcTcp0xFE5_2GroupSchema },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Group member list (0xFE7_3) ---
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFE7_3UinSchema = {
|
|
||||||
uid: { field: 2, type: 'string' as const },
|
|
||||||
uin: { field: 4, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFE7_3CardSchema = {
|
|
||||||
memberCard: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFE7_3LevelSchema = {
|
|
||||||
infos: { field: 1, type: 'repeated_uint32' as const },
|
|
||||||
level: { field: 2, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFE7_3MemberSchema = {
|
|
||||||
uin: { field: 1, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE7_3UinSchema },
|
|
||||||
memberName: { field: 10, type: 'string' as const },
|
|
||||||
specialTitle: { field: 17, type: 'string' as const },
|
|
||||||
memberCard: { field: 11, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE7_3CardSchema },
|
|
||||||
level: { field: 12, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE7_3LevelSchema },
|
|
||||||
joinTimestamp: { field: 100, type: 'uint32' as const },
|
|
||||||
lastMsgTimestamp: { field: 101, type: 'uint32' as const },
|
|
||||||
shutUpTimestamp: { field: 102, type: 'uint32' as const },
|
|
||||||
permission: { field: 107, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xFE7_3ResponseSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
members: { field: 2, type: 'repeated_message' as const, schema: OidbSvcTrpcTcp0xFE7_3MemberSchema },
|
|
||||||
field3: { field: 3, type: 'uint32' as const },
|
|
||||||
memberChangeSeq: { field: 5, type: 'uint32' as const },
|
|
||||||
memberCardChangeSeq:{ field: 6, type: 'uint32' as const },
|
|
||||||
token: { field: 15, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
// --- Group request (0x10C0) ---
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0x10C0ResponseUserSchema = {
|
|
||||||
uid: { field: 1, type: 'string' as const },
|
|
||||||
name: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0x10C0ResponseGroupSchema = {
|
|
||||||
groupUin: { field: 1, type: 'uint32' as const },
|
|
||||||
groupName: { field: 2, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0x10C0ResponseRequestSchema = {
|
|
||||||
sequence: { field: 1, type: 'uint64' as const },
|
|
||||||
eventType: { field: 2, type: 'uint32' as const },
|
|
||||||
state: { field: 3, type: 'uint32' as const },
|
|
||||||
group: { field: 4, type: 'message' as const, schema: OidbSvcTrpcTcp0x10C0ResponseGroupSchema },
|
|
||||||
target: { field: 5, type: 'message' as const, schema: OidbSvcTrpcTcp0x10C0ResponseUserSchema },
|
|
||||||
invitor: { field: 6, type: 'message' as const, schema: OidbSvcTrpcTcp0x10C0ResponseUserSchema },
|
|
||||||
operatorUser: { field: 7, type: 'message' as const, schema: OidbSvcTrpcTcp0x10C0ResponseUserSchema },
|
|
||||||
field9: { field: 9, type: 'string' as const },
|
|
||||||
comment: { field: 10, type: 'string' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0x10C0ResponseSchema = {
|
|
||||||
requests: { field: 1, type: 'repeated_message' as const, schema: OidbSvcTrpcTcp0x10C0ResponseRequestSchema },
|
|
||||||
field2: { field: 2, type: 'uint64' as const },
|
|
||||||
newLatestSeq: { field: 3, type: 'uint64' as const },
|
|
||||||
field4: { field: 4, type: 'uint32' as const },
|
|
||||||
field5: { field: 5, type: 'uint64' as const },
|
|
||||||
field6: { field: 6, type: 'uint32' as const },
|
|
||||||
} satisfies ProtoSchema;
|
|
||||||
@@ -3,119 +3,574 @@ import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@sn
|
|||||||
// Re-exported from the legacy oidb-action module while large protocol groups
|
// Re-exported from the legacy oidb-action module while large protocol groups
|
||||||
// are split into focused files.
|
// are split into focused files.
|
||||||
|
|
||||||
export interface OidbMuteMemberBody { targetUid?: pb<1, string>; duration?: pb<2, uint_32>; }
|
export interface OidbMuteMemberBody {
|
||||||
export interface OidbMuteMember { groupUin?: pb<1, uint_32>; type?: pb<2, uint_32>; body?: pb<3, OidbMuteMemberBody>; }
|
targetUid?: pb<1, string>;
|
||||||
export interface OidbMuteAllState { state?: pb<17, uint_32>; }
|
duration?: pb<2, 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 OidbMuteMember {
|
||||||
export interface Oidb0x89a_0AddOption { groupUin?: pb<1, uint_64>; settings?: pb<2, Oidb0x89a_0AddOptionSettings>; field12?: pb<12, uint_32>; }
|
groupUin?: pb<1, uint_32>;
|
||||||
export interface Oidb0x89a_0Search { groupUin?: pb<1, uint_64>; settings?: pb<2, bytes>; field12?: pb<12, uint_32>; }
|
type?: pb<2, uint_32>;
|
||||||
export interface OidbKickMember { groupUin?: pb<1, uint_32>; targetUid?: pb<3, string>; rejectAddRequest?: pb<4, bool>; reason?: pb<5, string>; }
|
body?: pb<3, OidbMuteMemberBody>;
|
||||||
export interface OidbLeaveGroup { groupUin?: pb<1, uint_32>; }
|
}
|
||||||
export interface OidbFriendRequestAction { accept?: pb<1, uint_32>; targetUid?: pb<2, string>; }
|
export interface OidbMuteAllState {
|
||||||
export interface OidbDeleteFriendField2Field3 { field1?: pb<1, uint_32>; field2?: pb<2, uint_32>; field3?: pb<3, uint_32>; }
|
state?: pb<17, 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 OidbMuteAll {
|
||||||
export interface OidbDeleteFriend { field1?: pb<1, OidbDeleteFriendField1>; }
|
groupUin?: pb<1, uint_32>;
|
||||||
export interface OidbGroupRequestBody { sequence?: pb<1, uint_64>; eventType?: pb<2, uint_32>; groupUin?: pb<3, uint_32>; message?: pb<4, string>; }
|
muteState?: pb<2, OidbMuteAllState>;
|
||||||
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 Oidb0x89a_0AddOptionSettings {
|
||||||
export interface OidbEssence { groupUin?: pb<1, uint_32>; sequence?: pb<2, uint_32>; random?: pb<3, uint_32>; }
|
addType?: pb<16, 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 Oidb0x89a_0AddOption {
|
||||||
export interface OidbRenameMember { groupUin?: pb<1, uint_32>; body?: pb<2, OidbRenameMemberBody>; }
|
groupUin?: pb<1, uint_64>;
|
||||||
export interface OidbRenameGroupBody { targetName?: pb<1, string>; }
|
settings?: pb<2, Oidb0x89a_0AddOptionSettings>;
|
||||||
export interface OidbRenameGroup { groupUin?: pb<1, uint_32>; body?: pb<2, OidbRenameGroupBody>; }
|
field12?: pb<12, uint_32>;
|
||||||
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 Oidb0x89a_0Search {
|
||||||
export interface OidbLike { targetUin?: pb<1, uint_32>; count?: pb<2, uint_32>; }
|
groupUin?: pb<1, uint_64>;
|
||||||
export interface OidbGroupRequestList { count?: pb<1, uint_32>; field2?: pb<2, uint_32>; }
|
settings?: pb<2, bytes>;
|
||||||
export interface OidbUserInfoKey { key?: pb<1, uint_32>; }
|
field12?: pb<12, 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 OidbKickMember {
|
||||||
export interface OidbByteProperty { code?: pb<1, uint_32>; value?: pb<2, bytes>; }
|
groupUin?: pb<1, uint_32>;
|
||||||
export interface OidbUserInfoProperty { numberProperties?: pb_repeated<1, OidbTwoNumber>; bytesProperties?: pb_repeated<2, OidbByteProperty>; }
|
targetUid?: pb<3, string>;
|
||||||
export interface OidbUserInfoResponseBody { uid?: pb<1, string>; properties?: pb<2, OidbUserInfoProperty>; uin?: pb<3, uint_32>; }
|
rejectAddRequest?: pb<4, bool>;
|
||||||
export interface OidbUserInfoResponse { body?: pb<1, OidbUserInfoResponseBody>; }
|
reason?: pb<5, string>;
|
||||||
export interface AvatarInfo { url?: pb<5, string>; }
|
}
|
||||||
export interface OidbFriendListNumber { numbers?: pb_repeated<1, uint_32>; }
|
export interface OidbLeaveGroup {
|
||||||
export interface OidbFriendListBodyItem { type?: pb<1, uint_32>; number?: pb<2, OidbFriendListNumber>; }
|
groupUin?: pb<1, uint_32>;
|
||||||
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 OidbFriendRequestAction {
|
||||||
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>; }
|
accept?: pb<1, uint_32>;
|
||||||
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>; }
|
targetUid?: pb<2, string>;
|
||||||
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 OidbDeleteFriendField2Field3 {
|
||||||
export interface OidbGroupListRequest { config?: pb<1, OidbGroupListConfig>; }
|
field1?: pb<1, uint_32>;
|
||||||
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>; }
|
field2?: pb<2, uint_32>;
|
||||||
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>; }
|
field3?: pb<3, uint_32>;
|
||||||
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 OidbDeleteFriendField2 {
|
||||||
export interface GroupRecallRequest { type?: pb<1, uint_32>; groupUin?: pb<2, uint_32>; info?: pb<3, GroupRecallInfo>; settings?: pb<4, GroupRecallSettings>; }
|
field1?: pb<1, uint_32>;
|
||||||
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>; }
|
field2?: pb<2, uint_32>;
|
||||||
export interface C2CRecallSettings { field1?: pb<1, bool>; field2?: pb<2, bool>; }
|
field3?: pb<3, OidbDeleteFriendField2Field3>;
|
||||||
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 OidbDeleteFriendField1 {
|
||||||
export interface GroupReadedReportItem { groupUin?: pb<1, uint_64>; lastReadSeq?: pb<2, uint_64>; }
|
targetUid?: pb<1, string>;
|
||||||
export interface C2CReadedReportItem { uid?: pb<2, string>; lastReadTime?: pb<3, uint_64>; lastReadSeq?: pb<4, uint_64>; }
|
field2?: pb<2, OidbDeleteFriendField2>;
|
||||||
export interface SsoReadedReportReq { groupList?: pb_repeated<1, GroupReadedReportItem>; c2cList?: pb_repeated<2, C2CReadedReportItem>; }
|
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 OidbClientKeyReq {}
|
||||||
export interface OidbClientKeyResp { keyIndex?: pb<2, uint_32>; clientKey?: pb<3, string>; expireTime?: pb<4, uint_32>; }
|
export interface OidbClientKeyResp {
|
||||||
export interface OidbGetPskeyReq { domainList?: pb_repeated<1, string>; }
|
keyIndex?: pb<2, uint_32>;
|
||||||
export interface OidbPskeyItem { domain?: pb<1, string>; pskey?: pb<2, string>; expireTime?: pb<3, uint_64>; }
|
clientKey?: pb<3, string>;
|
||||||
export interface OidbGetPskeyResp { pskeyItems?: pb_repeated<1, OidbPskeyItem>; }
|
expireTime?: pb<4, uint_32>;
|
||||||
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 OidbGetPskeyReq {
|
||||||
export interface SetStatusResp { errCode?: pb<1, int_32>; errMsg?: pb<2, string>; }
|
domainList?: pb_repeated<1, 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 OidbPskeyItem {
|
||||||
export interface OidbSetProfile { uin?: pb<1, uint_64>; stringProfiles?: pb_repeated<2, OidbProfileStringItem>; intProfiles?: pb_repeated<3, OidbProfileIntItem>; }
|
domain?: pb<1, string>;
|
||||||
export interface Oidb0x7edInteraction { totalCount?: pb<1, uint_32>; newCount?: pb<2, uint_32>; todayCount?: pb<3, uint_32>; lastTime?: pb<4, uint_64>; }
|
pskey?: pb<2, string>;
|
||||||
export interface Oidb0x7edUserLikeInfo { uid?: pb<1, string>; time?: pb<2, uint_64>; favoriteInfo?: pb<3, Oidb0x7edInteraction>; voteInfo?: pb<4, Oidb0x7edInteraction>; }
|
expireTime?: pb<3, uint_64>;
|
||||||
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 OidbGetPskeyResp {
|
||||||
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>; }
|
pskeyItems?: pb_repeated<1, OidbPskeyItem>;
|
||||||
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 SetStatusCustomExt {
|
||||||
export interface Oidb0xe17Resp { jsonBody?: pb<4, string>; }
|
faceId?: pb<1, uint_32>;
|
||||||
export interface Oidb0x112aProfileInfo { tag?: pb<1, uint_32>; value?: pb<2, string>; }
|
text?: pb<2, string>;
|
||||||
export interface Oidb0x112aReq { uin?: pb<1, uint_64>; profile?: pb<2, Oidb0x112aProfileInfo>; }
|
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 Oidb0x112aResp {}
|
||||||
export interface Oidb0xcd4ReqBody { uid?: pb<1, string>; chatType?: pb<2, uint_32>; eventType?: pb<3, uint_32>; }
|
export interface Oidb0xcd4ReqBody {
|
||||||
export interface Oidb0xcd4Req { reqBody?: pb<1, 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 Oidb0xcd4Resp {}
|
||||||
export interface Oidb0x990TranslateReq { srcLang?: pb<1, string>; dstLang?: pb<2, string>; words?: pb_repeated<3, string>; }
|
export interface Oidb0x990TranslateReq {
|
||||||
export interface Oidb0x990Req { translateReq?: pb<2, Oidb0x990TranslateReq>; tag10?: pb<10, uint_32>; tag12?: pb<12, uint_32>; }
|
srcLang?: pb<1, string>;
|
||||||
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>; }
|
dstLang?: pb<2, string>;
|
||||||
export interface Oidb0x990Resp { translateResp?: pb<2, Oidb0x990TranslateResp>; }
|
words?: pb_repeated<3, string>;
|
||||||
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 Oidb0x990Req {
|
||||||
export interface MiniAppShareRespBody { jsonStr?: pb<2, string>; }
|
translateReq?: pb<2, Oidb0x990TranslateReq>;
|
||||||
export interface MiniAppShareResp { status?: pb<2, uint_32>; msg?: pb<3, string>; body?: pb<4, MiniAppShareRespBody>; }
|
tag10?: pb<10, uint_32>;
|
||||||
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>; }
|
tag12?: pb<12, 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 Oidb0x990TranslateResp {
|
||||||
export interface Oidb0xeb7Req { signInInfo?: pb<2, Oidb0xeb7SignInInfo>; }
|
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 Oidb0xeb7Resp {}
|
||||||
export interface FaceroamOpReqInner { field1?: pb<1, uint_32>; osVersion?: pb<2, string>; qqVersion?: pb<3, string>; }
|
export interface FaceroamOpReqInner {
|
||||||
export interface FaceroamOpReq { inner?: pb<1, FaceroamOpReqInner>; uin?: pb<2, uint_64>; field3?: pb<3, uint_32>; field6?: pb<6, uint_32>; }
|
field1?: pb<1, uint_32>;
|
||||||
export interface FaceroamOpRespItem { faceIds?: pb_repeated<1, string>; category?: pb<3, string>; totalCount?: pb<4, uint_32>; }
|
osVersion?: pb<2, string>;
|
||||||
export interface FaceroamOpResp { retCode?: pb<1, uint_32>; message?: pb<2, string>; field3?: pb<3, uint_32>; item?: pb<4, FaceroamOpRespItem>; }
|
qqVersion?: pb<3, string>;
|
||||||
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 FaceroamOpReq {
|
||||||
export interface Oidb0x9083RespInner { userInfo?: pb<1, Oidb0x9083RespUserInfo>; field4?: pb<4, uint_32>; }
|
inner?: pb<1, FaceroamOpReqInner>;
|
||||||
export interface Oidb0x9083Resp { inner?: pb<4, Oidb0x9083RespInner>; cookie?: pb<5, bytes>; }
|
uin?: pb<2, uint_64>;
|
||||||
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>; }
|
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 Oidb0x8a0Resp {}
|
||||||
export interface Oidb0xf16Inner { groupId?: pb<1, uint_64>; remark?: pb<3, string>; }
|
export interface Oidb0xf16Inner {
|
||||||
export interface Oidb0xf16Req { inner?: pb<1, Oidb0xf16Inner>; field12?: pb<12, uint_32>; }
|
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 Oidb0xf16Resp {}
|
||||||
export interface OidbGroupTodo { groupUin?: pb<1, uint_32>; msgSeq?: pb<2, uint_64>; }
|
export interface OidbGroupTodo {
|
||||||
export interface OidbStrangerStatusKey { key?: pb<1, uint_32>; }
|
groupUin?: pb<1, uint_32>;
|
||||||
export interface OidbStrangerStatusReq { uin?: pb<1, uint_32>; key?: pb_repeated<3, OidbStrangerStatusKey>; }
|
msgSeq?: pb<2, uint_64>;
|
||||||
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 OidbStrangerStatusKey {
|
||||||
export interface OidbStrangerStatusRespData { status?: pb<2, OidbStrangerStatusRespStatus>; }
|
key?: pb<1, uint_32>;
|
||||||
export interface OidbStrangerStatusResp { data?: pb<1, OidbStrangerStatusRespData>; }
|
}
|
||||||
export interface GroupAvatarExtraField3 { field1?: pb<1, uint_32>; }
|
export interface OidbStrangerStatusReq {
|
||||||
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>; }
|
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>;
|
||||||
|
}
|
||||||
@@ -1,43 +1,216 @@
|
|||||||
import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton';
|
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 ExtMapEntry {
|
||||||
export interface ReqInfo { groupId?: pb<1, string>; albumId?: pb<2, string>; field3?: pb<3, int_32>; attachInfo?: pb<4, string>; field5?: pb<5, string>; }
|
key?: pb<1, 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>; }
|
value?: pb<2, string>;
|
||||||
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 ReqInfo {
|
||||||
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>; }
|
groupId?: pb<1, string>;
|
||||||
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>; }
|
albumId?: pb<2, string>;
|
||||||
export interface GetMediaListAlbumInfo { albumId?: pb<1, string>; owner?: pb<2, string>; name?: pb<3, string>; }
|
field3?: pb<3, int_32>;
|
||||||
export interface GetMediaListRspData { albumInfo?: pb<1, GetMediaListAlbumInfo>; mediaList?: pb_repeated<3, MediaInfo>; prevAttachInfo?: pb<4, string>; nextAttachInfo?: pb<5, string>; }
|
attachInfo?: pb<4, string>;
|
||||||
export interface GetMediaListResponse { field1?: pb<1, int_32>; field2?: pb<2, bytes>; field3?: pb<3, bytes>; data?: pb<4, GetMediaListRspData>; }
|
field5?: pb<5, string>;
|
||||||
export interface CommentContentItem { type?: pb<1, uint_32>; content?: pb<2, string>; }
|
}
|
||||||
export interface CommentUser { uin?: pb<13, string>; }
|
export interface GetMediaListRequest {
|
||||||
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>; }
|
field1?: pb<1, int_32>;
|
||||||
export interface CommentReqContent { field2?: pb<2, CommentUser>; field3?: pb<3, CommentReqContentMeta>; clientKey?: pb<7, string>; }
|
field2?: pb<2, bytes>;
|
||||||
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>; }
|
field3?: pb<3, bytes>;
|
||||||
export interface CommentReqPhotoWrap { field2?: pb<2, CommentReqPhotoMeta>; }
|
reqInfo?: pb<4, ReqInfo>;
|
||||||
export interface CommentReqPhotoInfo { field1?: pb<1, CommentReqPhotoWrap>; albumId?: pb<3, string>; field5?: pb<5, uint_32>; }
|
traceId?: pb<5, string>;
|
||||||
export interface CommentReqBodyHeader { field3?: pb<3, uint_32>; field4?: pb<4, string>; }
|
extMap?: pb_repeated<10, ExtMapEntry>;
|
||||||
export interface CommentReqBodyUserWrap { field1?: pb<1, CommentUser>; }
|
}
|
||||||
export interface CommentReqBody { field1?: pb<1, CommentReqBodyHeader>; field2?: pb<2, CommentReqBodyUserWrap>; field5?: pb<5, CommentReqPhotoInfo>; }
|
export interface UrlInfo {
|
||||||
export interface DoQunCommentRequestBody { groupId?: pb<2, string>; field3?: pb<3, uint_32>; reqBody?: pb<4, CommentReqBody>; field5?: pb<5, CommentReqContent>; }
|
url?: pb<1, string>;
|
||||||
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>; }
|
width?: pb<2, uint_32>;
|
||||||
export interface CommentRespUser { uin?: pb<13, string>; }
|
height?: pb<3, uint_32>;
|
||||||
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 PhotoUrl {
|
||||||
export interface DoQunCommentResponseComment { data?: pb<2, CommentRespData>; }
|
spec?: pb<1, uint_32>;
|
||||||
export interface DoQunCommentResponse { field1?: pb<1, int_32>; comment?: pb<4, DoQunCommentResponseComment>; }
|
url?: pb<2, UrlInfo>;
|
||||||
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 ImageInfo {
|
||||||
export interface DoQunLikeReqCellUser { uin?: pb<13, string>; }
|
name?: pb<1, string>;
|
||||||
export interface DoQunLikeReqCellUserInfo { user?: pb<1, DoQunLikeReqCellUser>; }
|
sloc?: pb<2, string>;
|
||||||
export interface DoQunLikeReqCellQunInfo { qunId?: pb<1, string>; }
|
lloc?: pb<3, string>;
|
||||||
export interface DoQunLikeReqCellMedia { albumId?: pb<3, string>; batchId?: pb<5, uint_64>; }
|
photoUrls?: pb_repeated<4, PhotoUrl>;
|
||||||
export interface DoQunLikeReqFeedPublish { cellCommon?: pb<1, DoQunLikeReqCellCommon>; cellUserInfo?: pb<2, DoQunLikeReqCellUserInfo>; cellMedia?: pb<5, DoQunLikeReqCellMedia>; cellQunInfo?: pb<12, DoQunLikeReqCellQunInfo>; }
|
defaultUrl?: pb<5, UrlInfo>;
|
||||||
export interface DoQunLikeReqBody { type?: pb<2, uint_32>; like?: pb<3, DoQunLikeReqLikeInfo>; publish?: pb<4, DoQunLikeReqFeedPublish>; clientKey?: pb<5, string>; }
|
isGif?: pb<6, bool>;
|
||||||
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>; }
|
hasRaw?: pb<7, bool>;
|
||||||
export interface DoQunLikeRespBody { like?: pb<2, DoQunLikeReqLikeInfo>; }
|
}
|
||||||
export interface DoQunLikeResponse { field1?: pb<1, int_32>; body?: pb<4, DoQunLikeRespBody>; }
|
export interface MediaInfo {
|
||||||
export interface DeleteMediasReqBody { groupId?: pb<1, string>; albumId?: pb<2, string>; lloc?: pb<3, string>; }
|
type?: pb<1, uint_32>;
|
||||||
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>; }
|
image?: pb<2, ImageInfo>;
|
||||||
export interface DeleteMediasResponse { field1?: pb<1, int_32>; field2?: pb<2, int_32>; field3?: pb<3, string>; }
|
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>;
|
||||||
|
}
|
||||||
@@ -1,31 +1,185 @@
|
|||||||
import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton';
|
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 OidbGroupFileListReq {
|
||||||
export interface OidbGroupFileViewReq { list?: pb<2, OidbGroupFileListReq>; }
|
groupUin?: pb<1, uint_32>;
|
||||||
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>; }
|
appId?: pb<2, 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>; }
|
targetDirectory?: pb<3, string>;
|
||||||
export interface OidbGroupFileListItemResp { type?: pb<1, uint_32>; folderInfo?: pb<2, OidbGroupFileListFolderResp>; fileInfo?: pb<3, OidbGroupFileListFileResp>; }
|
fileCount?: pb<5, uint_32>;
|
||||||
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>; }
|
sortBy?: pb<9, uint_32>;
|
||||||
export interface OidbGroupFileViewResp { list?: pb<2, OidbGroupFileListResp>; }
|
startIndex?: pb<13, uint_32>;
|
||||||
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>; }
|
field17?: pb<17, uint_32>;
|
||||||
export interface OidbGroupFileDownloadReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; busId?: pb<3, uint_32>; fileId?: pb<4, string>; }
|
field18?: pb<18, uint_32>;
|
||||||
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 OidbGroupFileViewReq {
|
||||||
export interface OidbGroupFileReq { file?: pb<1, OidbGroupFileUploadReq>; download?: pb<3, OidbGroupFileDownloadReq>; delete?: pb<4, OidbGroupFileDeleteReq>; move?: pb<6, OidbGroupFileMoveReq>; }
|
list?: pb<2, OidbGroupFileListReq>;
|
||||||
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 OidbGroupFileListFolderResp {
|
||||||
export interface OidbGroupFileRetResp { retCode?: pb<1, uint_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; }
|
folderId?: pb<1, string>;
|
||||||
export interface OidbGroupFileResp { upload?: pb<1, OidbGroupFileUploadResp>; download?: pb<3, OidbGroupFileDownloadResp>; delete?: pb<4, OidbGroupFileRetResp>; move?: pb<6, OidbGroupFileRetResp>; }
|
parentDirectoryId?: pb<2, string>;
|
||||||
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>; }
|
folderName?: pb<3, string>;
|
||||||
export interface OidbGroupSendFileBody { groupUin?: pb<1, uint_32>; type?: pb<2, uint_32>; info?: pb<3, OidbGroupSendFileInfo>; }
|
createTime?: pb<4, uint_32>;
|
||||||
export interface OidbGroupSendFileReq { body?: pb<5, OidbGroupSendFileBody>; }
|
modifiedTime?: pb<5, uint_32>;
|
||||||
export interface OidbGroupFileCreateFolderReq { groupUin?: pb<1, uint_32>; rootDirectory?: pb<3, string>; folderName?: pb<4, string>; }
|
creatorUin?: pb<6, uint_32>;
|
||||||
export interface OidbGroupFileDeleteFolderReq { groupUin?: pb<1, uint_32>; folderId?: pb<3, string>; }
|
creatorName?: pb<7, string>;
|
||||||
export interface OidbGroupFileRenameFolderReq { groupUin?: pb<1, uint_32>; folderId?: pb<3, string>; newFolderName?: pb<4, string>; }
|
totalFileCount?: pb<8, uint_32>;
|
||||||
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 OidbGroupFileListFileResp {
|
||||||
export interface OidbGroupFileFolderResp { create?: pb<1, OidbGroupFileFolderRetResp>; delete?: pb<2, OidbGroupFileFolderRetResp>; rename?: pb<3, OidbGroupFileFolderRetResp>; }
|
fileId?: pb<1, string>;
|
||||||
export interface OidbGroupFileCountReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; busId?: pb<3, uint_32>; }
|
fileName?: pb<2, string>;
|
||||||
export interface OidbGroupFileCountResp { fileCount?: pb<1, uint_32>; maxCount?: pb<2, uint_32>; isEnd?: pb<3, bool>; }
|
fileSize?: pb<3, uint_64>;
|
||||||
export interface OidbGroupFileCountViewReq { count?: pb<3, OidbGroupFileCountReq>; }
|
busId?: pb<4, uint_32>;
|
||||||
export interface OidbGroupFileCountViewResp { count?: pb<3, OidbGroupFileCountResp>; }
|
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>;
|
||||||
|
}
|
||||||
@@ -1,44 +1,242 @@
|
|||||||
import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton';
|
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 OidbPrivateFileDownloadReqBody {
|
||||||
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>; }
|
receiverUid?: pb<10, string>;
|
||||||
export interface OidbPrivateFileDownloadRespResult { server?: pb<20, string>; port?: pb<40, uint_32>; url?: pb<50, string>; }
|
fileUuid?: pb<20, string>;
|
||||||
export interface OidbPrivateFileDownloadRespBody { state?: pb<20, string>; result?: pb<30, OidbPrivateFileDownloadRespResult>; }
|
type?: pb<30, uint_32>;
|
||||||
export interface OidbPrivateFileDownloadResp { body?: pb<14, OidbPrivateFileDownloadRespBody>; }
|
fileHash?: pb<60, string>;
|
||||||
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>; }
|
t2?: pb<601, uint_32>;
|
||||||
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 OidbPrivateFileDownloadReq {
|
||||||
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>; }
|
subCommand?: pb<1, uint_32>;
|
||||||
export interface OidbPrivateFileUploadResp { upload?: pb<19, OidbPrivateFileUploadRespBody>; }
|
field2?: pb<2, uint_32>;
|
||||||
export interface NTV2CommonHead { requestId?: pb<1, uint_32>; command?: pb<2, uint_32>; }
|
body?: pb<14, OidbPrivateFileDownloadReqBody>;
|
||||||
export interface NTV2C2CUserInfo { accountType?: pb<1, uint_32>; targetUid?: pb<2, string>; }
|
field101?: pb<101, uint_32>;
|
||||||
export interface NTV2GroupInfo { groupUin?: pb<1, uint_32>; }
|
field102?: pb<102, 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>; }
|
field200?: pb<200, uint_32>;
|
||||||
export interface NTV2ClientMeta { agentType?: pb<1, uint_32>; }
|
field99999?: pb<99999, bytes>;
|
||||||
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 OidbPrivateFileDownloadRespResult {
|
||||||
export interface NTV2FileType { type?: pb<1, uint_32>; picFormat?: pb<2, uint_32>; videoFormat?: pb<3, uint_32>; voiceFormat?: pb<4, uint_32>; }
|
server?: pb<20, string>;
|
||||||
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>; }
|
port?: pb<40, 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>; }
|
url?: pb<50, string>;
|
||||||
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 OidbPrivateFileDownloadRespBody {
|
||||||
export interface NTV2DownloadReq { node?: pb<1, NTV2IndexNode>; download?: pb<2, NTV2DownloadExt>; }
|
state?: pb<20, string>;
|
||||||
export interface NTV2RichMediaReq { reqHead?: pb<1, NTV2ReqHead>; download?: pb<3, NTV2DownloadReq>; downloadRkey?: pb<4, NTV2DownloadRKeyReq>; }
|
result?: pb<30, OidbPrivateFileDownloadRespResult>;
|
||||||
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 OidbPrivateFileDownloadResp {
|
||||||
export interface NTV2DownloadRKeyResp { rkeys?: pb_repeated<1, NTV2RKeyInfo>; }
|
body?: pb<14, OidbPrivateFileDownloadRespBody>;
|
||||||
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 OidbPrivateFileUploadReqBody {
|
||||||
export interface NTV2RichMediaResp { respHead?: pb<1, NTV2RespHead>; download?: pb<3, NTV2MediaDownloadResp>; downloadRkey?: pb<4, NTV2DownloadRKeyResp>; }
|
senderUid?: pb<10, string>;
|
||||||
export interface OidbAiVoiceListReq { groupUin?: pb<1, uint_32>; chatType?: pb<2, uint_32>; }
|
receiverUid?: pb<20, string>;
|
||||||
export interface OidbAiVoiceListEntry { voiceId?: pb<1, string>; voiceDisplayName?: pb<2, string>; voiceExampleUrl?: pb<3, string>; }
|
fileSize?: pb<30, uint_32>;
|
||||||
export interface OidbAiVoiceListCategory { category?: pb<1, string>; voices?: pb_repeated<2, OidbAiVoiceListEntry>; }
|
fileName?: pb<40, string>;
|
||||||
export interface OidbAiVoiceListResp { content?: pb_repeated<1, OidbAiVoiceListCategory>; }
|
md510MCheckSum?: pb<50, bytes>;
|
||||||
export interface OidbAiVoiceSession { sessionId?: pb<1, uint_32>; }
|
sha1CheckSum?: pb<60, bytes>;
|
||||||
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>; }
|
localPath?: pb<70, string>;
|
||||||
export interface OidbAiVoiceFileType { type?: pb<1, uint_32>; picFormat?: pb<2, uint_32>; videoFormat?: pb<3, uint_32>; voiceFormat?: pb<4, uint_32>; }
|
md5CheckSum?: pb<110, bytes>;
|
||||||
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>; }
|
sha3CheckSum?: pb<120, bytes>;
|
||||||
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 OidbPrivateFileUploadReq {
|
||||||
export interface OidbAiVoiceMsgInfo { msgInfoBody?: pb_repeated<1, OidbAiVoiceMsgInfoBody>; }
|
command?: pb<1, uint_32>;
|
||||||
export interface OidbAiVoiceResp { statusCode?: pb<1, uint_32>; field2?: pb<2, uint_32>; field3?: pb<3, uint_32>; msgInfo?: pb<4, OidbAiVoiceMsgInfo>; }
|
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>;
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ import type {
|
|||||||
OidbClientKeyResp,
|
OidbClientKeyResp,
|
||||||
OidbGetPskeyReq,
|
OidbGetPskeyReq,
|
||||||
OidbGetPskeyResp,
|
OidbGetPskeyResp,
|
||||||
} from '../proto/proton/oidb-action';
|
} from '../proto/proton/oidb-actions/base';
|
||||||
import { RequestUtil } from '../web/request-util';
|
import { RequestUtil } from '../web/request-util';
|
||||||
|
|
||||||
export async function forceFetchClientKey(bridge: Bridge) {
|
export async function forceFetchClientKey(bridge: Bridge) {
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ import { protobuf_encode } from '@snowluma/proton';
|
|||||||
import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
||||||
import type {
|
import type {
|
||||||
OidbStrangerStatusResp,
|
OidbStrangerStatusResp,
|
||||||
|
} from '../../src/bridge/proto/proton/oidb-actions/base';
|
||||||
|
import type {
|
||||||
OidbAiVoiceListResp,
|
OidbAiVoiceListResp,
|
||||||
OidbAiVoiceResp,
|
OidbAiVoiceResp,
|
||||||
} from '../../src/bridge/proto/proton/oidb-action';
|
} from '../../src/bridge/proto/proton/oidb-actions/media';
|
||||||
|
|
||||||
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
||||||
// that the plugin substitutes at the call site with the inlined codec, so
|
// that the plugin substitutes at the call site with the inlined codec, so
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ vi.mock('../../src/bridge/element-builder', () => ({
|
|||||||
buildSendElems: buildSendElemsMock,
|
buildSendElems: buildSendElemsMock,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
import { protoEncode } from '../../src/protobuf/decode';
|
import { protobuf_encode } from '@snowluma/proton';
|
||||||
import { SendLongMsgRespSchema } from '../../src/bridge/proto/longmsg';
|
import type { SendLongMsgResp } from '../../src/bridge/proto/proton/longmsg';
|
||||||
import * as forward from '../../src/bridge/actions/forward';
|
import * as forward from '../../src/bridge/actions/forward';
|
||||||
import { mockBridge } from './_helpers';
|
import { mockBridge } from './_helpers';
|
||||||
|
|
||||||
function uploadResponseWithResId(resId: string) {
|
function uploadResponseWithResId(resId: string) {
|
||||||
const encoded = protoEncode({ result: { resId } }, SendLongMsgRespSchema);
|
const encoded = protobuf_encode<SendLongMsgResp>({ result: { resId } });
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
gotResponse: true,
|
gotResponse: true,
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ vi.mock('../../src/bridge/element-builder', () => ({
|
|||||||
buildSendElems: vi.fn(async () => []),
|
buildSendElems: vi.fn(async () => []),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
import { protoEncode } from '../../src/protobuf/decode';
|
import { protobuf_encode } from '@snowluma/proton';
|
||||||
import { SendLongMsgRespSchema } from '../../src/bridge/proto/longmsg';
|
import type { SendLongMsgResp } from '../../src/bridge/proto/proton/longmsg';
|
||||||
import * as forward from '../../src/bridge/actions/forward';
|
import * as forward from '../../src/bridge/actions/forward';
|
||||||
import { mockBridge } from './_helpers';
|
import { mockBridge } from './_helpers';
|
||||||
|
|
||||||
function uploadResponseWithResId(resId: string) {
|
function uploadResponseWithResId(resId: string) {
|
||||||
const encoded = protoEncode({ result: { resId } }, SendLongMsgRespSchema);
|
const encoded = protobuf_encode<SendLongMsgResp>({ result: { resId } });
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
gotResponse: true,
|
gotResponse: true,
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ describe('actions/friend', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.mocked(oidb.runOidb).mockClear();
|
vi.mocked(oidb.runOidb).mockClear();
|
||||||
vi.mocked(oidb.makeOidbEnvelope).mockClear();
|
vi.mocked(oidb.makeOidbEnvelope).mockClear();
|
||||||
vi.mocked(oidb.encodeOidbEnv).mockClear();
|
|
||||||
vi.mocked(oidb.decodeOidbEnv).mockClear();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('setFriendAddRequest: numeric input is treated as UIN and resolved', async () => {
|
it('setFriendAddRequest: numeric input is treated as UIN and resolved', async () => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||||
import { protobuf_encode } from '@snowluma/proton';
|
import { protobuf_encode } from '@snowluma/proton';
|
||||||
import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
||||||
import type { Oidb0x8a7Resp } from '../../src/bridge/proto/proton/oidb-action';
|
import type { Oidb0x8a7Resp } from '../../src/bridge/proto/proton/oidb-actions/base';
|
||||||
|
|
||||||
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
||||||
// that the plugin substitutes at the call site with the inlined codec, so
|
// that the plugin substitutes at the call site with the inlined codec, so
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ import type {
|
|||||||
OidbGroupFileCountViewResp,
|
OidbGroupFileCountViewResp,
|
||||||
OidbGroupFileResp,
|
OidbGroupFileResp,
|
||||||
OidbGroupFileViewResp,
|
OidbGroupFileViewResp,
|
||||||
OidbPrivateFileUploadResp,
|
|
||||||
OidbGroupFileFolderResp,
|
OidbGroupFileFolderResp,
|
||||||
|
} from '../../src/bridge/proto/proton/oidb-actions/group-file';
|
||||||
|
import type {
|
||||||
|
OidbPrivateFileUploadResp,
|
||||||
NTV2RichMediaResp,
|
NTV2RichMediaResp,
|
||||||
} from '../../src/bridge/proto/proton/oidb-action';
|
} from '../../src/bridge/proto/proton/oidb-actions/media';
|
||||||
|
|
||||||
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
||||||
// (substituted at the call site with the inlined codec). Mocking them on
|
// (substituted at the call site with the inlined codec). Mocking them on
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ describe('actions/group-message', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.mocked(oidb.runOidb).mockClear();
|
vi.mocked(oidb.runOidb).mockClear();
|
||||||
vi.mocked(oidb.makeOidbEnvelope).mockClear();
|
vi.mocked(oidb.makeOidbEnvelope).mockClear();
|
||||||
vi.mocked(oidb.encodeOidbEnv).mockClear();
|
|
||||||
vi.mocked(oidb.decodeOidbEnv).mockClear();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('recallGroupMessage sends to SsoGroupRecallMsg with the group sequence', async () => {
|
it('recallGroupMessage sends to SsoGroupRecallMsg with the group sequence', async () => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||||
import { protobuf_encode } from '@snowluma/proton';
|
import { protobuf_encode } from '@snowluma/proton';
|
||||||
import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
||||||
import type { Oidb0x9083Resp } from '../../src/bridge/proto/proton/oidb-action';
|
import type { Oidb0x9083Resp } from '../../src/bridge/proto/proton/oidb-actions/base';
|
||||||
|
|
||||||
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
||||||
// that the plugin substitutes at the call site for the inlined codec.
|
// that the plugin substitutes at the call site for the inlined codec.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
|||||||
import type {
|
import type {
|
||||||
Oidb0x990Resp,
|
Oidb0x990Resp,
|
||||||
Oidb0x112eResp,
|
Oidb0x112eResp,
|
||||||
} from '../../src/bridge/proto/proton/oidb-action';
|
} from '../../src/bridge/proto/proton/oidb-actions/base';
|
||||||
|
|
||||||
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
||||||
// — the plugin substitutes them at the call site with the inlined codec,
|
// — the plugin substitutes them at the call site with the inlined codec,
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||||
import { protobuf_encode } from '@snowluma/proton';
|
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||||
import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
||||||
import type {
|
import type {
|
||||||
|
GroupAvatarExtra,
|
||||||
Oidb0x7edResp,
|
Oidb0x7edResp,
|
||||||
Oidb0xe17Resp,
|
Oidb0xe17Resp,
|
||||||
} from '../../src/bridge/proto/proton/oidb-action';
|
SetStatusReq,
|
||||||
|
SetStatusResp,
|
||||||
|
} from '../../src/bridge/proto/proton/oidb-actions/base';
|
||||||
|
|
||||||
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
||||||
// (substituted at the call site with the inlined codec). Mocking them on
|
// (substituted at the call site with the inlined codec). Mocking them on
|
||||||
@@ -71,23 +74,19 @@ describe('actions/profile', () => {
|
|||||||
expect(serviceCmd).toBe('trpc.qq_new_tech.status_svc.StatusService.SetStatus');
|
expect(serviceCmd).toBe('trpc.qq_new_tech.status_svc.StatusService.SetStatus');
|
||||||
// Decode the wire bytes back through the same schema to assert
|
// Decode the wire bytes back through the same schema to assert
|
||||||
// every field landed in the right place.
|
// every field landed in the right place.
|
||||||
const { protoDecode } = await import('../../src/protobuf/decode');
|
const decoded = protobuf_decode<SetStatusReq>(body as Uint8Array);
|
||||||
const { SetStatusReqSchema } = await import('../../src/bridge/proto/oidb-action');
|
|
||||||
const decoded = protoDecode(body as Uint8Array, SetStatusReqSchema);
|
|
||||||
expect(decoded).toMatchObject({
|
expect(decoded).toMatchObject({
|
||||||
status: 10,
|
status: 10,
|
||||||
extStatus: 2000,
|
extStatus: 2000,
|
||||||
batteryStatus: 0,
|
|
||||||
customExt: { faceId: 1234, text: '摸鱼中', faceType: 2 },
|
customExt: { faceId: 1234, text: '摸鱼中', faceType: 2 },
|
||||||
});
|
});
|
||||||
|
expect(decoded.batteryStatus ?? 0).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('setDiyOnlineStatus surfaces server errors via the same path as setOnlineStatus', async () => {
|
it('setDiyOnlineStatus surfaces server errors via the same path as setOnlineStatus', async () => {
|
||||||
const bridge = mockBridge();
|
const bridge = mockBridge();
|
||||||
// Build a response that decodes to errCode != 0.
|
// Build a response that decodes to errCode != 0.
|
||||||
const { protoEncode } = await import('../../src/protobuf/decode');
|
const respBuf = Buffer.from(protobuf_encode<SetStatusResp>({ errCode: 1, errMsg: 'denied' }));
|
||||||
const { SetStatusRespSchema } = await import('../../src/bridge/proto/oidb-action');
|
|
||||||
const respBuf = Buffer.from(protoEncode({ errCode: 1, errMsg: 'denied' }, SetStatusRespSchema));
|
|
||||||
bridge.sendRawPacket.mockResolvedValueOnce({
|
bridge.sendRawPacket.mockResolvedValueOnce({
|
||||||
success: true, gotResponse: true, errorCode: 0, errorMessage: '', responseData: respBuf,
|
success: true, gotResponse: true, errorCode: 0, errorMessage: '', responseData: respBuf,
|
||||||
} as any);
|
} as any);
|
||||||
@@ -150,9 +149,7 @@ describe('actions/profile', () => {
|
|||||||
expect(cmdId).toBe(3000);
|
expect(cmdId).toBe(3000);
|
||||||
// Decode the extra blob back through the schema and assert every
|
// Decode the extra blob back through the schema and assert every
|
||||||
// protocol-prescribed constant lands where it should.
|
// protocol-prescribed constant lands where it should.
|
||||||
const { protoDecode } = await import('../../src/protobuf/decode');
|
const decoded = protobuf_decode<GroupAvatarExtra>(extend as Uint8Array);
|
||||||
const { GroupAvatarExtraSchema } = await import('../../src/bridge/proto/oidb-action');
|
|
||||||
const decoded = protoDecode(extend as Uint8Array, GroupAvatarExtraSchema);
|
|
||||||
expect(decoded).toEqual({
|
expect(decoded).toEqual({
|
||||||
type: 101,
|
type: 101,
|
||||||
groupUin: 12345,
|
groupUin: 12345,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { describe, expect, it, vi } from 'vitest';
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
|
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||||
import type { SendPacketResult } from '../src/protocol/packet-sender';
|
import type { SendPacketResult } from '../src/protocol/packet-sender';
|
||||||
import { protoDecode, protoEncode } from '../src/protobuf/decode';
|
import type { SendMessageRequest, SendMessageResponse } from '../src/bridge/proto/proton/action';
|
||||||
import { SendMessageRequestSchema, SendMessageResponseSchema } from '../src/bridge/proto/action';
|
import type { FileExtra } from '../src/bridge/proto/proton/message';
|
||||||
import { FileExtraSchema } from '../src/bridge/proto/message';
|
|
||||||
|
|
||||||
vi.mock('../src/bridge/element-builder', () => ({
|
vi.mock('../src/bridge/element-builder', () => ({
|
||||||
buildSendElems: vi.fn(async () => [{ text: { str: 'stub media elem' } }]),
|
buildSendElems: vi.fn(async () => [{ text: { str: 'stub media elem' } }]),
|
||||||
@@ -29,11 +29,12 @@ describe('Bridge private media routing', () => {
|
|||||||
gotResponse: true,
|
gotResponse: true,
|
||||||
errorCode: 0,
|
errorCode: 0,
|
||||||
errorMessage: '',
|
errorMessage: '',
|
||||||
responseData: Buffer.from(protoEncode({
|
responseData: Buffer.from(protobuf_encode<SendMessageResponse>({
|
||||||
result: 0,
|
result: 0,
|
||||||
|
errMsg: '',
|
||||||
privateSequence: 88,
|
privateSequence: 88,
|
||||||
timestamp1: 1710000000,
|
timestamp1: 1710000000,
|
||||||
}, SendMessageResponseSchema)),
|
})),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,7 +43,7 @@ describe('Bridge private media routing', () => {
|
|||||||
await bridge.sendPrivateMessage(12345, [{ type: 'video', url: 'file:///tmp/clip.mp4' } as any]);
|
await bridge.sendPrivateMessage(12345, [{ type: 'video', url: 'file:///tmp/clip.mp4' } as any]);
|
||||||
|
|
||||||
expect(bridge.capturedBody).toBeInstanceOf(Uint8Array);
|
expect(bridge.capturedBody).toBeInstanceOf(Uint8Array);
|
||||||
const request = protoDecode(bridge.capturedBody as Uint8Array, SendMessageRequestSchema);
|
const request = protobuf_decode<SendMessageRequest>(bridge.capturedBody as Uint8Array);
|
||||||
expect(request?.routingHead?.c2c).toMatchObject({
|
expect(request?.routingHead?.c2c).toMatchObject({
|
||||||
uin: 12345,
|
uin: 12345,
|
||||||
uid: 'u_peer_12345',
|
uid: 'u_peer_12345',
|
||||||
@@ -67,9 +68,9 @@ describe('Bridge private media routing', () => {
|
|||||||
this.capturedBody = body;
|
this.capturedBody = body;
|
||||||
return {
|
return {
|
||||||
success: true, gotResponse: true, errorCode: 0, errorMessage: '',
|
success: true, gotResponse: true, errorCode: 0, errorMessage: '',
|
||||||
responseData: Buffer.from(protoEncode({
|
responseData: Buffer.from(protobuf_encode<SendMessageResponse>({
|
||||||
result: 0, privateSequence: 88, timestamp1: 1710000000,
|
result: 0, errMsg: '', privateSequence: 88, timestamp1: 1710000000,
|
||||||
}, SendMessageResponseSchema)),
|
})),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,27 +85,24 @@ describe('Bridge private media routing', () => {
|
|||||||
fileHash: 'hash-xyz',
|
fileHash: 'hash-xyz',
|
||||||
});
|
});
|
||||||
|
|
||||||
const request = protoDecode(bridge.capturedBody as Uint8Array, SendMessageRequestSchema);
|
const request = protobuf_decode<SendMessageRequest>(bridge.capturedBody as Uint8Array);
|
||||||
|
|
||||||
// Routing: must be trans0x211 with ccCmd=4 + uid, no c2c slot.
|
// Routing: must be trans0x211 with ccCmd=4 + uid, no c2c slot.
|
||||||
expect(request?.routingHead?.trans0x211).toMatchObject({
|
expect(request?.routingHead?.trans0x211).toMatchObject({
|
||||||
ccCmd: 4,
|
ccCmd: 4,
|
||||||
uid: 'u_peer_xyz',
|
uid: 'u_peer_xyz',
|
||||||
});
|
});
|
||||||
expect(request?.routingHead?.c2c).toBeUndefined();
|
expect(request?.routingHead?.c2c ?? undefined).toBeUndefined();
|
||||||
|
|
||||||
// Body: msgContent carries the FileExtra; richText is absent (no
|
// Body: msgContent carries the FileExtra; richText is absent (no
|
||||||
// elems, no notOnlineFile slot — both lived on the wrong place).
|
// elems, no notOnlineFile slot — both lived on the wrong place).
|
||||||
expect(request?.messageBody?.msgContent).toBeInstanceOf(Uint8Array);
|
expect(request?.messageBody?.msgContent).toBeInstanceOf(Uint8Array);
|
||||||
expect(request?.messageBody?.richText).toBeUndefined();
|
expect(request?.messageBody?.richText ?? undefined).toBeUndefined();
|
||||||
|
|
||||||
// Decode the msgContent and verify the NotOnlineFile fields land
|
// Decode the msgContent and verify the NotOnlineFile fields land
|
||||||
// at the correct tags (Lagrange's NotOnlineFile schema, not the
|
// at the correct tags (Lagrange's NotOnlineFile schema, not the
|
||||||
// dead FileExtraInfo one).
|
// dead FileExtraInfo one).
|
||||||
const fileExtra = protoDecode(
|
const fileExtra = protobuf_decode<FileExtra>(request!.messageBody!.msgContent as Uint8Array);
|
||||||
request!.messageBody!.msgContent as Uint8Array,
|
|
||||||
FileExtraSchema,
|
|
||||||
);
|
|
||||||
expect(fileExtra?.file).toMatchObject({
|
expect(fileExtra?.file).toMatchObject({
|
||||||
fileUuid: 'uuid-abc-123',
|
fileUuid: 'uuid-abc-123',
|
||||||
fileName: 'doc.txt',
|
fileName: 'doc.txt',
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
// - formatEvent prints something readable in the [Event] log
|
// - formatEvent prints something readable in the [Event] log
|
||||||
|
|
||||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||||
import { protoEncode } from '../src/protobuf/decode';
|
import { protobuf_encode } from '@snowluma/proton';
|
||||||
import { GroupReactNotifySchema } from '../src/bridge/proto/notify';
|
import type { GroupReactNotify } from '../src/bridge/proto/proton/notify';
|
||||||
import { decodeEvent0x2DC } from '../src/bridge/msg-push/decoders/event-0x2dc';
|
import { decodeEvent0x2DC } from '../src/bridge/msg-push/decoders/event-0x2dc';
|
||||||
import type { MsgPushContext } from '../src/bridge/msg-push/context';
|
import type { MsgPushContext } from '../src/bridge/msg-push/context';
|
||||||
import { IdentityService } from '../src/bridge/identity-service';
|
import { IdentityService } from '../src/bridge/identity-service';
|
||||||
@@ -28,7 +28,7 @@ function makeIdentity(): IdentityService {
|
|||||||
* a 7-byte magic prefix followed by an encoded GroupReactNotify. */
|
* a 7-byte magic prefix followed by an encoded GroupReactNotify. */
|
||||||
function buildReactContent(notify: Record<string, unknown>): Uint8Array {
|
function buildReactContent(notify: Record<string, unknown>): Uint8Array {
|
||||||
const prefix = new Uint8Array([0, 0, 0, 0, 0, 0, 0]);
|
const prefix = new Uint8Array([0, 0, 0, 0, 0, 0, 0]);
|
||||||
const body = protoEncode(notify as never, GroupReactNotifySchema);
|
const body = protobuf_encode<GroupReactNotify>(notify as GroupReactNotify);
|
||||||
const out = new Uint8Array(prefix.length + body.length);
|
const out = new Uint8Array(prefix.length + body.length);
|
||||||
out.set(prefix, 0);
|
out.set(prefix, 0);
|
||||||
out.set(body, prefix.length);
|
out.set(body, prefix.length);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
// the actual decode path inside the pipeline.
|
// the actual decode path inside the pipeline.
|
||||||
|
|
||||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||||
|
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||||
|
|
||||||
vi.mock('../../src/bridge/highway/highway-client', () => ({
|
vi.mock('../../src/bridge/highway/highway-client', () => ({
|
||||||
fetchHighwaySession: vi.fn(async () => ({ sessionId: 'fake-session' })),
|
fetchHighwaySession: vi.fn(async () => ({ sessionId: 'fake-session' })),
|
||||||
@@ -23,13 +24,8 @@ import {
|
|||||||
runNtv2Upload,
|
runNtv2Upload,
|
||||||
type MediaSubFileUpload,
|
type MediaSubFileUpload,
|
||||||
} from '../../src/bridge/highway/pipeline';
|
} from '../../src/bridge/highway/pipeline';
|
||||||
import { protoDecode, protoEncode } from '../../src/protobuf/decode';
|
import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
||||||
import { makeOidbBaseSchema } from '../../src/bridge/proto/oidb';
|
import type { EncodableMediaMsgInfo, NTV2UploadRichMediaReq, NTV2UploadRichMediaResp } from '../../src/bridge/proto/proton/highway';
|
||||||
import {
|
|
||||||
EncodableMediaMsgInfoSchema,
|
|
||||||
NTV2UploadRichMediaReqSchema,
|
|
||||||
NTV2UploadRichMediaRespSchema,
|
|
||||||
} from '../../src/bridge/proto/highway';
|
|
||||||
|
|
||||||
interface FakeUploadResponse {
|
interface FakeUploadResponse {
|
||||||
upload?: {
|
upload?: {
|
||||||
@@ -48,8 +44,7 @@ interface FakeUploadResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function encodeOidbResponse(body: FakeUploadResponse, opts: { errorCode?: number; errorMsg?: string } = {}): Buffer {
|
function encodeOidbResponse(body: FakeUploadResponse, opts: { errorCode?: number; errorMsg?: string } = {}): Buffer {
|
||||||
const baseSchema = makeOidbBaseSchema(NTV2UploadRichMediaRespSchema);
|
return Buffer.from(protobuf_encode<OidbBase<NTV2UploadRichMediaResp>>({
|
||||||
return Buffer.from(protoEncode({
|
|
||||||
command: 0x11C4,
|
command: 0x11C4,
|
||||||
subCommand: 100,
|
subCommand: 100,
|
||||||
errorCode: opts.errorCode ?? 0,
|
errorCode: opts.errorCode ?? 0,
|
||||||
@@ -58,7 +53,7 @@ function encodeOidbResponse(body: FakeUploadResponse, opts: { errorCode?: number
|
|||||||
body: body as unknown as Record<string, unknown>,
|
body: body as unknown as Record<string, unknown>,
|
||||||
errorMsg: opts.errorMsg ?? '',
|
errorMsg: opts.errorMsg ?? '',
|
||||||
reserved: 1,
|
reserved: 1,
|
||||||
}, baseSchema));
|
} as OidbBase<NTV2UploadRichMediaResp>));
|
||||||
}
|
}
|
||||||
|
|
||||||
type SendPacketResult = {
|
type SendPacketResult = {
|
||||||
@@ -125,8 +120,7 @@ describe('pipeline — runNtv2Upload', () => {
|
|||||||
|
|
||||||
// The request roundtrips through the real OIDB envelope and carries
|
// The request roundtrips through the real OIDB envelope and carries
|
||||||
// the requestId / businessType / scene fields we passed.
|
// the requestId / businessType / scene fields we passed.
|
||||||
const baseSchema = makeOidbBaseSchema(NTV2UploadRichMediaReqSchema);
|
const decoded: any = protobuf_decode<OidbBase<NTV2UploadRichMediaReq>>(requestBytes as Uint8Array);
|
||||||
const decoded: any = protoDecode(requestBytes as Uint8Array, baseSchema);
|
|
||||||
expect(decoded.command).toBe(0x11C4);
|
expect(decoded.command).toBe(0x11C4);
|
||||||
expect(decoded.body.reqHead.common.requestId).toBe(1);
|
expect(decoded.body.reqHead.common.requestId).toBe(1);
|
||||||
expect(decoded.body.reqHead.scene.businessType).toBe(1);
|
expect(decoded.body.reqHead.scene.businessType).toBe(1);
|
||||||
@@ -141,7 +135,7 @@ describe('pipeline — runNtv2Upload', () => {
|
|||||||
await runNtv2Upload(baseParams({ bridge, isGroup: false, targetIdOrUid: 'recipient-uid' }));
|
await runNtv2Upload(baseParams({ bridge, isGroup: false, targetIdOrUid: 'recipient-uid' }));
|
||||||
|
|
||||||
const requestBytes = bridge.sendRawPacket.mock.calls[0]![1];
|
const requestBytes = bridge.sendRawPacket.mock.calls[0]![1];
|
||||||
const decoded: any = protoDecode(requestBytes as Uint8Array, makeOidbBaseSchema(NTV2UploadRichMediaReqSchema));
|
const decoded: any = protobuf_decode<OidbBase<NTV2UploadRichMediaReq>>(requestBytes as Uint8Array);
|
||||||
expect(decoded.body.reqHead.scene.sceneType).toBe(1);
|
expect(decoded.body.reqHead.scene.sceneType).toBe(1);
|
||||||
expect(decoded.body.reqHead.scene.c2c.targetUid).toBe('recipient-uid');
|
expect(decoded.body.reqHead.scene.c2c.targetUid).toBe('recipient-uid');
|
||||||
});
|
});
|
||||||
@@ -336,7 +330,7 @@ describe('pipeline — finalizeMediaMsgInfo', () => {
|
|||||||
msgInfo: { msgInfoBody: [], extBizInfo: {} },
|
msgInfo: { msgInfoBody: [], extBizInfo: {} },
|
||||||
}, { bizType: 7, textSummary: '[image]' });
|
}, { bizType: 7, textSummary: '[image]' });
|
||||||
|
|
||||||
const decoded: any = protoDecode(out, EncodableMediaMsgInfoSchema);
|
const decoded: any = protobuf_decode<EncodableMediaMsgInfo>(out);
|
||||||
expect(decoded.extBizInfo.pic.bizType).toBe(7);
|
expect(decoded.extBizInfo.pic.bizType).toBe(7);
|
||||||
expect(decoded.extBizInfo.pic.textSummary).toBe('[image]');
|
expect(decoded.extBizInfo.pic.textSummary).toBe('[image]');
|
||||||
});
|
});
|
||||||
@@ -345,10 +339,10 @@ describe('pipeline — finalizeMediaMsgInfo', () => {
|
|||||||
const out = finalizeMediaMsgInfo({
|
const out = finalizeMediaMsgInfo({
|
||||||
msgInfo: { msgInfoBody: [], extBizInfo: {} },
|
msgInfo: { msgInfoBody: [], extBizInfo: {} },
|
||||||
});
|
});
|
||||||
const decoded: any = protoDecode(out, EncodableMediaMsgInfoSchema);
|
const decoded: any = protobuf_decode<EncodableMediaMsgInfo>(out);
|
||||||
// An empty extBizInfo proto roundtrips to undefined; either way the
|
// An empty extBizInfo proto roundtrips to undefined; either way the
|
||||||
// pic field never got materialised.
|
// pic field never got materialised.
|
||||||
expect(decoded?.extBizInfo?.pic).toBeUndefined();
|
expect(decoded?.extBizInfo?.pic ?? undefined).toBeUndefined();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ import fs from 'fs';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { describe, it, expect, vi } from 'vitest';
|
import { describe, it, expect, vi } from 'vitest';
|
||||||
|
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||||
import { parseMessage } from '../src/onebot/message-parser';
|
import { parseMessage } from '../src/onebot/message-parser';
|
||||||
import { buildSendElems } from '../src/bridge/element-builder';
|
import { buildSendElems } from '../src/bridge/element-builder';
|
||||||
import { MentionExtraSendSchema } from '../src/bridge/proto/action';
|
import type { MentionExtraSend } from '../src/bridge/proto/proton/action';
|
||||||
import { makeOidbBaseSchema } from '../src/bridge/proto/oidb';
|
import type { OidbBase } from '../src/bridge/proto/proton/oidb';
|
||||||
import { NTV2UploadRichMediaRespSchema } from '../src/bridge/proto/highway';
|
import type { NTV2UploadRichMediaResp } from '../src/bridge/proto/proton/highway';
|
||||||
import { protoDecode, protoEncode } from '../src/protobuf/decode';
|
|
||||||
|
|
||||||
describe('parseMessage', () => {
|
describe('parseMessage', () => {
|
||||||
describe('plain text', () => {
|
describe('plain text', () => {
|
||||||
@@ -188,7 +188,7 @@ describe('parseMessage', () => {
|
|||||||
const protoElems = await buildSendElems(elements);
|
const protoElems = await buildSendElems(elements);
|
||||||
const reserve = protoElems[0].text?.pbReserve;
|
const reserve = protoElems[0].text?.pbReserve;
|
||||||
expect(reserve).toBeInstanceOf(Uint8Array);
|
expect(reserve).toBeInstanceOf(Uint8Array);
|
||||||
const extra = protoDecode(reserve as Uint8Array, MentionExtraSendSchema);
|
const extra = protobuf_decode<MentionExtraSend>(reserve as Uint8Array);
|
||||||
expect(extra).toMatchObject({
|
expect(extra).toMatchObject({
|
||||||
type: 2,
|
type: 2,
|
||||||
uin: 123456,
|
uin: 123456,
|
||||||
@@ -232,8 +232,7 @@ describe('parseMessage', () => {
|
|||||||
const videoPath = path.join(os.tmpdir(), `snowluma-video-test-${process.pid}-${Date.now()}.mp4`);
|
const videoPath = path.join(os.tmpdir(), `snowluma-video-test-${process.pid}-${Date.now()}.mp4`);
|
||||||
fs.writeFileSync(videoPath, Buffer.from([0, 1, 2, 3]));
|
fs.writeFileSync(videoPath, Buffer.from([0, 1, 2, 3]));
|
||||||
|
|
||||||
const respSchema = makeOidbBaseSchema(NTV2UploadRichMediaRespSchema);
|
const responseData = protobuf_encode<OidbBase<NTV2UploadRichMediaResp>>({
|
||||||
const responseData = protoEncode({
|
|
||||||
command: 0x11EA,
|
command: 0x11EA,
|
||||||
subCommand: 100,
|
subCommand: 100,
|
||||||
errorCode: 0,
|
errorCode: 0,
|
||||||
@@ -255,7 +254,7 @@ describe('parseMessage', () => {
|
|||||||
},
|
},
|
||||||
errorMsg: '',
|
errorMsg: '',
|
||||||
reserved: 1,
|
reserved: 1,
|
||||||
}, respSchema);
|
});
|
||||||
|
|
||||||
const bridge = {
|
const bridge = {
|
||||||
identity: { uin: '10000' },
|
identity: { uin: '10000' },
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import { protobuf_encode } from '@snowluma/proton';
|
|||||||
import { parseMsgPush, MSG_PUSH_CMD } from '../src/bridge/msg-push';
|
import { parseMsgPush, MSG_PUSH_CMD } from '../src/bridge/msg-push';
|
||||||
import { IdentityService } from '../src/bridge/identity-service';
|
import { IdentityService } from '../src/bridge/identity-service';
|
||||||
import type { GroupMemberInfo, QQGroupInfo } from '../src/bridge/qq-info';
|
import type { GroupMemberInfo, QQGroupInfo } from '../src/bridge/qq-info';
|
||||||
import { PushMsgSchema } from '../src/bridge/proto/message';
|
|
||||||
import { GroupChangeSchema, OperatorInfoSchema } from '../src/bridge/proto/notify';
|
|
||||||
// Proton's call-site analyzer keys off the literal type identifier
|
// Proton's call-site analyzer keys off the literal type identifier
|
||||||
// printed in `protobuf_encode<X>` — it walks imports by *original*
|
// printed in `protobuf_encode<X>` — it walks imports by *original*
|
||||||
// name (not alias). If both `import { X } from 'proto/notify'` and
|
// name (not alias). If both `import { X } from 'proto/notify'` and
|
||||||
@@ -15,8 +13,9 @@ import { GroupChangeSchema, OperatorInfoSchema } from '../src/bridge/proto/notif
|
|||||||
// name) — we don't need to import it directly since assertions can
|
// name) — we don't need to import it directly since assertions can
|
||||||
// inline-extract the kind.
|
// inline-extract the kind.
|
||||||
import type {
|
import type {
|
||||||
NewFriend, FriendRecall, SelfJoinInGroup,
|
GroupChange, NewFriend, FriendRecall, OperatorInfo, SelfJoinInGroup,
|
||||||
} from '../src/bridge/proto/proton/notify';
|
} from '../src/bridge/proto/proton/notify';
|
||||||
|
import type { PushMsg } from '../src/bridge/proto/proton/message';
|
||||||
import type {
|
import type {
|
||||||
GroupMemberJoin, FriendAddEvent, QQEventVariant,
|
GroupMemberJoin, FriendAddEvent, QQEventVariant,
|
||||||
} from '../src/bridge/events';
|
} from '../src/bridge/events';
|
||||||
@@ -26,7 +25,6 @@ import type {
|
|||||||
// proton import above.
|
// proton import above.
|
||||||
type FriendRecallEvent = Extract<QQEventVariant, { kind: 'friend_recall' }>;
|
type FriendRecallEvent = Extract<QQEventVariant, { kind: 'friend_recall' }>;
|
||||||
import type { PacketInfo } from '../src/protocol/types';
|
import type { PacketInfo } from '../src/protocol/types';
|
||||||
import { protoEncode } from '../src/protobuf/decode';
|
|
||||||
import { subscribeLogs } from '../src/utils/logger';
|
import { subscribeLogs } from '../src/utils/logger';
|
||||||
|
|
||||||
const SELF_UIN = '10001';
|
const SELF_UIN = '10001';
|
||||||
@@ -67,21 +65,21 @@ function makeIdentity(members: GroupMemberInfo[] = []): IdentityService {
|
|||||||
|
|
||||||
function makeGroupIncreasePacket(memberUid: string, operatorUid = '', fromUin = GROUP_ID): PacketInfo {
|
function makeGroupIncreasePacket(memberUid: string, operatorUid = '', fromUin = GROUP_ID): PacketInfo {
|
||||||
const operatorBytes = operatorUid
|
const operatorBytes = operatorUid
|
||||||
? protoEncode({ operatorField: { uid: operatorUid } } as any, OperatorInfoSchema)
|
? protobuf_encode<OperatorInfo>({ operatorField: { uid: operatorUid } })
|
||||||
: new Uint8Array(0);
|
: new Uint8Array(0);
|
||||||
const content = protoEncode({
|
const content = protobuf_encode<GroupChange>({
|
||||||
groupUin: GROUP_ID,
|
groupUin: GROUP_ID,
|
||||||
memberUid,
|
memberUid,
|
||||||
operatorBytes,
|
operatorBytes,
|
||||||
} as any, GroupChangeSchema);
|
});
|
||||||
const body = protoEncode({
|
const body = protobuf_encode<PushMsg>({
|
||||||
message: {
|
message: {
|
||||||
responseHead: { fromUin },
|
responseHead: { fromUin },
|
||||||
contentHead: { msgType: 33, timestamp: 1710000000 },
|
contentHead: { msgType: 33, timestamp: 1710000000 },
|
||||||
body: { msgContent: content },
|
body: { msgContent: content },
|
||||||
},
|
},
|
||||||
status: 0,
|
status: 0,
|
||||||
} as any, PushMsgSchema);
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
pid: 1,
|
pid: 1,
|
||||||
@@ -129,7 +127,7 @@ describe('parseMsgPush Event0x210 subType=38 (acknowledged-but-silent)', () => {
|
|||||||
// drop silently — no OneBot-level event, and — critically —
|
// drop silently — no OneBot-level event, and — critically —
|
||||||
// **no** "unknown subType=38" fallback log spam anymore.
|
// **no** "unknown subType=38" fallback log spam anymore.
|
||||||
function makeEvent0x210Packet(subType: number, content = new Uint8Array(0)): PacketInfo {
|
function makeEvent0x210Packet(subType: number, content = new Uint8Array(0)): PacketInfo {
|
||||||
const body = protoEncode({
|
const body = protobuf_encode<PushMsg>({
|
||||||
message: {
|
message: {
|
||||||
responseHead: { fromUin: 22222, type: 0, sigMap: 0 },
|
responseHead: { fromUin: 22222, type: 0, sigMap: 0 },
|
||||||
// 528 = Event0x210
|
// 528 = Event0x210
|
||||||
@@ -137,7 +135,7 @@ describe('parseMsgPush Event0x210 subType=38 (acknowledged-but-silent)', () => {
|
|||||||
body: { msgContent: content },
|
body: { msgContent: content },
|
||||||
},
|
},
|
||||||
status: 0,
|
status: 0,
|
||||||
} as any, PushMsgSchema);
|
});
|
||||||
return {
|
return {
|
||||||
pid: 1, uin: SELF_UIN, serviceCmd: MSG_PUSH_CMD, seqId: 1,
|
pid: 1, uin: SELF_UIN, serviceCmd: MSG_PUSH_CMD, seqId: 1,
|
||||||
retCode: 0, fromClient: false, body,
|
retCode: 0, fromClient: false, body,
|
||||||
@@ -186,14 +184,14 @@ describe('parseMsgPush Event0x210 subType=38 (acknowledged-but-silent)', () => {
|
|||||||
// that we were previously dropping into the "unknown" fallback. ──
|
// that we were previously dropping into the "unknown" fallback. ──
|
||||||
|
|
||||||
function makeEvent0x210PacketAny(subType: number, content: Uint8Array): PacketInfo {
|
function makeEvent0x210PacketAny(subType: number, content: Uint8Array): PacketInfo {
|
||||||
const body = protoEncode({
|
const body = protobuf_encode<PushMsg>({
|
||||||
message: {
|
message: {
|
||||||
responseHead: { fromUin: 22222, type: 0, sigMap: 0 },
|
responseHead: { fromUin: 22222, type: 0, sigMap: 0 },
|
||||||
contentHead: { msgType: 528, subType, timestamp: 1710000000 },
|
contentHead: { msgType: 528, subType, timestamp: 1710000000 },
|
||||||
body: { msgContent: content },
|
body: { msgContent: content },
|
||||||
},
|
},
|
||||||
status: 0,
|
status: 0,
|
||||||
} as any, PushMsgSchema);
|
});
|
||||||
return {
|
return {
|
||||||
pid: 1, uin: SELF_UIN, serviceCmd: MSG_PUSH_CMD, seqId: 1,
|
pid: 1, uin: SELF_UIN, serviceCmd: MSG_PUSH_CMD, seqId: 1,
|
||||||
retCode: 0, fromClient: false, body,
|
retCode: 0, fromClient: false, body,
|
||||||
@@ -313,14 +311,14 @@ describe('parseMsgPush PkgType 85 (bot self-joined a group)', () => {
|
|||||||
field6: 48,
|
field6: 48,
|
||||||
field7: '',
|
field7: '',
|
||||||
});
|
});
|
||||||
const body = protoEncode({
|
const body = protobuf_encode<PushMsg>({
|
||||||
message: {
|
message: {
|
||||||
responseHead: { fromUin: groupId, type: 0, sigMap: 0 },
|
responseHead: { fromUin: groupId, type: 0, sigMap: 0 },
|
||||||
contentHead: { msgType: 85, subType: 0, timestamp: 1710000000 },
|
contentHead: { msgType: 85, subType: 0, timestamp: 1710000000 },
|
||||||
body: { msgContent: content },
|
body: { msgContent: content },
|
||||||
},
|
},
|
||||||
status: 0,
|
status: 0,
|
||||||
} as any, PushMsgSchema);
|
});
|
||||||
return {
|
return {
|
||||||
pid: 1, uin: SELF_UIN, serviceCmd: MSG_PUSH_CMD, seqId: 1,
|
pid: 1, uin: SELF_UIN, serviceCmd: MSG_PUSH_CMD, seqId: 1,
|
||||||
retCode: 0, fromClient: false, body,
|
retCode: 0, fromClient: false, body,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
// network I/O.
|
// network I/O.
|
||||||
|
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
|
import { protobuf_encode } from '@snowluma/proton';
|
||||||
import { subscribeLogs, type LogEntry } from '../src/utils/logger';
|
import { subscribeLogs, type LogEntry } from '../src/utils/logger';
|
||||||
|
|
||||||
vi.mock('../src/bridge/highway/highway-client', () => ({
|
vi.mock('../src/bridge/highway/highway-client', () => ({
|
||||||
@@ -24,22 +25,18 @@ import {
|
|||||||
runNtv2Upload,
|
runNtv2Upload,
|
||||||
type MediaSubFileUpload,
|
type MediaSubFileUpload,
|
||||||
} from '../src/bridge/highway/pipeline';
|
} from '../src/bridge/highway/pipeline';
|
||||||
import { protoEncode } from '../src/protobuf/decode';
|
import type { OidbBase } from '../src/bridge/proto/proton/oidb';
|
||||||
import { makeOidbBaseSchema } from '../src/bridge/proto/oidb';
|
import type { NTV2UploadRichMediaResp } from '../src/bridge/proto/proton/highway';
|
||||||
import {
|
|
||||||
NTV2UploadRichMediaRespSchema,
|
|
||||||
} from '../src/bridge/proto/highway';
|
|
||||||
import { MsgPushRegistry } from '../src/bridge/msg-push/registry';
|
import { MsgPushRegistry } from '../src/bridge/msg-push/registry';
|
||||||
import type { MsgPushContext } from '../src/bridge/msg-push/context';
|
import type { MsgPushContext } from '../src/bridge/msg-push/context';
|
||||||
import { decodeEvent0x2DC } from '../src/bridge/msg-push/decoders/event-0x2dc';
|
import { decodeEvent0x2DC } from '../src/bridge/msg-push/decoders/event-0x2dc';
|
||||||
|
|
||||||
function encodeOidbResponse(body: unknown): Buffer {
|
function encodeOidbResponse(body: unknown): Buffer {
|
||||||
const baseSchema = makeOidbBaseSchema(NTV2UploadRichMediaRespSchema);
|
return Buffer.from(protobuf_encode<OidbBase<NTV2UploadRichMediaResp>>({
|
||||||
return Buffer.from(protoEncode({
|
|
||||||
command: 0x11C4, subCommand: 100, errorCode: 0,
|
command: 0x11C4, subCommand: 100, errorCode: 0,
|
||||||
body: body as Record<string, unknown>,
|
body: body as Record<string, unknown>,
|
||||||
errorMsg: '', reserved: 1,
|
errorMsg: '', reserved: 1,
|
||||||
}, baseSchema));
|
} as OidbBase<NTV2UploadRichMediaResp>));
|
||||||
}
|
}
|
||||||
|
|
||||||
function fakeBridge(responseData: Buffer, uin = '12345'): any {
|
function fakeBridge(responseData: Buffer, uin = '12345'): any {
|
||||||
|
|||||||
@@ -1,815 +0,0 @@
|
|||||||
// Proof-of-concept: verify that codec generated by @snowluma/proton's Vite
|
|
||||||
// plugin produces wire bytes byte-identical to the legacy runtime schema
|
|
||||||
// encoder for the same input. If this passes, the migration pattern is sound
|
|
||||||
// for the schemas covered here.
|
|
||||||
|
|
||||||
import { describe, it, expect } from 'vitest';
|
|
||||||
import { protobuf_encode, protobuf_decode } from '@snowluma/proton';
|
|
||||||
import { protoEncode, protoDecode } from '../src/protobuf/decode';
|
|
||||||
|
|
||||||
import {
|
|
||||||
SendLongMsgRespSchema,
|
|
||||||
SendLongMsgReqSchema,
|
|
||||||
RecvLongMsgReqSchema,
|
|
||||||
RecvLongMsgRespSchema,
|
|
||||||
LongMsgSettingsSchema,
|
|
||||||
LongMsgResultSchema,
|
|
||||||
} from '../src/bridge/proto/longmsg';
|
|
||||||
import {
|
|
||||||
TextElemSchema,
|
|
||||||
NotOnlineImageSchema,
|
|
||||||
ExtraInfoSchema,
|
|
||||||
SrcMsgSchema,
|
|
||||||
ElemSchema,
|
|
||||||
MsgInfoSchema,
|
|
||||||
} from '../src/bridge/proto/element';
|
|
||||||
import {
|
|
||||||
ResponseHeadSchema,
|
|
||||||
PushMsgBodySchema,
|
|
||||||
PushMsgSchema,
|
|
||||||
} from '../src/bridge/proto/message';
|
|
||||||
import {
|
|
||||||
GroupChangeSchema,
|
|
||||||
GroupAdminSchema,
|
|
||||||
NotifyMessageBodySchema,
|
|
||||||
GroupReactNotifySchema,
|
|
||||||
FriendRequestSchema,
|
|
||||||
GroupJoinSchema,
|
|
||||||
} from '../src/bridge/proto/notify';
|
|
||||||
import {
|
|
||||||
RoutingHeadSchema,
|
|
||||||
SendMessageRequestSchema,
|
|
||||||
SendMessageResponseSchema,
|
|
||||||
MentionExtraSendSchema,
|
|
||||||
MarkdownDataSchema,
|
|
||||||
} from '../src/bridge/proto/action';
|
|
||||||
import {
|
|
||||||
HttpConn0x6FF501RequestSchema,
|
|
||||||
HttpConn0x6FF501ResponseSchema,
|
|
||||||
ReqDataHighwayHeadSchema,
|
|
||||||
NTV2RichMediaHighwayExtSchema,
|
|
||||||
FileUploadExtSchema,
|
|
||||||
} from '../src/bridge/proto/highway';
|
|
||||||
import { makeOidbBaseSchema, OidbSvcTrpcTcp0xFE5_2ResponseSchema } from '../src/bridge/proto/oidb';
|
|
||||||
import { makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from '../src/bridge/bridge-oidb';
|
|
||||||
import {
|
|
||||||
GetMediaListRequestSchema,
|
|
||||||
DoQunCommentRequestSchema,
|
|
||||||
DoQunLikeRequestSchema,
|
|
||||||
DeleteMediasRequestSchema,
|
|
||||||
DeleteMediasResponseSchema,
|
|
||||||
} from '../src/bridge/proto/oidb-action';
|
|
||||||
|
|
||||||
import type {
|
|
||||||
SendLongMsgResp,
|
|
||||||
SendLongMsgReq,
|
|
||||||
RecvLongMsgReq,
|
|
||||||
RecvLongMsgResp,
|
|
||||||
LongMsgSettings,
|
|
||||||
LongMsgResult,
|
|
||||||
} from '../src/bridge/proto/proton/longmsg';
|
|
||||||
import type {
|
|
||||||
TextElem,
|
|
||||||
NotOnlineImage,
|
|
||||||
ExtraInfo,
|
|
||||||
SrcMsg,
|
|
||||||
Elem,
|
|
||||||
MsgInfo,
|
|
||||||
} from '../src/bridge/proto/proton/element';
|
|
||||||
import type {
|
|
||||||
ResponseHead,
|
|
||||||
PushMsgBody,
|
|
||||||
PushMsg,
|
|
||||||
} from '../src/bridge/proto/proton/message';
|
|
||||||
import type {
|
|
||||||
GroupChange,
|
|
||||||
GroupAdmin,
|
|
||||||
NotifyMessageBody,
|
|
||||||
GroupReactNotify,
|
|
||||||
FriendRequest as FriendRequestNotify,
|
|
||||||
GroupJoin,
|
|
||||||
} from '../src/bridge/proto/proton/notify';
|
|
||||||
import type {
|
|
||||||
RoutingHead,
|
|
||||||
SendMessageRequest,
|
|
||||||
SendMessageResponse,
|
|
||||||
MentionExtraSend,
|
|
||||||
MarkdownData,
|
|
||||||
} from '../src/bridge/proto/proton/action';
|
|
||||||
import type {
|
|
||||||
HttpConn0x6FF501Request,
|
|
||||||
HttpConn0x6FF501Response,
|
|
||||||
ReqDataHighwayHead,
|
|
||||||
NTV2RichMediaHighwayExt,
|
|
||||||
FileUploadExt,
|
|
||||||
} from '../src/bridge/proto/proton/highway';
|
|
||||||
import type {
|
|
||||||
OidbBase,
|
|
||||||
OidbSvcTrpcTcp0xFE5_2Response,
|
|
||||||
} from '../src/bridge/proto/proton/oidb';
|
|
||||||
import type {
|
|
||||||
GetMediaListRequest,
|
|
||||||
DoQunCommentRequest,
|
|
||||||
DoQunLikeRequest,
|
|
||||||
DeleteMediasRequest,
|
|
||||||
DeleteMediasResponse,
|
|
||||||
} from '../src/bridge/proto/proton/oidb-action';
|
|
||||||
|
|
||||||
function hex(buf: Uint8Array): string {
|
|
||||||
return Buffer.from(buf).toString('hex');
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('proton ↔ legacy parity (longmsg subset)', () => {
|
|
||||||
it('encodes LongMsgSettings identically', () => {
|
|
||||||
const data: LongMsgSettings = { field1: 1, field2: 2, field3: 3, field4: 4 };
|
|
||||||
const legacy = protoEncode(data as any, LongMsgSettingsSchema);
|
|
||||||
const proton = protobuf_encode<LongMsgSettings>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes SendLongMsgResp (nested message) identically', () => {
|
|
||||||
const data: SendLongMsgResp = { result: { resId: 'res-001' } };
|
|
||||||
const legacy = protoEncode(data as any, SendLongMsgRespSchema);
|
|
||||||
const proton = protobuf_encode<SendLongMsgResp>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes SendLongMsgReq with bytes + nested + settings identically', () => {
|
|
||||||
// NOTE: all numeric fields are non-zero — proton follows proto3 semantics
|
|
||||||
// and omits default-valued fields from the wire, whereas the legacy runtime
|
|
||||||
// encoder always writes them. Parity is therefore only expected when no
|
|
||||||
// numeric field equals its default. See the explicit divergence test below.
|
|
||||||
const data: SendLongMsgReq = {
|
|
||||||
info: {
|
|
||||||
type: 1,
|
|
||||||
uid: { uid: 'u_test' },
|
|
||||||
groupUin: 123456,
|
|
||||||
payload: new Uint8Array([0xde, 0xad, 0xbe, 0xef]),
|
|
||||||
},
|
|
||||||
settings: { field1: 4, field2: 1, field3: 7, field4: 2 },
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, SendLongMsgReqSchema);
|
|
||||||
const proton = protobuf_encode<SendLongMsgReq>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes RecvLongMsgReq with bool field identically', () => {
|
|
||||||
const data: RecvLongMsgReq = {
|
|
||||||
info: { uid: { uid: 'u_recv' }, resId: 'r-9', acquire: true },
|
|
||||||
settings: { field1: 4, field2: 1, field3: 7, field4: 2 },
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, RecvLongMsgReqSchema);
|
|
||||||
const proton = protobuf_encode<RecvLongMsgReq>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes RecvLongMsgResp (with bytes payload) identically', () => {
|
|
||||||
const data: RecvLongMsgResp = {
|
|
||||||
result: { resId: 'r-1', payload: new Uint8Array([1, 2, 3, 4, 5]) },
|
|
||||||
settings: { field1: 4, field2: 1, field3: 7, field4: 2 },
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, RecvLongMsgRespSchema);
|
|
||||||
const proton = protobuf_encode<RecvLongMsgResp>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── element.ts coverage ─────────────────────────────────────────────
|
|
||||||
|
|
||||||
it('encodes TextElem (only primitive bytes + strings) identically', () => {
|
|
||||||
const data: TextElem = {
|
|
||||||
str: 'hello',
|
|
||||||
link: 'https://example.com',
|
|
||||||
attr6Buf: new Uint8Array([1, 2, 3]),
|
|
||||||
buf: new Uint8Array([0xff, 0xee]),
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, TextElemSchema);
|
|
||||||
const proton = protobuf_encode<TextElem>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes NotOnlineImage with nested PbReserve identically', () => {
|
|
||||||
const data: NotOnlineImage = {
|
|
||||||
filePath: 'pic.jpg',
|
|
||||||
fileLen: 12345,
|
|
||||||
picMd5: new Uint8Array([0x11, 0x22, 0x33, 0x44]),
|
|
||||||
picHeight: 600,
|
|
||||||
picWidth: 800,
|
|
||||||
resId: 'res-abc',
|
|
||||||
original: 1,
|
|
||||||
bigUrl: 'https://q.qq.com/big/abc',
|
|
||||||
bizType: 5,
|
|
||||||
pbRes: {
|
|
||||||
subType: 1,
|
|
||||||
summary: '[picture]',
|
|
||||||
field10: 7,
|
|
||||||
field20: { field1: 1, field2: 'inner', field3: 2, field4: 3, field5: 4, field7: 'tail' },
|
|
||||||
url: 'https://q.qq.com/abc',
|
|
||||||
md5Str: 'abc123',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, NotOnlineImageSchema);
|
|
||||||
const proton = protobuf_encode<NotOnlineImage>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes ExtraInfo (mix of bytes + int32 + uint64) identically', () => {
|
|
||||||
const data: ExtraInfo = {
|
|
||||||
nick: new Uint8Array([0x41, 0x42]),
|
|
||||||
groupCard: new Uint8Array([0x43]),
|
|
||||||
level: 7,
|
|
||||||
flags: 1,
|
|
||||||
groupMask: 2,
|
|
||||||
msgTailId: 3,
|
|
||||||
uin: 10001n,
|
|
||||||
msgStateFlag: 4,
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, ExtraInfoSchema);
|
|
||||||
const proton = protobuf_encode<ExtraInfo>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes SrcMsg with repeated_uint32 + repeated_bytes identically', () => {
|
|
||||||
const data: SrcMsg = {
|
|
||||||
origSeqs: [100, 200, 300, 400],
|
|
||||||
senderUin: 10001n,
|
|
||||||
time: 1234567890,
|
|
||||||
flag: 1,
|
|
||||||
elemsRaw: [new Uint8Array([1, 2]), new Uint8Array([3, 4]), new Uint8Array([5, 6])],
|
|
||||||
type: 1,
|
|
||||||
toUin: 20002n,
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, SrcMsgSchema);
|
|
||||||
const proton = protobuf_encode<SrcMsg>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes Elem (oneOf-style union) identically across multiple shapes', () => {
|
|
||||||
const textOnly: Elem = { text: { str: 'hi', link: 'lnk' } };
|
|
||||||
expect(hex(protobuf_encode<Elem>(textOnly))).toBe(hex(protoEncode(textOnly as any, ElemSchema)));
|
|
||||||
|
|
||||||
const faceOnly: Elem = { face: { index: 42, buf: new Uint8Array([1, 2, 3]) } };
|
|
||||||
expect(hex(protobuf_encode<Elem>(faceOnly))).toBe(hex(protoEncode(faceOnly as any, ElemSchema)));
|
|
||||||
|
|
||||||
const generalFlags: Elem = { generalFlags: { uin: 10001n, longTextFlag: 1, longTextResId: 'rs' } };
|
|
||||||
expect(hex(protobuf_encode<Elem>(generalFlags))).toBe(hex(protoEncode(generalFlags as any, ElemSchema)));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes MsgInfo with repeated_message + deeply nested ExtBizInfo identically', () => {
|
|
||||||
const data: MsgInfo = {
|
|
||||||
msgInfoBody: [
|
|
||||||
{
|
|
||||||
index: {
|
|
||||||
info: { fileSize: 1024, fileHash: 'sha-1', fileSha1: 'sha-2', fileName: 'a.png', type: { type: 1, picFormat: 2, videoFormat: 3, voiceFormat: 4 }, width: 100, height: 200, time: 99, original: 1 },
|
|
||||||
fileUuid: 'uuid-1', storeId: 5, uploadTime: 1000, ttl: 86400, subType: 1,
|
|
||||||
},
|
|
||||||
picture: {
|
|
||||||
urlPath: '/p/1',
|
|
||||||
ext: { originalParameter: 'op', bigParameter: 'bp', thumbParameter: 'tp' },
|
|
||||||
domain: 'q.qq.com',
|
|
||||||
},
|
|
||||||
fileExist: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
extBizInfo: {
|
|
||||||
pic: {
|
|
||||||
bizType: 5, textSummary: '[pic]',
|
|
||||||
extData: { subType: 2, textSummary: 'sum' },
|
|
||||||
fromScene: 1, toScene: 2, oldFileId: 999,
|
|
||||||
},
|
|
||||||
busiType: 3,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, MsgInfoSchema);
|
|
||||||
const proton = protobuf_encode<MsgInfo>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── message.ts coverage ─────────────────────────────────────────────
|
|
||||||
|
|
||||||
it('encodes ResponseHead (nested forward + grp) identically', () => {
|
|
||||||
const data: ResponseHead = {
|
|
||||||
fromUin: 10001, fromUid: 'u_a', type: 1, sigMap: 2, toUin: 20002, toUid: 'u_b',
|
|
||||||
forward: { friendName: 'Alice' },
|
|
||||||
grp: { groupUin: 555, memberName: 'Bob', groupName: 'TestGroup' },
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, ResponseHeadSchema);
|
|
||||||
const proton = protobuf_encode<ResponseHead>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes PushMsgBody (with RichText holding Elem[]) identically', () => {
|
|
||||||
const data: PushMsgBody = {
|
|
||||||
responseHead: { fromUin: 1, toUin: 2, type: 1, sigMap: 3, fromUid: 'a', toUid: 'b' },
|
|
||||||
contentHead: { msgType: 1, subType: 1, divSeq: 1, msgId: 99, sequence: 100, timestamp: 1234567890 },
|
|
||||||
body: {
|
|
||||||
richText: {
|
|
||||||
elems: [
|
|
||||||
{ text: { str: 'hi ' } },
|
|
||||||
{ text: { str: 'world', link: 'lnk' } },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, PushMsgBodySchema);
|
|
||||||
const proton = protobuf_encode<PushMsgBody>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes PushMsg (top-level) identically', () => {
|
|
||||||
const data: PushMsg = {
|
|
||||||
message: {
|
|
||||||
responseHead: { fromUin: 1, toUin: 2, type: 1, sigMap: 1, fromUid: 'a', toUid: 'b' },
|
|
||||||
contentHead: { msgType: 1, subType: 1, divSeq: 1, msgId: 1, sequence: 1, timestamp: 1 },
|
|
||||||
body: { richText: { elems: [{ text: { str: 'x' } }] } },
|
|
||||||
},
|
|
||||||
status: 1,
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, PushMsgSchema);
|
|
||||||
const proton = protobuf_encode<PushMsg>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── longmsg.ts: full migration (Content / Action / Result) ─────────
|
|
||||||
|
|
||||||
it('encodes LongMsgResult (repeated Action → Content → PushMsgBody[]) identically', () => {
|
|
||||||
const inner: PushMsgBody = {
|
|
||||||
responseHead: { fromUin: 1, toUin: 2, type: 1, sigMap: 1, fromUid: 'a', toUid: 'b' },
|
|
||||||
contentHead: { msgType: 1, subType: 1, divSeq: 1, msgId: 1, sequence: 1, timestamp: 1 },
|
|
||||||
body: { richText: { elems: [{ text: { str: 'forwarded' } }] } },
|
|
||||||
};
|
|
||||||
const data: LongMsgResult = {
|
|
||||||
action: [
|
|
||||||
{
|
|
||||||
actionCommand: 'MultiMsg',
|
|
||||||
actionData: { msgBody: [inner, inner] },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, LongMsgResultSchema);
|
|
||||||
const proton = protobuf_encode<LongMsgResult>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── notify.ts coverage ──────────────────────────────────────────────
|
|
||||||
|
|
||||||
it('encodes GroupChange identically', () => {
|
|
||||||
const data: GroupChange = {
|
|
||||||
groupUin: 555,
|
|
||||||
flag: 1,
|
|
||||||
memberUid: 'u_x',
|
|
||||||
decreaseType: 130,
|
|
||||||
operatorBytes: new Uint8Array([1, 2, 3]),
|
|
||||||
increaseType: 1,
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, GroupChangeSchema);
|
|
||||||
const proton = protobuf_encode<GroupChange>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes GroupAdmin (extraEnable variant) identically', () => {
|
|
||||||
const data: GroupAdmin = {
|
|
||||||
groupUin: 777, flag: 1, isPromote: true,
|
|
||||||
body: { extraEnable: { adminUid: 'u_admin', isPromote: true } },
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, GroupAdminSchema);
|
|
||||||
const proton = protobuf_encode<GroupAdmin>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes NotifyMessageBody (recall variant with repeated RecallMessage) identically', () => {
|
|
||||||
const data: NotifyMessageBody = {
|
|
||||||
type: 17,
|
|
||||||
groupUin: 555,
|
|
||||||
recall: {
|
|
||||||
operatorUid: 'u_op',
|
|
||||||
recallMessages: [
|
|
||||||
{ sequence: 1, time: 100, random: 42, type: 1, flag: 1, authorUid: 'u_a' },
|
|
||||||
{ sequence: 2, time: 200, random: 43, type: 1, flag: 1, authorUid: 'u_a' },
|
|
||||||
],
|
|
||||||
groupType: 1, opType: 2,
|
|
||||||
tipInfo: { tip: 'recalled' },
|
|
||||||
},
|
|
||||||
msgSequence: 99,
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, NotifyMessageBodySchema);
|
|
||||||
const proton = protobuf_encode<NotifyMessageBody>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes GroupReactNotify (deeply nested) identically', () => {
|
|
||||||
const data: GroupReactNotify = {
|
|
||||||
groupUin: 555n,
|
|
||||||
field13: 35,
|
|
||||||
groupReactionData: {
|
|
||||||
data: {
|
|
||||||
data: {
|
|
||||||
groupReactionTarget: { seq: 12345n },
|
|
||||||
groupReactionDataContent: { code: '128516', count: 1, operatorUid: 'u_op', type: 1 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, GroupReactNotifySchema);
|
|
||||||
const proton = protobuf_encode<GroupReactNotify>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes FriendRequest identically', () => {
|
|
||||||
const data: FriendRequestNotify = {
|
|
||||||
info: { targetUid: 'u_me', sourceUid: 'u_them', newSource: 'qrcode', message: 'hello!', source: 'web' },
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, FriendRequestSchema);
|
|
||||||
const proton = protobuf_encode<FriendRequestNotify>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes GroupJoin identically', () => {
|
|
||||||
const data: GroupJoin = {
|
|
||||||
groupUin: 555, field2: 1, targetUid: 'u_them', field4: 1,
|
|
||||||
field6: 1, field7: 'reason', field8: 1, field9: new Uint8Array([0xaa]),
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, GroupJoinSchema);
|
|
||||||
const proton = protobuf_encode<GroupJoin>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── action.ts coverage ─────────────────────────────────────────────
|
|
||||||
|
|
||||||
it('encodes RoutingHead (c2c variant) identically', () => {
|
|
||||||
const data: RoutingHead = { c2c: { uin: 10001, uid: 'u_a' } };
|
|
||||||
const legacy = protoEncode(data as any, RoutingHeadSchema);
|
|
||||||
const proton = protobuf_encode<RoutingHead>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes RoutingHead (group variant) identically', () => {
|
|
||||||
const data: RoutingHead = { grp: { groupCode: 555n } };
|
|
||||||
const legacy = protoEncode(data as any, RoutingHeadSchema);
|
|
||||||
const proton = protobuf_encode<RoutingHead>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes SendMessageRequest (group with two text elements) identically', () => {
|
|
||||||
const data: SendMessageRequest = {
|
|
||||||
routingHead: { grp: { groupCode: 555n } },
|
|
||||||
contentHead: { type: 1, subType: 1, c2cCmd: 11 },
|
|
||||||
messageBody: {
|
|
||||||
richText: {
|
|
||||||
elems: [
|
|
||||||
{ text: { str: 'hi ' } },
|
|
||||||
{ text: { str: 'world', link: 'lnk' } },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
clientSequence: 1,
|
|
||||||
random: 12345,
|
|
||||||
syncCookie: new Uint8Array([0xaa, 0xbb]),
|
|
||||||
via: 1,
|
|
||||||
dataStatist: 1,
|
|
||||||
multiSendSeq: 1,
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, SendMessageRequestSchema);
|
|
||||||
const proton = protobuf_encode<SendMessageRequest>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes SendMessageResponse identically', () => {
|
|
||||||
const data: SendMessageResponse = {
|
|
||||||
result: 1, errMsg: 'ok', timestamp1: 1234567890,
|
|
||||||
field10: 1, groupSequence: 100, timestamp2: 1234567891, privateSequence: 200,
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, SendMessageResponseSchema);
|
|
||||||
const proton = protobuf_encode<SendMessageResponse>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes MentionExtraSend identically', () => {
|
|
||||||
const data: MentionExtraSend = { type: 2, uin: 10001, field5: 1, uid: 'u_a' };
|
|
||||||
const legacy = protoEncode(data as any, MentionExtraSendSchema);
|
|
||||||
const proton = protobuf_encode<MentionExtraSend>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes MarkdownData identically', () => {
|
|
||||||
const data: MarkdownData = { content: '**bold** _italic_' };
|
|
||||||
const legacy = protoEncode(data as any, MarkdownDataSchema);
|
|
||||||
const proton = protobuf_encode<MarkdownData>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── highway.ts coverage ────────────────────────────────────────────
|
|
||||||
|
|
||||||
it('encodes HttpConn0x6FF501Request (high-numbered field tag 0x501) identically', () => {
|
|
||||||
const data: HttpConn0x6FF501Request = {
|
|
||||||
httpConn: {
|
|
||||||
field1: 1, field2: 2, field3: 16, field4: 1, field6: 3,
|
|
||||||
serviceTypes: [1, 5, 10, 21],
|
|
||||||
field9: 2, field10: 9, field11: 8, ver: '1.0.1',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, HttpConn0x6FF501RequestSchema);
|
|
||||||
const proton = protobuf_encode<HttpConn0x6FF501Request>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes HttpConn0x6FF501Response (with repeated server infos) identically', () => {
|
|
||||||
const data: HttpConn0x6FF501Response = {
|
|
||||||
httpConn: {
|
|
||||||
sigSession: new Uint8Array([1, 2, 3]),
|
|
||||||
sessionKey: new Uint8Array([4, 5, 6]),
|
|
||||||
serverInfos: [
|
|
||||||
{ serviceType: 1, serverAddrs: [{ type: 1, ip: 0x01020304, port: 8080, area: 1 }] },
|
|
||||||
{ serviceType: 2, serverAddrs: [{ type: 1, ip: 0x05060708, port: 8081, area: 2 }] },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, HttpConn0x6FF501ResponseSchema);
|
|
||||||
const proton = protobuf_encode<HttpConn0x6FF501Response>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes ReqDataHighwayHead (multiple nested messages) identically', () => {
|
|
||||||
const data: ReqDataHighwayHead = {
|
|
||||||
msgBaseHead: {
|
|
||||||
version: 1, uin: '10001', command: 'PicUp.DataUp', seq: 1, retryTimes: 1,
|
|
||||||
appId: 1600001604, dataFlag: 16, commandId: 1003,
|
|
||||||
},
|
|
||||||
msgSegHead: {
|
|
||||||
serviceId: 1, filesize: 100n, dataOffset: 50n, dataLength: 100,
|
|
||||||
retCode: 1, serviceTicket: new Uint8Array([1, 2, 3]), flag: 1,
|
|
||||||
md5: new Uint8Array([4, 5, 6]), fileMd5: new Uint8Array([7, 8, 9]),
|
|
||||||
cacheAddr: 1, cachePort: 80,
|
|
||||||
},
|
|
||||||
bytesReqExtendInfo: new Uint8Array([0xab, 0xcd]),
|
|
||||||
timestamp: 1234567890n,
|
|
||||||
msgLoginSigHead: { loginSigType: 8, appId: 1600001604 },
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, ReqDataHighwayHeadSchema);
|
|
||||||
const proton = protobuf_encode<ReqDataHighwayHead>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes NTV2RichMediaHighwayExt (repeated_bytes hash) identically', () => {
|
|
||||||
const data: NTV2RichMediaHighwayExt = {
|
|
||||||
fileUuid: 'uuid-1',
|
|
||||||
uKey: 'key-1',
|
|
||||||
network: { ipv4s: [{ domain: { isEnable: true, ip: '127.0.0.1' }, port: 80 }] },
|
|
||||||
blockSize: 1048576,
|
|
||||||
hash: { fileSha1: [new Uint8Array([1, 2]), new Uint8Array([3, 4])] },
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, NTV2RichMediaHighwayExtSchema);
|
|
||||||
const proton = protobuf_encode<NTV2RichMediaHighwayExt>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes FileUploadExt (high-numbered tags 100/200/400/600/700) identically', () => {
|
|
||||||
const data: FileUploadExt = {
|
|
||||||
unknown1: 100,
|
|
||||||
unknown2: 1,
|
|
||||||
unknown3: 1,
|
|
||||||
entry: {
|
|
||||||
busiBuff: {
|
|
||||||
busId: 102,
|
|
||||||
senderUin: 10001n,
|
|
||||||
receiverUin: 555n,
|
|
||||||
groupCode: 555n,
|
|
||||||
},
|
|
||||||
fileEntry: {
|
|
||||||
fileSize: 12345n,
|
|
||||||
md5: new Uint8Array([0x11, 0x22]),
|
|
||||||
checkKey: new Uint8Array([0x33, 0x44]),
|
|
||||||
md5S2: new Uint8Array([0x55]),
|
|
||||||
fileId: 'file-1',
|
|
||||||
uploadKey: new Uint8Array([0x66]),
|
|
||||||
},
|
|
||||||
clientInfo: {
|
|
||||||
clientType: 3, appId: '100', terminalType: 3, clientVer: '1.1.1', unknown: 4,
|
|
||||||
},
|
|
||||||
fileNameInfo: { fileName: 'a.bin' },
|
|
||||||
host: {
|
|
||||||
hosts: [
|
|
||||||
{ url: { unknown: 1, host: 'upload.qq.com' }, port: 80 },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
unknown200: 1,
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, FileUploadExtSchema);
|
|
||||||
const proton = protobuf_encode<FileUploadExt>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── oidb.ts coverage (OidbBase<T> generic envelope) ────────────────
|
|
||||||
|
|
||||||
it('encodes OidbBase<OidbSvcTrpcTcp0xFE5_2Response> identically to makeOidbBaseSchema', () => {
|
|
||||||
// This is the exact pattern runOidb uses for the OIDB envelope. Proton's
|
|
||||||
// OidbBase<T> generic interface should monomorphize to a codec that is
|
|
||||||
// byte-equivalent to the legacy makeOidbBaseSchema(InnerSchema) factory.
|
|
||||||
// The inner Body type used here is a real schema (group-list response).
|
|
||||||
const body: OidbSvcTrpcTcp0xFE5_2Response = {
|
|
||||||
groups: [
|
|
||||||
{
|
|
||||||
groupUin: 555,
|
|
||||||
info: {
|
|
||||||
groupOwner: { uid: 'u_owner' },
|
|
||||||
createdTime: 1234567890, memberMax: 100, memberCount: 50,
|
|
||||||
groupName: 'TestGroup', description: 'desc', question: 'q?',
|
|
||||||
announcement: 'announcement',
|
|
||||||
},
|
|
||||||
customInfo: { remark: 'remark' },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const envelope = {
|
|
||||||
command: 0xFE5,
|
|
||||||
subCommand: 2,
|
|
||||||
errorCode: 1, // non-zero so it isn't proto3-omitted
|
|
||||||
body,
|
|
||||||
errorMsg: 'ok',
|
|
||||||
reserved: 1,
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(envelope as any, makeOidbBaseSchema(OidbSvcTrpcTcp0xFE5_2ResponseSchema));
|
|
||||||
const proton = protobuf_encode<OidbBase<OidbSvcTrpcTcp0xFE5_2Response>>(envelope);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodeOidbEnv<T> pass-through wrapper byte-equivalent to direct codec', () => {
|
|
||||||
// The bridge-oidb.ts module exposes encodeOidbEnv<T> / decodeOidbEnv<T>
|
|
||||||
// as pure pass-through wrappers around protobuf_encode/decode<OidbBase<T>>.
|
|
||||||
// Proton wrapper-binds them and substitutes each call site with the
|
|
||||||
// monomorphized codec, so byte-output must match a direct call.
|
|
||||||
const body: OidbSvcTrpcTcp0xFE5_2Response = {
|
|
||||||
groups: [{ groupUin: 100, info: { groupName: 'G' } }],
|
|
||||||
};
|
|
||||||
const env = makeOidbEnvelope<OidbSvcTrpcTcp0xFE5_2Response>(0xFE5, 2, body, false);
|
|
||||||
const viaWrapper = encodeOidbEnv<OidbSvcTrpcTcp0xFE5_2Response>(env);
|
|
||||||
const viaDirect = protobuf_encode<OidbBase<OidbSvcTrpcTcp0xFE5_2Response>>(env);
|
|
||||||
expect(hex(viaWrapper)).toBe(hex(viaDirect));
|
|
||||||
|
|
||||||
const back = decodeOidbEnv<OidbSvcTrpcTcp0xFE5_2Response>(viaWrapper);
|
|
||||||
expect(back.body?.groups?.[0]?.groupUin).toBe(100);
|
|
||||||
expect(back.body?.groups?.[0]?.info?.groupName).toBe('G');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('round-trips OidbBase<T> with non-trivial nested body', () => {
|
|
||||||
const body: OidbSvcTrpcTcp0xFE5_2Response = {
|
|
||||||
groups: [{ groupUin: 100, info: { groupName: 'G' } }],
|
|
||||||
};
|
|
||||||
const envelope: OidbBase<OidbSvcTrpcTcp0xFE5_2Response> = {
|
|
||||||
command: 0xFE5, subCommand: 2, errorCode: 1, body, errorMsg: 'ok', reserved: 1,
|
|
||||||
};
|
|
||||||
const encoded = protobuf_encode<OidbBase<OidbSvcTrpcTcp0xFE5_2Response>>(envelope);
|
|
||||||
const decoded = protobuf_decode<OidbBase<OidbSvcTrpcTcp0xFE5_2Response>>(encoded);
|
|
||||||
expect(decoded.command).toBe(0xFE5);
|
|
||||||
expect(decoded.errorCode).toBe(1);
|
|
||||||
expect(decoded.body?.groups?.[0]?.groupUin).toBe(100);
|
|
||||||
expect(decoded.body?.groups?.[0]?.info?.groupName).toBe('G');
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── Documented divergence: proto3 default-value omission ────────────
|
|
||||||
|
|
||||||
it('proton omits default-valued numeric fields (legacy emits them)', () => {
|
|
||||||
// proto3 wire format says fields equal to their default value MUST NOT be
|
|
||||||
// emitted. Proton follows that; the legacy runtime encoder always emits.
|
|
||||||
// Either form is round-trippable through a conforming proto3 reader — the
|
|
||||||
// missing field decodes as its default. This test pins that behaviour.
|
|
||||||
const data: LongMsgSettings = { field1: 0, field2: 0, field3: 0, field4: 0 };
|
|
||||||
const legacy = protoEncode(data as any, LongMsgSettingsSchema);
|
|
||||||
const proton = protobuf_encode<LongMsgSettings>(data);
|
|
||||||
expect(hex(proton)).toBe(''); // nothing on the wire
|
|
||||||
expect(legacy.length).toBeGreaterThan(0); // legacy emits all zeros
|
|
||||||
// Legacy emits explicit zero values; a proto3-conforming reader sees them
|
|
||||||
// back when decoding. (Decoding the empty wire returns null because the
|
|
||||||
// legacy decoder treats an empty buffer as "no message at all" — that's
|
|
||||||
// also semantically equivalent to "all-default values" in proto3.)
|
|
||||||
expect(protoDecode(legacy, LongMsgSettingsSchema)).toMatchObject({
|
|
||||||
field1: 0, field2: 0, field3: 0, field4: 0,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── round-trip via decode ───────────────────────────────────────────
|
|
||||||
|
|
||||||
it('round-trips SendLongMsgResp through proton encode → legacy decode', () => {
|
|
||||||
const data: SendLongMsgResp = { result: { resId: 'rt-1' } };
|
|
||||||
const encoded = protobuf_encode<SendLongMsgResp>(data);
|
|
||||||
const decoded = protoDecode(encoded, SendLongMsgRespSchema);
|
|
||||||
expect(decoded?.result?.resId).toBe('rt-1');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('round-trips SendLongMsgResp through legacy encode → proton decode', () => {
|
|
||||||
const data: SendLongMsgResp = { result: { resId: 'rt-2' } };
|
|
||||||
const encoded = protoEncode(data as any, SendLongMsgRespSchema);
|
|
||||||
const decoded = protobuf_decode<SendLongMsgResp>(encoded);
|
|
||||||
expect(decoded.result?.resId).toBe('rt-2');
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── Group album TRPC envelopes (PR #31) ─────────────────────────────
|
|
||||||
//
|
|
||||||
// Raw TRPC packets — not OIDB-wrapped — that the group-album actions
|
|
||||||
// ship to `QunAlbum.trpc.qzone.webapp_qun_*`. Field names are mostly
|
|
||||||
// positional (`field1`/`field2`/...) because the upstream protocol
|
|
||||||
// doesn't expose semantic names; the byte-for-byte parity below is
|
|
||||||
// what guarantees the migration preserved every numbered field.
|
|
||||||
|
|
||||||
// NOTE: every numeric/bytes field below is non-zero / non-empty —
|
|
||||||
// proton follows proto3 semantics and skips default-valued fields on
|
|
||||||
// the wire, while the legacy runtime encoder writes them all. Byte
|
|
||||||
// parity therefore only holds when no field equals its default. The
|
|
||||||
// actual production callers in `actions/group-album.ts` *do* pass
|
|
||||||
// some zero-valued fields (e.g. `field1: 0`), which means the
|
|
||||||
// post-migration packet drops a few leading zero tags — semantically
|
|
||||||
// equivalent to a proto3-conforming reader, see the explicit
|
|
||||||
// divergence test earlier in this file.
|
|
||||||
|
|
||||||
it('encodes GetMediaListRequest (nested ReqInfo + extMap) identically', () => {
|
|
||||||
const data: GetMediaListRequest = {
|
|
||||||
field1: 1, // proto3 non-default
|
|
||||||
field2: new Uint8Array([0xab]),
|
|
||||||
field3: new Uint8Array([0xcd]),
|
|
||||||
reqInfo: { groupId: '555', albumId: 'alb-1', field3: 7, attachInfo: 'cursor', field5: 'tag' },
|
|
||||||
traceId: '_1700000000_12345',
|
|
||||||
extMap: [{ key: 'fc-appid', value: '100' }],
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, GetMediaListRequestSchema);
|
|
||||||
const proton = protobuf_encode<GetMediaListRequest>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes DoQunCommentRequest (deeply nested anonymous-in-legacy schemas) identically', () => {
|
|
||||||
const data: DoQunCommentRequest = {
|
|
||||||
field1: 8527,
|
|
||||||
field2: new Uint8Array([0x01]),
|
|
||||||
field3: new Uint8Array([0x02]),
|
|
||||||
body: {
|
|
||||||
groupId: '555',
|
|
||||||
field3: 2,
|
|
||||||
reqBody: {
|
|
||||||
field1: { field3: 3, field4: 'h' },
|
|
||||||
field2: { field1: { uin: '10001' } },
|
|
||||||
field5: {
|
|
||||||
field1: {
|
|
||||||
field2: {
|
|
||||||
field1: 1, field2: 'a', lloc: 'lloc-x',
|
|
||||||
field4: 'b', field6: 'c', field7: 1, field8: 1, field9: 1,
|
|
||||||
field14: 1, field15: 1, field17: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
albumId: 'alb-1',
|
|
||||||
field5: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
field5: {
|
|
||||||
field2: { uin: '10001' },
|
|
||||||
field3: { field1: 1, field2: 'hello', field3: 'd', field4: 'e', field5: 1, field6: 'f' },
|
|
||||||
clientKey: 'ck-1',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
traceId: '_1700000000_12345',
|
|
||||||
extMap: [{ key: 'fc-appid', value: '100' }],
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, DoQunCommentRequestSchema);
|
|
||||||
const proton = protobuf_encode<DoQunCommentRequest>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes DoQunLikeRequest (with bigint time/batchId) identically', () => {
|
|
||||||
const data: DoQunLikeRequest = {
|
|
||||||
field1: 5495,
|
|
||||||
field2: 'h5_test',
|
|
||||||
field3: 'h5_test',
|
|
||||||
body: {
|
|
||||||
type: 2,
|
|
||||||
like: { id: '421_1_0_555|alb|42', status: 1 }, // non-default
|
|
||||||
publish: {
|
|
||||||
cellCommon: { time: 1700000000000n, feedId: '422_0_42' },
|
|
||||||
cellUserInfo: { user: { uin: '10001' } },
|
|
||||||
cellMedia: { albumId: 'alb', batchId: 42n },
|
|
||||||
cellQunInfo: { qunId: '555' },
|
|
||||||
},
|
|
||||||
clientKey: 'ck',
|
|
||||||
},
|
|
||||||
extMap: [{ key: 'fc-appid', value: '100' }],
|
|
||||||
};
|
|
||||||
const legacy = protoEncode(data as any, DoQunLikeRequestSchema);
|
|
||||||
const proton = protobuf_encode<DoQunLikeRequest>(data);
|
|
||||||
expect(hex(proton)).toBe(hex(legacy));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('encodes DeleteMediasRequest + decodes DeleteMediasResponse identically', () => {
|
|
||||||
const req: DeleteMediasRequest = {
|
|
||||||
field1: 8694, field2: 'h5_test', field3: 'h5_test',
|
|
||||||
body: { groupId: '555', albumId: 'alb', lloc: 'lloc-x' },
|
|
||||||
traceId: 'tr-1',
|
|
||||||
extMap: [{ key: 'fc-appid', value: '100' }],
|
|
||||||
};
|
|
||||||
expect(hex(protobuf_encode<DeleteMediasRequest>(req)))
|
|
||||||
.toBe(hex(protoEncode(req as any, DeleteMediasRequestSchema)));
|
|
||||||
|
|
||||||
// Response: encode with legacy, decode with proton, fields stay aligned.
|
|
||||||
const respBytes = protoEncode({ field1: 8694, field2: 10023, field3: 'no right delete' } as any, DeleteMediasResponseSchema);
|
|
||||||
const decoded = protobuf_decode<DeleteMediasResponse>(respBytes);
|
|
||||||
expect(decoded.field1).toBe(8694);
|
|
||||||
expect(decoded.field2).toBe(10023);
|
|
||||||
expect(decoded.field3).toBe('no right delete');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -4,7 +4,7 @@ import type { OidbBase } from '../../src/bridge/proto/proton/oidb';
|
|||||||
import type {
|
import type {
|
||||||
OidbClientKeyResp,
|
OidbClientKeyResp,
|
||||||
OidbGetPskeyResp,
|
OidbGetPskeyResp,
|
||||||
} from '../../src/bridge/proto/proton/oidb-action';
|
} from '../../src/bridge/proto/proton/oidb-actions/base';
|
||||||
|
|
||||||
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
// `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers
|
||||||
// — the plugin substitutes them at the call site with the inlined codec,
|
// — the plugin substitutes them at the call site with the inlined codec,
|
||||||
|
|||||||
Reference in new issue
Block a user