mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
chore: 有笨蛋
This commit is contained in:
parent
e9332e7646
commit
5cca8457e7
@ -111,6 +111,7 @@ export class NTQQPacketApi {
|
||||
await this.sendPacket('OidbSvcTrpcTcp.0x8fc_2', data!, true);
|
||||
}
|
||||
|
||||
// TODO: can simplify this
|
||||
async uploadResources(msg: PacketMsg[], groupUin: number = 0) {
|
||||
const reqList = [];
|
||||
for (const m of msg) {
|
||||
@ -135,7 +136,7 @@ export class NTQQPacketApi {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Promise.all(reqList);
|
||||
return Promise.all(reqList); // TODO: use promise.allSettled
|
||||
}
|
||||
|
||||
async sendUploadForwardMsg(msg: PacketMsg[], groupUin: number = 0) {
|
||||
|
@ -94,6 +94,7 @@ export class HighwayTcpUploader extends HighwayUploader {
|
||||
const handleRspHeader = (header: Buffer) => {
|
||||
const rsp = new NapProtoMsg(RespDataHighwayHead).decode(header);
|
||||
if (rsp.errorCode !== 0) {
|
||||
// TODO: immediately reject promise if error code is not 0
|
||||
this.logger.logWarn(`[Highway] tcpUpload failed (code: ${rsp.errorCode})`);
|
||||
}
|
||||
const percent = ((Number(rsp.msgSegHead?.dataOffset) + Number(rsp.msgSegHead?.dataLength)) / Number(rsp.msgSegHead?.filesize)).toFixed(2);
|
||||
@ -159,6 +160,7 @@ export class HighwayHttpUploader extends HighwayUploader {
|
||||
const headData = new NapProtoMsg(RespDataHighwayHead).decode(head);
|
||||
this.logger.logDebug(`[Highway] httpUploadBlock: ${headData.errorCode} | ${headData.msgSegHead?.retCode} | ${headData.bytesRspExtendInfo} | ${head.toString('hex')} | ${body.toString('hex')}`);
|
||||
if (headData.errorCode !== 0) {
|
||||
// TODO: immediately throw error if error code is not 0
|
||||
this.logger.logError(`[Highway] httpUploadBlock failed (code=${headData.errorCode})`);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ export class PacketPacker {
|
||||
this.packetConverter = new PacketMsgConverter(logger);
|
||||
}
|
||||
|
||||
// TODO: 一步到位多好ww
|
||||
private toHexStr(byteArray: Uint8Array): PacketHexStr {
|
||||
return Buffer.from(byteArray).toString('hex') as PacketHexStr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user