mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
style: lint
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { encode } from "silk-wasm";
|
import { encode } from 'silk-wasm';
|
||||||
|
|
||||||
export interface EncodeArgs {
|
export interface EncodeArgs {
|
||||||
input: ArrayBufferView | ArrayBuffer
|
input: ArrayBufferView | ArrayBuffer
|
||||||
|
@@ -4,8 +4,8 @@ import path from 'node:path';
|
|||||||
import { randomUUID } from 'crypto';
|
import { randomUUID } from 'crypto';
|
||||||
import { EncodeResult, getDuration, getWavFileInfo, isSilk, isWav } from 'silk-wasm';
|
import { EncodeResult, getDuration, getWavFileInfo, isSilk, isWav } from 'silk-wasm';
|
||||||
import { LogWrapper } from '@/common/log';
|
import { LogWrapper } from '@/common/log';
|
||||||
import { EncodeArgs } from "@/common/audio-worker";
|
import { EncodeArgs } from '@/common/audio-worker';
|
||||||
import { FFmpegService } from "@/common/ffmpeg";
|
import { FFmpegService } from '@/common/ffmpeg';
|
||||||
|
|
||||||
const ALLOW_SAMPLE_RATE = [8000, 12000, 16000, 24000, 32000, 44100, 48000];
|
const ALLOW_SAMPLE_RATE = [8000, 12000, 16000, 24000, 32000, 44100, 48000];
|
||||||
|
|
||||||
|
@@ -39,9 +39,9 @@ export abstract class ConfigBase<T> {
|
|||||||
if (!fs.existsSync(configPath) && copy_default) {
|
if (!fs.existsSync(configPath) && copy_default) {
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(configPath, fs.readFileSync(this.getConfigPath(undefined), 'utf-8'));
|
fs.writeFileSync(configPath, fs.readFileSync(this.getConfigPath(undefined), 'utf-8'));
|
||||||
this.core.context.logger.log(`[Core] [Config] 配置文件创建成功!\n`);
|
this.core.context.logger.log('[Core] [Config] 配置文件创建成功!\n');
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
this.core.context.logger.logError(`[Core] [Config] 创建配置文件时发生错误:`, e.message);
|
this.core.context.logger.logError('[Core] [Config] 创建配置文件时发生错误:', e.message);
|
||||||
}
|
}
|
||||||
} else if (!fs.existsSync(configPath) && !copy_default) {
|
} else if (!fs.existsSync(configPath) && !copy_default) {
|
||||||
fs.writeFileSync(configPath, '{}');
|
fs.writeFileSync(configPath, '{}');
|
||||||
@@ -52,9 +52,9 @@ export abstract class ConfigBase<T> {
|
|||||||
return this.configData;
|
return this.configData;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
if (e instanceof SyntaxError) {
|
if (e instanceof SyntaxError) {
|
||||||
this.core.context.logger.logError(`[Core] [Config] 配置文件格式错误,请检查配置文件:`, e.message);
|
this.core.context.logger.logError('[Core] [Config] 配置文件格式错误,请检查配置文件:', e.message);
|
||||||
} else {
|
} else {
|
||||||
this.core.context.logger.logError(`[Core] [Config] 读取配置文件时发生错误:`, e.message);
|
this.core.context.logger.logError('[Core] [Config] 读取配置文件时发生错误:', e.message);
|
||||||
}
|
}
|
||||||
return {} as T;
|
return {} as T;
|
||||||
}
|
}
|
||||||
|
@@ -209,8 +209,8 @@ export class NTEventWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ListenerNameList = listenerAndMethod.split('/');
|
const ListenerNameList = listenerAndMethod.split('/');
|
||||||
const ListenerMainName = ListenerNameList[0]??"";
|
const ListenerMainName = ListenerNameList[0]??'';
|
||||||
const ListenerSubName = ListenerNameList[1]??"";
|
const ListenerSubName = ListenerNameList[1]??'';
|
||||||
|
|
||||||
return new Promise<[EventRet: Awaited<ReturnType<EventType>>, ...Parameters<ListenerType>]>(
|
return new Promise<[EventRet: Awaited<ReturnType<EventType>>, ...Parameters<ListenerType>]>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
|
@@ -108,9 +108,9 @@ class FFmpegService {
|
|||||||
const message = msg.join(' ');
|
const message = msg.join(' ');
|
||||||
const durationMatch = message.match(/Duration: (\d+):(\d+):(\d+\.\d+)/);
|
const durationMatch = message.match(/Duration: (\d+):(\d+):(\d+\.\d+)/);
|
||||||
if (durationMatch) {
|
if (durationMatch) {
|
||||||
const hours = parseInt(durationMatch[1] ?? "0", 10);
|
const hours = parseInt(durationMatch[1] ?? '0', 10);
|
||||||
const minutes = parseInt(durationMatch[2] ?? "0", 10);
|
const minutes = parseInt(durationMatch[2] ?? '0', 10);
|
||||||
const seconds = parseFloat(durationMatch[3] ?? "0");
|
const seconds = parseFloat(durationMatch[3] ?? '0');
|
||||||
duration = hours * 3600 + minutes * 60 + seconds;
|
duration = hours * 3600 + minutes * 60 + seconds;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import Piscina from "piscina";
|
import Piscina from 'piscina';
|
||||||
import { VideoInfo } from "./video";
|
import { VideoInfo } from './video';
|
||||||
|
|
||||||
type EncodeArgs = {
|
type EncodeArgs = {
|
||||||
method: 'extractThumbnail' | 'convertFile' | 'convert' | 'getVideoInfo';
|
method: 'extractThumbnail' | 'convertFile' | 'convert' | 'getVideoInfo';
|
||||||
|
@@ -83,7 +83,7 @@ class FileUUIDManager {
|
|||||||
this.cache = new TimeBasedCache<string, FileUUIDData>(5000, ttl);
|
this.cache = new TimeBasedCache<string, FileUUIDData>(5000, ttl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public encode(data: FileUUIDData, endString: string = "", customUUID?: string): string {
|
public encode(data: FileUUIDData, endString: string = '', customUUID?: string): string {
|
||||||
const uuid = customUUID ? customUUID : randomUUID().replace(/-/g, '') + endString;
|
const uuid = customUUID ? customUUID : randomUUID().replace(/-/g, '') + endString;
|
||||||
this.cache.put(uuid, data);
|
this.cache.put(uuid, data);
|
||||||
return uuid;
|
return uuid;
|
||||||
@@ -101,7 +101,7 @@ export class FileNapCatOneBotUUIDWrap {
|
|||||||
this.manager = new FileUUIDManager(ttl);
|
this.manager = new FileUUIDManager(ttl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public encodeModelId(peer: Peer, modelId: string, fileId: string, fileUUID: string = "", endString: string = "", customUUID?: string): string {
|
public encodeModelId(peer: Peer, modelId: string, fileId: string, fileUUID: string = '', endString: string = '', customUUID?: string): string {
|
||||||
return this.manager.encode({ peer, modelId, fileId, fileUUID }, endString, customUUID);
|
return this.manager.encode({ peer, modelId, fileId, fileUUID }, endString, customUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,8 +109,8 @@ export class FileNapCatOneBotUUIDWrap {
|
|||||||
return this.manager.decode(uuid);
|
return this.manager.decode(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public encode(peer: Peer, msgId: string, elementId: string, fileUUID: string = "", customUUID?: string): string {
|
public encode(peer: Peer, msgId: string, elementId: string, fileUUID: string = '', customUUID?: string): string {
|
||||||
return this.manager.encode({ peer, msgId, elementId, fileUUID }, "", customUUID);
|
return this.manager.encode({ peer, msgId, elementId, fileUUID }, '', customUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public decode(uuid: string): FileUUIDData | undefined {
|
public decode(uuid: string): FileUUIDData | undefined {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import * as crypto from "node:crypto";
|
import * as crypto from 'node:crypto';
|
||||||
import { PacketMsg } from "@/core/packet/message/message";
|
import { PacketMsg } from '@/core/packet/message/message';
|
||||||
|
|
||||||
interface ForwardMsgJson {
|
interface ForwardMsgJson {
|
||||||
app: string
|
app: string
|
||||||
@@ -50,15 +50,15 @@ interface ForwardAdaptMsgElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ForwardMsgBuilder {
|
export class ForwardMsgBuilder {
|
||||||
private static build(resId: string, msg: ForwardAdaptMsg[], source?: string, news?: ForwardMsgJsonMetaDetail["news"], summary?: string, prompt?: string): ForwardMsgJson {
|
private static build(resId: string, msg: ForwardAdaptMsg[], source?: string, news?: ForwardMsgJsonMetaDetail['news'], summary?: string, prompt?: string): ForwardMsgJson {
|
||||||
const id = crypto.randomUUID();
|
const id = crypto.randomUUID();
|
||||||
const isGroupMsg = msg.some(m => m.isGroupMsg);
|
const isGroupMsg = msg.some(m => m.isGroupMsg);
|
||||||
if (!source) {
|
if (!source) {
|
||||||
source = isGroupMsg ? "群聊的聊天记录" : msg.map(m => m.senderName).filter((v, i, a) => a.indexOf(v) === i).slice(0, 4).join('和') + '的聊天记录';
|
source = isGroupMsg ? '群聊的聊天记录' : msg.map(m => m.senderName).filter((v, i, a) => a.indexOf(v) === i).slice(0, 4).join('和') + '的聊天记录';
|
||||||
}
|
}
|
||||||
if (!news) {
|
if (!news) {
|
||||||
news = msg.length === 0 ? [{
|
news = msg.length === 0 ? [{
|
||||||
text: "Nya~ This message is send from NapCat.Packet!",
|
text: 'Nya~ This message is send from NapCat.Packet!',
|
||||||
}] : msg.map(m => ({
|
}] : msg.map(m => ({
|
||||||
text: `${m.senderName}: ${m.msg?.map(msg => msg.preview).join('')}`,
|
text: `${m.senderName}: ${m.msg?.map(msg => msg.preview).join('')}`,
|
||||||
}));
|
}));
|
||||||
@@ -67,15 +67,15 @@ export class ForwardMsgBuilder {
|
|||||||
summary = `查看${msg.length}条转发消息`;
|
summary = `查看${msg.length}条转发消息`;
|
||||||
}
|
}
|
||||||
if (!prompt) {
|
if (!prompt) {
|
||||||
prompt = "[聊天记录]";
|
prompt = '[聊天记录]';
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
app: "com.tencent.multimsg",
|
app: 'com.tencent.multimsg',
|
||||||
config: {
|
config: {
|
||||||
autosize: 1,
|
autosize: 1,
|
||||||
forward: 1,
|
forward: 1,
|
||||||
round: 1,
|
round: 1,
|
||||||
type: "normal",
|
type: 'normal',
|
||||||
width: 300
|
width: 300
|
||||||
},
|
},
|
||||||
desc: prompt,
|
desc: prompt,
|
||||||
@@ -93,8 +93,8 @@ export class ForwardMsgBuilder {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
prompt,
|
prompt,
|
||||||
ver: "0.0.0.5",
|
ver: '0.0.0.5',
|
||||||
view: "contact",
|
view: 'contact',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,12 +102,12 @@ export class ForwardMsgBuilder {
|
|||||||
return this.build(resId, []);
|
return this.build(resId, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromPacketMsg(resId: string, packetMsg: PacketMsg[], source?: string, news?: ForwardMsgJsonMetaDetail["news"], summary?: string, prompt?: string): ForwardMsgJson {
|
static fromPacketMsg(resId: string, packetMsg: PacketMsg[], source?: string, news?: ForwardMsgJsonMetaDetail['news'], summary?: string, prompt?: string): ForwardMsgJson {
|
||||||
return this.build(resId, packetMsg.map(msg => ({
|
return this.build(resId, packetMsg.map(msg => ({
|
||||||
senderName: msg.senderName,
|
senderName: msg.senderName,
|
||||||
isGroupMsg: msg.groupId !== undefined,
|
isGroupMsg: msg.groupId !== undefined,
|
||||||
msg: msg.msg.map(m => ({
|
msg: msg.msg.map(m => ({
|
||||||
preview: m.valid ? m.toPreview() : "[该消息类型暂不支持查看]",
|
preview: m.valid ? m.toPreview() : '[该消息类型暂不支持查看]',
|
||||||
}))
|
}))
|
||||||
})), source, news, summary, prompt);
|
})), source, news, summary, prompt);
|
||||||
}
|
}
|
||||||
|
@@ -172,8 +172,8 @@ export function stringifyWithBigInt(obj: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function parseAppidFromMajor(nodeMajor: string): string | undefined {
|
export function parseAppidFromMajor(nodeMajor: string): string | undefined {
|
||||||
const hexSequence = "A4 09 00 00 00 35";
|
const hexSequence = 'A4 09 00 00 00 35';
|
||||||
const sequenceBytes = Buffer.from(hexSequence.replace(/ /g, ""), "hex");
|
const sequenceBytes = Buffer.from(hexSequence.replace(/ /g, ''), 'hex');
|
||||||
const filePath = path.resolve(nodeMajor);
|
const filePath = path.resolve(nodeMajor);
|
||||||
const fileContent = fs.readFileSync(filePath);
|
const fileContent = fs.readFileSync(filePath);
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ export function parseAppidFromMajor(nodeMajor: string): string | undefined {
|
|||||||
const content = fileContent.subarray(start, end);
|
const content = fileContent.subarray(start, end);
|
||||||
if (!content.every(byte => byte === 0x00)) {
|
if (!content.every(byte => byte === 0x00)) {
|
||||||
try {
|
try {
|
||||||
return content.toString("utf-8");
|
return content.toString('utf-8');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -303,7 +303,7 @@ function textElementToText(textElement: any): string {
|
|||||||
const originalContentLines = textElement.content.split('\n');
|
const originalContentLines = textElement.content.split('\n');
|
||||||
return `${originalContentLines[0]}${originalContentLines.length > 1 ? ' ...' : ''}`;
|
return `${originalContentLines[0]}${originalContentLines.length > 1 ? ' ...' : ''}`;
|
||||||
} else if (textElement.atType === NTMsgAtType.ATTYPEALL) {
|
} else if (textElement.atType === NTMsgAtType.ATTYPEALL) {
|
||||||
return `@全体成员`;
|
return '@全体成员';
|
||||||
} else if (textElement.atType === NTMsgAtType.ATTYPEONE) {
|
} else if (textElement.atType === NTMsgAtType.ATTYPEONE) {
|
||||||
return `${textElement.content} (${textElement.atUid})`;
|
return `${textElement.content} (${textElement.atUid})`;
|
||||||
}
|
}
|
||||||
|
@@ -86,14 +86,14 @@ export class QQBasicInfoWrapper {
|
|||||||
try {
|
try {
|
||||||
const majorAppid = this.getAppidV2ByMajor(fullVersion);
|
const majorAppid = this.getAppidV2ByMajor(fullVersion);
|
||||||
if (majorAppid) {
|
if (majorAppid) {
|
||||||
this.context.logger.log(`[QQ版本兼容性检测] 当前版本Appid未内置 通过Major获取 为了更好的性能请尝试更新NapCat`);
|
this.context.logger.log('[QQ版本兼容性检测] 当前版本Appid未内置 通过Major获取 为了更好的性能请尝试更新NapCat');
|
||||||
return { appid: majorAppid, qua: this.getQUAFallback() };
|
return { appid: majorAppid, qua: this.getQUAFallback() };
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.context.logger.log(`[QQ版本兼容性检测] 通过Major 获取Appid异常 请检测NapCat/QQNT是否正常`);
|
this.context.logger.log('[QQ版本兼容性检测] 通过Major 获取Appid异常 请检测NapCat/QQNT是否正常');
|
||||||
}
|
}
|
||||||
// 最终兜底为老版本
|
// 最终兜底为老版本
|
||||||
this.context.logger.log(`[QQ版本兼容性检测] 获取Appid异常 请检测NapCat/QQNT是否正常`);
|
this.context.logger.log('[QQ版本兼容性检测] 获取Appid异常 请检测NapCat/QQNT是否正常');
|
||||||
this.context.logger.log(`[QQ版本兼容性检测] ${fullVersion} 版本兼容性不佳,可能会导致一些功能无法正常使用`,);
|
this.context.logger.log(`[QQ版本兼容性检测] ${fullVersion} 版本兼容性不佳,可能会导致一些功能无法正常使用`,);
|
||||||
return { appid: this.getAppIdFallback(), qua: this.getQUAFallback() };
|
return { appid: this.getAppIdFallback(), qua: this.getQUAFallback() };
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MsfChangeReasonType, MsfStatusType } from "@/core/types/adapter";
|
import { MsfChangeReasonType, MsfStatusType } from '@/core/types/adapter';
|
||||||
|
|
||||||
export class NodeIDependsAdapter {
|
export class NodeIDependsAdapter {
|
||||||
onMSFStatusChange(statusType: MsfStatusType, changeReasonType: MsfChangeReasonType) {
|
onMSFStatusChange(statusType: MsfStatusType, changeReasonType: MsfChangeReasonType) {
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import offset from '@/core/external/offset.json';
|
import offset from '@/core/external/offset.json';
|
||||||
import { InstanceContext, NapCatCore } from "@/core";
|
import { InstanceContext, NapCatCore } from '@/core';
|
||||||
import { LogWrapper } from "@/common/log";
|
import { LogWrapper } from '@/common/log';
|
||||||
import { PacketClientSession } from "@/core/packet/clientSession";
|
import { PacketClientSession } from '@/core/packet/clientSession';
|
||||||
import { napCatVersion } from "@/common/version";
|
import { napCatVersion } from '@/common/version';
|
||||||
|
|
||||||
interface OffsetType {
|
interface OffsetType {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
|
@@ -322,18 +322,18 @@ export class NTQQWebApi {
|
|||||||
data: pskey,
|
data: pskey,
|
||||||
appid: 5
|
appid: 5
|
||||||
},
|
},
|
||||||
appid: "qun",
|
appid: 'qun',
|
||||||
checksum: img_md5,
|
checksum: img_md5,
|
||||||
check_type: 0,
|
check_type: 0,
|
||||||
file_len: img_size,
|
file_len: img_size,
|
||||||
env: {
|
env: {
|
||||||
refer: "qzone",
|
refer: 'qzone',
|
||||||
deviceInfo: "h5"
|
deviceInfo: 'h5'
|
||||||
},
|
},
|
||||||
model: 0,
|
model: 0,
|
||||||
biz_req: {
|
biz_req: {
|
||||||
sPicTitle: img_name,
|
sPicTitle: img_name,
|
||||||
sPicDesc: "",
|
sPicDesc: '',
|
||||||
sAlbumName: sAlbumName,
|
sAlbumName: sAlbumName,
|
||||||
sAlbumID: sAlbumID,
|
sAlbumID: sAlbumID,
|
||||||
iAlbumTypeID: 0,
|
iAlbumTypeID: 0,
|
||||||
@@ -341,7 +341,7 @@ export class NTQQWebApi {
|
|||||||
iUploadType: 0,
|
iUploadType: 0,
|
||||||
iUpPicType: 0,
|
iUpPicType: 0,
|
||||||
iBatchID: time,
|
iBatchID: time,
|
||||||
sPicPath: "",
|
sPicPath: '',
|
||||||
iPicWidth: 0,
|
iPicWidth: 0,
|
||||||
iPicHight: 0,
|
iPicHight: 0,
|
||||||
iWaterType: 0,
|
iWaterType: 0,
|
||||||
@@ -349,19 +349,19 @@ export class NTQQWebApi {
|
|||||||
iNeedFeeds: 1,
|
iNeedFeeds: 1,
|
||||||
iUploadTime: time,
|
iUploadTime: time,
|
||||||
mapExt: {
|
mapExt: {
|
||||||
appid: "qun",
|
appid: 'qun',
|
||||||
userid: gc
|
userid: gc
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
session: "",
|
session: '',
|
||||||
asy_upload: 0,
|
asy_upload: 0,
|
||||||
cmd: "FileUpload"
|
cmd: 'FileUpload'
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
const api = `https://h5.qzone.qq.com/webapp/json/sliceUpload/FileBatchControl/${img_md5}?g_tk=${GTK}`;
|
const api = `https://h5.qzone.qq.com/webapp/json/sliceUpload/FileBatchControl/${img_md5}?g_tk=${GTK}`;
|
||||||
const post = await RequestUtil.HttpGetJson(api, 'POST', body, {
|
const post = await RequestUtil.HttpGetJson(api, 'POST', body, {
|
||||||
"Cookie": cookie,
|
'Cookie': cookie,
|
||||||
"Content-Type": "application/json"
|
'Content-Type': 'application/json'
|
||||||
});
|
});
|
||||||
|
|
||||||
return post;
|
return post;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
// TODO: further refactor in NapCat.Packet v2
|
// TODO: further refactor in NapCat.Packet v2
|
||||||
import { NapProtoMsg, ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { NapProtoMsg, ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
const LikeDetail = {
|
const LikeDetail = {
|
||||||
txt: ProtoField(1, ScalarType.STRING),
|
txt: ProtoField(1, ScalarType.STRING),
|
||||||
|
@@ -32,7 +32,7 @@ export class RkeyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.failureCount >= this.FAILURE_LIMIT) {
|
if (this.failureCount >= this.FAILURE_LIMIT) {
|
||||||
this.logger.logError(`[Rkey] 服务存在异常, 图片使用FallBack机制`);
|
this.logger.logError('[Rkey] 服务存在异常, 图片使用FallBack机制');
|
||||||
throw new Error('获取rkey失败次数过多,请稍后再试');
|
throw new Error('获取rkey失败次数过多,请稍后再试');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import os from "node:os";
|
import os from 'node:os';
|
||||||
import EventEmitter from "node:events";
|
import EventEmitter from 'node:events';
|
||||||
|
|
||||||
export interface SystemStatus {
|
export interface SystemStatus {
|
||||||
cpu: {
|
cpu: {
|
||||||
|
@@ -52,7 +52,7 @@ export function loadQQWrapper(QQVersion: string): WrapperNodeApi {
|
|||||||
}
|
}
|
||||||
let wrapperNodePath = path.resolve(appPath, 'wrapper.node');
|
let wrapperNodePath = path.resolve(appPath, 'wrapper.node');
|
||||||
if (!fs.existsSync(wrapperNodePath)) {
|
if (!fs.existsSync(wrapperNodePath)) {
|
||||||
wrapperNodePath = path.join(appPath, `./resources/app/wrapper.node`);
|
wrapperNodePath = path.join(appPath, './resources/app/wrapper.node');
|
||||||
}
|
}
|
||||||
//老版本兼容 未来去掉
|
//老版本兼容 未来去掉
|
||||||
if (!fs.existsSync(wrapperNodePath)) {
|
if (!fs.existsSync(wrapperNodePath)) {
|
||||||
@@ -74,7 +74,7 @@ export function getMajorPath(QQVersion: string): string {
|
|||||||
}
|
}
|
||||||
let majorPath = path.resolve(appPath, 'major.node');
|
let majorPath = path.resolve(appPath, 'major.node');
|
||||||
if (!fs.existsSync(majorPath)) {
|
if (!fs.existsSync(majorPath)) {
|
||||||
majorPath = path.join(appPath, `./resources/app/major.node`);
|
majorPath = path.join(appPath, './resources/app/major.node');
|
||||||
}
|
}
|
||||||
//老版本兼容 未来去掉
|
//老版本兼容 未来去掉
|
||||||
if (!fs.existsSync(majorPath)) {
|
if (!fs.existsSync(majorPath)) {
|
||||||
@@ -177,7 +177,7 @@ export class NapCatCore {
|
|||||||
profileListener.onSelfStatusChanged = (Info: SelfStatusInfo) => {
|
profileListener.onSelfStatusChanged = (Info: SelfStatusInfo) => {
|
||||||
if (Info.status == 20) {
|
if (Info.status == 20) {
|
||||||
this.selfInfo.online = false;
|
this.selfInfo.online = false;
|
||||||
this.context.logger.log("账号状态变更为离线");
|
this.context.logger.log('账号状态变更为离线');
|
||||||
} else {
|
} else {
|
||||||
this.selfInfo.online = true;
|
this.selfInfo.online = true;
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { LRUCache } from "@/common/lru-cache";
|
import { LRUCache } from '@/common/lru-cache';
|
||||||
import crypto, { createHash } from "crypto";
|
import crypto, { createHash } from 'crypto';
|
||||||
import { OidbPacket, PacketHexStr } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketHexStr } from '@/core/packet/transformer/base';
|
||||||
import { LogStack } from "@/core/packet/context/clientContext";
|
import { LogStack } from '@/core/packet/context/clientContext';
|
||||||
import { NapCoreContext } from "@/core/packet/context/napCoreContext";
|
import { NapCoreContext } from '@/core/packet/context/napCoreContext';
|
||||||
import { PacketLogger } from "@/core/packet/context/loggerContext";
|
import { PacketLogger } from '@/core/packet/context/loggerContext';
|
||||||
|
|
||||||
export interface RecvPacket {
|
export interface RecvPacket {
|
||||||
type: string, // 仅recv
|
type: string, // 仅recv
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { createHash } from "crypto";
|
import { createHash } from 'crypto';
|
||||||
import path, { dirname } from "path";
|
import path, { dirname } from 'path';
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from 'url';
|
||||||
import fs from "fs";
|
import fs from 'fs';
|
||||||
import { IPacketClient } from "@/core/packet/client/baseClient";
|
import { IPacketClient } from '@/core/packet/client/baseClient';
|
||||||
import { constants } from "node:os";
|
import { constants } from 'node:os';
|
||||||
import { LRUCache } from "@/common/lru-cache";
|
import { LRUCache } from '@/common/lru-cache';
|
||||||
import { LogStack } from "@/core/packet/context/clientContext";
|
import { LogStack } from '@/core/packet/context/clientContext';
|
||||||
import { NapCoreContext } from "@/core/packet/context/napCoreContext";
|
import { NapCoreContext } from '@/core/packet/context/napCoreContext';
|
||||||
import { PacketLogger } from "@/core/packet/context/loggerContext";
|
import { PacketLogger } from '@/core/packet/context/loggerContext';
|
||||||
|
|
||||||
// 0 send 1 recv
|
// 0 send 1 recv
|
||||||
export interface NativePacketExportType {
|
export interface NativePacketExportType {
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { Data, WebSocket, ErrorEvent } from "ws";
|
import { Data, WebSocket, ErrorEvent } from 'ws';
|
||||||
import { IPacketClient, RecvPacket } from "@/core/packet/client/baseClient";
|
import { IPacketClient, RecvPacket } from '@/core/packet/client/baseClient';
|
||||||
import { LogStack } from "@/core/packet/context/clientContext";
|
import { LogStack } from '@/core/packet/context/clientContext';
|
||||||
import { NapCoreContext } from "@/core/packet/context/napCoreContext";
|
import { NapCoreContext } from '@/core/packet/context/napCoreContext';
|
||||||
import { PacketLogger } from "@/core/packet/context/loggerContext";
|
import { PacketLogger } from '@/core/packet/context/loggerContext';
|
||||||
|
|
||||||
export class WsPacketClient extends IPacketClient {
|
export class WsPacketClient extends IPacketClient {
|
||||||
private websocket: WebSocket | null = null;
|
private websocket: WebSocket | null = null;
|
||||||
@@ -23,7 +23,7 @@ export class WsPacketClient extends IPacketClient {
|
|||||||
|
|
||||||
check(): boolean {
|
check(): boolean {
|
||||||
if (!this.napcore.config.packetServer) {
|
if (!this.napcore.config.packetServer) {
|
||||||
this.logStack.pushLogWarn(`wsPacketClient 未配置服务器地址`);
|
this.logStack.pushLogWarn('wsPacketClient 未配置服务器地址');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -80,7 +80,7 @@ export class WsPacketClient extends IPacketClient {
|
|||||||
};
|
};
|
||||||
this.websocket.onclose = () => {
|
this.websocket.onclose = () => {
|
||||||
this.available = false;
|
this.available = false;
|
||||||
this.logger.warn(`WebSocket 连接关闭,尝试重连...`);
|
this.logger.warn('WebSocket 连接关闭,尝试重连...');
|
||||||
reject(new Error('WebSocket 连接关闭'));
|
reject(new Error('WebSocket 连接关闭'));
|
||||||
};
|
};
|
||||||
this.websocket.onmessage = (event) => this.handleMessage(event.data).catch(err => {
|
this.websocket.onmessage = (event) => this.handleMessage(event.data).catch(err => {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { PacketContext } from "@/core/packet/context/packetContext";
|
import { PacketContext } from '@/core/packet/context/packetContext';
|
||||||
import { NapCatCore } from "@/core";
|
import { NapCatCore } from '@/core';
|
||||||
|
|
||||||
export class PacketClientSession {
|
export class PacketClientSession {
|
||||||
private readonly context: PacketContext;
|
private readonly context: PacketContext;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { IPacketClient } from "@/core/packet/client/baseClient";
|
import { IPacketClient } from '@/core/packet/client/baseClient';
|
||||||
import { NativePacketClient } from "@/core/packet/client/nativeClient";
|
import { NativePacketClient } from '@/core/packet/client/nativeClient';
|
||||||
import { WsPacketClient } from "@/core/packet/client/wsClient";
|
import { WsPacketClient } from '@/core/packet/client/wsClient';
|
||||||
import { OidbPacket } from "@/core/packet/transformer/base";
|
import { OidbPacket } from '@/core/packet/transformer/base';
|
||||||
import { PacketLogger } from "@/core/packet/context/loggerContext";
|
import { PacketLogger } from '@/core/packet/context/loggerContext';
|
||||||
import { NapCoreContext } from "@/core/packet/context/napCoreContext";
|
import { NapCoreContext } from '@/core/packet/context/napCoreContext';
|
||||||
|
|
||||||
type clientPriority = {
|
type clientPriority = {
|
||||||
[key: number]: (napCore: NapCoreContext, logger: PacketLogger, logStack: LogStack) => IPacketClient;
|
[key: number]: (napCore: NapCoreContext, logger: PacketLogger, logStack: LogStack) => IPacketClient;
|
||||||
@@ -77,22 +77,22 @@ export class PacketClientContext {
|
|||||||
|
|
||||||
async sendOidbPacket<T extends boolean = false>(pkt: OidbPacket, rsp?: T): Promise<T extends true ? Buffer : void> {
|
async sendOidbPacket<T extends boolean = false>(pkt: OidbPacket, rsp?: T): Promise<T extends true ? Buffer : void> {
|
||||||
const raw = await this._client.sendOidbPacket(pkt, rsp);
|
const raw = await this._client.sendOidbPacket(pkt, rsp);
|
||||||
return (rsp ? Buffer.from(raw.hex_data, "hex") : undefined) as T extends true ? Buffer : void;
|
return (rsp ? Buffer.from(raw.hex_data, 'hex') : undefined) as T extends true ? Buffer : void;
|
||||||
}
|
}
|
||||||
|
|
||||||
private newClient(): IPacketClient {
|
private newClient(): IPacketClient {
|
||||||
const prefer = this.napCore.config.packetBackend;
|
const prefer = this.napCore.config.packetBackend;
|
||||||
let client: IPacketClient | null;
|
let client: IPacketClient | null;
|
||||||
switch (prefer) {
|
switch (prefer) {
|
||||||
case "native":
|
case 'native':
|
||||||
this.logger.info("使用指定的 NativePacketClient 作为后端");
|
this.logger.info('使用指定的 NativePacketClient 作为后端');
|
||||||
client = new NativePacketClient(this.napCore, this.logger, this.logStack);
|
client = new NativePacketClient(this.napCore, this.logger, this.logStack);
|
||||||
break;
|
break;
|
||||||
case "frida":
|
case 'frida':
|
||||||
this.logger.info("[Core] [Packet] 使用指定的 FridaPacketClient 作为后端");
|
this.logger.info('[Core] [Packet] 使用指定的 FridaPacketClient 作为后端');
|
||||||
client = new WsPacketClient(this.napCore, this.logger, this.logStack);
|
client = new WsPacketClient(this.napCore, this.logger, this.logStack);
|
||||||
break;
|
break;
|
||||||
case "auto":
|
case 'auto':
|
||||||
case undefined:
|
case undefined:
|
||||||
client = this.judgeClient();
|
client = this.judgeClient();
|
||||||
break;
|
break;
|
||||||
@@ -101,10 +101,10 @@ export class PacketClientContext {
|
|||||||
client = null;
|
client = null;
|
||||||
}
|
}
|
||||||
if (!client?.check()) {
|
if (!client?.check()) {
|
||||||
throw new Error("[Core] [Packet] 无可用的后端,NapCat.Packet将不会加载!");
|
throw new Error('[Core] [Packet] 无可用的后端,NapCat.Packet将不会加载!');
|
||||||
}
|
}
|
||||||
if (!client) {
|
if (!client) {
|
||||||
throw new Error("[Core] [Packet] 后端异常,NapCat.Packet将不会加载!");
|
throw new Error('[Core] [Packet] 后端异常,NapCat.Packet将不会加载!');
|
||||||
}
|
}
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ export class PacketClientContext {
|
|||||||
.sort((a, b) => b.score - a.score);
|
.sort((a, b) => b.score - a.score);
|
||||||
const selectedClient = sortedClients[0]?.client;
|
const selectedClient = sortedClients[0]?.client;
|
||||||
if (!selectedClient) {
|
if (!selectedClient) {
|
||||||
throw new Error("[Core] [Packet] 无可用的后端,NapCat.Packet将不会加载!");
|
throw new Error('[Core] [Packet] 无可用的后端,NapCat.Packet将不会加载!');
|
||||||
}
|
}
|
||||||
this.logger.info(`自动选择 ${selectedClient.constructor.name} 作为后端`);
|
this.logger.info(`自动选择 ${selectedClient.constructor.name} 作为后端`);
|
||||||
return selectedClient;
|
return selectedClient;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { LogLevel, LogWrapper } from "@/common/log";
|
import { LogLevel, LogWrapper } from '@/common/log';
|
||||||
import { NapCoreContext } from "@/core/packet/context/napCoreContext";
|
import { NapCoreContext } from '@/core/packet/context/napCoreContext';
|
||||||
|
|
||||||
// TODO: check bind?
|
// TODO: check bind?
|
||||||
export class PacketLogger {
|
export class PacketLogger {
|
||||||
@@ -10,7 +10,7 @@ export class PacketLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _log(level: LogLevel, ...msg: any[]): void {
|
private _log(level: LogLevel, ...msg: any[]): void {
|
||||||
this.napLogger._log(level, "[Core] [Packet] " + msg);
|
this.napLogger._log(level, '[Core] [Packet] ' + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(...msg: any[]): void {
|
debug(...msg: any[]): void {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { NapCatCore } from "@/core";
|
import { NapCatCore } from '@/core';
|
||||||
|
|
||||||
export interface NapCoreCompatBasicInfo {
|
export interface NapCoreCompatBasicInfo {
|
||||||
readonly uin: number;
|
readonly uin: number;
|
||||||
|
@@ -1,20 +1,20 @@
|
|||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import { PacketContext } from "@/core/packet/context/packetContext";
|
import { PacketContext } from '@/core/packet/context/packetContext';
|
||||||
import * as trans from "@/core/packet/transformer";
|
import * as trans from '@/core/packet/transformer';
|
||||||
import { PacketMsg } from "@/core/packet/message/message";
|
import { PacketMsg } from '@/core/packet/message/message';
|
||||||
import {
|
import {
|
||||||
PacketMsgFileElement,
|
PacketMsgFileElement,
|
||||||
PacketMsgPicElement,
|
PacketMsgPicElement,
|
||||||
PacketMsgPttElement,
|
PacketMsgPttElement,
|
||||||
PacketMsgVideoElement
|
PacketMsgVideoElement
|
||||||
} from "@/core/packet/message/element";
|
} from '@/core/packet/message/element';
|
||||||
import { ChatType } from "@/core";
|
import { ChatType } from '@/core';
|
||||||
import { MiniAppRawData, MiniAppReqParams } from "@/core/packet/entities/miniApp";
|
import { MiniAppRawData, MiniAppReqParams } from '@/core/packet/entities/miniApp';
|
||||||
import { AIVoiceChatType } from "@/core/packet/entities/aiChat";
|
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
||||||
import { NapProtoDecodeStructType, NapProtoEncodeStructType } from "@napneko/nap-proto-core";
|
import { NapProtoDecodeStructType, NapProtoEncodeStructType } from '@napneko/nap-proto-core';
|
||||||
import { IndexNode, MsgInfo } from "@/core/packet/transformer/proto";
|
import { IndexNode, MsgInfo } from '@/core/packet/transformer/proto';
|
||||||
import { OidbPacket } from "@/core/packet/transformer/base";
|
import { OidbPacket } from '@/core/packet/transformer/base';
|
||||||
import { ImageOcrResult } from "@/core/packet/entities/ocrResult";
|
import { ImageOcrResult } from '@/core/packet/entities/ocrResult';
|
||||||
|
|
||||||
export class PacketOperationContext {
|
export class PacketOperationContext {
|
||||||
private readonly context: PacketContext;
|
private readonly context: PacketContext;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { PacketHighwayContext } from "@/core/packet/highway/highwayContext";
|
import { PacketHighwayContext } from '@/core/packet/highway/highwayContext';
|
||||||
import { NapCatCore } from "@/core";
|
import { NapCatCore } from '@/core';
|
||||||
import { PacketLogger } from "@/core/packet/context/loggerContext";
|
import { PacketLogger } from '@/core/packet/context/loggerContext';
|
||||||
import { NapCoreContext } from "@/core/packet/context/napCoreContext";
|
import { NapCoreContext } from '@/core/packet/context/napCoreContext';
|
||||||
import { PacketClientContext } from "@/core/packet/context/clientContext";
|
import { PacketClientContext } from '@/core/packet/context/clientContext';
|
||||||
import { PacketOperationContext } from "@/core/packet/context/operationContext";
|
import { PacketOperationContext } from '@/core/packet/context/operationContext';
|
||||||
import { PacketMsgConverter } from "@/core/packet/message/converter";
|
import { PacketMsgConverter } from '@/core/packet/message/converter';
|
||||||
|
|
||||||
export class PacketContext {
|
export class PacketContext {
|
||||||
readonly msgConverter: PacketMsgConverter;
|
readonly msgConverter: PacketMsgConverter;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import * as stream from 'node:stream';
|
import * as stream from 'node:stream';
|
||||||
import { ReadStream } from "node:fs";
|
import { ReadStream } from 'node:fs';
|
||||||
import { HighwayTcpUploader } from "@/core/packet/highway/uploader/highwayTcpUploader";
|
import { HighwayTcpUploader } from '@/core/packet/highway/uploader/highwayTcpUploader';
|
||||||
import { HighwayHttpUploader } from "@/core/packet/highway/uploader/highwayHttpUploader";
|
import { HighwayHttpUploader } from '@/core/packet/highway/uploader/highwayHttpUploader';
|
||||||
import { PacketHighwaySig } from "@/core/packet/highway/highwayContext";
|
import { PacketHighwaySig } from '@/core/packet/highway/highwayContext';
|
||||||
import { PacketLogger } from "@/core/packet/context/loggerContext";
|
import { PacketLogger } from '@/core/packet/context/loggerContext';
|
||||||
|
|
||||||
export interface PacketHighwayTrans {
|
export interface PacketHighwayTrans {
|
||||||
uin: string;
|
uin: string;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import assert from "node:assert";
|
import assert from 'node:assert';
|
||||||
|
|
||||||
export class Frame{
|
export class Frame{
|
||||||
static pack(head: Buffer, body: Buffer): Buffer {
|
static pack(head: Buffer, body: Buffer): Buffer {
|
||||||
|
@@ -1,22 +1,22 @@
|
|||||||
import { PacketHighwayClient } from "@/core/packet/highway/client";
|
import { PacketHighwayClient } from '@/core/packet/highway/client';
|
||||||
import { PacketLogger } from "@/core/packet/context/loggerContext";
|
import { PacketLogger } from '@/core/packet/context/loggerContext';
|
||||||
import FetchSessionKey from "@/core/packet/transformer/highway/FetchSessionKey";
|
import FetchSessionKey from '@/core/packet/transformer/highway/FetchSessionKey';
|
||||||
import { int32ip2str, oidbIpv4s2HighwayIpv4s } from "@/core/packet/highway/utils";
|
import { int32ip2str, oidbIpv4s2HighwayIpv4s } from '@/core/packet/highway/utils';
|
||||||
import {
|
import {
|
||||||
PacketMsgFileElement,
|
PacketMsgFileElement,
|
||||||
PacketMsgPicElement,
|
PacketMsgPicElement,
|
||||||
PacketMsgPttElement,
|
PacketMsgPttElement,
|
||||||
PacketMsgVideoElement
|
PacketMsgVideoElement
|
||||||
} from "@/core/packet/message/element";
|
} from '@/core/packet/message/element';
|
||||||
import { ChatType, Peer } from "@/core";
|
import { ChatType, Peer } from '@/core';
|
||||||
import { calculateSha1, calculateSha1StreamBytes, computeMd5AndLengthWithLimit } from "@/core/packet/utils/crypto/hash";
|
import { calculateSha1, calculateSha1StreamBytes, computeMd5AndLengthWithLimit } from '@/core/packet/utils/crypto/hash';
|
||||||
import UploadGroupImage from "@/core/packet/transformer/highway/UploadGroupImage";
|
import UploadGroupImage from '@/core/packet/transformer/highway/UploadGroupImage';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import * as trans from "@/core/packet/transformer";
|
import * as trans from '@/core/packet/transformer';
|
||||||
import fs from "fs";
|
import fs from 'fs';
|
||||||
import { NapCoreContext } from "@/core/packet/context/napCoreContext";
|
import { NapCoreContext } from '@/core/packet/context/napCoreContext';
|
||||||
import { PacketClientContext } from "@/core/packet/context/clientContext";
|
import { PacketClientContext } from '@/core/packet/context/clientContext';
|
||||||
|
|
||||||
export const BlockSize = 1024 * 1024;
|
export const BlockSize = 1024 * 1024;
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ export class PacketHighwayContext {
|
|||||||
const resp = await this.client.sendOidbPacket(req, true);
|
const resp = await this.client.sendOidbPacket(req, true);
|
||||||
const preRespData = UploadGroupImage.parse(resp);
|
const preRespData = UploadGroupImage.parse(resp);
|
||||||
const ukey = preRespData.upload.uKey;
|
const ukey = preRespData.upload.uKey;
|
||||||
if (ukey && ukey != "") {
|
if (ukey && ukey != '') {
|
||||||
this.logger.debug(`[Highway] uploadGroupImageReq get upload ukey: ${ukey}, need upload!`);
|
this.logger.debug(`[Highway] uploadGroupImageReq get upload ukey: ${ukey}, need upload!`);
|
||||||
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
||||||
const sha1 = Buffer.from(index.info.fileSha1, 'hex');
|
const sha1 = Buffer.from(index.info.fileSha1, 'hex');
|
||||||
@@ -179,7 +179,7 @@ export class PacketHighwayContext {
|
|||||||
const resp = await this.client.sendOidbPacket(req, true);
|
const resp = await this.client.sendOidbPacket(req, true);
|
||||||
const preRespData = trans.UploadPrivateImage.parse(resp);
|
const preRespData = trans.UploadPrivateImage.parse(resp);
|
||||||
const ukey = preRespData.upload.uKey;
|
const ukey = preRespData.upload.uKey;
|
||||||
if (ukey && ukey != "") {
|
if (ukey && ukey != '') {
|
||||||
this.logger.debug(`[Highway] uploadC2CImageReq get upload ukey: ${ukey}, need upload!`);
|
this.logger.debug(`[Highway] uploadC2CImageReq get upload ukey: ${ukey}, need upload!`);
|
||||||
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
||||||
const sha1 = Buffer.from(index.info.fileSha1, 'hex');
|
const sha1 = Buffer.from(index.info.fileSha1, 'hex');
|
||||||
@@ -210,14 +210,14 @@ export class PacketHighwayContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async uploadGroupVideo(groupUin: number, video: PacketMsgVideoElement): Promise<void> {
|
private async uploadGroupVideo(groupUin: number, video: PacketMsgVideoElement): Promise<void> {
|
||||||
if (!video.filePath || !video.thumbPath) throw new Error("video.filePath or video.thumbPath is empty");
|
if (!video.filePath || !video.thumbPath) throw new Error('video.filePath or video.thumbPath is empty');
|
||||||
video.fileSha1 = Buffer.from(await calculateSha1(video.filePath)).toString('hex');
|
video.fileSha1 = Buffer.from(await calculateSha1(video.filePath)).toString('hex');
|
||||||
video.thumbSha1 = Buffer.from(await calculateSha1(video.thumbPath)).toString('hex');
|
video.thumbSha1 = Buffer.from(await calculateSha1(video.thumbPath)).toString('hex');
|
||||||
const req = trans.UploadGroupVideo.build(groupUin, video);
|
const req = trans.UploadGroupVideo.build(groupUin, video);
|
||||||
const resp = await this.client.sendOidbPacket(req, true);
|
const resp = await this.client.sendOidbPacket(req, true);
|
||||||
const preRespData = trans.UploadGroupVideo.parse(resp);
|
const preRespData = trans.UploadGroupVideo.parse(resp);
|
||||||
const ukey = preRespData.upload.uKey;
|
const ukey = preRespData.upload.uKey;
|
||||||
if (ukey && ukey != "") {
|
if (ukey && ukey != '') {
|
||||||
this.logger.debug(`[Highway] uploadGroupVideoReq get upload video ukey: ${ukey}, need upload!`);
|
this.logger.debug(`[Highway] uploadGroupVideoReq get upload video ukey: ${ukey}, need upload!`);
|
||||||
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
||||||
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
||||||
@@ -244,7 +244,7 @@ export class PacketHighwayContext {
|
|||||||
this.logger.debug(`[Highway] uploadGroupVideoReq get upload invalid ukey ${ukey}, don't need upload!`);
|
this.logger.debug(`[Highway] uploadGroupVideoReq get upload invalid ukey ${ukey}, don't need upload!`);
|
||||||
}
|
}
|
||||||
const subFile = preRespData.upload.subFileInfos[0];
|
const subFile = preRespData.upload.subFileInfos[0];
|
||||||
if (subFile.uKey && subFile.uKey != "") {
|
if (subFile.uKey && subFile.uKey != '') {
|
||||||
this.logger.debug(`[Highway] uploadGroupVideoReq get upload video thumb ukey: ${subFile.uKey}, need upload!`);
|
this.logger.debug(`[Highway] uploadGroupVideoReq get upload video thumb ukey: ${subFile.uKey}, need upload!`);
|
||||||
const index = preRespData.upload.msgInfo.msgInfoBody[1].index;
|
const index = preRespData.upload.msgInfo.msgInfoBody[1].index;
|
||||||
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
||||||
@@ -275,14 +275,14 @@ export class PacketHighwayContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async uploadC2CVideo(peerUid: string, video: PacketMsgVideoElement): Promise<void> {
|
private async uploadC2CVideo(peerUid: string, video: PacketMsgVideoElement): Promise<void> {
|
||||||
if (!video.filePath || !video.thumbPath) throw new Error("video.filePath or video.thumbPath is empty");
|
if (!video.filePath || !video.thumbPath) throw new Error('video.filePath or video.thumbPath is empty');
|
||||||
video.fileSha1 = Buffer.from(await calculateSha1(video.filePath)).toString('hex');
|
video.fileSha1 = Buffer.from(await calculateSha1(video.filePath)).toString('hex');
|
||||||
video.thumbSha1 = Buffer.from(await calculateSha1(video.thumbPath)).toString('hex');
|
video.thumbSha1 = Buffer.from(await calculateSha1(video.thumbPath)).toString('hex');
|
||||||
const req = trans.UploadPrivateVideo.build(peerUid, video);
|
const req = trans.UploadPrivateVideo.build(peerUid, video);
|
||||||
const resp = await this.client.sendOidbPacket(req, true);
|
const resp = await this.client.sendOidbPacket(req, true);
|
||||||
const preRespData = trans.UploadPrivateVideo.parse(resp);
|
const preRespData = trans.UploadPrivateVideo.parse(resp);
|
||||||
const ukey = preRespData.upload.uKey;
|
const ukey = preRespData.upload.uKey;
|
||||||
if (ukey && ukey != "") {
|
if (ukey && ukey != '') {
|
||||||
this.logger.debug(`[Highway] uploadC2CVideoReq get upload video ukey: ${ukey}, need upload!`);
|
this.logger.debug(`[Highway] uploadC2CVideoReq get upload video ukey: ${ukey}, need upload!`);
|
||||||
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
||||||
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
||||||
@@ -309,7 +309,7 @@ export class PacketHighwayContext {
|
|||||||
this.logger.debug(`[Highway] uploadC2CVideoReq get upload invalid ukey ${ukey}, don't need upload!`);
|
this.logger.debug(`[Highway] uploadC2CVideoReq get upload invalid ukey ${ukey}, don't need upload!`);
|
||||||
}
|
}
|
||||||
const subFile = preRespData.upload.subFileInfos[0];
|
const subFile = preRespData.upload.subFileInfos[0];
|
||||||
if (subFile.uKey && subFile.uKey != "") {
|
if (subFile.uKey && subFile.uKey != '') {
|
||||||
this.logger.debug(`[Highway] uploadC2CVideoReq get upload video thumb ukey: ${subFile.uKey}, need upload!`);
|
this.logger.debug(`[Highway] uploadC2CVideoReq get upload video thumb ukey: ${subFile.uKey}, need upload!`);
|
||||||
const index = preRespData.upload.msgInfo.msgInfoBody[1].index;
|
const index = preRespData.upload.msgInfo.msgInfoBody[1].index;
|
||||||
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
||||||
@@ -345,7 +345,7 @@ export class PacketHighwayContext {
|
|||||||
const resp = await this.client.sendOidbPacket(req, true);
|
const resp = await this.client.sendOidbPacket(req, true);
|
||||||
const preRespData = trans.UploadGroupPtt.parse(resp);
|
const preRespData = trans.UploadGroupPtt.parse(resp);
|
||||||
const ukey = preRespData.upload.uKey;
|
const ukey = preRespData.upload.uKey;
|
||||||
if (ukey && ukey != "") {
|
if (ukey && ukey != '') {
|
||||||
this.logger.debug(`[Highway] uploadGroupPttReq get upload ptt ukey: ${ukey}, need upload!`);
|
this.logger.debug(`[Highway] uploadGroupPttReq get upload ptt ukey: ${ukey}, need upload!`);
|
||||||
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
||||||
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
||||||
@@ -381,7 +381,7 @@ export class PacketHighwayContext {
|
|||||||
const resp = await this.client.sendOidbPacket(req, true);
|
const resp = await this.client.sendOidbPacket(req, true);
|
||||||
const preRespData = trans.UploadPrivatePtt.parse(resp);
|
const preRespData = trans.UploadPrivatePtt.parse(resp);
|
||||||
const ukey = preRespData.upload.uKey;
|
const ukey = preRespData.upload.uKey;
|
||||||
if (ukey && ukey != "") {
|
if (ukey && ukey != '') {
|
||||||
this.logger.debug(`[Highway] uploadC2CPttReq get upload ptt ukey: ${ukey}, need upload!`);
|
this.logger.debug(`[Highway] uploadC2CPttReq get upload ptt ukey: ${ukey}, need upload!`);
|
||||||
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
const index = preRespData.upload.msgInfo.msgInfoBody[0].index;
|
||||||
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
const md5 = Buffer.from(index.info.fileHash, 'hex');
|
||||||
@@ -419,7 +419,7 @@ export class PacketHighwayContext {
|
|||||||
const resp = await this.client.sendOidbPacket(req, true);
|
const resp = await this.client.sendOidbPacket(req, true);
|
||||||
const preRespData = trans.UploadGroupFile.parse(resp);
|
const preRespData = trans.UploadGroupFile.parse(resp);
|
||||||
if (!preRespData?.upload?.boolFileExist) {
|
if (!preRespData?.upload?.boolFileExist) {
|
||||||
this.logger.debug(`[Highway] uploadGroupFileReq file not exist, need upload!`);
|
this.logger.debug('[Highway] uploadGroupFileReq file not exist, need upload!');
|
||||||
const ext = new NapProtoMsg(proto.FileUploadExt).encode({
|
const ext = new NapProtoMsg(proto.FileUploadExt).encode({
|
||||||
unknown1: 100,
|
unknown1: 100,
|
||||||
unknown2: 1,
|
unknown2: 1,
|
||||||
@@ -439,9 +439,9 @@ export class PacketHighwayContext {
|
|||||||
},
|
},
|
||||||
clientInfo: {
|
clientInfo: {
|
||||||
clientType: 3,
|
clientType: 3,
|
||||||
appId: "100",
|
appId: '100',
|
||||||
terminalType: 3,
|
terminalType: 3,
|
||||||
clientVer: "1.1.1",
|
clientVer: '1.1.1',
|
||||||
unknown: 4
|
unknown: 4
|
||||||
},
|
},
|
||||||
fileNameInfo: {
|
fileNameInfo: {
|
||||||
@@ -469,7 +469,7 @@ export class PacketHighwayContext {
|
|||||||
ext
|
ext
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.logger.debug(`[Highway] uploadGroupFileReq file exist, don't need upload!`);
|
this.logger.debug('[Highway] uploadGroupFileReq file exist, don\'t need upload!');
|
||||||
}
|
}
|
||||||
file.fileUuid = preRespData.upload.fileId;
|
file.fileUuid = preRespData.upload.fileId;
|
||||||
}
|
}
|
||||||
@@ -482,7 +482,7 @@ export class PacketHighwayContext {
|
|||||||
const res = await this.client.sendOidbPacket(req, true);
|
const res = await this.client.sendOidbPacket(req, true);
|
||||||
const preRespData = trans.UploadPrivateFile.parse(res);
|
const preRespData = trans.UploadPrivateFile.parse(res);
|
||||||
if (!preRespData.upload?.boolFileExist) {
|
if (!preRespData.upload?.boolFileExist) {
|
||||||
this.logger.debug(`[Highway] uploadC2CFileReq file not exist, need upload!`);
|
this.logger.debug('[Highway] uploadC2CFileReq file not exist, need upload!');
|
||||||
const ext = new NapProtoMsg(proto.FileUploadExt).encode({
|
const ext = new NapProtoMsg(proto.FileUploadExt).encode({
|
||||||
unknown1: 100,
|
unknown1: 100,
|
||||||
unknown2: 1,
|
unknown2: 1,
|
||||||
@@ -500,9 +500,9 @@ export class PacketHighwayContext {
|
|||||||
},
|
},
|
||||||
clientInfo: {
|
clientInfo: {
|
||||||
clientType: 3,
|
clientType: 3,
|
||||||
appId: "100",
|
appId: '100',
|
||||||
terminalType: 3,
|
terminalType: 3,
|
||||||
clientVer: "1.1.1",
|
clientVer: '1.1.1',
|
||||||
unknown: 4
|
unknown: 4
|
||||||
},
|
},
|
||||||
fileNameInfo: {
|
fileNameInfo: {
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import crypto from "node:crypto";
|
import crypto from 'node:crypto';
|
||||||
import http from "node:http";
|
import http from 'node:http';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { IHighwayUploader } from "@/core/packet/highway/uploader/highwayUploader";
|
import { IHighwayUploader } from '@/core/packet/highway/uploader/highwayUploader';
|
||||||
import { Frame } from "@/core/packet/highway/frame";
|
import { Frame } from '@/core/packet/highway/frame';
|
||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
export class HighwayHttpUploader extends IHighwayUploader {
|
export class HighwayHttpUploader extends IHighwayUploader {
|
||||||
async upload(): Promise<void> {
|
async upload(): Promise<void> {
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import net from "node:net";
|
import net from 'node:net';
|
||||||
import stream from "node:stream";
|
import stream from 'node:stream';
|
||||||
import crypto from "node:crypto";
|
import crypto from 'node:crypto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { BlockSize } from "@/core/packet/highway/highwayContext";
|
import { BlockSize } from '@/core/packet/highway/highwayContext';
|
||||||
import { Frame } from "@/core/packet/highway/frame";
|
import { Frame } from '@/core/packet/highway/frame';
|
||||||
import { IHighwayUploader } from "@/core/packet/highway/uploader/highwayUploader";
|
import { IHighwayUploader } from '@/core/packet/highway/uploader/highwayUploader';
|
||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
class HighwayTcpUploaderTransform extends stream.Transform {
|
class HighwayTcpUploaderTransform extends stream.Transform {
|
||||||
uploader: HighwayTcpUploader;
|
uploader: HighwayTcpUploader;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import * as tea from "@/core/packet/utils/crypto/tea";
|
import * as tea from '@/core/packet/utils/crypto/tea';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { PacketHighwayTrans } from "@/core/packet/highway/client";
|
import { PacketHighwayTrans } from '@/core/packet/highway/client';
|
||||||
import { PacketLogger } from "@/core/packet/context/loggerContext";
|
import { PacketLogger } from '@/core/packet/context/loggerContext';
|
||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
export abstract class IHighwayUploader {
|
export abstract class IHighwayUploader {
|
||||||
readonly trans: PacketHighwayTrans;
|
readonly trans: PacketHighwayTrans;
|
||||||
@@ -32,7 +32,7 @@ export abstract class IHighwayUploader {
|
|||||||
msgBaseHead: {
|
msgBaseHead: {
|
||||||
version: 1,
|
version: 1,
|
||||||
uin: this.trans.uin,
|
uin: this.trans.uin,
|
||||||
command: "PicUp.DataUp",
|
command: 'PicUp.DataUp',
|
||||||
seq: 0,
|
seq: 0,
|
||||||
retryTimes: 0,
|
retryTimes: 0,
|
||||||
appId: 1600001604,
|
appId: 1600001604,
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { NapProtoEncodeStructType } from "@napneko/nap-proto-core";
|
import { NapProtoEncodeStructType } from '@napneko/nap-proto-core';
|
||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
|
|
||||||
export const int32ip2str = (ip: number) => {
|
export const int32ip2str = (ip: number) => {
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
import * as crypto from "crypto";
|
import * as crypto from 'crypto';
|
||||||
import { PushMsgBody } from "@/core/packet/transformer/proto";
|
import { PushMsgBody } from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoEncodeStructType } from "@napneko/nap-proto-core";
|
import { NapProtoEncodeStructType } from '@napneko/nap-proto-core';
|
||||||
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/message/message";
|
import { PacketMsg, PacketSendMsgElement } from '@/core/packet/message/message';
|
||||||
import { IPacketMsgElement, PacketMsgTextElement } from "@/core/packet/message/element";
|
import { IPacketMsgElement, PacketMsgTextElement } from '@/core/packet/message/element';
|
||||||
import { SendTextElement } from "@/core";
|
import { SendTextElement } from '@/core';
|
||||||
|
|
||||||
export class PacketMsgBuilder {
|
export class PacketMsgBuilder {
|
||||||
protected static failBackText = new PacketMsgTextElement(
|
protected static failBackText = new PacketMsgTextElement(
|
||||||
{
|
{
|
||||||
textElement: { content: "[该消息类型暂不支持查看]" }
|
textElement: { content: '[该消息类型暂不支持查看]' }
|
||||||
} as SendTextElement
|
} as SendTextElement
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ export class PacketMsgBuilder {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
responseHead: {
|
responseHead: {
|
||||||
fromUid: "",
|
fromUid: '',
|
||||||
fromUin: node.senderUin,
|
fromUin: node.senderUin,
|
||||||
toUid: node.groupId ? undefined : selfUid,
|
toUid: node.groupId ? undefined : selfUid,
|
||||||
forward: node.groupId ? undefined : {
|
forward: node.groupId ? undefined : {
|
||||||
|
@@ -15,7 +15,7 @@ import {
|
|||||||
SendStructLongMsgElement,
|
SendStructLongMsgElement,
|
||||||
SendTextElement,
|
SendTextElement,
|
||||||
SendVideoElement
|
SendVideoElement
|
||||||
} from "@/core";
|
} from '@/core';
|
||||||
import {
|
import {
|
||||||
IPacketMsgElement,
|
IPacketMsgElement,
|
||||||
PacketMsgAtElement,
|
PacketMsgAtElement,
|
||||||
@@ -30,8 +30,8 @@ import {
|
|||||||
PacketMsgTextElement,
|
PacketMsgTextElement,
|
||||||
PacketMsgVideoElement,
|
PacketMsgVideoElement,
|
||||||
PacketMultiMsgElement
|
PacketMultiMsgElement
|
||||||
} from "@/core/packet/message/element";
|
} from '@/core/packet/message/element';
|
||||||
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/message/message";
|
import { PacketMsg, PacketSendMsgElement } from '@/core/packet/message/message';
|
||||||
|
|
||||||
const SupportedElementTypes = [
|
const SupportedElementTypes = [
|
||||||
ElementType.TEXT,
|
ElementType.TEXT,
|
||||||
@@ -146,7 +146,7 @@ export class PacketMsgConverter {
|
|||||||
? msg.sendMemberName
|
? msg.sendMemberName
|
||||||
: msg.sendNickName && msg.sendNickName !== ''
|
: msg.sendNickName && msg.sendNickName !== ''
|
||||||
? msg.sendNickName
|
? msg.sendNickName
|
||||||
: "QQ用户",
|
: 'QQ用户',
|
||||||
time: +msg.msgTime,
|
time: +msg.msgTime,
|
||||||
msg: msg.elements.map((element) => {
|
msg: msg.elements.map((element) => {
|
||||||
if (!this.isValidElementType(element.elementType)) return null;
|
if (!this.isValidElementType(element.elementType)) return null;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import * as zlib from "node:zlib";
|
import * as zlib from 'node:zlib';
|
||||||
import { NapProtoEncodeStructType, NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import {
|
import {
|
||||||
CustomFace,
|
CustomFace,
|
||||||
Elem,
|
Elem,
|
||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
OidbSvcTrpcTcp0XE37_800Response,
|
OidbSvcTrpcTcp0XE37_800Response,
|
||||||
FileExtra,
|
FileExtra,
|
||||||
GroupFileExtra
|
GroupFileExtra
|
||||||
} from "@/core/packet/transformer/proto";
|
} from '@/core/packet/transformer/proto';
|
||||||
import {
|
import {
|
||||||
BaseEmojiType,
|
BaseEmojiType,
|
||||||
FaceType,
|
FaceType,
|
||||||
@@ -29,9 +29,9 @@ import {
|
|||||||
SendStructLongMsgElement,
|
SendStructLongMsgElement,
|
||||||
SendTextElement,
|
SendTextElement,
|
||||||
SendVideoElement
|
SendVideoElement
|
||||||
} from "@/core";
|
} from '@/core';
|
||||||
import { ForwardMsgBuilder } from "@/common/forward-msg-builder";
|
import { ForwardMsgBuilder } from '@/common/forward-msg-builder';
|
||||||
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/message/message";
|
import { PacketMsg, PacketSendMsgElement } from '@/core/packet/message/message';
|
||||||
|
|
||||||
// raw <-> packet
|
// raw <-> packet
|
||||||
// TODO: SendStructLongMsgElement
|
// TODO: SendStructLongMsgElement
|
||||||
@@ -153,7 +153,7 @@ export class PacketMsgReplyElement extends IPacketMsgElement<SendReplyElement> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
return "[回复消息]";
|
return '[回复消息]';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,12 +175,12 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
|
|||||||
commonElem: {
|
commonElem: {
|
||||||
serviceType: 37,
|
serviceType: 37,
|
||||||
pbElem: new NapProtoMsg(QBigFaceExtra).encode({
|
pbElem: new NapProtoMsg(QBigFaceExtra).encode({
|
||||||
aniStickerPackId: "1",
|
aniStickerPackId: '1',
|
||||||
aniStickerId: "8",
|
aniStickerId: '8',
|
||||||
faceId: this.faceId,
|
faceId: this.faceId,
|
||||||
sourceType: 1,
|
sourceType: 1,
|
||||||
resultId: this.resultId,
|
resultId: this.resultId,
|
||||||
preview: "",
|
preview: '',
|
||||||
randomType: 1
|
randomType: 1
|
||||||
}),
|
}),
|
||||||
businessType: 1
|
businessType: 1
|
||||||
@@ -198,8 +198,8 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
|
|||||||
serviceType: 33,
|
serviceType: 33,
|
||||||
pbElem: new NapProtoMsg(QSmallFaceExtra).encode({
|
pbElem: new NapProtoMsg(QSmallFaceExtra).encode({
|
||||||
faceId: this.faceId,
|
faceId: this.faceId,
|
||||||
preview: "",
|
preview: '',
|
||||||
preview2: ""
|
preview2: ''
|
||||||
}),
|
}),
|
||||||
businessType: 1
|
businessType: 1
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
return "[表情]";
|
return '[表情]';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ export class PacketMsgVideoElement extends IPacketMsgElement<SendVideoElement> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
return "[视频]";
|
return '[视频]';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ export class PacketMsgPttElement extends IPacketMsgElement<SendPttElement> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
return "[语音]";
|
return '[语音]';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +450,7 @@ export class PacketMsgFileElement extends IPacketMsgElement<SendFileElement> {
|
|||||||
fileSize: BigInt(this.fileSize),
|
fileSize: BigInt(this.fileSize),
|
||||||
fileName: this.fileName,
|
fileName: this.fileName,
|
||||||
fileSha: this.fileSha1,
|
fileSha: this.fileSha1,
|
||||||
extInfoString: "",
|
extInfoString: '',
|
||||||
fileMd5: this.fileMd5,
|
fileMd5: this.fileMd5,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -489,7 +489,7 @@ export class PacketMsgLightAppElement extends IPacketMsgElement<SendArkElement>
|
|||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
return "[卡片消息]";
|
return '[卡片消息]';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,6 +540,6 @@ export class PacketMultiMsgElement extends IPacketMsgElement<SendStructLongMsgEl
|
|||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
return "[聊天记录]";
|
return '[聊天记录]';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { IPacketMsgElement } from "@/core/packet/message/element";
|
import { IPacketMsgElement } from '@/core/packet/message/element';
|
||||||
import { SendMessageElement, SendStructLongMsgElement } from "@/core";
|
import { SendMessageElement, SendStructLongMsgElement } from '@/core';
|
||||||
|
|
||||||
export type PacketSendMsgElement = SendMessageElement | SendStructLongMsgElement
|
export type PacketSendMsgElement = SendMessageElement | SendStructLongMsgElement
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import { AIVoiceChatType } from "@/core/packet/entities/aiChat";
|
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
||||||
|
|
||||||
class FetchAiVoiceList extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0X929D_0Resp> {
|
class FetchAiVoiceList extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0X929D_0Resp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import { AIVoiceChatType } from "@/core/packet/entities/aiChat";
|
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
||||||
|
|
||||||
class GetAiVoice extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0X929B_0Resp> {
|
class GetAiVoice extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0X929B_0Resp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketHexStrBuilder, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketHexStrBuilder, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import { MiniAppReqParams } from "@/core/packet/entities/miniApp";
|
import { MiniAppReqParams } from '@/core/packet/entities/miniApp';
|
||||||
|
|
||||||
class GetMiniAppAdaptShareInfo extends PacketTransformer<typeof proto.MiniAppAdaptShareInfoResp> {
|
class GetMiniAppAdaptShareInfo extends PacketTransformer<typeof proto.MiniAppAdaptShareInfoResp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -23,24 +23,24 @@ class GetMiniAppAdaptShareInfo extends PacketTransformer<typeof proto.MiniAppAda
|
|||||||
templateType: req.templateType,
|
templateType: req.templateType,
|
||||||
businessType: req.businessType,
|
businessType: req.businessType,
|
||||||
picUrl: req.picUrl,
|
picUrl: req.picUrl,
|
||||||
vidUrl: "",
|
vidUrl: '',
|
||||||
jumpUrl: req.jumpUrl,
|
jumpUrl: req.jumpUrl,
|
||||||
iconUrl: req.iconUrl,
|
iconUrl: req.iconUrl,
|
||||||
verType: req.verType,
|
verType: req.verType,
|
||||||
shareType: req.shareType,
|
shareType: req.shareType,
|
||||||
versionId: req.versionId,
|
versionId: req.versionId,
|
||||||
withShareTicket: req.withShareTicket,
|
withShareTicket: req.withShareTicket,
|
||||||
webURL: req.webUrl ?? "",
|
webURL: req.webUrl ?? '',
|
||||||
appidRich: Buffer.alloc(0),
|
appidRich: Buffer.alloc(0),
|
||||||
template: {
|
template: {
|
||||||
templateId: "",
|
templateId: '',
|
||||||
templateData: ""
|
templateData: ''
|
||||||
},
|
},
|
||||||
field20: ""
|
field20: ''
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
cmd: "LightAppSvc.mini_app_share.AdaptShareInfo",
|
cmd: 'LightAppSvc.mini_app_share.AdaptShareInfo',
|
||||||
data: PacketHexStrBuilder(data)
|
data: PacketHexStrBuilder(data)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
class GetStrangerInfo extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XFE1_2RSP> {
|
class GetStrangerInfo extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XFE1_2RSP> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
class GroupSign extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
class GroupSign extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -14,7 +14,7 @@ class GroupSign extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
|||||||
body: {
|
body: {
|
||||||
uin: String(uin),
|
uin: String(uin),
|
||||||
groupUin: String(groupCode),
|
groupUin: String(groupCode),
|
||||||
version: "9.0.90"
|
version: '9.0.90'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
class ImageOCR extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0xE07_0_Response> {
|
class ImageOCR extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0xE07_0_Response> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -16,11 +16,11 @@ class ImageOCR extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0xE07_0_Resp
|
|||||||
entrance: 1,
|
entrance: 1,
|
||||||
ocrReqBody: {
|
ocrReqBody: {
|
||||||
imageUrl: url,
|
imageUrl: url,
|
||||||
originMd5: "",
|
originMd5: '',
|
||||||
afterCompressMd5: "",
|
afterCompressMd5: '',
|
||||||
afterCompressFileSize: "",
|
afterCompressFileSize: '',
|
||||||
afterCompressWeight: "",
|
afterCompressWeight: '',
|
||||||
afterCompressHeight: "",
|
afterCompressHeight: '',
|
||||||
isCut: false,
|
isCut: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
class SendPoke extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
class SendPoke extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
class SetSpecialTitle extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
class SetSpecialTitle extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { NapProtoDecodeStructType } from "@napneko/nap-proto-core";
|
import { NapProtoDecodeStructType } from '@napneko/nap-proto-core';
|
||||||
import { PacketMsgBuilder } from "@/core/packet/message/builder";
|
import { PacketMsgBuilder } from '@/core/packet/message/builder';
|
||||||
|
|
||||||
export type PacketHexStr = string & { readonly hexNya: unique symbol };
|
export type PacketHexStr = string & { readonly hexNya: unique symbol };
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
class DownloadGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6Response> {
|
class DownloadGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6Response> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoEncodeStructType, NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
class DownloadGroupPtt extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
class DownloadGroupPtt extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoEncodeStructType, NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import { IndexNode } from "@/core/packet/transformer/proto";
|
import { IndexNode } from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
class DownloadImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
class DownloadImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
class DownloadOfflineFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XE37Response> {
|
class DownloadOfflineFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XE37Response> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
class DownloadPrivateFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XE37_1200Response> {
|
class DownloadPrivateFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XE37_1200Response> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketHexStrBuilder, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketHexStrBuilder, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
|
|
||||||
class FetchSessionKey extends PacketTransformer<typeof proto.HttpConn0x6ff_501Response> {
|
class FetchSessionKey extends PacketTransformer<typeof proto.HttpConn0x6ff_501Response> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -20,11 +20,11 @@ class FetchSessionKey extends PacketTransformer<typeof proto.HttpConn0x6ff_501Re
|
|||||||
field9: 2,
|
field9: 2,
|
||||||
field10: 9,
|
field10: 9,
|
||||||
field11: 8,
|
field11: 8,
|
||||||
ver: "1.0.1"
|
ver: '1.0.1'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
cmd: "HttpConn.0x6ff_501",
|
cmd: 'HttpConn.0x6ff_501',
|
||||||
data: PacketHexStrBuilder(req)
|
data: PacketHexStrBuilder(req)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import { PacketMsgFileElement } from "@/core/packet/message/element";
|
import { PacketMsgFileElement } from '@/core/packet/message/element';
|
||||||
|
|
||||||
class UploadGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6Response> {
|
class UploadGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6Response> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from "node:crypto";
|
import crypto from 'node:crypto';
|
||||||
import { PacketMsgPicElement } from "@/core/packet/message/element";
|
import { PacketMsgPicElement } from '@/core/packet/message/element';
|
||||||
|
|
||||||
class UploadGroupImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
class UploadGroupImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from "node:crypto";
|
import crypto from 'node:crypto';
|
||||||
import { PacketMsgPttElement } from "@/core/packet/message/element";
|
import { PacketMsgPttElement } from '@/core/packet/message/element';
|
||||||
|
|
||||||
class UploadGroupPtt extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
class UploadGroupPtt extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -57,7 +57,7 @@ class UploadGroupPtt extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
|||||||
compatQMsgSceneType: 2,
|
compatQMsgSceneType: 2,
|
||||||
extBizInfo: {
|
extBizInfo: {
|
||||||
pic: {
|
pic: {
|
||||||
textSummary: "Nya~",
|
textSummary: 'Nya~',
|
||||||
},
|
},
|
||||||
video: {
|
video: {
|
||||||
bytesPbReserve: Buffer.alloc(0),
|
bytesPbReserve: Buffer.alloc(0),
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from "node:crypto";
|
import crypto from 'node:crypto';
|
||||||
import { PacketMsgVideoElement } from "@/core/packet/message/element";
|
import { PacketMsgVideoElement } from '@/core/packet/message/element';
|
||||||
|
|
||||||
class UploadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
class UploadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -11,7 +11,7 @@ class UploadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp>
|
|||||||
}
|
}
|
||||||
|
|
||||||
build(groupUin: number, video: PacketMsgVideoElement): OidbPacket {
|
build(groupUin: number, video: PacketMsgVideoElement): OidbPacket {
|
||||||
if (!video.fileSize || !video.thumbSize) throw new Error("video.fileSize or video.thumbSize is empty");
|
if (!video.fileSize || !video.thumbSize) throw new Error('video.fileSize or video.thumbSize is empty');
|
||||||
const data = new NapProtoMsg(proto.NTV2RichMediaReq).encode({
|
const data = new NapProtoMsg(proto.NTV2RichMediaReq).encode({
|
||||||
reqHead: {
|
reqHead: {
|
||||||
common: {
|
common: {
|
||||||
@@ -37,7 +37,7 @@ class UploadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp>
|
|||||||
fileSize: +video.fileSize,
|
fileSize: +video.fileSize,
|
||||||
fileHash: video.fileMd5,
|
fileHash: video.fileMd5,
|
||||||
fileSha1: video.fileSha1,
|
fileSha1: video.fileSha1,
|
||||||
fileName: "nya.mp4",
|
fileName: 'nya.mp4',
|
||||||
type: {
|
type: {
|
||||||
type: 2,
|
type: 2,
|
||||||
picFormat: 0,
|
picFormat: 0,
|
||||||
@@ -55,7 +55,7 @@ class UploadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp>
|
|||||||
fileSize: +video.thumbSize,
|
fileSize: +video.thumbSize,
|
||||||
fileHash: video.thumbMd5,
|
fileHash: video.thumbMd5,
|
||||||
fileSha1: video.thumbSha1,
|
fileSha1: video.thumbSha1,
|
||||||
fileName: "nya.jpg",
|
fileName: 'nya.jpg',
|
||||||
type: {
|
type: {
|
||||||
type: 1,
|
type: 1,
|
||||||
picFormat: 0,
|
picFormat: 0,
|
||||||
@@ -77,7 +77,7 @@ class UploadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp>
|
|||||||
extBizInfo: {
|
extBizInfo: {
|
||||||
pic: {
|
pic: {
|
||||||
bizType: 0,
|
bizType: 0,
|
||||||
textSummary: "Nya~",
|
textSummary: 'Nya~',
|
||||||
},
|
},
|
||||||
video: {
|
video: {
|
||||||
bytesPbReserve: Buffer.from([0x80, 0x01, 0x00]),
|
bytesPbReserve: Buffer.from([0x80, 0x01, 0x00]),
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import { PacketMsgFileElement } from "@/core/packet/message/element";
|
import { PacketMsgFileElement } from '@/core/packet/message/element';
|
||||||
import { computeMd5AndLengthWithLimit } from "@/core/packet/utils/crypto/hash";
|
import { computeMd5AndLengthWithLimit } from '@/core/packet/utils/crypto/hash';
|
||||||
|
|
||||||
class UploadPrivateFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XE37Response> {
|
class UploadPrivateFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XE37Response> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -21,7 +21,7 @@ class UploadPrivateFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XE
|
|||||||
fileName: file.fileName,
|
fileName: file.fileName,
|
||||||
md510MCheckSum: await computeMd5AndLengthWithLimit(file.filePath, 10 * 1024 * 1024),
|
md510MCheckSum: await computeMd5AndLengthWithLimit(file.filePath, 10 * 1024 * 1024),
|
||||||
sha1CheckSum: file.fileSha1,
|
sha1CheckSum: file.fileSha1,
|
||||||
localPath: "/",
|
localPath: '/',
|
||||||
md5CheckSum: file.fileMd5,
|
md5CheckSum: file.fileMd5,
|
||||||
sha3CheckSum: Buffer.alloc(0)
|
sha3CheckSum: Buffer.alloc(0)
|
||||||
},
|
},
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from "node:crypto";
|
import crypto from 'node:crypto';
|
||||||
import { PacketMsgPicElement } from "@/core/packet/message/element";
|
import { PacketMsgPicElement } from '@/core/packet/message/element';
|
||||||
|
|
||||||
class UploadPrivateImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
class UploadPrivateImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from "node:crypto";
|
import crypto from 'node:crypto';
|
||||||
import { PacketMsgPttElement } from "@/core/packet/message/element";
|
import { PacketMsgPttElement } from '@/core/packet/message/element';
|
||||||
|
|
||||||
class UploadPrivatePtt extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
class UploadPrivatePtt extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -58,7 +58,7 @@ class UploadPrivatePtt extends PacketTransformer<typeof proto.NTV2RichMediaResp>
|
|||||||
compatQMsgSceneType: 1,
|
compatQMsgSceneType: 1,
|
||||||
extBizInfo: {
|
extBizInfo: {
|
||||||
pic: {
|
pic: {
|
||||||
textSummary: "Nya~",
|
textSummary: 'Nya~',
|
||||||
},
|
},
|
||||||
ptt: {
|
ptt: {
|
||||||
bytesReserve: Buffer.from([0x08, 0x00, 0x38, 0x00]),
|
bytesReserve: Buffer.from([0x08, 0x00, 0x38, 0x00]),
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from "node:crypto";
|
import crypto from 'node:crypto';
|
||||||
import { PacketMsgVideoElement } from "@/core/packet/message/element";
|
import { PacketMsgVideoElement } from '@/core/packet/message/element';
|
||||||
|
|
||||||
class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -11,7 +11,7 @@ class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaRes
|
|||||||
}
|
}
|
||||||
|
|
||||||
build(peerUin: string, video: PacketMsgVideoElement): OidbPacket {
|
build(peerUin: string, video: PacketMsgVideoElement): OidbPacket {
|
||||||
if (!video.fileSize || !video.thumbSize) throw new Error("video.fileSize or video.thumbSize is empty");
|
if (!video.fileSize || !video.thumbSize) throw new Error('video.fileSize or video.thumbSize is empty');
|
||||||
const data = new NapProtoMsg(proto.NTV2RichMediaReq).encode({
|
const data = new NapProtoMsg(proto.NTV2RichMediaReq).encode({
|
||||||
reqHead: {
|
reqHead: {
|
||||||
common: {
|
common: {
|
||||||
@@ -38,7 +38,7 @@ class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaRes
|
|||||||
fileSize: +video.fileSize,
|
fileSize: +video.fileSize,
|
||||||
fileHash: video.fileMd5,
|
fileHash: video.fileMd5,
|
||||||
fileSha1: video.fileSha1,
|
fileSha1: video.fileSha1,
|
||||||
fileName: "nya.mp4",
|
fileName: 'nya.mp4',
|
||||||
type: {
|
type: {
|
||||||
type: 2,
|
type: 2,
|
||||||
picFormat: 0,
|
picFormat: 0,
|
||||||
@@ -56,7 +56,7 @@ class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaRes
|
|||||||
fileSize: +video.thumbSize,
|
fileSize: +video.thumbSize,
|
||||||
fileHash: video.thumbMd5,
|
fileHash: video.thumbMd5,
|
||||||
fileSha1: video.thumbSha1,
|
fileSha1: video.thumbSha1,
|
||||||
fileName: "nya.jpg",
|
fileName: 'nya.jpg',
|
||||||
type: {
|
type: {
|
||||||
type: 1,
|
type: 1,
|
||||||
picFormat: 0,
|
picFormat: 0,
|
||||||
@@ -78,7 +78,7 @@ class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaRes
|
|||||||
extBizInfo: {
|
extBizInfo: {
|
||||||
pic: {
|
pic: {
|
||||||
bizType: 0,
|
bizType: 0,
|
||||||
textSummary: "Nya~",
|
textSummary: 'Nya~',
|
||||||
},
|
},
|
||||||
video: {
|
video: {
|
||||||
bytesPbReserve: Buffer.from([0x80, 0x01, 0x00]),
|
bytesPbReserve: Buffer.from([0x80, 0x01, 0x00]),
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import zlib from "node:zlib";
|
import zlib from 'node:zlib';
|
||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketHexStrBuilder, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketHexStrBuilder, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import { PacketMsg } from "@/core/packet/message/message";
|
import { PacketMsg } from '@/core/packet/message/message';
|
||||||
|
|
||||||
class UploadForwardMsg extends PacketTransformer<typeof proto.SendLongMsgResp> {
|
class UploadForwardMsg extends PacketTransformer<typeof proto.SendLongMsgResp> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -14,7 +14,7 @@ class UploadForwardMsg extends PacketTransformer<typeof proto.SendLongMsgResp> {
|
|||||||
const longMsgResultData = new NapProtoMsg(proto.LongMsgResult).encode(
|
const longMsgResultData = new NapProtoMsg(proto.LongMsgResult).encode(
|
||||||
{
|
{
|
||||||
action: {
|
action: {
|
||||||
actionCommand: "MultiMsg",
|
actionCommand: 'MultiMsg',
|
||||||
actionData: {
|
actionData: {
|
||||||
msgBody: msgBody
|
msgBody: msgBody
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ class UploadForwardMsg extends PacketTransformer<typeof proto.SendLongMsgResp> {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
cmd: "trpc.group.long_msg_interface.MsgService.SsoSendLongMsg",
|
cmd: 'trpc.group.long_msg_interface.MsgService.SsoSendLongMsg',
|
||||||
data: PacketHexStrBuilder(req)
|
data: PacketHexStrBuilder(req)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketHexStrBuilder, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketHexStrBuilder, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
|
|
||||||
class OidbBase extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
class OidbBase extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { ScalarType } from "@protobuf-ts/runtime";
|
import { ScalarType } from '@protobuf-ts/runtime';
|
||||||
import { ProtoField } from "@napneko/nap-proto-core";
|
import { ProtoField } from '@napneko/nap-proto-core';
|
||||||
import { ContentHead, MessageBody, MessageControl, RoutingHead } from "@/core/packet/transformer/proto";
|
import { ContentHead, MessageBody, MessageControl, RoutingHead } from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
export const FaceRoamRequest = {
|
export const FaceRoamRequest = {
|
||||||
comm: ProtoField(1, () => PlatInfo, true),
|
comm: ProtoField(1, () => PlatInfo, true),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const MiniAppAdaptShareInfoReq = {
|
export const MiniAppAdaptShareInfoReq = {
|
||||||
appId: ProtoField(2, ScalarType.STRING),
|
appId: ProtoField(2, ScalarType.STRING),
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
import { MsgInfoBody } from "@/core/packet/transformer/proto";
|
import { MsgInfoBody } from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
export const DataHighwayHead = {
|
export const DataHighwayHead = {
|
||||||
version: ProtoField(1, ScalarType.UINT32),
|
version: ProtoField(1, ScalarType.UINT32),
|
||||||
|
@@ -1,32 +1,32 @@
|
|||||||
// action folder
|
// action folder
|
||||||
export * from "./action/action";
|
export * from './action/action';
|
||||||
export * from "./action/miniAppAdaptShareInfo";
|
export * from './action/miniAppAdaptShareInfo';
|
||||||
|
|
||||||
// highway folder
|
// highway folder
|
||||||
export * from "./highway/highway";
|
export * from './highway/highway';
|
||||||
|
|
||||||
// message folder
|
// message folder
|
||||||
export * from "./message/action";
|
export * from './message/action';
|
||||||
export * from "./message/c2c";
|
export * from './message/c2c';
|
||||||
export * from "./message/component";
|
export * from './message/component';
|
||||||
export * from "./message/element";
|
export * from './message/element';
|
||||||
export * from "./message/group";
|
export * from './message/group';
|
||||||
export * from "./message/message";
|
export * from './message/message';
|
||||||
export * from "./message/notify";
|
export * from './message/notify';
|
||||||
export * from "./message/routing";
|
export * from './message/routing';
|
||||||
|
|
||||||
// oidb folder
|
// oidb folder
|
||||||
export * from "./oidb/common/Ntv2.RichMediaReq";
|
export * from './oidb/common/Ntv2.RichMediaReq';
|
||||||
export * from "./oidb/common/Ntv2.RichMediaResp";
|
export * from './oidb/common/Ntv2.RichMediaResp';
|
||||||
export * from "./oidb/Oidb.0x6D6";
|
export * from './oidb/Oidb.0x6D6';
|
||||||
export * from "./oidb/Oidb.0x8FC_2";
|
export * from './oidb/Oidb.0x8FC_2';
|
||||||
export * from "./oidb/Oidb.0x9067_202";
|
export * from './oidb/Oidb.0x9067_202';
|
||||||
export * from "./oidb/Oidb.0x929";
|
export * from './oidb/Oidb.0x929';
|
||||||
export * from "./oidb/Oidb.0xE37_1200";
|
export * from './oidb/Oidb.0xE37_1200';
|
||||||
export * from "./oidb/Oidb.0xE37_1700";
|
export * from './oidb/Oidb.0xE37_1700';
|
||||||
export * from "./oidb/Oidb.0XE37_800";
|
export * from './oidb/Oidb.0XE37_800';
|
||||||
export * from "./oidb/Oidb.0xEB7";
|
export * from './oidb/Oidb.0xEB7';
|
||||||
export * from "./oidb/Oidb.0xED3_1";
|
export * from './oidb/Oidb.0xED3_1';
|
||||||
export * from "./oidb/Oidb.0XFE1_2";
|
export * from './oidb/Oidb.0XFE1_2';
|
||||||
export * from "./oidb/OidbBase";
|
export * from './oidb/OidbBase';
|
||||||
export * from "./oidb/Oidb.0xE07";
|
export * from './oidb/Oidb.0xE07';
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
import { PushMsgBody } from "@/core/packet/transformer/proto";
|
import { PushMsgBody } from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
export const LongMsgResult = {
|
export const LongMsgResult = {
|
||||||
action: ProtoField(2, () => LongMsgAction)
|
action: ProtoField(2, () => LongMsgAction)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const C2C = {
|
export const C2C = {
|
||||||
uin: ProtoField(1, ScalarType.UINT32, true),
|
uin: ProtoField(1, ScalarType.UINT32, true),
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
import { Elem } from "@/core/packet/transformer/proto";
|
import { Elem } from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
export const Attr = {
|
export const Attr = {
|
||||||
codePage: ProtoField(1, ScalarType.INT32),
|
codePage: ProtoField(1, ScalarType.INT32),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const Elem = {
|
export const Elem = {
|
||||||
text: ProtoField(1, () => Text, true),
|
text: ProtoField(1, () => Text, true),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const GroupRecallMsg = {
|
export const GroupRecallMsg = {
|
||||||
type: ProtoField(1, ScalarType.UINT32),
|
type: ProtoField(1, ScalarType.UINT32),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const GroupAdminExtra = {
|
export const GroupAdminExtra = {
|
||||||
adminUid: ProtoField(1, ScalarType.STRING),
|
adminUid: ProtoField(1, ScalarType.STRING),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
import {
|
import {
|
||||||
C2C,
|
C2C,
|
||||||
ForwardHead,
|
ForwardHead,
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
ResponseGrp, RichText,
|
ResponseGrp, RichText,
|
||||||
Trans0X211,
|
Trans0X211,
|
||||||
WPATmp
|
WPATmp
|
||||||
} from "@/core/packet/transformer/proto";
|
} from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
export const ContentHead = {
|
export const ContentHead = {
|
||||||
type: ProtoField(1, ScalarType.UINT32),
|
type: ProtoField(1, ScalarType.UINT32),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const FriendRecall = {
|
export const FriendRecall = {
|
||||||
info: ProtoField(1, () => FriendRecallInfo),
|
info: ProtoField(1, () => FriendRecallInfo),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const ForwardHead = {
|
export const ForwardHead = {
|
||||||
field1: ProtoField(1, ScalarType.UINT32, true),
|
field1: ProtoField(1, ScalarType.UINT32, true),
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
import { OidbSvcTrpcTcp0XE37_800_1200Metadata } from "@/core/packet/transformer/proto";
|
import { OidbSvcTrpcTcp0XE37_800_1200Metadata } from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XE37_800 = {
|
export const OidbSvcTrpcTcp0XE37_800 = {
|
||||||
subCommand: ProtoField(1, ScalarType.UINT32),
|
subCommand: ProtoField(1, ScalarType.UINT32),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XFE1_2 = {
|
export const OidbSvcTrpcTcp0XFE1_2 = {
|
||||||
uin: ProtoField(1, ScalarType.UINT32),
|
uin: ProtoField(1, ScalarType.UINT32),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0x6D6 = {
|
export const OidbSvcTrpcTcp0x6D6 = {
|
||||||
file: ProtoField(1, () => OidbSvcTrpcTcp0x6D6Upload, true),
|
file: ProtoField(1, () => OidbSvcTrpcTcp0x6D6Upload, true),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
|
|
||||||
//设置群头衔 OidbSvcTrpcTcp.0x8fc_2
|
//设置群头衔 OidbSvcTrpcTcp.0x8fc_2
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
import { MultiMediaReqHead } from "./common/Ntv2.RichMediaReq";
|
import { MultiMediaReqHead } from './common/Ntv2.RichMediaReq';
|
||||||
|
|
||||||
//Req
|
//Req
|
||||||
export const OidbSvcTrpcTcp0X9067_202 = {
|
export const OidbSvcTrpcTcp0X9067_202 = {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
import { MsgInfo } from "@/core/packet/transformer/proto";
|
import { MsgInfo } from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0X929D_0 = {
|
export const OidbSvcTrpcTcp0X929D_0 = {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xE07_0 = {
|
export const OidbSvcTrpcTcp0xE07_0 = {
|
||||||
version: ProtoField(1, ScalarType.UINT32),
|
version: ProtoField(1, ScalarType.UINT32),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XE37_1200 = {
|
export const OidbSvcTrpcTcp0XE37_1200 = {
|
||||||
subCommand: ProtoField(1, ScalarType.UINT32, true),
|
subCommand: ProtoField(1, ScalarType.UINT32, true),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XE37_1700 = {
|
export const OidbSvcTrpcTcp0XE37_1700 = {
|
||||||
command: ProtoField(1, ScalarType.UINT32, true),
|
command: ProtoField(1, ScalarType.UINT32, true),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XEB7_Body = {
|
export const OidbSvcTrpcTcp0XEB7_Body = {
|
||||||
uin: ProtoField(1, ScalarType.STRING),
|
uin: ProtoField(1, ScalarType.STRING),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
// Send Poke
|
// Send Poke
|
||||||
export const OidbSvcTrpcTcp0XED3_1 = {
|
export const OidbSvcTrpcTcp0XED3_1 = {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcpBase = {
|
export const OidbSvcTrpcTcpBase = {
|
||||||
command: ProtoField(1, ScalarType.UINT32),
|
command: ProtoField(1, ScalarType.UINT32),
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
|
|
||||||
export const NTV2RichMediaReq = {
|
export const NTV2RichMediaReq = {
|
||||||
ReqHead: ProtoField(1, () => MultiMediaReqHead),
|
ReqHead: ProtoField(1, () => MultiMediaReqHead),
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { ProtoField, ScalarType } from "@napneko/nap-proto-core";
|
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
||||||
import { CommonHead, MsgInfo, PicUrlExtInfo, VideoExtInfo } from "@/core/packet/transformer/proto";
|
import { CommonHead, MsgInfo, PicUrlExtInfo, VideoExtInfo } from '@/core/packet/transformer/proto';
|
||||||
|
|
||||||
|
|
||||||
export const NTV2RichMediaResp = {
|
export const NTV2RichMediaResp = {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as proto from "@/core/packet/transformer/proto";
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from "@napneko/nap-proto-core";
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { OidbPacket, PacketTransformer } from "@/core/packet/transformer/base";
|
import { OidbPacket, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
import OidbBase from "@/core/packet/transformer/oidb/oidbBase";
|
import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
class FetchRkey extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0X9067_202_Rsp_Body> {
|
class FetchRkey extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0X9067_202_Rsp_Body> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import * as stream from 'stream';
|
import * as stream from 'stream';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { CalculateStreamBytesTransform } from "@/core/packet/utils/crypto/sha1StreamBytesTransform";
|
import { CalculateStreamBytesTransform } from '@/core/packet/utils/crypto/sha1StreamBytesTransform';
|
||||||
|
|
||||||
function sha1Stream(readable: stream.Readable) {
|
function sha1Stream(readable: stream.Readable) {
|
||||||
return new Promise<Buffer>((resolve, reject) => {
|
return new Promise<Buffer>((resolve, reject) => {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import * as stream from "node:stream";
|
import * as stream from 'node:stream';
|
||||||
import { Sha1Stream } from "@/core/packet/utils/crypto/sha1Stream";
|
import { Sha1Stream } from '@/core/packet/utils/crypto/sha1Stream';
|
||||||
|
|
||||||
export class CalculateStreamBytesTransform extends stream.Transform {
|
export class CalculateStreamBytesTransform extends stream.Transform {
|
||||||
private readonly blockSize = 1024 * 1024;
|
private readonly blockSize = 1024 * 1024;
|
||||||
|
@@ -4,12 +4,12 @@ import {
|
|||||||
MiniAppRawData,
|
MiniAppRawData,
|
||||||
MiniAppReqCustomParams,
|
MiniAppReqCustomParams,
|
||||||
MiniAppReqTemplateParams
|
MiniAppReqTemplateParams
|
||||||
} from "@/core/packet/entities/miniApp";
|
} from '@/core/packet/entities/miniApp';
|
||||||
|
|
||||||
type MiniAppTemplateNameList = "bili" | "weibo";
|
type MiniAppTemplateNameList = 'bili' | 'weibo';
|
||||||
|
|
||||||
export abstract class MiniAppInfo {
|
export abstract class MiniAppInfo {
|
||||||
static readonly sdkId: string = "V1_PC_MINISDK_99.99.99_1_APP_A";
|
static readonly sdkId: string = 'V1_PC_MINISDK_99.99.99_1_APP_A';
|
||||||
template: MiniAppReqTemplateParams;
|
template: MiniAppReqTemplateParams;
|
||||||
|
|
||||||
private static readonly appMap = new Map<MiniAppTemplateNameList, MiniAppInfo>();
|
private static readonly appMap = new Map<MiniAppTemplateNameList, MiniAppInfo>();
|
||||||
@@ -26,17 +26,17 @@ export abstract class MiniAppInfo {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
sdkId: MiniAppInfo.sdkId,
|
sdkId: MiniAppInfo.sdkId,
|
||||||
appId: "1109937557",
|
appId: '1109937557',
|
||||||
scene: 1,
|
scene: 1,
|
||||||
templateType: 1,
|
templateType: 1,
|
||||||
businessType: 0,
|
businessType: 0,
|
||||||
verType: 3,
|
verType: 3,
|
||||||
shareType: 0,
|
shareType: 0,
|
||||||
versionId: "cfc5f7b05b44b5956502edaecf9d2240",
|
versionId: 'cfc5f7b05b44b5956502edaecf9d2240',
|
||||||
withShareTicket: 0,
|
withShareTicket: 0,
|
||||||
iconUrl: "https://miniapp.gtimg.cn/public/appicon/51f90239b78a2e4994c11215f4c4ba15_200.jpg"
|
iconUrl: 'https://miniapp.gtimg.cn/public/appicon/51f90239b78a2e4994c11215f4c4ba15_200.jpg'
|
||||||
});
|
});
|
||||||
MiniAppInfo.appMap.set("bili", this);
|
MiniAppInfo.appMap.set('bili', this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -44,17 +44,17 @@ export abstract class MiniAppInfo {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
sdkId: MiniAppInfo.sdkId,
|
sdkId: MiniAppInfo.sdkId,
|
||||||
appId: "1109224783",
|
appId: '1109224783',
|
||||||
scene: 1,
|
scene: 1,
|
||||||
templateType: 1,
|
templateType: 1,
|
||||||
businessType: 0,
|
businessType: 0,
|
||||||
verType: 3,
|
verType: 3,
|
||||||
shareType: 0,
|
shareType: 0,
|
||||||
versionId: "e482a3cc4e574d9b772e96ba6eec9ba2",
|
versionId: 'e482a3cc4e574d9b772e96ba6eec9ba2',
|
||||||
withShareTicket: 0,
|
withShareTicket: 0,
|
||||||
iconUrl: "https://miniapp.gtimg.cn/public/appicon/35bbb44dc68e65194cfacfb206b8f1f7_200.jpg"
|
iconUrl: 'https://miniapp.gtimg.cn/public/appicon/35bbb44dc68e65194cfacfb206b8f1f7_200.jpg'
|
||||||
});
|
});
|
||||||
MiniAppInfo.appMap.set("weibo", this);
|
MiniAppInfo.appMap.set('weibo', this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ export class MiniAppInfoHelper {
|
|||||||
view: rawData.appView,
|
view: rawData.appView,
|
||||||
meta: rawData.metaData,
|
meta: rawData.metaData,
|
||||||
miniappShareOrigin: 3,
|
miniappShareOrigin: 3,
|
||||||
miniappOpenRefer: "10002",
|
miniappOpenRefer: '10002',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { GeneralCallResult } from "./common";
|
import { GeneralCallResult } from './common';
|
||||||
|
|
||||||
export interface NodeIKernelMSFService {
|
export interface NodeIKernelMSFService {
|
||||||
getServerTime(): string;
|
getServerTime(): string;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { NodeIO3MiscListener } from "@/core/listeners/NodeIO3MiscListener";
|
import { NodeIO3MiscListener } from '@/core/listeners/NodeIO3MiscListener';
|
||||||
|
|
||||||
export interface NodeIO3MiscService {
|
export interface NodeIO3MiscService {
|
||||||
get(): NodeIO3MiscService;
|
get(): NodeIO3MiscService;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ElementType, MessageElement, NTGrayTipElementSubTypeV2, PicSubType, PicType, TipAioOpGrayTipElement, TipGroupElement, NTVideoType, FaceType } from "./msg";
|
import { ElementType, MessageElement, NTGrayTipElementSubTypeV2, PicSubType, PicType, TipAioOpGrayTipElement, TipGroupElement, NTVideoType, FaceType } from './msg';
|
||||||
|
|
||||||
type ElementFullBase = Omit<MessageElement, 'elementType' | 'elementId' | 'extBufForUI'>;
|
type ElementFullBase = Omit<MessageElement, 'elementType' | 'elementId' | 'extBufForUI'>;
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { GetPacketStatusDepends } from "@/onebot/action/packet/GetPacketStatus";
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { AIVoiceChatType } from "@/core/packet/entities/aiChat";
|
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
||||||
import { Type, Static } from '@sinclair/typebox';
|
import { Type, Static } from '@sinclair/typebox';
|
||||||
|
|
||||||
const SchemaData = Type.Object({
|
const SchemaData = Type.Object({
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { GetPacketStatusDepends } from "@/onebot/action/packet/GetPacketStatus";
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { MiniAppInfo, MiniAppInfoHelper } from "@/core/packet/utils/helper/miniAppHelper";
|
import { MiniAppInfo, MiniAppInfoHelper } from '@/core/packet/utils/helper/miniAppHelper';
|
||||||
import { MiniAppData, MiniAppRawData, MiniAppReqCustomParams, MiniAppReqParams } from "@/core/packet/entities/miniApp";
|
import { MiniAppData, MiniAppRawData, MiniAppReqCustomParams, MiniAppReqParams } from '@/core/packet/entities/miniApp';
|
||||||
import { Static, Type } from '@sinclair/typebox';
|
import { Static, Type } from '@sinclair/typebox';
|
||||||
|
|
||||||
const SchemaData = Type.Union([
|
const SchemaData = Type.Union([
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { GetPacketStatusDepends } from "@/onebot/action/packet/GetPacketStatus";
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
|
|
||||||
export class GetRkey extends GetPacketStatusDepends<void, Array<any>> {
|
export class GetRkey extends GetPacketStatusDepends<void, Array<any>> {
|
||||||
actionName = ActionName.GetRkey;
|
actionName = ActionName.GetRkey;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user