feat(proton): migrate highway.ts schemas + highway-client + group-file
Mirrors all 35 schemas in bridge/proto/highway.ts as proton interface
forms and switches the two non-OIDB-wrapped consumers
(highway/highway-client.ts and actions/group-file.ts) over to the new
compile-time API.
Migrated schemas (proton/highway.ts):
DataHighwayHead, SegHead, LoginSigHead, ReqDataHighwayHead,
RespDataHighwayHead, HighwayDomain, HighwayIPv4, HighwayNetwork,
HighwayHash, HighwayMsgInfoBody, NTV2RichMediaHighwayExt,
FileUploadUrl, FileUploadHost, FileUploadHostConfig,
FileUploadNameInfo, FileUploadClientInfo, FileUploadFileEntry,
FileUploadBusiInfo, FileUploadEntry, FileUploadExt,
EncodableMediaExtBizInfo, EncodableMediaMsgInfo, HttpConn,
HttpConn0x6FF501Request, ServerAddr, ServerInfo, HttpConnResponse,
HttpConn0x6FF501Response, NTV2FileType, NTV2FileInfo,
NTV2UploadInfo, NTV2ExtBizInfo, NTV2UploadReq, NTV2C2CUserInfo,
NTV2GroupInfo, NTV2UploadSceneInfo, NTV2CommonHead, NTV2ClientMeta,
NTV2UploadReqHead, NTV2UploadRichMediaReq, NTV2IPv4,
NTV2SubFileInfoResp, NTV2UploadRespMsgInfo, NTV2UploadRespBody,
NTV2UploadRespHead, NTV2UploadRichMediaResp
Consumer switches:
- highway/highway-client.ts: protobuf_encode/decode for HttpConn
session fetch, ReqDataHighwayHead frames, NTV2RichMediaHighwayExt
extend bytes, RespDataHighwayHead per-chunk responses
- actions/group-file.ts: protobuf_encode<FileUploadExt> for both
group + private file upload ext bytes
NOT migrated (depends on the OIDB factory pattern):
- highway/pipeline.ts — uses makeOidbBaseSchema(NTV2UploadRichMediaReqSchema)
to wrap the NTV2 upload in an OIDB envelope at runtime. Waits for
the oidb.ts migration to land a generic OidbBase<T> form.
Verification:
- 5 new parity tests for highway schemas (HttpConn0x6FF501 req+resp
with the high-numbered 0x501 tag, ReqDataHighwayHead with multiple
nested messages, NTV2RichMediaHighwayExt with repeated_bytes,
FileUploadExt with the 100/200/400/600/700 high-numbered tags)
- 602/602 core test suite passes — the existing image / ptt / video
upload tests implicitly validated wire format equivalence
- tsc --noEmit clean
This commit is contained in:
4 files changed
+471
-23
No files matched your search
@@ -6,7 +6,7 @@
|
||||
// stay as separate functions.
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
import { protoEncode } from '../../protobuf/decode';
|
||||
import { protobuf_encode } from '@snowluma/proton';
|
||||
import { runOidb } from '../bridge-oidb';
|
||||
import { fetchHighwaySession, uploadHighwayHttp } from '../highway/highway-client';
|
||||
import { computeHashes, computeMd5, FILE_UPLOAD_MAX_BYTES, loadBinarySource } from '../highway/utils';
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
NTV2RichMediaReqSchema,
|
||||
NTV2RichMediaRespSchema,
|
||||
} from '../proto/oidb-action';
|
||||
import { FileUploadExtSchema } from '../proto/highway';
|
||||
import type { FileUploadExt } from '../proto/proton/highway';
|
||||
import { toHexUpper } from '../../utils/hex';
|
||||
import { ensureRetCodeZero, resolveSelfUid, toInt, type MediaIndexNode } from './shared';
|
||||
|
||||
@@ -104,7 +104,7 @@ function buildGroupFileUploadExt(
|
||||
uploadHost: string,
|
||||
uploadPort: number,
|
||||
): Uint8Array {
|
||||
return protoEncode({
|
||||
return protobuf_encode<FileUploadExt>({
|
||||
unknown1: 100,
|
||||
unknown2: 1,
|
||||
entry: {
|
||||
@@ -145,7 +145,7 @@ function buildGroupFileUploadExt(
|
||||
},
|
||||
},
|
||||
unknown200: 0,
|
||||
}, FileUploadExtSchema);
|
||||
});
|
||||
}
|
||||
|
||||
function buildPrivateFileUploadExt(
|
||||
@@ -159,7 +159,7 @@ function buildPrivateFileUploadExt(
|
||||
uploadHost: string,
|
||||
uploadPort: number,
|
||||
): Uint8Array {
|
||||
return protoEncode({
|
||||
return protobuf_encode<FileUploadExt>({
|
||||
unknown1: 100,
|
||||
unknown2: 1,
|
||||
entry: {
|
||||
@@ -201,7 +201,7 @@ function buildPrivateFileUploadExt(
|
||||
},
|
||||
unknown3: 0,
|
||||
unknown200: 1,
|
||||
}, FileUploadExtSchema);
|
||||
});
|
||||
}
|
||||
|
||||
function normalizeMediaNode(node: MediaIndexNode): Record<string, unknown> {
|
||||
|
||||
Reference in new issue
Block a user