style: lint

This commit is contained in:
手瓜一十雪 2024-10-25 18:09:41 +08:00
parent dac6709f27
commit 63f746c237
15 changed files with 118 additions and 118 deletions

View File

@ -378,8 +378,8 @@ export class NTQQFileApi {
}; };
try { try {
if (this.core.apis.PacketApi.available) { if (this.core.apis.PacketApi.available) {
let rkey_expired_private = !this.packetRkey || this.packetRkey[0].time + Number(this.packetRkey[0].ttl) < Date.now() / 1000; const rkey_expired_private = !this.packetRkey || this.packetRkey[0].time + Number(this.packetRkey[0].ttl) < Date.now() / 1000;
let rkey_expired_group = !this.packetRkey || this.packetRkey[0].time + Number(this.packetRkey[0].ttl) < Date.now() / 1000; const rkey_expired_group = !this.packetRkey || this.packetRkey[0].time + Number(this.packetRkey[0].ttl) < Date.now() / 1000;
if (rkey_expired_private || rkey_expired_group) { if (rkey_expired_private || rkey_expired_group) {
this.packetRkey = await this.core.apis.PacketApi.sendRkeyPacket(); this.packetRkey = await this.core.apis.PacketApi.sendRkeyPacket();
} }

View File

@ -244,7 +244,7 @@ export class PacketHighwaySession {
hash: { hash: {
fileSha1: await calculateSha1StreamBytes(video.filePath!) fileSha1: await calculateSha1StreamBytes(video.filePath!)
} }
}) });
await this.packetHighwayClient.upload( await this.packetHighwayClient.upload(
1005, 1005,
fs.createReadStream(video.filePath!, { highWaterMark: BlockSize }), fs.createReadStream(video.filePath!, { highWaterMark: BlockSize }),
@ -312,7 +312,7 @@ export class PacketHighwaySession {
hash: { hash: {
fileSha1: await calculateSha1StreamBytes(video.filePath!) fileSha1: await calculateSha1StreamBytes(video.filePath!)
} }
}) });
await this.packetHighwayClient.upload( await this.packetHighwayClient.upload(
1001, 1001,
fs.createReadStream(video.filePath!, { highWaterMark: BlockSize }), fs.createReadStream(video.filePath!, { highWaterMark: BlockSize }),
@ -379,7 +379,7 @@ export class PacketHighwaySession {
hash: { hash: {
fileSha1: [sha1] fileSha1: [sha1]
} }
}) });
await this.packetHighwayClient.upload( await this.packetHighwayClient.upload(
1008, 1008,
fs.createReadStream(ptt.filePath, { highWaterMark: BlockSize }), fs.createReadStream(ptt.filePath, { highWaterMark: BlockSize }),
@ -418,7 +418,7 @@ export class PacketHighwaySession {
hash: { hash: {
fileSha1: [sha1] fileSha1: [sha1]
} }
}) });
await this.packetHighwayClient.upload( await this.packetHighwayClient.upload(
1007, 1007,
fs.createReadStream(ptt.filePath, { highWaterMark: BlockSize }), fs.createReadStream(ptt.filePath, { highWaterMark: BlockSize }),
@ -484,7 +484,7 @@ export class PacketHighwaySession {
} }
}, },
unknown200: 0, unknown200: 0,
}) });
await this.packetHighwayClient.upload( await this.packetHighwayClient.upload(
71, 71,
fs.createReadStream(file.filePath, { highWaterMark: BlockSize }), fs.createReadStream(file.filePath, { highWaterMark: BlockSize }),
@ -549,7 +549,7 @@ export class PacketHighwaySession {
}, },
unknown200: 1, unknown200: 1,
unknown3: 0 unknown3: 0
}) });
await this.packetHighwayClient.upload( await this.packetHighwayClient.upload(
95, 95,
fs.createReadStream(file.filePath, { highWaterMark: BlockSize }), fs.createReadStream(file.filePath, { highWaterMark: BlockSize }),

View File

@ -30,7 +30,7 @@ abstract class HighwayUploader {
reject(new Error(`[Highway] timeout after ${this.trans.timeout}s`)); reject(new Error(`[Highway] timeout after ${this.trans.timeout}s`));
}, (this.trans.timeout ?? Infinity) * 1000 }, (this.trans.timeout ?? Infinity) * 1000
); );
}) });
} }
buildPicUpHead(offset: number, bodyLength: number, bodyMd5: Uint8Array): Uint8Array { buildPicUpHead(offset: number, bodyLength: number, bodyMd5: Uint8Array): Uint8Array {
@ -159,7 +159,7 @@ export class HighwayHttpUploader extends HighwayUploader {
try { try {
await this.uploadBlock(block, offset); await this.uploadBlock(block, offset);
} catch (err) { } catch (err) {
throw new Error(`[Highway] httpUpload Error uploading block at offset ${offset}: ${err}`) throw new Error(`[Highway] httpUpload Error uploading block at offset ${offset}: ${err}`);
} }
offset += block.length; offset += block.length;
} }

View File

@ -17,7 +17,7 @@ export class PacketMsgBuilder {
{ {
textElement: { content: "[该消息类型暂不支持查看]" }! textElement: { content: "[该消息类型暂不支持查看]" }!
} as SendTextElement } as SendTextElement
) );
buildFakeMsg(selfUid: string, element: PacketMsg[]): NapProtoEncodeStructType<typeof PushMsgBody>[] { buildFakeMsg(selfUid: string, element: PacketMsg[]): NapProtoEncodeStructType<typeof PushMsgBody>[] {
return element.map((node): NapProtoEncodeStructType<typeof PushMsgBody> => { return element.map((node): NapProtoEncodeStructType<typeof PushMsgBody> => {

View File

@ -308,7 +308,7 @@ export class PacketMsgVideoElement extends IPacketMsgElement<SendVideoElement> {
this.filePath = element.videoElement.filePath; this.filePath = element.videoElement.filePath;
this.thumbSize = element.videoElement.thumbSize; this.thumbSize = element.videoElement.thumbSize;
this.thumbPath = element.videoElement.thumbPath?.get(0); this.thumbPath = element.videoElement.thumbPath?.get(0);
this.fileMd5 = element.videoElement.videoMd5 this.fileMd5 = element.videoElement.videoMd5;
this.thumbMd5 = element.videoElement.thumbMd5; this.thumbMd5 = element.videoElement.thumbMd5;
this.thumbWidth = element.videoElement.thumbWidth; this.thumbWidth = element.videoElement.thumbWidth;
this.thumbHeight = element.videoElement.thumbHeight; this.thumbHeight = element.videoElement.thumbHeight;
@ -355,7 +355,7 @@ export class PacketMsgPttElement extends IPacketMsgElement<SendPttElement> {
} }
buildElement(): NapProtoEncodeStructType<typeof Elem>[] { buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
return [] return [];
// if (!this.msgInfo) return []; // if (!this.msgInfo) return [];
// return [{ // return [{
// commonElem: { // commonElem: {
@ -382,7 +382,7 @@ export class PacketMsgFileElement extends IPacketMsgElement<SendFileElement> {
isGroupFile?: boolean; isGroupFile?: boolean;
_private_send_uid?: string; _private_send_uid?: string;
_private_recv_uid?: string; _private_recv_uid?: string;
_e37_800_rsp?: NapProtoEncodeStructType<typeof OidbSvcTrpcTcp0XE37_800Response> _e37_800_rsp?: NapProtoEncodeStructType<typeof OidbSvcTrpcTcp0XE37_800Response>;
constructor(element: SendFileElement) { constructor(element: SendFileElement) {
super(element); super(element);
@ -423,7 +423,7 @@ export class PacketMsgFileElement extends IPacketMsgElement<SendFileElement> {
destUid: this._private_recv_uid, destUid: this._private_recv_uid,
} }
} }
}) });
} }
buildElement(): NapProtoEncodeStructType<typeof Elem>[] { buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
@ -443,7 +443,7 @@ export class PacketMsgFileElement extends IPacketMsgElement<SendFileElement> {
fileMd5: this.fileMd5, fileMd5: this.fileMd5,
} }
} }
}) });
lb.writeUInt16BE(transElemVal.length); lb.writeUInt16BE(transElemVal.length);
return [{ return [{
transElem: { transElem: {

View File

@ -61,7 +61,7 @@ export class PacketPacker {
return { return {
cmd: `OidbSvcTrpcTcp.0x${cmd.toString(16).toUpperCase()}_${subCmd}`, cmd: `OidbSvcTrpcTcp.0x${cmd.toString(16).toUpperCase()}_${subCmd}`,
data: this.packetPacket(data) data: this.packetPacket(data)
} };
} }
packPokePacket(peer: number, group?: number): OidbPacket { packPokePacket(peer: number, group?: number): OidbPacket {
@ -538,7 +538,7 @@ export class PacketPacker {
clientSeq: 0, clientSeq: 0,
noNeedCompatMsg: false noNeedCompatMsg: false
} }
}) });
return this.packOidbPacket(0x126E, 100, req, true, false); return this.packOidbPacket(0x126E, 100, req, true, false);
} }
@ -600,7 +600,7 @@ export class PacketPacker {
clientSeq: 0, clientSeq: 0,
noNeedCompatMsg: false noNeedCompatMsg: false
} }
}) });
return this.packOidbPacket(0x126D, 100, req, true, false); return this.packOidbPacket(0x126D, 100, req, true, false);
} }
@ -642,7 +642,7 @@ export class PacketPacker {
businessId: 3, businessId: 3,
clientType: 1, clientType: 1,
flagSupportMediaPlatform: 1 flagSupportMediaPlatform: 1
}) });
return this.packOidbPacket(0xE37, 1700, body, false, false); return this.packOidbPacket(0xE37, 1700, body, false, false);
} }

View File

@ -118,7 +118,7 @@ export const FileExtra = {
export const PrivateFileExtra = { export const PrivateFileExtra = {
field2: ProtoField(2, () => PrivateFileExtraField2), field2: ProtoField(2, () => PrivateFileExtraField2),
} };
export const PrivateFileExtraField2 = { export const PrivateFileExtraField2 = {
field1: ProtoField(1, ScalarType.UINT32), field1: ProtoField(1, ScalarType.UINT32),
@ -131,7 +131,7 @@ export const PrivateFileExtraField2 = {
fileHash: ProtoField(14, ScalarType.STRING), fileHash: ProtoField(14, ScalarType.STRING),
selfUid: ProtoField(15, ScalarType.STRING), selfUid: ProtoField(15, ScalarType.STRING),
destUid: ProtoField(16, ScalarType.STRING), destUid: ProtoField(16, ScalarType.STRING),
} };
export const GroupFileExtra = { export const GroupFileExtra = {
field1: ProtoField(1, ScalarType.UINT32), field1: ProtoField(1, ScalarType.UINT32),

View File

@ -59,4 +59,4 @@ export const OidbSvcTrpcTcp0XE37_800Response = {
export const OidbSvcTrpcTcp0XE37_800ResponseBody = { export const OidbSvcTrpcTcp0XE37_800ResponseBody = {
field10: ProtoField(10, ScalarType.UINT32, true), field10: ProtoField(10, ScalarType.UINT32, true),
field30: ProtoField(30, () => OidbSvcTrpcTcp0XE37_800_1200Metadata, true), field30: ProtoField(30, () => OidbSvcTrpcTcp0XE37_800_1200Metadata, true),
} };

View File

@ -8,7 +8,7 @@ export const OidbSvcTrpcTcp0XE37_1700 = {
businessId: ProtoField(101, ScalarType.INT32, true), businessId: ProtoField(101, ScalarType.INT32, true),
clientType: ProtoField(102, ScalarType.INT32, true), clientType: ProtoField(102, ScalarType.INT32, true),
flagSupportMediaPlatform: ProtoField(200, ScalarType.INT32, true), flagSupportMediaPlatform: ProtoField(200, ScalarType.INT32, true),
} };
export const ApplyUploadReqV3 = { export const ApplyUploadReqV3 = {
senderUid: ProtoField(10, ScalarType.STRING, true), senderUid: ProtoField(10, ScalarType.STRING, true),
@ -20,4 +20,4 @@ export const ApplyUploadReqV3 = {
localPath: ProtoField(70, ScalarType.STRING, true), localPath: ProtoField(70, ScalarType.STRING, true),
md5CheckSum: ProtoField(110, ScalarType.BYTES, true), md5CheckSum: ProtoField(110, ScalarType.BYTES, true),
sha3CheckSum: ProtoField(120, ScalarType.BYTES, true), sha3CheckSum: ProtoField(120, ScalarType.BYTES, true),
} };

View File

@ -9,4 +9,4 @@ export const OidbSvcTrpcTcp0XEB7_Body = {
export const OidbSvcTrpcTcp0XEB7 = { export const OidbSvcTrpcTcp0XEB7 = {
body: ProtoField(2, () => OidbSvcTrpcTcp0XEB7_Body), body: ProtoField(2, () => OidbSvcTrpcTcp0XEB7_Body),
} };

View File

@ -73,7 +73,7 @@ export class Sha1Stream {
this._count[1] = (this._count[1] + (dataLen >>> 29)) >>> 0; this._count[1] = (this._count[1] + (dataLen >>> 29)) >>> 0;
let partLen = (this.Sha1BlockSize - index) >>> 0; const partLen = (this.Sha1BlockSize - index) >>> 0;
let i = 0; let i = 0;
if (dataLen >= partLen) { if (dataLen >= partLen) {
@ -100,11 +100,11 @@ export class Sha1Stream {
public final(): Buffer { public final(): Buffer {
const digest = Buffer.allocUnsafe(this.Sha1DigestSize); const digest = Buffer.allocUnsafe(this.Sha1DigestSize);
const bits = Buffer.allocUnsafe(8) const bits = Buffer.allocUnsafe(8);
bits.writeUInt32BE(this._count[1], 0); bits.writeUInt32BE(this._count[1], 0);
bits.writeUInt32BE(this._count[0], 4); bits.writeUInt32BE(this._count[0], 4);
let index = ((this._count[0] >>> 3) & 0x3F) >>> 0; const index = ((this._count[0] >>> 3) & 0x3F) >>> 0;
const padLen = ((index < 56) ? (56 - index) : (120 - index)) >>> 0; const padLen = ((index < 56) ? (56 - index) : (120 - index)) >>> 0;
this.update(this._padding, padLen); this.update(this._padding, padLen);
this.update(bits); this.update(bits);