mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
style: lint
This commit is contained in:
parent
345e941e11
commit
dacfefe644
@ -1,4 +1,4 @@
|
|||||||
import {PacketMsg} from "@/core/packet/msg/message";
|
import { PacketMsg } from "@/core/packet/msg/message";
|
||||||
import * as crypto from "node:crypto";
|
import * as crypto from "node:crypto";
|
||||||
|
|
||||||
interface ForwardMsgJson {
|
interface ForwardMsgJson {
|
||||||
@ -78,7 +78,7 @@ export class ForwardMsgBuilder {
|
|||||||
source: isGroupMsg ? "群聊的聊天记录" :
|
source: isGroupMsg ? "群聊的聊天记录" :
|
||||||
msg.length
|
msg.length
|
||||||
? Array.from(new Set(msg.map(m => m.senderName)))
|
? Array.from(new Set(msg.map(m => m.senderName)))
|
||||||
.join('和') + '的聊天记录'
|
.join('和') + '的聊天记录'
|
||||||
: '聊天记录',
|
: '聊天记录',
|
||||||
summary: `查看${msg.length}条转发消息`,
|
summary: `查看${msg.length}条转发消息`,
|
||||||
uniseq: id,
|
uniseq: id,
|
||||||
@ -87,11 +87,11 @@ export class ForwardMsgBuilder {
|
|||||||
prompt: "[聊天记录]",
|
prompt: "[聊天记录]",
|
||||||
ver: "0.0.0.5",
|
ver: "0.0.0.5",
|
||||||
view: "contact",
|
view: "contact",
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromResId(resId: string): ForwardMsgJson {
|
static fromResId(resId: string): ForwardMsgJson {
|
||||||
return this.build(resId, [])
|
return this.build(resId, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromPacketMsg(resId: string, packetMsg: PacketMsg[]): ForwardMsgJson {
|
static fromPacketMsg(resId: string, packetMsg: PacketMsg[]): ForwardMsgJson {
|
||||||
@ -101,6 +101,6 @@ export class ForwardMsgBuilder {
|
|||||||
msg: msg.msg.map(m => ({
|
msg: msg.msg.map(m => ({
|
||||||
preview: m.toPreview(),
|
preview: m.toPreview(),
|
||||||
}))
|
}))
|
||||||
})))
|
})));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ export class NTQQGroupApi {
|
|||||||
|
|
||||||
async getGroupMembersV2(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
async getGroupMembersV2(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
||||||
const sceneId = this.context.session.getGroupService().createMemberListScene(groupQQ, 'groupMemberList_MainWindow');
|
const sceneId = this.context.session.getGroupService().createMemberListScene(groupQQ, 'groupMemberList_MainWindow');
|
||||||
let once = this.core.eventWrapper.registerListen('NodeIKernelGroupListener/onMemberListChange', 1, 2000, (params) => params.sceneId === sceneId)
|
const once = this.core.eventWrapper.registerListen('NodeIKernelGroupListener/onMemberListChange', 1, 2000, (params) => params.sceneId === sceneId)
|
||||||
.catch();
|
.catch();
|
||||||
const result = await this.context.session.getGroupService().getNextMemberList(sceneId!, undefined, num);
|
const result = await this.context.session.getGroupService().getNextMemberList(sceneId!, undefined, num);
|
||||||
if (result.errCode !== 0) {
|
if (result.errCode !== 0) {
|
||||||
|
@ -27,7 +27,7 @@ const typedOffset: OffsetType = offset;
|
|||||||
export class NTQQPacketApi {
|
export class NTQQPacketApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
core: NapCatCore;
|
core: NapCatCore;
|
||||||
logger: LogWrapper
|
logger: LogWrapper;
|
||||||
serverUrl: string | undefined;
|
serverUrl: string | undefined;
|
||||||
qqVersion: string | undefined;
|
qqVersion: string | undefined;
|
||||||
packetSession: PacketSession | undefined;
|
packetSession: PacketSession | undefined;
|
||||||
@ -64,7 +64,7 @@ export class NTQQPacketApi {
|
|||||||
if (this.packetSession && this.packetSession.client) {
|
if (this.packetSession && this.packetSession.client) {
|
||||||
this.packetSession.client.init(process.pid, table.recv, table.send).then().catch(this.logger.logError.bind(this.logger));
|
this.packetSession.client.init(process.pid, table.recv, table.send).then().catch(this.logger.logError.bind(this.logger));
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
await this.packetSession.client.connect(cb);
|
await this.packetSession.client.connect(cb);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ export class NTQQPacketApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async uploadResources(msg: PacketMsg[], groupUin: number = 0) {
|
private async uploadResources(msg: PacketMsg[], groupUin: number = 0) {
|
||||||
const reqList = []
|
const reqList = [];
|
||||||
for (const m of msg) {
|
for (const m of msg) {
|
||||||
for (const e of m.msg) {
|
for (const e of m.msg) {
|
||||||
if (e instanceof PacketMsgPicElement) {
|
if (e instanceof PacketMsgPicElement) {
|
||||||
@ -143,6 +143,6 @@ export class NTQQPacketApi {
|
|||||||
if (resp.download.retCode !== 0) {
|
if (resp.download.retCode !== 0) {
|
||||||
throw new Error(`sendGroupFileDownloadReq error: ${resp.download.clientWording}`);
|
throw new Error(`sendGroupFileDownloadReq error: ${resp.download.clientWording}`);
|
||||||
}
|
}
|
||||||
return `https://${resp.download.downloadDns}/ftn_handler/${Buffer.from(resp.download.downloadUrl).toString('hex')}/?fname=`
|
return `https://${resp.download.downloadDns}/ftn_handler/${Buffer.from(resp.download.downloadUrl).toString('hex')}/?fname=`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import * as stream from 'node:stream';
|
import * as stream from 'node:stream';
|
||||||
import {ReadStream} from "node:fs";
|
import { ReadStream } from "node:fs";
|
||||||
import {PacketHighwaySig} from "@/core/packet/highway/session";
|
import { PacketHighwaySig } from "@/core/packet/highway/session";
|
||||||
import {HighwayHttpUploader, HighwayTcpUploader} from "@/core/packet/highway/uploader";
|
import { HighwayHttpUploader, HighwayTcpUploader } from "@/core/packet/highway/uploader";
|
||||||
import {LogWrapper} from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
|
|
||||||
export interface PacketHighwayTrans {
|
export interface PacketHighwayTrans {
|
||||||
uin: string;
|
uin: string;
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import * as fs from "node:fs";
|
import * as fs from "node:fs";
|
||||||
import {ChatType, Peer} from "@/core";
|
import { ChatType, Peer } from "@/core";
|
||||||
import {LogWrapper} from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
import {PacketClient} from "@/core/packet/client";
|
import { PacketClient } from "@/core/packet/client";
|
||||||
import {PacketPacker} from "@/core/packet/packer";
|
import { PacketPacker } from "@/core/packet/packer";
|
||||||
import {NapProtoMsg} from "@/core/packet/proto/NapProto";
|
import { NapProtoMsg } from "@/core/packet/proto/NapProto";
|
||||||
import {HttpConn0x6ff_501Response} from "@/core/packet/proto/action/action";
|
import { HttpConn0x6ff_501Response } from "@/core/packet/proto/action/action";
|
||||||
import {PacketHighwayClient} from "@/core/packet/highway/client";
|
import { PacketHighwayClient } from "@/core/packet/highway/client";
|
||||||
import {NTV2RichMediaResp} from "@/core/packet/proto/oidb/common/Ntv2.RichMediaResp";
|
import { NTV2RichMediaResp } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaResp";
|
||||||
import {OidbSvcTrpcTcpBaseRsp} from "@/core/packet/proto/oidb/OidbBase";
|
import { OidbSvcTrpcTcpBaseRsp } from "@/core/packet/proto/oidb/OidbBase";
|
||||||
import {PacketMsgPicElement} from "@/core/packet/msg/element";
|
import { PacketMsgPicElement } from "@/core/packet/msg/element";
|
||||||
import {NTV2RichMediaHighwayExt} from "@/core/packet/proto/highway/highway";
|
import { NTV2RichMediaHighwayExt } from "@/core/packet/proto/highway/highway";
|
||||||
import {int32ip2str, oidbIpv4s2HighwayIpv4s} from "@/core/packet/highway/utils";
|
import { int32ip2str, oidbIpv4s2HighwayIpv4s } from "@/core/packet/highway/utils";
|
||||||
|
|
||||||
export const BlockSize = 1024 * 1024;
|
export const BlockSize = 1024 * 1024;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ export class PacketHighwaySession {
|
|||||||
sigSession: null,
|
sigSession: null,
|
||||||
sessionKey: null,
|
sessionKey: null,
|
||||||
serverAddr: [],
|
serverAddr: [],
|
||||||
}
|
};
|
||||||
this.packer = packer;
|
this.packer = packer;
|
||||||
this.packetHighwayClient = new PacketHighwayClient(this.sig, this.logger);
|
this.packetHighwayClient = new PacketHighwayClient(this.sig, this.logger);
|
||||||
}
|
}
|
||||||
@ -69,8 +69,8 @@ export class PacketHighwaySession {
|
|||||||
const rsp = new NapProtoMsg(HttpConn0x6ff_501Response).decode(
|
const rsp = new NapProtoMsg(HttpConn0x6ff_501Response).decode(
|
||||||
Buffer.from(req.hex_data, 'hex')
|
Buffer.from(req.hex_data, 'hex')
|
||||||
);
|
);
|
||||||
this.sig.sigSession = rsp.httpConn.sigSession
|
this.sig.sigSession = rsp.httpConn.sigSession;
|
||||||
this.sig.sessionKey = rsp.httpConn.sessionKey
|
this.sig.sessionKey = rsp.httpConn.sessionKey;
|
||||||
for (const info of rsp.httpConn.serverInfos) {
|
for (const info of rsp.httpConn.serverInfos) {
|
||||||
if (info.serviceType !== 1) continue;
|
if (info.serviceType !== 1) continue;
|
||||||
for (const addr of info.serverAddrs) {
|
for (const addr of info.serverAddrs) {
|
||||||
@ -78,7 +78,7 @@ export class PacketHighwaySession {
|
|||||||
this.sig.serverAddr.push({
|
this.sig.serverAddr.push({
|
||||||
ip: int32ip2str(addr.ip),
|
ip: int32ip2str(addr.ip),
|
||||||
port: addr.port
|
port: addr.port
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,10 +118,10 @@ export class PacketHighwaySession {
|
|||||||
hash: {
|
hash: {
|
||||||
fileSha1: [sha1]
|
fileSha1: [sha1]
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
await this.packetHighwayClient.upload(
|
await this.packetHighwayClient.upload(
|
||||||
1004,
|
1004,
|
||||||
fs.createReadStream(img.path, {highWaterMark: BlockSize}),
|
fs.createReadStream(img.path, { highWaterMark: BlockSize }),
|
||||||
img.size,
|
img.size,
|
||||||
md5,
|
md5,
|
||||||
extend
|
extend
|
||||||
@ -157,10 +157,10 @@ export class PacketHighwaySession {
|
|||||||
hash: {
|
hash: {
|
||||||
fileSha1: [sha1]
|
fileSha1: [sha1]
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
await this.packetHighwayClient.upload(
|
await this.packetHighwayClient.upload(
|
||||||
1003,
|
1003,
|
||||||
fs.createReadStream(img.path, {highWaterMark: BlockSize}),
|
fs.createReadStream(img.path, { highWaterMark: BlockSize }),
|
||||||
img.size,
|
img.size,
|
||||||
md5,
|
md5,
|
||||||
extend
|
extend
|
||||||
|
@ -2,13 +2,13 @@ import * as net from "node:net";
|
|||||||
import * as crypto from "node:crypto";
|
import * as crypto from "node:crypto";
|
||||||
import * as http from "node:http";
|
import * as http from "node:http";
|
||||||
import * as stream from "node:stream";
|
import * as stream from "node:stream";
|
||||||
import {LogWrapper} from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
import * as tea from "@/core/packet/utils/crypto/tea";
|
import * as tea from "@/core/packet/utils/crypto/tea";
|
||||||
import {NapProtoMsg} from "@/core/packet/proto/NapProto";
|
import { NapProtoMsg } from "@/core/packet/proto/NapProto";
|
||||||
import {ReqDataHighwayHead, RespDataHighwayHead} from "@/core/packet/proto/highway/highway";
|
import { ReqDataHighwayHead, RespDataHighwayHead } from "@/core/packet/proto/highway/highway";
|
||||||
import {BlockSize} from "@/core/packet/highway/session";
|
import { BlockSize } from "@/core/packet/highway/session";
|
||||||
import {PacketHighwayTrans} from "@/core/packet/highway/client";
|
import { PacketHighwayTrans } from "@/core/packet/highway/client";
|
||||||
import {Frame} from "@/core/packet/highway/frame";
|
import { Frame } from "@/core/packet/highway/frame";
|
||||||
|
|
||||||
abstract class HighwayUploader {
|
abstract class HighwayUploader {
|
||||||
readonly trans: PacketHighwayTrans;
|
readonly trans: PacketHighwayTrans;
|
||||||
@ -53,7 +53,7 @@ abstract class HighwayUploader {
|
|||||||
uint32LoginSigType: 8,
|
uint32LoginSigType: 8,
|
||||||
appId: 1600001604,
|
appId: 1600001604,
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract upload(): Promise<void>;
|
abstract upload(): Promise<void>;
|
||||||
@ -89,8 +89,8 @@ export class HighwayTcpUploader extends HighwayUploader {
|
|||||||
const highwayTransForm = new HighwayTcpUploaderTransform(this);
|
const highwayTransForm = new HighwayTcpUploaderTransform(this);
|
||||||
const upload = new Promise<void>((resolve, _) => {
|
const upload = new Promise<void>((resolve, _) => {
|
||||||
const socket = net.connect(this.trans.port, this.trans.server, () => {
|
const socket = net.connect(this.trans.port, this.trans.server, () => {
|
||||||
this.trans.data.pipe(highwayTransForm).pipe(socket, {end: false});
|
this.trans.data.pipe(highwayTransForm).pipe(socket, { end: false });
|
||||||
})
|
});
|
||||||
const handleRspHeader = (header: Buffer) => {
|
const handleRspHeader = (header: Buffer) => {
|
||||||
const rsp = new NapProtoMsg(RespDataHighwayHead).decode(header);
|
const rsp = new NapProtoMsg(RespDataHighwayHead).decode(header);
|
||||||
if (rsp.errorCode !== 0) {
|
if (rsp.errorCode !== 0) {
|
||||||
@ -111,25 +111,25 @@ export class HighwayTcpUploader extends HighwayUploader {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.logError(`[Highway] tcpUpload parse response error: ${e}`);
|
this.logger.logError(`[Highway] tcpUpload parse response error: ${e}`);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
socket.on('close', () => {
|
socket.on('close', () => {
|
||||||
this.logger.logDebug('[Highway] tcpUpload socket closed.');
|
this.logger.logDebug('[Highway] tcpUpload socket closed.');
|
||||||
resolve();
|
resolve();
|
||||||
})
|
});
|
||||||
socket.on('error', (err) => {
|
socket.on('error', (err) => {
|
||||||
this.logger.logError('[Highway] tcpUpload socket.on error:', err);
|
this.logger.logError('[Highway] tcpUpload socket.on error:', err);
|
||||||
})
|
});
|
||||||
this.trans.data.on('error', (err) => {
|
this.trans.data.on('error', (err) => {
|
||||||
this.logger.logError('[Highway] tcpUpload readable error:', err);
|
this.logger.logError('[Highway] tcpUpload readable error:', err);
|
||||||
socket.end();
|
socket.end();
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
const timeout = new Promise<void>((_, reject) => {
|
const timeout = new Promise<void>((_, reject) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
reject(new Error(`[Highway] tcpUpload timeout after ${this.trans.timeout}s`))
|
reject(new Error(`[Highway] tcpUpload timeout after ${this.trans.timeout}s`));
|
||||||
}, (this.trans.timeout ?? Infinity) * 1000
|
}, (this.trans.timeout ?? Infinity) * 1000
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
await Promise.race([upload, timeout]);
|
await Promise.race([upload, timeout]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ export class HighwayHttpUploader extends HighwayUploader {
|
|||||||
async upload(): Promise<void> {
|
async upload(): Promise<void> {
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
for await (const chunk of this.trans.data) {
|
for await (const chunk of this.trans.data) {
|
||||||
let block = chunk as Buffer;
|
const block = chunk as Buffer;
|
||||||
try {
|
try {
|
||||||
await this.uploadBlock(block, offset);
|
await this.uploadBlock(block, offset);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -153,7 +153,7 @@ export class HighwayHttpUploader extends HighwayUploader {
|
|||||||
private async uploadBlock(block: Buffer, offset: number): Promise<void> {
|
private async uploadBlock(block: Buffer, offset: number): Promise<void> {
|
||||||
const chunkMD5 = crypto.createHash('md5').update(block).digest();
|
const chunkMD5 = crypto.createHash('md5').update(block).digest();
|
||||||
const payload = this.buildPicUpHead(offset, block.length, chunkMD5);
|
const payload = this.buildPicUpHead(offset, block.length, chunkMD5);
|
||||||
const frame = Frame.pack(Buffer.from(payload), block)
|
const frame = Frame.pack(Buffer.from(payload), block);
|
||||||
const resp = await this.httpPostHighwayContent(frame, `http://${this.trans.server}:${this.trans.port}/cgi-bin/httpconn?htcmd=0x6FF0087&uin=${this.trans.uin}`);
|
const resp = await this.httpPostHighwayContent(frame, `http://${this.trans.server}:${this.trans.port}/cgi-bin/httpconn?htcmd=0x6FF0087&uin=${this.trans.uin}`);
|
||||||
const [head, body] = Frame.unpack(resp);
|
const [head, body] = Frame.unpack(resp);
|
||||||
const headData = new NapProtoMsg(RespDataHighwayHead).decode(head);
|
const headData = new NapProtoMsg(RespDataHighwayHead).decode(head);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import {NapProtoEncodeStructType} from "@/core/packet/proto/NapProto";
|
import { NapProtoEncodeStructType } from "@/core/packet/proto/NapProto";
|
||||||
import {IPv4} from "@/core/packet/proto/oidb/common/Ntv2.RichMediaResp";
|
import { IPv4 } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaResp";
|
||||||
import {NTHighwayIPv4} from "@/core/packet/proto/highway/highway";
|
import { NTHighwayIPv4 } from "@/core/packet/proto/highway/highway";
|
||||||
|
|
||||||
export const int32ip2str = (ip: number) => {
|
export const int32ip2str = (ip: number) => {
|
||||||
ip = ip & 0xffffffff;
|
ip = ip & 0xffffffff;
|
||||||
return [ip & 0xff, (ip & 0xff00) >> 8, (ip & 0xff0000) >> 16, ((ip & 0xff000000) >> 24) & 0xff].join('.');
|
return [ip & 0xff, (ip & 0xff00) >> 8, (ip & 0xff0000) >> 16, ((ip & 0xff000000) >> 24) & 0xff].join('.');
|
||||||
}
|
};
|
||||||
|
|
||||||
export const oidbIpv4s2HighwayIpv4s = (ipv4s: NapProtoEncodeStructType<typeof IPv4>[]): NapProtoEncodeStructType<typeof NTHighwayIPv4>[] =>{
|
export const oidbIpv4s2HighwayIpv4s = (ipv4s: NapProtoEncodeStructType<typeof IPv4>[]): NapProtoEncodeStructType<typeof NTHighwayIPv4>[] =>{
|
||||||
return ipv4s.map((ip) => {
|
return ipv4s.map((ip) => {
|
||||||
@ -15,6 +15,6 @@ export const oidbIpv4s2HighwayIpv4s = (ipv4s: NapProtoEncodeStructType<typeof IP
|
|||||||
ip: int32ip2str(ip.outIP!),
|
ip: int32ip2str(ip.outIP!),
|
||||||
},
|
},
|
||||||
port: ip.outPort!
|
port: ip.outPort!
|
||||||
} as NapProtoEncodeStructType<typeof NTHighwayIPv4>
|
} as NapProtoEncodeStructType<typeof NTHighwayIPv4>;
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import * as crypto from "crypto";
|
import * as crypto from "crypto";
|
||||||
import {PushMsgBody} from "@/core/packet/proto/message/message";
|
import { PushMsgBody } from "@/core/packet/proto/message/message";
|
||||||
import {NapProtoEncodeStructType} from "@/core/packet/proto/NapProto";
|
import { NapProtoEncodeStructType } from "@/core/packet/proto/NapProto";
|
||||||
import {LogWrapper} from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
import {PacketMsg} from "@/core/packet/msg/message";
|
import { PacketMsg } from "@/core/packet/msg/message";
|
||||||
|
|
||||||
export class PacketMsgBuilder {
|
export class PacketMsgBuilder {
|
||||||
private logger: LogWrapper;
|
private logger: LogWrapper;
|
||||||
|
@ -28,8 +28,8 @@ import {
|
|||||||
PacketMsgVideoElement,
|
PacketMsgVideoElement,
|
||||||
PacketMultiMsgElement
|
PacketMultiMsgElement
|
||||||
} from "@/core/packet/msg/element";
|
} from "@/core/packet/msg/element";
|
||||||
import {PacketMsg, PacketSendMsgElement} from "@/core/packet/msg/message";
|
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/msg/message";
|
||||||
import {LogWrapper} from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
|
|
||||||
type SendMessageElementMap = {
|
type SendMessageElementMap = {
|
||||||
textElement: SendTextElement,
|
textElement: SendTextElement,
|
||||||
@ -82,50 +82,50 @@ export class PacketMsgConverter {
|
|||||||
);
|
);
|
||||||
if (key) {
|
if (key) {
|
||||||
const elementData = (element as any)[key]; // TODO:
|
const elementData = (element as any)[key]; // TODO:
|
||||||
if (elementData) return this.rawToPacketMsgConverters[key](element as any)
|
if (elementData) return this.rawToPacketMsgConverters[key](element as any);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}).filter((e) => e !== null)
|
}).filter((e) => e !== null)
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private rawToPacketMsgConverters: RawToPacketMsgConverters = {
|
private rawToPacketMsgConverters: RawToPacketMsgConverters = {
|
||||||
textElement: (element: SendTextElement) => {
|
textElement: (element: SendTextElement) => {
|
||||||
if (element.textElement.atType) {
|
if (element.textElement.atType) {
|
||||||
return new PacketMsgAtElement(element)
|
return new PacketMsgAtElement(element);
|
||||||
}
|
}
|
||||||
return new PacketMsgTextElement(element)
|
return new PacketMsgTextElement(element);
|
||||||
},
|
},
|
||||||
picElement: (element: SendPicElement) => {
|
picElement: (element: SendPicElement) => {
|
||||||
return new PacketMsgPicElement(element)
|
return new PacketMsgPicElement(element);
|
||||||
},
|
},
|
||||||
replyElement: (element: SendReplyElement) => {
|
replyElement: (element: SendReplyElement) => {
|
||||||
return new PacketMsgReplyElement(element)
|
return new PacketMsgReplyElement(element);
|
||||||
},
|
},
|
||||||
faceElement: (element: SendFaceElement) => {
|
faceElement: (element: SendFaceElement) => {
|
||||||
return new PacketMsgFaceElement(element)
|
return new PacketMsgFaceElement(element);
|
||||||
},
|
},
|
||||||
marketFaceElement: (element: SendMarketFaceElement) => {
|
marketFaceElement: (element: SendMarketFaceElement) => {
|
||||||
return new PacketMsgMarkFaceElement(element)
|
return new PacketMsgMarkFaceElement(element);
|
||||||
},
|
},
|
||||||
videoElement: (element: SendVideoElement) => {
|
videoElement: (element: SendVideoElement) => {
|
||||||
return new PacketMsgVideoElement(element)
|
return new PacketMsgVideoElement(element);
|
||||||
},
|
},
|
||||||
fileElement: (element: SendFileElement) => {
|
fileElement: (element: SendFileElement) => {
|
||||||
return new PacketMsgFileElement(element)
|
return new PacketMsgFileElement(element);
|
||||||
},
|
},
|
||||||
pttElement: (element: SendPttElement) => {
|
pttElement: (element: SendPttElement) => {
|
||||||
return new PacketMsgPttElement(element)
|
return new PacketMsgPttElement(element);
|
||||||
},
|
},
|
||||||
arkElement: (element: SendArkElement) => {
|
arkElement: (element: SendArkElement) => {
|
||||||
return new PacketMsgLightAppElement(element)
|
return new PacketMsgLightAppElement(element);
|
||||||
},
|
},
|
||||||
markdownElement: (element: SendMarkdownElement) => {
|
markdownElement: (element: SendMarkdownElement) => {
|
||||||
return new PacketMsgMarkDownElement(element)
|
return new PacketMsgMarkDownElement(element);
|
||||||
},
|
},
|
||||||
// TODO: check this logic, move it in arkElement?
|
// TODO: check this logic, move it in arkElement?
|
||||||
structLongMsgElement: (element: SendStructLongMsgElement) => {
|
structLongMsgElement: (element: SendStructLongMsgElement) => {
|
||||||
return new PacketMultiMsgElement(element)
|
return new PacketMultiMsgElement(element);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import assert from "node:assert";
|
import assert from "node:assert";
|
||||||
import * as zlib from "node:zlib";
|
import * as zlib from "node:zlib";
|
||||||
import {NapProtoEncodeStructType, NapProtoMsg} from "@/core/packet/proto/NapProto";
|
import { NapProtoEncodeStructType, NapProtoMsg } from "@/core/packet/proto/NapProto";
|
||||||
import {
|
import {
|
||||||
CustomFace,
|
CustomFace,
|
||||||
Elem,
|
Elem,
|
||||||
@ -25,9 +25,9 @@ import {
|
|||||||
SendTextElement,
|
SendTextElement,
|
||||||
SendVideoElement
|
SendVideoElement
|
||||||
} from "@/core";
|
} from "@/core";
|
||||||
import {MsgInfo} from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
import { MsgInfo } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
||||||
import {PacketMsg, PacketSendMsgElement} from "@/core/packet/msg/message";
|
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/msg/message";
|
||||||
import {ForwardMsgBuilder} from "@/common/forward-msg-builder";
|
import { ForwardMsgBuilder } from "@/common/forward-msg-builder";
|
||||||
|
|
||||||
// raw <-> packet
|
// raw <-> packet
|
||||||
// TODO: SendStructLongMsgElement
|
// TODO: SendStructLongMsgElement
|
||||||
@ -84,11 +84,11 @@ export class PacketMsgAtElement extends PacketMsgTextElement {
|
|||||||
text: {
|
text: {
|
||||||
str: this.text,
|
str: this.text,
|
||||||
pbReserve: new NapProtoMsg(MentionExtra).encode({
|
pbReserve: new NapProtoMsg(MentionExtra).encode({
|
||||||
type: this.atAll ? 1 : 2,
|
type: this.atAll ? 1 : 2,
|
||||||
uin: 0,
|
uin: 0,
|
||||||
field5: 0,
|
field5: 0,
|
||||||
uid: this.targetUid,
|
uid: this.targetUid,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
@ -101,7 +101,7 @@ export class PacketMsgAtElement extends PacketMsgTextElement {
|
|||||||
|
|
||||||
export class PacketMsgPicElement extends IPacketMsgElement<SendPicElement> {
|
export class PacketMsgPicElement extends IPacketMsgElement<SendPicElement> {
|
||||||
path: string;
|
path: string;
|
||||||
name: string
|
name: string;
|
||||||
size: number;
|
size: number;
|
||||||
md5: string;
|
md5: string;
|
||||||
width: number;
|
width: number;
|
||||||
@ -131,7 +131,7 @@ export class PacketMsgPicElement extends IPacketMsgElement<SendPicElement> {
|
|||||||
pbElem: new NapProtoMsg(MsgInfo).encode(this.msgInfo),
|
pbElem: new NapProtoMsg(MsgInfo).encode(this.msgInfo),
|
||||||
businessType: 10,
|
businessType: 10,
|
||||||
}
|
}
|
||||||
}]
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
@ -185,7 +185,7 @@ export class PacketMsgReplyElement extends IPacketMsgElement<SendReplyElement> {
|
|||||||
uid: String(this.targetUid),
|
uid: String(this.targetUid),
|
||||||
}),
|
}),
|
||||||
} : undefined,
|
} : undefined,
|
||||||
}]
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
@ -219,7 +219,7 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
|
|||||||
}),
|
}),
|
||||||
businessType: 1
|
businessType: 1
|
||||||
}
|
}
|
||||||
}]
|
}];
|
||||||
} else if (this.faceId < 260) {
|
} else if (this.faceId < 260) {
|
||||||
return [{
|
return [{
|
||||||
face: {
|
face: {
|
||||||
@ -237,7 +237,7 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
|
|||||||
}),
|
}),
|
||||||
businessType: 1
|
businessType: 1
|
||||||
}
|
}
|
||||||
}]
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ export class PacketMsgMarkFaceElement extends IPacketMsgElement<SendMarketFaceEl
|
|||||||
field8: 1
|
field8: 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
@ -318,7 +318,7 @@ export class PacketMsgLightAppElement extends IPacketMsgElement<SendArkElement>
|
|||||||
zlib.deflateSync(Buffer.from(this.payload, 'utf-8'))
|
zlib.deflateSync(Buffer.from(this.payload, 'utf-8'))
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}]
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
@ -343,7 +343,7 @@ export class PacketMsgMarkDownElement extends IPacketMsgElement<SendMarkdownElem
|
|||||||
}),
|
}),
|
||||||
businessType: 1
|
businessType: 1
|
||||||
}
|
}
|
||||||
}]
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
@ -369,7 +369,7 @@ export class PacketMultiMsgElement extends IPacketMsgElement<SendStructLongMsgEl
|
|||||||
zlib.deflateSync(Buffer.from(JSON.stringify(ForwardMsgBuilder.fromPacketMsg(this.resid, this.message)), 'utf-8'))
|
zlib.deflateSync(Buffer.from(JSON.stringify(ForwardMsgBuilder.fromPacketMsg(this.resid, this.message)), 'utf-8'))
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}]
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {IPacketMsgElement} from "@/core/packet/msg/element";
|
import { IPacketMsgElement } from "@/core/packet/msg/element";
|
||||||
import {SendMessageElement, SendStructLongMsgElement} from "@/core";
|
import { SendMessageElement, SendStructLongMsgElement } from "@/core";
|
||||||
|
|
||||||
export type PacketSendMsgElement = SendMessageElement | SendStructLongMsgElement
|
export type PacketSendMsgElement = SendMessageElement | SendStructLongMsgElement
|
||||||
|
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
import * as zlib from "node:zlib";
|
import * as zlib from "node:zlib";
|
||||||
import * as crypto from "node:crypto";
|
import * as crypto from "node:crypto";
|
||||||
import {calculateSha1} from "@/core/packet/utils/crypto/hash"
|
import { calculateSha1 } from "@/core/packet/utils/crypto/hash";
|
||||||
import {NapProtoMsg} from "@/core/packet/proto/NapProto";
|
import { NapProtoMsg } from "@/core/packet/proto/NapProto";
|
||||||
import {OidbSvcTrpcTcpBase} from "@/core/packet/proto/oidb/OidbBase";
|
import { OidbSvcTrpcTcpBase } from "@/core/packet/proto/oidb/OidbBase";
|
||||||
import {OidbSvcTrpcTcp0X9067_202} from "@/core/packet/proto/oidb/Oidb.0x9067_202";
|
import { OidbSvcTrpcTcp0X9067_202 } from "@/core/packet/proto/oidb/Oidb.0x9067_202";
|
||||||
import {OidbSvcTrpcTcp0X8FC_2, OidbSvcTrpcTcp0X8FC_2_Body} from "@/core/packet/proto/oidb/Oidb.0x8FC_2";
|
import { OidbSvcTrpcTcp0X8FC_2, OidbSvcTrpcTcp0X8FC_2_Body } from "@/core/packet/proto/oidb/Oidb.0x8FC_2";
|
||||||
import {OidbSvcTrpcTcp0XFE1_2} from "@/core/packet/proto/oidb/Oidb.0XFE1_2";
|
import { OidbSvcTrpcTcp0XFE1_2 } from "@/core/packet/proto/oidb/Oidb.0XFE1_2";
|
||||||
import {OidbSvcTrpcTcp0XED3_1} from "@/core/packet/proto/oidb/Oidb.0xED3_1";
|
import { OidbSvcTrpcTcp0XED3_1 } from "@/core/packet/proto/oidb/Oidb.0xED3_1";
|
||||||
import {NTV2RichMediaReq} from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
import { NTV2RichMediaReq } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
||||||
import {HttpConn0x6ff_501} from "@/core/packet/proto/action/action";
|
import { HttpConn0x6ff_501 } from "@/core/packet/proto/action/action";
|
||||||
import {LongMsgResult, SendLongMsgReq} from "@/core/packet/proto/message/action";
|
import { LongMsgResult, SendLongMsgReq } from "@/core/packet/proto/message/action";
|
||||||
import {PacketMsgBuilder} from "@/core/packet/msg/builder";
|
import { PacketMsgBuilder } from "@/core/packet/msg/builder";
|
||||||
import {PacketMsgPicElement} from "@/core/packet/msg/element";
|
import { PacketMsgPicElement } from "@/core/packet/msg/element";
|
||||||
import {LogWrapper} from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
import {PacketMsg} from "@/core/packet/msg/message";
|
import { PacketMsg } from "@/core/packet/msg/message";
|
||||||
import {OidbSvcTrpcTcp0x6D6} from "@/core/packet/proto/oidb/Oidb.0x6D6";
|
import { OidbSvcTrpcTcp0x6D6 } from "@/core/packet/proto/oidb/Oidb.0x6D6";
|
||||||
import {OidbSvcTrpcTcp0XE37_1200} from "@/core/packet/proto/oidb/Oidb.0xE37_1200";
|
import { OidbSvcTrpcTcp0XE37_1200 } from "@/core/packet/proto/oidb/Oidb.0xE37_1200";
|
||||||
import {PacketMsgConverter} from "@/core/packet/msg/converter";
|
import { PacketMsgConverter } from "@/core/packet/msg/converter";
|
||||||
import {PacketClient} from "@/core/packet/client";
|
import { PacketClient } from "@/core/packet/client";
|
||||||
|
|
||||||
export type PacketHexStr = string & { readonly hexNya: unique symbol };
|
export type PacketHexStr = string & { readonly hexNya: unique symbol };
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ export class PacketPacker {
|
|||||||
packStatusPacket(uin: number): PacketHexStr {
|
packStatusPacket(uin: number): PacketHexStr {
|
||||||
const oidb_0xfe1_2 = new NapProtoMsg(OidbSvcTrpcTcp0XFE1_2).encode({
|
const oidb_0xfe1_2 = new NapProtoMsg(OidbSvcTrpcTcp0XFE1_2).encode({
|
||||||
uin: uin,
|
uin: uin,
|
||||||
key: [{key: 27372}]
|
key: [{ key: 27372 }]
|
||||||
});
|
});
|
||||||
return this.toHexStr(this.packOidbPacket(0xfe1, 2, oidb_0xfe1_2));
|
return this.toHexStr(this.packOidbPacket(0xfe1, 2, oidb_0xfe1_2));
|
||||||
}
|
}
|
||||||
@ -217,75 +217,75 @@ export class PacketPacker {
|
|||||||
noNeedCompatMsg: false,
|
noNeedCompatMsg: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
return this.toHexStr(this.packOidbPacket(0x11c4, 100, req, true, false));
|
return this.toHexStr(this.packOidbPacket(0x11c4, 100, req, true, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
async packUploadC2CImgReq(peerUin: string, img: PacketMsgPicElement): Promise<PacketHexStr> {
|
async packUploadC2CImgReq(peerUin: string, img: PacketMsgPicElement): Promise<PacketHexStr> {
|
||||||
const req = new NapProtoMsg(NTV2RichMediaReq).encode({
|
const req = new NapProtoMsg(NTV2RichMediaReq).encode({
|
||||||
reqHead: {
|
reqHead: {
|
||||||
common: {
|
common: {
|
||||||
requestId: 1,
|
requestId: 1,
|
||||||
command: 100
|
command: 100
|
||||||
|
},
|
||||||
|
scene: {
|
||||||
|
requestType: 2,
|
||||||
|
businessType: 1,
|
||||||
|
sceneType: 1,
|
||||||
|
c2C: {
|
||||||
|
accountType: 2,
|
||||||
|
targetUid: peerUin
|
||||||
},
|
},
|
||||||
scene: {
|
},
|
||||||
requestType: 2,
|
client: {
|
||||||
businessType: 1,
|
agentType: 2,
|
||||||
sceneType: 1,
|
}
|
||||||
c2C: {
|
},
|
||||||
accountType: 2,
|
upload: {
|
||||||
targetUid: peerUin
|
uploadInfo: [
|
||||||
|
{
|
||||||
|
fileInfo: {
|
||||||
|
fileSize: Number(img.size),
|
||||||
|
fileHash: img.md5,
|
||||||
|
fileSha1: this.toHexStr(await calculateSha1(img.path)),
|
||||||
|
fileName: img.name,
|
||||||
|
type: {
|
||||||
|
type: 1,
|
||||||
|
picFormat: img.picType, //TODO: extend NapCat imgType /cc @MliKiowa
|
||||||
|
videoFormat: 0,
|
||||||
|
voiceFormat: 0,
|
||||||
|
},
|
||||||
|
width: img.width,
|
||||||
|
height: img.height,
|
||||||
|
time: 0,
|
||||||
|
original: 1
|
||||||
},
|
},
|
||||||
|
subFileType: 0,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
tryFastUploadCompleted: true,
|
||||||
|
srvSendMsg: false,
|
||||||
|
clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'),
|
||||||
|
compatQMsgSceneType: 1,
|
||||||
|
extBizInfo: {
|
||||||
|
pic: {
|
||||||
|
bytesPbReserveTroop: Buffer.from("0800180020004200500062009201009a0100a2010c080012001800200028003a00", 'hex'),
|
||||||
|
textSummary: "Nya~", // TODO:
|
||||||
},
|
},
|
||||||
client: {
|
video: {
|
||||||
agentType: 2,
|
bytesPbReserve: Buffer.alloc(0),
|
||||||
|
},
|
||||||
|
ptt: {
|
||||||
|
bytesPbReserve: Buffer.alloc(0),
|
||||||
|
bytesReserve: Buffer.alloc(0),
|
||||||
|
bytesGeneralFlags: Buffer.alloc(0),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
upload: {
|
clientSeq: 0,
|
||||||
uploadInfo: [
|
noNeedCompatMsg: false,
|
||||||
{
|
|
||||||
fileInfo: {
|
|
||||||
fileSize: Number(img.size),
|
|
||||||
fileHash: img.md5,
|
|
||||||
fileSha1: this.toHexStr(await calculateSha1(img.path)),
|
|
||||||
fileName: img.name,
|
|
||||||
type: {
|
|
||||||
type: 1,
|
|
||||||
picFormat: img.picType, //TODO: extend NapCat imgType /cc @MliKiowa
|
|
||||||
videoFormat: 0,
|
|
||||||
voiceFormat: 0,
|
|
||||||
},
|
|
||||||
width: img.width,
|
|
||||||
height: img.height,
|
|
||||||
time: 0,
|
|
||||||
original: 1
|
|
||||||
},
|
|
||||||
subFileType: 0,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
tryFastUploadCompleted: true,
|
|
||||||
srvSendMsg: false,
|
|
||||||
clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'),
|
|
||||||
compatQMsgSceneType: 1,
|
|
||||||
extBizInfo: {
|
|
||||||
pic: {
|
|
||||||
bytesPbReserveTroop: Buffer.from("0800180020004200500062009201009a0100a2010c080012001800200028003a00", 'hex'),
|
|
||||||
textSummary: "Nya~", // TODO:
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
bytesPbReserve: Buffer.alloc(0),
|
|
||||||
},
|
|
||||||
ptt: {
|
|
||||||
bytesPbReserve: Buffer.alloc(0),
|
|
||||||
bytesReserve: Buffer.alloc(0),
|
|
||||||
bytesGeneralFlags: Buffer.alloc(0),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
clientSeq: 0,
|
|
||||||
noNeedCompatMsg: false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
);
|
||||||
return this.toHexStr(this.packOidbPacket(0x11c5, 100, req, true, false));
|
return this.toHexStr(this.packOidbPacket(0x11c5, 100, req, true, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ export class PacketPacker {
|
|||||||
fileId: fileUUID
|
fileId: fileUUID
|
||||||
}
|
}
|
||||||
}), true, false)
|
}), true, false)
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
packC2CFileDownloadReq(selfUid: string, fileUUID: string, fileHash: string): PacketHexStr {
|
packC2CFileDownloadReq(selfUid: string, fileUUID: string, fileHash: string): PacketHexStr {
|
||||||
@ -319,6 +319,6 @@ export class PacketPacker {
|
|||||||
field200: 1,
|
field200: 1,
|
||||||
field99999: Buffer.from([0xc0, 0x85, 0x2c, 0x01])
|
field99999: Buffer.from([0xc0, 0x85, 0x2c, 0x01])
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ScalarType } from "@protobuf-ts/runtime";
|
import { ScalarType } from "@protobuf-ts/runtime";
|
||||||
import { ProtoField } from "../NapProto";
|
import { ProtoField } from "../NapProto";
|
||||||
import {ContentHead, MessageBody, MessageControl, RoutingHead} from "@/core/packet/proto/message/message";
|
import { ContentHead, MessageBody, MessageControl, RoutingHead } from "@/core/packet/proto/message/message";
|
||||||
|
|
||||||
export const FaceRoamRequest = {
|
export const FaceRoamRequest = {
|
||||||
comm: ProtoField(1, () => PlatInfo, true),
|
comm: ProtoField(1, () => PlatInfo, true),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {ScalarType} from "@protobuf-ts/runtime";
|
import { ScalarType } from "@protobuf-ts/runtime";
|
||||||
import {ProtoField} from "../NapProto";
|
import { ProtoField } from "../NapProto";
|
||||||
import {MsgInfo, MsgInfoBody} from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
import { MsgInfo, MsgInfoBody } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
||||||
|
|
||||||
export const DataHighwayHead = {
|
export const DataHighwayHead = {
|
||||||
version: ProtoField(1, ScalarType.UINT32),
|
version: ProtoField(1, ScalarType.UINT32),
|
||||||
@ -12,7 +12,7 @@ export const DataHighwayHead = {
|
|||||||
dataFlag: ProtoField(7, ScalarType.UINT32),
|
dataFlag: ProtoField(7, ScalarType.UINT32),
|
||||||
commandId: ProtoField(8, ScalarType.UINT32),
|
commandId: ProtoField(8, ScalarType.UINT32),
|
||||||
buildVer: ProtoField(9, ScalarType.BYTES, true),
|
buildVer: ProtoField(9, ScalarType.BYTES, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const FileUploadExt = {
|
export const FileUploadExt = {
|
||||||
unknown1: ProtoField(1, ScalarType.INT32),
|
unknown1: ProtoField(1, ScalarType.INT32),
|
||||||
@ -20,7 +20,7 @@ export const FileUploadExt = {
|
|||||||
unknown3: ProtoField(3, ScalarType.INT32),
|
unknown3: ProtoField(3, ScalarType.INT32),
|
||||||
entry: ProtoField(100, () => FileUploadEntry),
|
entry: ProtoField(100, () => FileUploadEntry),
|
||||||
unknown200: ProtoField(200, ScalarType.INT32),
|
unknown200: ProtoField(200, ScalarType.INT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const FileUploadEntry = {
|
export const FileUploadEntry = {
|
||||||
busiBuff: ProtoField(100, () => ExcitingBusiInfo),
|
busiBuff: ProtoField(100, () => ExcitingBusiInfo),
|
||||||
@ -28,14 +28,14 @@ export const FileUploadEntry = {
|
|||||||
clientInfo: ProtoField(300, () => ExcitingClientInfo),
|
clientInfo: ProtoField(300, () => ExcitingClientInfo),
|
||||||
fileNameInfo: ProtoField(400, () => ExcitingFileNameInfo),
|
fileNameInfo: ProtoField(400, () => ExcitingFileNameInfo),
|
||||||
host: ProtoField(500, () => ExcitingHostConfig),
|
host: ProtoField(500, () => ExcitingHostConfig),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ExcitingBusiInfo = {
|
export const ExcitingBusiInfo = {
|
||||||
busId: ProtoField(1, ScalarType.INT32),
|
busId: ProtoField(1, ScalarType.INT32),
|
||||||
senderUin: ProtoField(100, ScalarType.UINT64),
|
senderUin: ProtoField(100, ScalarType.UINT64),
|
||||||
receiverUin: ProtoField(200, ScalarType.UINT64),
|
receiverUin: ProtoField(200, ScalarType.UINT64),
|
||||||
groupCode: ProtoField(400, ScalarType.UINT64),
|
groupCode: ProtoField(400, ScalarType.UINT64),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ExcitingFileEntry = {
|
export const ExcitingFileEntry = {
|
||||||
fileSize: ProtoField(100, ScalarType.UINT64),
|
fileSize: ProtoField(100, ScalarType.UINT64),
|
||||||
@ -44,7 +44,7 @@ export const ExcitingFileEntry = {
|
|||||||
md5S2: ProtoField(400, ScalarType.BYTES),
|
md5S2: ProtoField(400, ScalarType.BYTES),
|
||||||
fileId: ProtoField(600, ScalarType.STRING),
|
fileId: ProtoField(600, ScalarType.STRING),
|
||||||
uploadKey: ProtoField(700, ScalarType.BYTES),
|
uploadKey: ProtoField(700, ScalarType.BYTES),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ExcitingClientInfo = {
|
export const ExcitingClientInfo = {
|
||||||
clientType: ProtoField(100, ScalarType.INT32),
|
clientType: ProtoField(100, ScalarType.INT32),
|
||||||
@ -52,31 +52,31 @@ export const ExcitingClientInfo = {
|
|||||||
terminalType: ProtoField(300, ScalarType.INT32),
|
terminalType: ProtoField(300, ScalarType.INT32),
|
||||||
clientVer: ProtoField(400, ScalarType.STRING),
|
clientVer: ProtoField(400, ScalarType.STRING),
|
||||||
unknown: ProtoField(600, ScalarType.INT32),
|
unknown: ProtoField(600, ScalarType.INT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ExcitingFileNameInfo = {
|
export const ExcitingFileNameInfo = {
|
||||||
fileName: ProtoField(100, ScalarType.STRING),
|
fileName: ProtoField(100, ScalarType.STRING),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ExcitingHostConfig = {
|
export const ExcitingHostConfig = {
|
||||||
hosts: ProtoField(200, () => ExcitingHostInfo, false, true),
|
hosts: ProtoField(200, () => ExcitingHostInfo, false, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ExcitingHostInfo = {
|
export const ExcitingHostInfo = {
|
||||||
url: ProtoField(1, () => ExcitingUrlInfo),
|
url: ProtoField(1, () => ExcitingUrlInfo),
|
||||||
port: ProtoField(2, ScalarType.UINT32),
|
port: ProtoField(2, ScalarType.UINT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ExcitingUrlInfo = {
|
export const ExcitingUrlInfo = {
|
||||||
unknown: ProtoField(1, ScalarType.INT32),
|
unknown: ProtoField(1, ScalarType.INT32),
|
||||||
host: ProtoField(2, ScalarType.STRING),
|
host: ProtoField(2, ScalarType.STRING),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const LoginSigHead = {
|
export const LoginSigHead = {
|
||||||
uint32LoginSigType: ProtoField(1, ScalarType.UINT32),
|
uint32LoginSigType: ProtoField(1, ScalarType.UINT32),
|
||||||
bytesLoginSig: ProtoField(2, ScalarType.BYTES),
|
bytesLoginSig: ProtoField(2, ScalarType.BYTES),
|
||||||
appId: ProtoField(3, ScalarType.UINT32),
|
appId: ProtoField(3, ScalarType.UINT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const NTV2RichMediaHighwayExt = {
|
export const NTV2RichMediaHighwayExt = {
|
||||||
fileUuid: ProtoField(1, ScalarType.STRING),
|
fileUuid: ProtoField(1, ScalarType.STRING),
|
||||||
@ -85,25 +85,25 @@ export const NTV2RichMediaHighwayExt = {
|
|||||||
msgInfoBody: ProtoField(6, () => MsgInfoBody, false, true),
|
msgInfoBody: ProtoField(6, () => MsgInfoBody, false, true),
|
||||||
blockSize: ProtoField(10, ScalarType.UINT32),
|
blockSize: ProtoField(10, ScalarType.UINT32),
|
||||||
hash: ProtoField(11, () => NTHighwayHash),
|
hash: ProtoField(11, () => NTHighwayHash),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const NTHighwayHash = {
|
export const NTHighwayHash = {
|
||||||
fileSha1: ProtoField(1, ScalarType.BYTES, false, true),
|
fileSha1: ProtoField(1, ScalarType.BYTES, false, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const NTHighwayNetwork = {
|
export const NTHighwayNetwork = {
|
||||||
ipv4s: ProtoField(1, () => NTHighwayIPv4, false, true),
|
ipv4s: ProtoField(1, () => NTHighwayIPv4, false, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const NTHighwayIPv4 = {
|
export const NTHighwayIPv4 = {
|
||||||
domain: ProtoField(1, () => NTHighwayDomain),
|
domain: ProtoField(1, () => NTHighwayDomain),
|
||||||
port: ProtoField(2, ScalarType.UINT32),
|
port: ProtoField(2, ScalarType.UINT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const NTHighwayDomain = {
|
export const NTHighwayDomain = {
|
||||||
isEnable: ProtoField(1, ScalarType.BOOL),
|
isEnable: ProtoField(1, ScalarType.BOOL),
|
||||||
ip: ProtoField(2, ScalarType.STRING),
|
ip: ProtoField(2, ScalarType.STRING),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ReqDataHighwayHead = {
|
export const ReqDataHighwayHead = {
|
||||||
msgBaseHead: ProtoField(1, () => DataHighwayHead, true),
|
msgBaseHead: ProtoField(1, () => DataHighwayHead, true),
|
||||||
@ -111,7 +111,7 @@ export const ReqDataHighwayHead = {
|
|||||||
bytesReqExtendInfo: ProtoField(3, ScalarType.BYTES, true),
|
bytesReqExtendInfo: ProtoField(3, ScalarType.BYTES, true),
|
||||||
timestamp: ProtoField(4, ScalarType.UINT64),
|
timestamp: ProtoField(4, ScalarType.UINT64),
|
||||||
msgLoginSigHead: ProtoField(5, () => LoginSigHead, true),
|
msgLoginSigHead: ProtoField(5, () => LoginSigHead, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const RespDataHighwayHead = {
|
export const RespDataHighwayHead = {
|
||||||
msgBaseHead: ProtoField(1, () => DataHighwayHead, true),
|
msgBaseHead: ProtoField(1, () => DataHighwayHead, true),
|
||||||
@ -124,7 +124,7 @@ export const RespDataHighwayHead = {
|
|||||||
timestamp: ProtoField(8, ScalarType.UINT64),
|
timestamp: ProtoField(8, ScalarType.UINT64),
|
||||||
range: ProtoField(9, ScalarType.UINT64),
|
range: ProtoField(9, ScalarType.UINT64),
|
||||||
isReset: ProtoField(10, ScalarType.UINT32),
|
isReset: ProtoField(10, ScalarType.UINT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const SegHead = {
|
export const SegHead = {
|
||||||
serviceId: ProtoField(1, ScalarType.UINT32, true),
|
serviceId: ProtoField(1, ScalarType.UINT32, true),
|
||||||
@ -140,7 +140,7 @@ export const SegHead = {
|
|||||||
queryTimes: ProtoField(11, ScalarType.UINT32),
|
queryTimes: ProtoField(11, ScalarType.UINT32),
|
||||||
updateCacheIp: ProtoField(12, ScalarType.UINT32),
|
updateCacheIp: ProtoField(12, ScalarType.UINT32),
|
||||||
cachePort: ProtoField(13, ScalarType.UINT32, true),
|
cachePort: ProtoField(13, ScalarType.UINT32, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const GroupAvatarExtra = {
|
export const GroupAvatarExtra = {
|
||||||
type: ProtoField(1, ScalarType.UINT32),
|
type: ProtoField(1, ScalarType.UINT32),
|
||||||
@ -148,8 +148,8 @@ export const GroupAvatarExtra = {
|
|||||||
field3: ProtoField(3, () => GroupAvatarExtraField3),
|
field3: ProtoField(3, () => GroupAvatarExtraField3),
|
||||||
field5: ProtoField(5, ScalarType.UINT32),
|
field5: ProtoField(5, ScalarType.UINT32),
|
||||||
field6: ProtoField(6, ScalarType.UINT32),
|
field6: ProtoField(6, ScalarType.UINT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const GroupAvatarExtraField3 = {
|
export const GroupAvatarExtraField3 = {
|
||||||
field1: ProtoField(1, ScalarType.UINT32),
|
field1: ProtoField(1, ScalarType.UINT32),
|
||||||
}
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {ScalarType} from "@protobuf-ts/runtime";
|
import { ScalarType } from "@protobuf-ts/runtime";
|
||||||
import {ProtoField} from "../NapProto";
|
import { ProtoField } from "../NapProto";
|
||||||
|
|
||||||
export const Elem = {
|
export const Elem = {
|
||||||
text: ProtoField(1, () => Text, true),
|
text: ProtoField(1, () => Text, true),
|
||||||
@ -118,7 +118,7 @@ export const MarketFace = {
|
|||||||
|
|
||||||
export const MarketFacePbRes = {
|
export const MarketFacePbRes = {
|
||||||
field8: ProtoField(8, ScalarType.INT32)
|
field8: ProtoField(8, ScalarType.INT32)
|
||||||
}
|
};
|
||||||
|
|
||||||
export const CustomFace = {
|
export const CustomFace = {
|
||||||
guid: ProtoField(1, ScalarType.BYTES),
|
guid: ProtoField(1, ScalarType.BYTES),
|
||||||
@ -315,7 +315,7 @@ export const SrcMsgPbRes = {
|
|||||||
senderUid: ProtoField(6, ScalarType.STRING, true),
|
senderUid: ProtoField(6, ScalarType.STRING, true),
|
||||||
receiverUid: ProtoField(7, ScalarType.STRING, true),
|
receiverUid: ProtoField(7, ScalarType.STRING, true),
|
||||||
friendSeq: ProtoField(8, ScalarType.UINT32, true),
|
friendSeq: ProtoField(8, ScalarType.UINT32, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const LightAppElem = {
|
export const LightAppElem = {
|
||||||
data: ProtoField(1, ScalarType.BYTES),
|
data: ProtoField(1, ScalarType.BYTES),
|
||||||
@ -358,4 +358,4 @@ export const QSmallFaceExtra = {
|
|||||||
|
|
||||||
export const MarkdownData = {
|
export const MarkdownData = {
|
||||||
content: ProtoField(1, ScalarType.STRING)
|
content: ProtoField(1, ScalarType.STRING)
|
||||||
}
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {ScalarType} from "@protobuf-ts/runtime";
|
import { ScalarType } from "@protobuf-ts/runtime";
|
||||||
import {ProtoField} from "../../NapProto";
|
import { ProtoField } from "../../NapProto";
|
||||||
|
|
||||||
export const NTV2RichMediaReq = {
|
export const NTV2RichMediaReq = {
|
||||||
ReqHead: ProtoField(1, () => MultiMediaReqHead),
|
ReqHead: ProtoField(1, () => MultiMediaReqHead),
|
||||||
@ -160,7 +160,7 @@ export const PicUrlExtInfo = {
|
|||||||
|
|
||||||
export const VideoExtInfo = {
|
export const VideoExtInfo = {
|
||||||
VideoCodecFormat: ProtoField(1, ScalarType.UINT32),
|
VideoCodecFormat: ProtoField(1, ScalarType.UINT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ExtBizInfo = {
|
export const ExtBizInfo = {
|
||||||
Pic: ProtoField(1, () => PicExtBizInfo),
|
Pic: ProtoField(1, () => PicExtBizInfo),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {ScalarType} from "@protobuf-ts/runtime";
|
import { ScalarType } from "@protobuf-ts/runtime";
|
||||||
import {ProtoField} from "../../NapProto";
|
import { ProtoField } from "../../NapProto";
|
||||||
import {CommonHead, MsgInfo, PicUrlExtInfo, VideoExtInfo} from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
import { CommonHead, MsgInfo, PicUrlExtInfo, VideoExtInfo } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
||||||
|
|
||||||
export const NTV2RichMediaResp = {
|
export const NTV2RichMediaResp = {
|
||||||
respHead: ProtoField(1, () => MultiMediaRespHead),
|
respHead: ProtoField(1, () => MultiMediaRespHead),
|
||||||
@ -13,20 +13,20 @@ export const NTV2RichMediaResp = {
|
|||||||
uploadKeyRenewal: ProtoField(8, () => UploadKeyRenewalResp),
|
uploadKeyRenewal: ProtoField(8, () => UploadKeyRenewalResp),
|
||||||
downloadSafe: ProtoField(9, () => DownloadSafeResp),
|
downloadSafe: ProtoField(9, () => DownloadSafeResp),
|
||||||
extension: ProtoField(99, ScalarType.BYTES, true),
|
extension: ProtoField(99, ScalarType.BYTES, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const MultiMediaRespHead = {
|
export const MultiMediaRespHead = {
|
||||||
common: ProtoField(1, () => CommonHead),
|
common: ProtoField(1, () => CommonHead),
|
||||||
retCode: ProtoField(2, ScalarType.UINT32),
|
retCode: ProtoField(2, ScalarType.UINT32),
|
||||||
message: ProtoField(3, ScalarType.STRING),
|
message: ProtoField(3, ScalarType.STRING),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const DownloadResp = {
|
export const DownloadResp = {
|
||||||
rKeyParam: ProtoField(1, ScalarType.STRING),
|
rKeyParam: ProtoField(1, ScalarType.STRING),
|
||||||
rKeyTtlSecond: ProtoField(2, ScalarType.UINT32),
|
rKeyTtlSecond: ProtoField(2, ScalarType.UINT32),
|
||||||
info: ProtoField(3, () => DownloadInfo),
|
info: ProtoField(3, () => DownloadInfo),
|
||||||
rKeyCreateTime: ProtoField(4, ScalarType.UINT32),
|
rKeyCreateTime: ProtoField(4, ScalarType.UINT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const DownloadInfo = {
|
export const DownloadInfo = {
|
||||||
domain: ProtoField(1, ScalarType.STRING),
|
domain: ProtoField(1, ScalarType.STRING),
|
||||||
@ -36,7 +36,7 @@ export const DownloadInfo = {
|
|||||||
ipv6s: ProtoField(5, () => IPv6, false, true),
|
ipv6s: ProtoField(5, () => IPv6, false, true),
|
||||||
picUrlExtInfo: ProtoField(6, () => PicUrlExtInfo),
|
picUrlExtInfo: ProtoField(6, () => PicUrlExtInfo),
|
||||||
videoExtInfo: ProtoField(7, () => VideoExtInfo),
|
videoExtInfo: ProtoField(7, () => VideoExtInfo),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const IPv4 = {
|
export const IPv4 = {
|
||||||
outIP: ProtoField(1, ScalarType.UINT32),
|
outIP: ProtoField(1, ScalarType.UINT32),
|
||||||
@ -44,7 +44,7 @@ export const IPv4 = {
|
|||||||
inIP: ProtoField(3, ScalarType.UINT32),
|
inIP: ProtoField(3, ScalarType.UINT32),
|
||||||
inPort: ProtoField(4, ScalarType.UINT32),
|
inPort: ProtoField(4, ScalarType.UINT32),
|
||||||
ipType: ProtoField(5, ScalarType.UINT32),
|
ipType: ProtoField(5, ScalarType.UINT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const IPv6 = {
|
export const IPv6 = {
|
||||||
outIP: ProtoField(1, ScalarType.BYTES),
|
outIP: ProtoField(1, ScalarType.BYTES),
|
||||||
@ -52,7 +52,7 @@ export const IPv6 = {
|
|||||||
inIP: ProtoField(3, ScalarType.BYTES),
|
inIP: ProtoField(3, ScalarType.BYTES),
|
||||||
inPort: ProtoField(4, ScalarType.UINT32),
|
inPort: ProtoField(4, ScalarType.UINT32),
|
||||||
ipType: ProtoField(5, ScalarType.UINT32),
|
ipType: ProtoField(5, ScalarType.UINT32),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const UploadResp = {
|
export const UploadResp = {
|
||||||
uKey: ProtoField(1, ScalarType.STRING, true),
|
uKey: ProtoField(1, ScalarType.STRING, true),
|
||||||
@ -64,13 +64,13 @@ export const UploadResp = {
|
|||||||
ext: ProtoField(7, () => RichMediaStorageTransInfo, false, true),
|
ext: ProtoField(7, () => RichMediaStorageTransInfo, false, true),
|
||||||
compatQMsg: ProtoField(8, ScalarType.BYTES),
|
compatQMsg: ProtoField(8, ScalarType.BYTES),
|
||||||
subFileInfos: ProtoField(10, () => SubFileInfo, false, true),
|
subFileInfos: ProtoField(10, () => SubFileInfo, false, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const RichMediaStorageTransInfo = {
|
export const RichMediaStorageTransInfo = {
|
||||||
subType: ProtoField(1, ScalarType.UINT32),
|
subType: ProtoField(1, ScalarType.UINT32),
|
||||||
extType: ProtoField(2, ScalarType.UINT32),
|
extType: ProtoField(2, ScalarType.UINT32),
|
||||||
extValue: ProtoField(3, ScalarType.BYTES),
|
extValue: ProtoField(3, ScalarType.BYTES),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const SubFileInfo = {
|
export const SubFileInfo = {
|
||||||
subType: ProtoField(1, ScalarType.UINT32),
|
subType: ProtoField(1, ScalarType.UINT32),
|
||||||
@ -78,32 +78,32 @@ export const SubFileInfo = {
|
|||||||
uKeyTtlSecond: ProtoField(3, ScalarType.UINT32),
|
uKeyTtlSecond: ProtoField(3, ScalarType.UINT32),
|
||||||
ipv4s: ProtoField(4, () => IPv4, false, true),
|
ipv4s: ProtoField(4, () => IPv4, false, true),
|
||||||
ipv6s: ProtoField(5, () => IPv6, false, true),
|
ipv6s: ProtoField(5, () => IPv6, false, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const DownloadSafeResp = {
|
export const DownloadSafeResp = {
|
||||||
}
|
};
|
||||||
|
|
||||||
export const UploadKeyRenewalResp = {
|
export const UploadKeyRenewalResp = {
|
||||||
ukey: ProtoField(1, ScalarType.STRING),
|
ukey: ProtoField(1, ScalarType.STRING),
|
||||||
ukeyTtlSec: ProtoField(2, ScalarType.UINT64),
|
ukeyTtlSec: ProtoField(2, ScalarType.UINT64),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const MsgInfoAuthResp = {
|
export const MsgInfoAuthResp = {
|
||||||
authCode: ProtoField(1, ScalarType.UINT32),
|
authCode: ProtoField(1, ScalarType.UINT32),
|
||||||
msg: ProtoField(2, ScalarType.BYTES),
|
msg: ProtoField(2, ScalarType.BYTES),
|
||||||
resultTime: ProtoField(3, ScalarType.UINT64),
|
resultTime: ProtoField(3, ScalarType.UINT64),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const UploadCompletedResp = {
|
export const UploadCompletedResp = {
|
||||||
msgSeq: ProtoField(1, ScalarType.UINT64),
|
msgSeq: ProtoField(1, ScalarType.UINT64),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const DeleteResp = {
|
export const DeleteResp = {
|
||||||
}
|
};
|
||||||
|
|
||||||
export const DownloadRKeyResp = {
|
export const DownloadRKeyResp = {
|
||||||
rKeys: ProtoField(1, () => RKeyInfo, false, true),
|
rKeys: ProtoField(1, () => RKeyInfo, false, true),
|
||||||
}
|
};
|
||||||
|
|
||||||
export const RKeyInfo = {
|
export const RKeyInfo = {
|
||||||
rkey: ProtoField(1, ScalarType.STRING),
|
rkey: ProtoField(1, ScalarType.STRING),
|
||||||
@ -111,4 +111,4 @@ export const RKeyInfo = {
|
|||||||
storeId: ProtoField(3, ScalarType.UINT32),
|
storeId: ProtoField(3, ScalarType.UINT32),
|
||||||
rkeyCreateTime: ProtoField(4, ScalarType.UINT32, true),
|
rkeyCreateTime: ProtoField(4, ScalarType.UINT32, true),
|
||||||
type: ProtoField(5, ScalarType.UINT32, true),
|
type: ProtoField(5, ScalarType.UINT32, true),
|
||||||
}
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { PacketClient } from "@/core/packet/client";
|
import { PacketClient } from "@/core/packet/client";
|
||||||
import { PacketHighwaySession } from "@/core/packet/highway/session";
|
import { PacketHighwaySession } from "@/core/packet/highway/session";
|
||||||
import { LogWrapper } from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
import {PacketPacker} from "@/core/packet/packer";
|
import { PacketPacker } from "@/core/packet/packer";
|
||||||
|
|
||||||
export class PacketSession {
|
export class PacketSession {
|
||||||
readonly logger: LogWrapper;
|
readonly logger: LogWrapper;
|
||||||
|
@ -76,7 +76,7 @@ export function decrypt(encrypted: Buffer, key: Buffer) {
|
|||||||
encrypted.writeInt32BE(r1, i);
|
encrypted.writeInt32BE(r1, i);
|
||||||
encrypted.writeInt32BE(r2, i + 4);
|
encrypted.writeInt32BE(r2, i + 4);
|
||||||
}
|
}
|
||||||
if (Buffer.compare(encrypted.subarray(encrypted.length - 7), BUF7) !== 0) throw ERROR_ENCRYPTED_ILLEGAL
|
if (Buffer.compare(encrypted.subarray(encrypted.length - 7), BUF7) !== 0) throw ERROR_ENCRYPTED_ILLEGAL;
|
||||||
// if (Buffer.compare(encrypted.slice(encrypted.length - 7), BUF7) !== 0) throw ERROR_ENCRYPTED_ILLEGAL;
|
// if (Buffer.compare(encrypted.slice(encrypted.length - 7), BUF7) !== 0) throw ERROR_ENCRYPTED_ILLEGAL;
|
||||||
return encrypted.subarray((encrypted[0] & 0x07) + 3, encrypted.length - 7);
|
return encrypted.subarray((encrypted[0] & 0x07) + 3, encrypted.length - 7);
|
||||||
// return encrypted.slice((encrypted[0] & 0x07) + 3, encrypted.length - 7);
|
// return encrypted.slice((encrypted[0] & 0x07) + 3, encrypted.length - 7);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import {GetPacketStatusDepends} from "@/onebot/action/packet/GetPacketStatus";
|
import { GetPacketStatusDepends } from "@/onebot/action/packet/GetPacketStatus";
|
||||||
// no_cache get时传字符串
|
// no_cache get时传字符串
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@ -27,7 +27,7 @@ export class GetGroupFileUrl extends GetPacketStatusDepends<Payload, GetGroupFil
|
|||||||
if (contextMsgFile?.fileUUID) {
|
if (contextMsgFile?.fileUUID) {
|
||||||
return {
|
return {
|
||||||
url: await this.core.apis.PacketApi.sendGroupFileDownloadReq(+payload.group_id, contextMsgFile.fileUUID)
|
url: await this.core.apis.PacketApi.sendGroupFileDownloadReq(+payload.group_id, contextMsgFile.fileUUID)
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
throw new Error('real fileUUID not found!');
|
throw new Error('real fileUUID not found!');
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageForward, OB11MessageNodePlain as OB11MessageNode} from '@/onebot';
|
import { OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageForward, OB11MessageNodePlain as OB11MessageNode } from '@/onebot';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import {GetPacketStatusDepends} from "@/onebot/action/packet/GetPacketStatus";
|
import { GetPacketStatusDepends } from "@/onebot/action/packet/GetPacketStatus";
|
||||||
// no_cache get时传字符串
|
// no_cache get时传字符串
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@ -90,8 +90,8 @@ import { SetSpecialTittle } from './extends/SetSpecialTittle';
|
|||||||
import { GetGroupShutList } from './group/GetGroupShutList';
|
import { GetGroupShutList } from './group/GetGroupShutList';
|
||||||
import { GetGroupMemberList } from './group/GetGroupMemberList';
|
import { GetGroupMemberList } from './group/GetGroupMemberList';
|
||||||
import { GetGroupFileUrl } from "@/onebot/action/file/GetGroupFileUrl";
|
import { GetGroupFileUrl } from "@/onebot/action/file/GetGroupFileUrl";
|
||||||
import {GetPacketStatus} from "@/onebot/action/packet/GetPacketStatus";
|
import { GetPacketStatus } from "@/onebot/action/packet/GetPacketStatus";
|
||||||
import {FriendPoke} from "@/onebot/action/user/FriendPoke";
|
import { FriendPoke } from "@/onebot/action/user/FriendPoke";
|
||||||
|
|
||||||
|
|
||||||
export type ActionMap = Map<string, BaseAction<any, any>>;
|
export type ActionMap = Map<string, BaseAction<any, any>>;
|
||||||
|
@ -6,14 +6,14 @@ import {
|
|||||||
OB11PostContext,
|
OB11PostContext,
|
||||||
OB11PostSendMsg,
|
OB11PostSendMsg,
|
||||||
} from '@/onebot/types';
|
} from '@/onebot/types';
|
||||||
import {ActionName, BaseCheckResult} from '@/onebot/action/types';
|
import { ActionName, BaseCheckResult } from '@/onebot/action/types';
|
||||||
import {decodeCQCode} from '@/onebot/cqcode';
|
import { decodeCQCode } from '@/onebot/cqcode';
|
||||||
import {MessageUnique} from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import {ChatType, ElementType, NapCatCore, Peer, RawMessage, SendArkElement, SendMessageElement} from '@/core';
|
import { ChatType, ElementType, NapCatCore, Peer, RawMessage, SendArkElement, SendMessageElement } from '@/core';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import {rawMsgWithSendMsg} from "@/core/packet/msg/converter";
|
import { rawMsgWithSendMsg } from "@/core/packet/msg/converter";
|
||||||
import {PacketMsg} from "@/core/packet/msg/message";
|
import { PacketMsg } from "@/core/packet/msg/message";
|
||||||
import {ForwardMsgBuilder} from "@/common/forward-msg-builder";
|
import { ForwardMsgBuilder } from "@/common/forward-msg-builder";
|
||||||
|
|
||||||
export interface ReturnDataType {
|
export interface ReturnDataType {
|
||||||
message_id: number;
|
message_id: number;
|
||||||
@ -30,7 +30,7 @@ export enum ContextMode {
|
|||||||
export function normalize(message: OB11MessageMixType, autoEscape = false): OB11MessageData[] {
|
export function normalize(message: OB11MessageMixType, autoEscape = false): OB11MessageData[] {
|
||||||
return typeof message === 'string' ? (
|
return typeof message === 'string' ? (
|
||||||
autoEscape ?
|
autoEscape ?
|
||||||
[{type: OB11MessageDataType.text, data: {text: message}}] :
|
[{ type: OB11MessageDataType.text, data: { text: message } }] :
|
||||||
decodeCQCode(message)
|
decodeCQCode(message)
|
||||||
) : Array.isArray(message) ? message : [message];
|
) : Array.isArray(message) ? message : [message];
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
message: '转发消息不能和普通消息混在一起发送,转发需要保证message只有type为node的元素',
|
message: '转发消息不能和普通消息混在一起发送,转发需要保证message只有type为node的元素',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {valid: true};
|
return { valid: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
async _handle(payload: OB11PostSendMsg): Promise<ReturnDataType> {
|
async _handle(payload: OB11PostSendMsg): Promise<ReturnDataType> {
|
||||||
@ -115,7 +115,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (getSpecialMsgNum(payload, OB11MessageDataType.node)) {
|
if (getSpecialMsgNum(payload, OB11MessageDataType.node)) {
|
||||||
const packetMode = this.core.apis.PacketApi.available
|
const packetMode = this.core.apis.PacketApi.available;
|
||||||
const returnMsgAndResId = packetMode
|
const returnMsgAndResId = packetMode
|
||||||
? await this.handleForwardedNodesPacket(peer, messages as OB11MessageNode[])
|
? await this.handleForwardedNodesPacket(peer, messages as OB11MessageNode[])
|
||||||
: await this.handleForwardedNodes(peer, messages as OB11MessageNode[]);
|
: await this.handleForwardedNodes(peer, messages as OB11MessageNode[]);
|
||||||
@ -125,7 +125,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
peerUid: peer.peerUid,
|
peerUid: peer.peerUid,
|
||||||
chatType: peer.chatType,
|
chatType: peer.chatType,
|
||||||
}, (returnMsgAndResId.message)!.msgId);
|
}, (returnMsgAndResId.message)!.msgId);
|
||||||
return {message_id: msgShortId!, res_id: returnMsgAndResId.res_id};
|
return { message_id: msgShortId!, res_id: returnMsgAndResId.res_id };
|
||||||
} else if (returnMsgAndResId.res_id && !returnMsgAndResId.message) {
|
} else if (returnMsgAndResId.res_id && !returnMsgAndResId.message) {
|
||||||
throw Error(`发送转发消息(res_id:${returnMsgAndResId.res_id} 失败`);
|
throw Error(`发送转发消息(res_id:${returnMsgAndResId.res_id} 失败`);
|
||||||
}
|
}
|
||||||
@ -139,10 +139,10 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
}
|
}
|
||||||
// log("send msg:", peer, sendElements)
|
// log("send msg:", peer, sendElements)
|
||||||
|
|
||||||
const {sendElements, deleteAfterSentFiles} = await this.obContext.apis.MsgApi
|
const { sendElements, deleteAfterSentFiles } = await this.obContext.apis.MsgApi
|
||||||
.createSendElements(messages, peer);
|
.createSendElements(messages, peer);
|
||||||
const returnMsg = await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(peer, sendElements, deleteAfterSentFiles);
|
const returnMsg = await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(peer, sendElements, deleteAfterSentFiles);
|
||||||
return {message_id: returnMsg!.id!};
|
return { message_id: returnMsg!.id! };
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: recursively handle forwarded nodes
|
// TODO: recursively handle forwarded nodes
|
||||||
@ -155,14 +155,14 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
for (const node of messageNodes) {
|
for (const node of messageNodes) {
|
||||||
if ((node.data.id && typeof node.data.content !== "string") || !node.data.id) {
|
if ((node.data.id && typeof node.data.content !== "string") || !node.data.id) {
|
||||||
const OB11Data = normalize(node.data.content);
|
const OB11Data = normalize(node.data.content);
|
||||||
const {sendElements} = await this.obContext.apis.MsgApi.createSendElements(OB11Data, msgPeer);
|
const { sendElements } = await this.obContext.apis.MsgApi.createSendElements(OB11Data, msgPeer);
|
||||||
const packetMsgElements: rawMsgWithSendMsg = {
|
const packetMsgElements: rawMsgWithSendMsg = {
|
||||||
senderUin: node.data.user_id ?? +this.core.selfInfo.uin,
|
senderUin: node.data.user_id ?? +this.core.selfInfo.uin,
|
||||||
senderName: node.data.nickname,
|
senderName: node.data.nickname,
|
||||||
groupId: msgPeer.chatType === ChatType.KCHATTYPEGROUP ? +msgPeer.peerUid : undefined,
|
groupId: msgPeer.chatType === ChatType.KCHATTYPEGROUP ? +msgPeer.peerUid : undefined,
|
||||||
time: Date.now(),
|
time: Date.now(),
|
||||||
msg: sendElements,
|
msg: sendElements,
|
||||||
}
|
};
|
||||||
logger.logDebug(`handleForwardedNodesPacket 开始转换 ${JSON.stringify(packetMsgElements)}`);
|
logger.logDebug(`handleForwardedNodesPacket 开始转换 ${JSON.stringify(packetMsgElements)}`);
|
||||||
const transformedMsg = this.core.apis.PacketApi.packetSession?.packer.packetConverter.rawMsgWithSendMsgToPacketMsg(packetMsgElements);
|
const transformedMsg = this.core.apis.PacketApi.packetSession?.packer.packetConverter.rawMsgWithSendMsgToPacketMsg(packetMsgElements);
|
||||||
logger.logDebug(`handleForwardedNodesPacket 转换为 ${JSON.stringify(transformedMsg)}`);
|
logger.logDebug(`handleForwardedNodesPacket 转换为 ${JSON.stringify(transformedMsg)}`);
|
||||||
@ -179,14 +179,14 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
arkElement: {
|
arkElement: {
|
||||||
bytesData: JSON.stringify(forwardJson),
|
bytesData: JSON.stringify(forwardJson),
|
||||||
},
|
},
|
||||||
} as SendArkElement
|
} as SendArkElement;
|
||||||
let returnMsg: RawMessage | undefined;
|
let returnMsg: RawMessage | undefined;
|
||||||
try {
|
try {
|
||||||
returnMsg = await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(msgPeer, [finallySendElements], [], true).catch(_ => undefined)
|
returnMsg = await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(msgPeer, [finallySendElements], [], true).catch(_ => undefined);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.logWarn("发送伪造合并转发消息失败!", e);
|
logger.logWarn("发送伪造合并转发消息失败!", e);
|
||||||
}
|
}
|
||||||
return {message: returnMsg ?? null, res_id: resid};
|
return { message: returnMsg ?? null, res_id: resid };
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleForwardedNodes(destPeer: Peer, messageNodes: OB11MessageNode[]): Promise<{
|
private async handleForwardedNodes(destPeer: Peer, messageNodes: OB11MessageNode[]): Promise<{
|
||||||
@ -228,7 +228,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
//完成子卡片生成跳过后续
|
//完成子卡片生成跳过后续
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const {sendElements} = await this.obContext.apis.MsgApi
|
const { sendElements } = await this.obContext.apis.MsgApi
|
||||||
.createSendElements(OB11Data, destPeer);
|
.createSendElements(OB11Data, destPeer);
|
||||||
|
|
||||||
//拆分消息
|
//拆分消息
|
||||||
@ -269,7 +269,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const nodeMsg = (await this.core.apis.MsgApi.getMsgsByMsgId(nodeMsgPeer.Peer, [msgId])).msgList[0];
|
const nodeMsg = (await this.core.apis.MsgApi.getMsgsByMsgId(nodeMsgPeer.Peer, [msgId])).msgList[0];
|
||||||
srcPeer = srcPeer ?? {chatType: nodeMsg.chatType, peerUid: nodeMsg.peerUid};
|
srcPeer = srcPeer ?? { chatType: nodeMsg.chatType, peerUid: nodeMsg.peerUid };
|
||||||
if (srcPeer.peerUid !== nodeMsg.peerUid) {
|
if (srcPeer.peerUid !== nodeMsg.peerUid) {
|
||||||
needSendSelf = true;
|
needSendSelf = true;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import {ActionName, BaseCheckResult} from '../types';
|
import { ActionName, BaseCheckResult } from '../types';
|
||||||
|
|
||||||
|
|
||||||
export abstract class GetPacketStatusDepends<PT, RT> extends BaseAction<PT, RT> {
|
export abstract class GetPacketStatusDepends<PT, RT> extends BaseAction<PT, RT> {
|
||||||
@ -10,16 +10,16 @@ export abstract class GetPacketStatusDepends<PT, RT> extends BaseAction<PT, RT>
|
|||||||
return {
|
return {
|
||||||
valid: false,
|
valid: false,
|
||||||
message: "packetServer不可用,请参照文档 https://napneko.github.io/config/advanced 检查packetServer状态或进行配置!",
|
message: "packetServer不可用,请参照文档 https://napneko.github.io/config/advanced 检查packetServer状态或进行配置!",
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
valid: true,
|
valid: true,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPacketStatus extends GetPacketStatusDepends<any, null> {
|
export class GetPacketStatus extends GetPacketStatusDepends<any, null> {
|
||||||
async _handle(payload: any) {
|
async _handle(payload: any) {
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import {GetPacketStatusDepends} from "@/onebot/action/packet/GetPacketStatus";
|
import { GetPacketStatusDepends } from "@/onebot/action/packet/GetPacketStatus";
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@ -26,16 +26,16 @@ import {
|
|||||||
OB11MessageFileBase,
|
OB11MessageFileBase,
|
||||||
OB11MessageForward,
|
OB11MessageForward,
|
||||||
} from '@/onebot';
|
} from '@/onebot';
|
||||||
import {OB11Entities} from '@/onebot/entities';
|
import { OB11Entities } from '@/onebot/entities';
|
||||||
import {EventType} from '@/onebot/event/OB11BaseEvent';
|
import { EventType } from '@/onebot/event/OB11BaseEvent';
|
||||||
import {encodeCQCode} from '@/onebot/cqcode';
|
import { encodeCQCode } from '@/onebot/cqcode';
|
||||||
import {uri2local} from '@/common/file';
|
import { uri2local } from '@/common/file';
|
||||||
import {RequestUtil} from '@/common/request';
|
import { RequestUtil } from '@/common/request';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import fsPromise from 'node:fs/promises';
|
import fsPromise from 'node:fs/promises';
|
||||||
import {OB11FriendAddNoticeEvent} from '@/onebot/event/notice/OB11FriendAddNoticeEvent';
|
import { OB11FriendAddNoticeEvent } from '@/onebot/event/notice/OB11FriendAddNoticeEvent';
|
||||||
import {decodeSysMessage} from '@/core/packet/proto/old/ProfileLike';
|
import { decodeSysMessage } from '@/core/packet/proto/old/ProfileLike';
|
||||||
import {ForwardMsgBuilder} from "@/common/forward-msg-builder";
|
import { ForwardMsgBuilder } from "@/common/forward-msg-builder";
|
||||||
|
|
||||||
type RawToOb11Converters = {
|
type RawToOb11Converters = {
|
||||||
[Key in keyof MessageElement as Key extends `${string}Element` ? Key : never]: (
|
[Key in keyof MessageElement as Key extends `${string}Element` ? Key : never]: (
|
||||||
@ -602,7 +602,7 @@ export class OneBotMsgApi {
|
|||||||
[OB11MessageDataType.node]: async () => undefined,
|
[OB11MessageDataType.node]: async () => undefined,
|
||||||
|
|
||||||
[OB11MessageDataType.forward]: async ({ data }, context) => {
|
[OB11MessageDataType.forward]: async ({ data }, context) => {
|
||||||
const jsonData = ForwardMsgBuilder.fromResId(data.id)
|
const jsonData = ForwardMsgBuilder.fromResId(data.id);
|
||||||
return this.ob11ToRawConverters.json({
|
return this.ob11ToRawConverters.json({
|
||||||
data: { data: JSON.stringify(jsonData) },
|
data: { data: JSON.stringify(jsonData) },
|
||||||
type: OB11MessageDataType.json
|
type: OB11MessageDataType.json
|
||||||
|
@ -305,8 +305,8 @@ export class NapCatOneBot11Adapter {
|
|||||||
m.msgId,
|
m.msgId,
|
||||||
);
|
);
|
||||||
// if (m.sourceType == MsgSourceType.K_DOWN_SOURCETYPE_AIOINNER) {
|
// if (m.sourceType == MsgSourceType.K_DOWN_SOURCETYPE_AIOINNER) {
|
||||||
await this.emitMsg(m)
|
await this.emitMsg(m)
|
||||||
.catch(e => this.context.logger.logError.bind(this.context.logger)('处理消息失败', e));
|
.catch(e => this.context.logger.logError.bind(this.context.logger)('处理消息失败', e));
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user