feat: 统一并标准化eslint

This commit is contained in:
时瑾 2025-11-03 12:39:26 +08:00
parent d5b8f886d6
commit 2889a9f8db
No known key found for this signature in database
GPG Key ID: 023F70A1B8F8C196
55 changed files with 3935 additions and 3441 deletions

View File

@ -15,7 +15,7 @@ charset = utf-8
# 4 space indentation # 4 space indentation
[*.{cjs,mjs,js,jsx,ts,tsx,css,scss,sass,html,json}] [*.{cjs,mjs,js,jsx,ts,tsx,css,scss,sass,html,json}]
indent_style = space indent_style = space
indent_size = 4 indent_size = 2
[*.bat] [*.bat]
charset = latin1 charset = latin1

View File

@ -1,10 +0,0 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"arrowParens": "always",
"printWidth": 120,
"endOfLine": "auto"
}

28
.vscode/settings.json vendored
View File

@ -3,15 +3,35 @@
"explorer.fileNesting.expand": false, "explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": { "explorer.fileNesting.patterns": {
".env.universal": ".env.*", ".env.universal": ".env.*",
"tsconfig.json": "tsconfig.*.json, env.d.ts, vite.config.ts", "vite.config.ts": "vite*.ts",
"README.md": "CODE_OF_CONDUCT.md, RELEASES.md, CONTRIBUTING.md, CHANGELOG.md, SECURITY.md",
"tsconfig.json": "tsconfig.*.json, env.d.ts",
"package.json": "package-lock.json, eslint*, .prettier*, .editorconfig, manifest.json, logo.png, .gitignore, LICENSE" "package.json": "package-lock.json, eslint*, .prettier*, .editorconfig, manifest.json, logo.png, .gitignore, LICENSE"
}, },
"css.customData": [ "css.customData": [
".vscode/tailwindcss.json" ".vscode/tailwindcss.json"
], ],
"editor.formatOnPaste": false, "editor.detectIndentation": false,
"editor.formatOnSave": false, "editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.formatOnType": false,
"editor.formatOnPaste": true,
"editor.formatOnSaveMode": "file",
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": "never" "source.fixAll.eslint": "always"
}, },
"files.autoSave": "onFocusChange",
"javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single",
"javascript.format.semicolons": "insert",
"typescript.format.semicolons": "insert",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"typescript.format.insertSpaceBeforeFunctionParenthesis": true,
"typescript.format.insertSpaceAfterConstructor": true,
"javascript.format.insertSpaceAfterConstructor": true,
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.importModuleSpecifierEnding": "minimal",
"javascript.preferences.importModuleSpecifier": "non-relative",
"javascript.preferences.importModuleSpecifierEnding": "minimal",
"typescript.disableAutomaticTypeAcquisition": true,
} }

View File

@ -1,32 +1,43 @@
import eslint from '@eslint/js'; import neostandard from 'neostandard';
import tsEslintPlugin from '@typescript-eslint/eslint-plugin';
import tsEslintParser from '@typescript-eslint/parser';
import globals from "globals";
const customTsFlatConfig = [ /** 尾随逗号 */
{ const commaDangle = val => {
name: 'typescript-eslint/base', if (val?.rules?.['@stylistic/comma-dangle']?.[0] === 'warn') {
languageOptions: { const rule = val?.rules?.['@stylistic/comma-dangle']?.[1];
parser: tsEslintParser, Object.keys(rule).forEach(key => {
sourceType: 'module', rule[key] = 'always-multiline';
globals: { });
...globals.browser, val.rules['@stylistic/comma-dangle'][1] = rule;
...globals.node, }
NodeJS: 'readonly', // 添加 NodeJS 全局变量
}, /** 三元表达式 */
}, if (val?.rules?.['@stylistic/indent']) {
files: ['**/*.{ts,tsx}'], val.rules['@stylistic/indent'][2] = {
rules: { ...val.rules?.['@stylistic/indent']?.[2],
...tsEslintPlugin.configs.recommended.rules, flatTernaryExpressions: true,
'quotes': ['error', 'single'], // 使用单引号 offsetTernaryExpressions: false,
'semi': ['error', 'always'], // 强制使用分号 };
'indent': ['error', 4], // 使用 4 空格缩进 }
},
plugins: { /** 支持下划线 - 禁用 camelcase 规则 */
'@typescript-eslint': tsEslintPlugin, if (val?.rules?.camelcase) {
}, val.rules.camelcase = 'off';
ignores: ['src/webui/**'], // 忽略 src/webui/ 目录所有文件 }
},
return val;
};
/** 忽略的文件 */
const ignores = [
'node_modules',
'**/dist/**',
'launcher',
]; ];
export default [eslint.configs.recommended, ...customTsFlatConfig]; const options = neostandard({
ts: true,
ignores,
semi: true, // 强制使用分号
}).map(commaDangle);
export default options;

View File

@ -1,7 +0,0 @@
dist
*.md
*.html
yarn.lock
package-lock.json
node_modules
pnpm-lock.yaml

View File

@ -1,23 +0,0 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"semi": false,
"trailingComma": "none",
"bracketSpacing": true,
"importOrder": [
"<THIRD_PARTY_MODULES>",
"^@/const/(.*)$",
"^@/store/(.*)$",
"^@/components/(.*)$",
"^@/contexts/(.*)$",
"^@/hooks/(.*)$",
"^@/utils/(.*)$",
"^@/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"plugins": ["@trivago/prettier-plugin-sort-imports"]
}

View File

@ -1,91 +0,0 @@
import eslint_js from '@eslint/js'
import tsEslintPlugin from '@typescript-eslint/eslint-plugin'
import tsEslintParser from '@typescript-eslint/parser'
import eslintConfigPrettier from 'eslint-config-prettier'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import reactPlugin from 'eslint-plugin-react'
import reactHooksPlugin from 'eslint-plugin-react-hooks'
import globals from 'globals'
const customTsFlatConfig = [
{
name: 'typescript-eslint/base',
languageOptions: {
parser: tsEslintParser,
sourceType: 'module'
},
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
rules: {
...tsEslintPlugin.configs.recommended.rules
},
plugins: {
'@typescript-eslint': tsEslintPlugin
}
}
]
export default [
eslint_js.configs.recommended,
eslintPluginPrettierRecommended,
...customTsFlatConfig,
{
name: 'global config',
languageOptions: {
globals: {
...globals.es2022,
...globals.browser,
...globals.node
},
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false
}
},
rules: {
'prettier/prettier': 'error',
'no-unused-vars': 'off',
'no-undef': 'off',
//关闭不能再promise中使用ansyc
'no-async-promise-executor': 'off',
//关闭不能再常量中使用??
'no-constant-binary-expression': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-unused-vars': 'off',
//禁止失去精度的字面数字
'@typescript-eslint/no-loss-of-precision': 'off',
//禁止使用any
'@typescript-eslint/no-explicit-any': 'error'
}
},
{
ignores: ['**/node_modules', '**/dist', '**/output']
},
{
name: 'react-eslint',
files: ['src/*.{js,jsx,mjs,cjs,ts,tsx}'],
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin
},
languageOptions: {
...reactPlugin.configs.recommended.languageOptions
},
rules: {
...reactPlugin.configs.recommended.rules,
'react/react-in-jsx-scope': 'off'
},
settings: {
react: {
// 需要显示安装 react
version: 'detect'
}
}
},
{
languageOptions: { globals: { ...globals.browser, ...globals.node } }
},
eslintConfigPrettier
]

View File

@ -86,7 +86,6 @@
"zod": "^3.24.1" "zod": "^3.24.1"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.19.0",
"@react-types/shared": "^3.26.0", "@react-types/shared": "^3.26.0",
"@trivago/prettier-plugin-sort-imports": "^5.2.2", "@trivago/prettier-plugin-sort-imports": "^5.2.2",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
@ -97,20 +96,14 @@
"@types/react": "^19.0.8", "@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3", "@types/react-dom": "^19.0.3",
"@types/react-window": "^1.8.8", "@types/react-window": "^1.8.8",
"@typescript-eslint/eslint-plugin": "^8.22.0",
"@typescript-eslint/parser": "^8.22.0",
"@vitejs/plugin-react": "^4.3.4", "@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"eslint": "^9.19.0", "eslint": "^9.19.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-import": "^2.31.0", "eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "5.2.3", "eslint-plugin-prettier": "5.2.3",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-unused-imports": "^4.1.4", "eslint-plugin-unused-imports": "^4.1.4",
"globals": "^15.14.0",
"postcss": "^8.5.1", "postcss": "^8.5.1",
"prettier": "^3.4.2", "prettier": "^3.4.2",
"typescript": "^5.7.3", "typescript": "^5.7.3",

View File

@ -1,69 +1,69 @@
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react';
// 全局图片缓存 // 全局图片缓存
const imageCache = new Map<string, HTMLImageElement>() const imageCache = new Map<string, HTMLImageElement>();
export function usePreloadImages(urls: string[]) { export function usePreloadImages (urls: string[]) {
const [loadedUrls, setLoadedUrls] = useState<Record<string, boolean>>({}) const [loadedUrls, setLoadedUrls] = useState<Record<string, boolean>>({});
const [isLoading, setIsLoading] = useState(true) const [isLoading, setIsLoading] = useState(true);
const isMounted = useRef(true) const isMounted = useRef(true);
useEffect(() => { useEffect(() => {
isMounted.current = true isMounted.current = true;
// 检查是否所有图片都已缓存 // 检查是否所有图片都已缓存
const allCached = urls.every((url) => imageCache.has(url)) const allCached = urls.every((url) => imageCache.has(url));
if (allCached) { if (allCached) {
setLoadedUrls(urls.reduce((acc, url) => ({ ...acc, [url]: true }), {})) setLoadedUrls(urls.reduce((acc, url) => ({ ...acc, [url]: true }), {}));
setIsLoading(false) setIsLoading(false);
return return;
} }
setIsLoading(true) setIsLoading(true);
const loadedImages: Record<string, boolean> = {} const loadedImages: Record<string, boolean> = {};
let pendingCount = urls.length let pendingCount = urls.length;
urls.forEach((url) => { urls.forEach((url) => {
// 如果已经缓存,直接标记为已加载 // 如果已经缓存,直接标记为已加载
if (imageCache.has(url)) { if (imageCache.has(url)) {
loadedImages[url] = true loadedImages[url] = true;
pendingCount-- pendingCount--;
if (pendingCount === 0) { if (pendingCount === 0) {
setLoadedUrls(loadedImages) setLoadedUrls(loadedImages);
setIsLoading(false) setIsLoading(false);
} }
return return;
} }
const img = new Image() const img = new Image();
img.onload = () => { img.onload = () => {
if (!isMounted.current) return if (!isMounted.current) return;
loadedImages[url] = true loadedImages[url] = true;
imageCache.set(url, img) imageCache.set(url, img);
pendingCount-- pendingCount--;
if (pendingCount === 0) { if (pendingCount === 0) {
setLoadedUrls(loadedImages) setLoadedUrls(loadedImages);
setIsLoading(false) setIsLoading(false);
} }
} };
img.onerror = () => { img.onerror = () => {
if (!isMounted.current) return if (!isMounted.current) return;
loadedImages[url] = false loadedImages[url] = false;
pendingCount-- pendingCount--;
if (pendingCount === 0) { if (pendingCount === 0) {
setLoadedUrls(loadedImages) setLoadedUrls(loadedImages);
setIsLoading(false) setIsLoading(false);
} }
} };
img.src = url img.src = url;
}) });
return () => { return () => {
isMounted.current = false isMounted.current = false;
} };
}, [urls]) }, [urls]);
return { loadedUrls, isLoading } return { loadedUrls, isLoading };
} }

View File

@ -1,25 +1,25 @@
import { createElement } from 'react' import { createElement } from 'react';
import ShowStructedMessage from '@/components/chat_input/components/show_structed_message' import ShowStructedMessage from '@/components/chat_input/components/show_structed_message';
import { OB11Segment } from '@/types/onebot' import { OB11Segment } from '@/types/onebot';
import useDialog from './use-dialog' import useDialog from './use-dialog';
const useShowStructuredMessage = () => { const useShowStructuredMessage = () => {
const dialog = useDialog() const dialog = useDialog();
const showStructuredMessage = (messages: OB11Segment[]) => { const showStructuredMessage = (messages: OB11Segment[]) => {
dialog.alert({ dialog.alert({
title: '消息内容', title: '消息内容',
size: '3xl', size: '3xl',
content: createElement(ShowStructedMessage, { content: createElement(ShowStructedMessage, {
messages: messages messages,
}) }),
}) });
} };
return showStructuredMessage return showStructuredMessage;
} };
export default useShowStructuredMessage export default useShowStructuredMessage;

1015
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,12 @@
"dev:shell": "vite build --mode shell", "dev:shell": "vite build --mode shell",
"dev:shell-analysis": "vite build --mode shell-analysis", "dev:shell-analysis": "vite build --mode shell-analysis",
"dev:webui": "cd napcat.webui && npm run dev", "dev:webui": "cd napcat.webui && npm run dev",
"lint": "eslint --fix src/**/*.{js,ts,vue}", "lint": "npm run lint:core && npm run lint:webui",
"lint:fix": "npm run lint:fix:core && npm run lint:fix:webui",
"lint:core": "eslint src/**/*.{js,ts}",
"lint:fix:core": "eslint --fix src/**/*.{js,ts,vue}",
"lint:webui": "cd napcat.webui && eslint src/**/*.{js,ts}",
"lint:fix:webui": "cd napcat.webui && eslint --fix src/**/*.{js,ts,tsx}",
"depend": "cd dist && npm install --omit=dev", "depend": "cd dist && npm install --omit=dev",
"dev:depend": "npm i && cd napcat.webui && npm i" "dev:depend": "npm i && cd napcat.webui && npm i"
}, },
@ -24,9 +29,6 @@
"@babel/preset-typescript": "^7.24.7", "@babel/preset-typescript": "^7.24.7",
"@babel/traverse": "^7.28.0", "@babel/traverse": "^7.28.0",
"@babel/types": "^7.28.2", "@babel/types": "^7.28.2",
"@eslint/compat": "^1.3.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.33.0",
"@homebridge/node-pty-prebuilt-multiarch": "^0.12.0-beta.5", "@homebridge/node-pty-prebuilt-multiarch": "^0.12.0-beta.5",
"@log4js-node/log4js-api": "^1.0.2", "@log4js-node/log4js-api": "^1.0.2",
"@napneko/nap-proto-core": "^0.0.4", "@napneko/nap-proto-core": "^0.0.4",
@ -42,8 +44,6 @@
"@types/react-color": "^3.0.13", "@types/react-color": "^3.0.13",
"@types/type-is": "^1.6.7", "@types/type-is": "^1.6.7",
"@types/ws": "^8.5.12", "@types/ws": "^8.5.12",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.39.0",
"ajv": "^8.13.0", "ajv": "^8.13.0",
"async-mutex": "^0.5.0", "async-mutex": "^0.5.0",
"commander": "^13.0.0", "commander": "^13.0.0",
@ -51,15 +51,13 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"esbuild": "0.25.8", "esbuild": "0.25.8",
"eslint": "^9.14.0", "eslint": "^9.14.0",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"express-rate-limit": "^7.5.0", "express-rate-limit": "^7.5.0",
"fast-xml-parser": "^4.3.6", "fast-xml-parser": "^4.3.6",
"file-type": "^21.0.0", "file-type": "^21.0.0",
"globals": "^16.0.0",
"json5": "^2.2.3", "json5": "^2.2.3",
"multer": "^2.0.1", "multer": "^2.0.1",
"napcat.protobuf": "^1.1.4", "napcat.protobuf": "^1.1.4",
"neostandard": "^0.12.2",
"typescript": "^5.3.3", "typescript": "^5.3.3",
"typescript-eslint": "^8.35.1", "typescript-eslint": "^8.35.1",
"vite": "^7.1.1", "vite": "^7.1.1",

File diff suppressed because it is too large Load Diff

View File

@ -6,70 +6,70 @@ 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> {
const controller = new AbortController(); const controller = new AbortController();
const { signal } = controller; const { signal } = controller;
const upload = (async () => { const upload = (async () => {
let offset = 0; let offset = 0;
for await (const chunk of this.trans.data) { for await (const chunk of this.trans.data) {
if (signal.aborted) { if (signal.aborted) {
throw new Error('Upload aborted due to timeout'); throw new Error('Upload aborted due to timeout');
} }
const block = chunk as Buffer; const block = chunk as Buffer;
try { try {
await this.uploadBlock(block, offset); await this.uploadBlock(block, offset);
} catch (err) { } catch (err) {
throw new Error(`[Highway] httpUpload Error uploading block at offset ${offset}: ${err}`); throw new Error(`[Highway] httpUpload Error uploading block at offset ${offset}: ${err}`);
} }
offset += block.length; offset += block.length;
} }
})(); })();
const timeout = this.timeout().catch((err) => { const timeout = this.timeout().catch((err) => {
controller.abort(); controller.abort();
throw new Error(err.message); throw new Error(err.message);
}); });
await Promise.race([upload, timeout]); await Promise.race([upload, timeout]);
} }
private async uploadBlock(block: Buffer, offset: number): Promise<void> { private async uploadBlock (block: Buffer, offset: number): Promise<void> {
const chunkMD5 = crypto.createHash('md5').update(block).digest(); const chunkMD5 = crypto.createHash('md5').update(block).digest();
const payload = this.buildPicUpHead(offset, block.length, chunkMD5); const payload = this.buildPicUpHead(offset, block.length, chunkMD5);
const frame = Frame.pack(Buffer.from(payload), block); const frame = Frame.pack(Buffer.from(payload), block);
const resp = await this.httpPostHighwayContent(frame, `http://${this.trans.server}:${this.trans.port}/cgi-bin/httpconn?htcmd=0x6FF0087&uin=${this.trans.uin}`); const resp = await this.httpPostHighwayContent(frame, `http://${this.trans.server}:${this.trans.port}/cgi-bin/httpconn?htcmd=0x6FF0087&uin=${this.trans.uin}`);
const [head, body] = Frame.unpack(resp); const [head, body] = Frame.unpack(resp);
const headData = new NapProtoMsg(proto.RespDataHighwayHead).decode(head); const headData = new NapProtoMsg(proto.RespDataHighwayHead).decode(head);
this.logger.debug(`[Highway] httpUploadBlock: ${headData.errorCode} | ${headData.msgSegHead?.retCode} | ${headData.bytesRspExtendInfo} | ${head.toString('hex')} | ${body.toString('hex')}`); this.logger.debug(`[Highway] httpUploadBlock: ${headData.errorCode} | ${headData.msgSegHead?.retCode} | ${headData.bytesRspExtendInfo} | ${head.toString('hex')} | ${body.toString('hex')}`);
if (headData.errorCode !== 0) throw new Error(`[Highway] httpUploadBlock failed (code=${headData.errorCode})`); if (headData.errorCode !== 0) throw new Error(`[Highway] httpUploadBlock failed (code=${headData.errorCode})`);
} }
private async httpPostHighwayContent(frame: Buffer, serverURL: string): Promise<Buffer> { private async httpPostHighwayContent (frame: Buffer, serverURL: string): Promise<Buffer> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
const options: http.RequestOptions = { const options: http.RequestOptions = {
method: 'POST', method: 'POST',
headers: { headers: {
'Connection': 'keep-alive', Connection: 'keep-alive',
'Accept-Encoding': 'identity', 'Accept-Encoding': 'identity',
'User-Agent': 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2)', 'User-Agent': 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2)',
'Content-Length': frame.length.toString(), 'Content-Length': frame.length.toString(),
}, },
}; };
const req = http.request(serverURL, options, (res) => { const req = http.request(serverURL, options, (res) => {
const data: Buffer[] = []; const data: Buffer[] = [];
res.on('data', (chunk) => { res.on('data', (chunk) => {
data.push(chunk); data.push(chunk);
}); });
res.on('end', () => { res.on('end', () => {
resolve(Buffer.concat(data)); resolve(Buffer.concat(data));
}); });
});
req.write(frame);
req.on('error', (error: Error) => {
reject(error);
});
} catch (error: unknown) {
reject(new Error((error as Error).message));
}
}); });
} req.write(frame);
req.on('error', (error: Error) => {
reject(error);
});
} catch (error: unknown) {
reject(new Error((error as Error).message));
}
});
}
} }

View File

@ -8,80 +8,79 @@ 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;
offset: number; offset: number;
constructor(uploader: HighwayTcpUploader) { constructor (uploader: HighwayTcpUploader) {
super(); super();
this.uploader = uploader; this.uploader = uploader;
this.offset = 0; this.offset = 0;
} }
// eslint-disable-next-line no-undef override _transform (data: Buffer, _: BufferEncoding, callback: stream.TransformCallback) {
override _transform(data: Buffer, _: BufferEncoding, callback: stream.TransformCallback) { let chunkOffset = 0;
let chunkOffset = 0; while (chunkOffset < data.length) {
while (chunkOffset < data.length) { const chunkSize = Math.min(BlockSize, data.length - chunkOffset);
const chunkSize = Math.min(BlockSize, data.length - chunkOffset); const chunk = data.subarray(chunkOffset, chunkOffset + chunkSize);
const chunk = data.subarray(chunkOffset, chunkOffset + chunkSize); const chunkMd5 = crypto.createHash('md5').update(chunk).digest();
const chunkMd5 = crypto.createHash('md5').update(chunk).digest(); const head = this.uploader.buildPicUpHead(this.offset, chunk.length, chunkMd5);
const head = this.uploader.buildPicUpHead(this.offset, chunk.length, chunkMd5); chunkOffset += chunk.length;
chunkOffset += chunk.length; this.offset += chunk.length;
this.offset += chunk.length; this.push(Frame.pack(Buffer.from(head), chunk));
this.push(Frame.pack(Buffer.from(head), chunk));
}
callback(null);
} }
callback(null);
}
} }
export class HighwayTcpUploader extends IHighwayUploader { export class HighwayTcpUploader extends IHighwayUploader {
async upload(): Promise<void> { async upload (): Promise<void> {
const controller = new AbortController(); const controller = new AbortController();
const { signal } = controller; const { signal } = controller;
const upload = new Promise<void>((resolve, reject) => { const upload = new Promise<void>((resolve, reject) => {
const highwayTransForm = new HighwayTcpUploaderTransform(this); const highwayTransForm = new HighwayTcpUploaderTransform(this);
const socket = net.connect(this.trans.port, this.trans.server, () => { const socket = net.connect(this.trans.port, this.trans.server, () => {
this.trans.data.pipe(highwayTransForm).pipe(socket, { end: false }); this.trans.data.pipe(highwayTransForm).pipe(socket, { end: false });
}); });
const handleRspHeader = (header: Buffer) => { const handleRspHeader = (header: Buffer) => {
const rsp = new NapProtoMsg(proto.RespDataHighwayHead).decode(header); const rsp = new NapProtoMsg(proto.RespDataHighwayHead).decode(header);
if (rsp.errorCode !== 0) { if (rsp.errorCode !== 0) {
socket.end(); socket.end();
reject(new Error(`[Highway] tcpUpload failed (code=${rsp.errorCode})`)); reject(new Error(`[Highway] tcpUpload failed (code=${rsp.errorCode})`));
} }
const percent = ((Number(rsp.msgSegHead?.dataOffset) + Number(rsp.msgSegHead?.dataLength)) / Number(rsp.msgSegHead?.filesize)).toFixed(2); const percent = ((Number(rsp.msgSegHead?.dataOffset) + Number(rsp.msgSegHead?.dataLength)) / Number(rsp.msgSegHead?.filesize)).toFixed(2);
this.logger.debug(`[Highway] tcpUpload ${rsp.errorCode} | ${percent} | ${Buffer.from(header).toString('hex')}`); this.logger.debug(`[Highway] tcpUpload ${rsp.errorCode} | ${percent} | ${Buffer.from(header).toString('hex')}`);
if (Number(rsp.msgSegHead?.dataOffset) + Number(rsp.msgSegHead?.dataLength) >= Number(rsp.msgSegHead?.filesize)) { if (Number(rsp.msgSegHead?.dataOffset) + Number(rsp.msgSegHead?.dataLength) >= Number(rsp.msgSegHead?.filesize)) {
this.logger.debug('[Highway] tcpUpload finished.'); this.logger.debug('[Highway] tcpUpload finished.');
socket.end(); socket.end();
resolve(); resolve();
} }
}; };
socket.on('data', (chunk: Buffer) => { socket.on('data', (chunk: Buffer) => {
if (signal.aborted) { if (signal.aborted) {
socket.end(); socket.end();
reject(new Error('Upload aborted due to timeout')); reject(new Error('Upload aborted due to timeout'));
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const [head, _] = Frame.unpack(chunk); const [head, _] = Frame.unpack(chunk);
handleRspHeader(head); handleRspHeader(head);
}); });
socket.on('close', () => { socket.on('close', () => {
this.logger.debug('[Highway] tcpUpload socket closed.'); this.logger.debug('[Highway] tcpUpload socket closed.');
resolve(); resolve();
}); });
socket.on('error', (err) => { socket.on('error', (err) => {
socket.end(); socket.end();
reject(new Error(`[Highway] tcpUpload socket.on error: ${err}`)); reject(new Error(`[Highway] tcpUpload socket.on error: ${err}`));
}); });
this.trans.data.on('error', (err) => { this.trans.data.on('error', (err) => {
socket.end(); socket.end();
reject(new Error(`[Highway] tcpUpload readable error: ${err}`)); reject(new Error(`[Highway] tcpUpload readable error: ${err}`));
}); });
}); });
const timeout = this.timeout().catch((err) => { const timeout = this.timeout().catch((err) => {
controller.abort(); controller.abort();
throw new Error(err.message); throw new Error(err.message);
}); });
await Promise.race([upload, timeout]); await Promise.race([upload, timeout]);
} }
} }

View File

@ -5,59 +5,59 @@ 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;
readonly logger: PacketLogger; readonly logger: PacketLogger;
constructor(trans: PacketHighwayTrans, logger: PacketLogger) { constructor (trans: PacketHighwayTrans, logger: PacketLogger) {
this.trans = trans; this.trans = trans;
this.logger = logger; this.logger = logger;
} }
private encryptTransExt(key: Uint8Array) { private encryptTransExt (key: Uint8Array) {
if (!this.trans.encrypt) return; if (!this.trans.encrypt) return;
this.trans.ext = tea.encrypt(Buffer.from(this.trans.ext), Buffer.from(key)); this.trans.ext = tea.encrypt(Buffer.from(this.trans.ext), Buffer.from(key));
} }
protected timeout(): Promise<void> { protected timeout (): Promise<void> {
return new Promise<void>((_, reject) => { return new Promise<void>((_, reject) => {
setTimeout(() => { setTimeout(() => {
reject(new Error(`[Highway] timeout after ${this.trans.timeout}s`)); reject(new Error(`[Highway] timeout after ${this.trans.timeout}s`));
}, (this.trans.timeout ?? Infinity) * 1000 }, (this.trans.timeout ?? Infinity) * 1000
); );
}); });
} }
buildPicUpHead(offset: number, bodyLength: number, bodyMd5: Uint8Array): Uint8Array { buildPicUpHead (offset: number, bodyLength: number, bodyMd5: Uint8Array): Uint8Array {
return new NapProtoMsg(proto.ReqDataHighwayHead).encode({ return new NapProtoMsg(proto.ReqDataHighwayHead).encode({
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,
dataFlag: 16, dataFlag: 16,
commandId: this.trans.cmd, commandId: this.trans.cmd,
}, },
msgSegHead: { msgSegHead: {
serviceId: 0, serviceId: 0,
filesize: BigInt(this.trans.size), filesize: BigInt(this.trans.size),
dataOffset: BigInt(offset), dataOffset: BigInt(offset),
dataLength: bodyLength, dataLength: bodyLength,
serviceTicket: this.trans.ticket, serviceTicket: this.trans.ticket,
md5: bodyMd5, md5: bodyMd5,
fileMd5: this.trans.sum, fileMd5: this.trans.sum,
cacheAddr: 0, cacheAddr: 0,
cachePort: 0, cachePort: 0,
}, },
bytesReqExtendInfo: this.trans.ext, bytesReqExtendInfo: this.trans.ext,
timestamp: BigInt(0), timestamp: BigInt(0),
msgLoginSigHead: { msgLoginSigHead: {
uint32LoginSigType: 8, uint32LoginSigType: 8,
appId: 1600001604, appId: 1600001604,
} },
}); });
} }
abstract upload(): Promise<void>; abstract upload (): Promise<void>;
} }

View File

@ -6,61 +6,65 @@ import { IPacketMsgElement, PacketMsgTextElement } from '@/core/packet/message/e
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
); );
buildFakeMsg(selfUid: string, element: PacketMsg[]): NapProtoEncodeStructType<typeof PushMsgBody>[] { buildFakeMsg (selfUid: string, element: PacketMsg[]): NapProtoEncodeStructType<typeof PushMsgBody>[] {
return element.map((node): NapProtoEncodeStructType<typeof PushMsgBody> => { return element.map((node): NapProtoEncodeStructType<typeof PushMsgBody> => {
const avatar = `https://q.qlogo.cn/headimg_dl?dst_uin=${node.senderUin}&spec=640&img_type=jpg`; const avatar = `https://q.qlogo.cn/headimg_dl?dst_uin=${node.senderUin}&spec=640&img_type=jpg`;
const msgContent = node.msg.reduceRight((acc: undefined | Uint8Array, msg: IPacketMsgElement<PacketSendMsgElement>) => { const msgContent = node.msg.reduceRight((acc: undefined | Uint8Array, msg: IPacketMsgElement<PacketSendMsgElement>) => {
return acc ?? msg.buildContent(); return acc ?? msg.buildContent();
}, undefined); }, undefined);
const msgElement = node.msg.flatMap(msg => msg.buildElement() ?? []); const msgElement = node.msg.flatMap(msg => msg.buildElement() ?? []);
if (!msgContent && !msgElement.length) { if (!msgContent && !msgElement.length) {
msgElement.push(PacketMsgBuilder.failBackText.buildElement()); msgElement.push(PacketMsgBuilder.failBackText.buildElement());
}
return {
responseHead: {
fromUin: node.senderUin,
type: 0,
sigMap: 0,
toUin: 0,
fromUid: '',
forward: node.groupId
? undefined
: {
friendName: node.senderName,
},
toUid: node.groupId ? undefined : selfUid,
grp: node.groupId
? {
groupUin: node.groupId,
memberName: node.senderName,
unknown5: 2,
} }
return { : undefined,
responseHead: { },
fromUin: node.senderUin, contentHead: {
type: 0, type: node.groupId ? 82 : 9,
sigMap: 0, subType: node.groupId ? undefined : 4,
toUin: 0, divSeq: node.groupId ? undefined : 4,
fromUid: '', autoReply: 0,
forward: node.groupId ? undefined : { sequence: crypto.randomBytes(4).readUInt32LE(0),
friendName: node.senderName, timeStamp: +node.time.toString().substring(0, 10),
}, forward: {
toUid: node.groupId ? undefined : selfUid, field1: 0,
grp: node.groupId ? { field2: 0,
groupUin: node.groupId, field3: node.groupId ? 1 : 2,
memberName: node.senderName, unknownBase64: avatar,
unknown5: 2 avatar,
} : undefined, },
}, },
contentHead: { body: {
type: node.groupId ? 82 : 9, richText: {
subType: node.groupId ? undefined : 4, elems: msgElement,
divSeq: node.groupId ? undefined : 4, },
autoReply: 0, msgContent,
sequence: crypto.randomBytes(4).readUInt32LE(0), },
timeStamp: +node.time.toString().substring(0, 10), };
forward: { });
field1: 0, }
field2: 0,
field3: node.groupId ? 1 : 2,
unknownBase64: avatar,
avatar: avatar
}
},
body: {
richText: {
elems: msgElement
},
msgContent: msgContent,
}
};
});
}
} }

View File

@ -1,170 +1,170 @@
import { import {
ChatType, ChatType,
ElementType, ElementType,
MessageElement, MessageElement,
Peer, Peer,
RawMessage, RawMessage,
SendArkElement, SendArkElement,
SendFaceElement, SendFaceElement,
SendFileElement, SendFileElement,
SendMarkdownElement, SendMarkdownElement,
SendMarketFaceElement, SendMarketFaceElement,
SendMultiForwardMsgElement, SendMultiForwardMsgElement,
SendPicElement, SendPicElement,
SendPttElement, SendPttElement,
SendReplyElement, SendReplyElement,
SendTextElement, SendTextElement,
SendVideoElement SendVideoElement,
} from '@/core'; } from '@/core';
import { import {
IPacketMsgElement, IPacketMsgElement,
PacketMsgAtElement, PacketMsgAtElement,
PacketMsgFaceElement, PacketMsgFaceElement,
PacketMsgFileElement, PacketMsgFileElement,
PacketMsgLightAppElement, PacketMsgLightAppElement,
PacketMsgMarkDownElement, PacketMsgMarkDownElement,
PacketMsgMarkFaceElement, PacketMsgMarkFaceElement,
PacketMsgPicElement, PacketMsgPicElement,
PacketMsgPttElement, PacketMsgPttElement,
PacketMsgReplyElement, PacketMsgReplyElement,
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';
import {NapProtoDecodeStructType} from '@napneko/nap-proto-core'; import { NapProtoDecodeStructType } from '@napneko/nap-proto-core';
import {Elem} from '@/core/packet/transformer/proto'; import { Elem } from '@/core/packet/transformer/proto';
const SupportedElementTypes = [ const SupportedElementTypes = [
ElementType.TEXT, ElementType.TEXT,
ElementType.PIC, ElementType.PIC,
ElementType.REPLY, ElementType.REPLY,
ElementType.FACE, ElementType.FACE,
ElementType.MFACE, ElementType.MFACE,
ElementType.VIDEO, ElementType.VIDEO,
ElementType.FILE, ElementType.FILE,
ElementType.PTT, ElementType.PTT,
ElementType.ARK, ElementType.ARK,
ElementType.MARKDOWN, ElementType.MARKDOWN,
ElementType.MULTIFORWARD ElementType.MULTIFORWARD,
]; ];
type SendMessageTypeElementMap = { type SendMessageTypeElementMap = {
[ElementType.TEXT]: SendTextElement, [ElementType.TEXT]: SendTextElement,
[ElementType.PIC]: SendPicElement, [ElementType.PIC]: SendPicElement,
[ElementType.FILE]: SendFileElement, [ElementType.FILE]: SendFileElement,
[ElementType.PTT]: SendPttElement, [ElementType.PTT]: SendPttElement,
[ElementType.VIDEO]: SendVideoElement, [ElementType.VIDEO]: SendVideoElement,
[ElementType.FACE]: SendFaceElement, [ElementType.FACE]: SendFaceElement,
[ElementType.REPLY]: SendReplyElement, [ElementType.REPLY]: SendReplyElement,
[ElementType.ARK]: SendArkElement, [ElementType.ARK]: SendArkElement,
[ElementType.MFACE]: SendMarketFaceElement, [ElementType.MFACE]: SendMarketFaceElement,
[ElementType.MULTIFORWARD]: SendMultiForwardMsgElement, [ElementType.MULTIFORWARD]: SendMultiForwardMsgElement,
[ElementType.MARKDOWN]: SendMarkdownElement, [ElementType.MARKDOWN]: SendMarkdownElement,
}; };
type ElementToPacketMsgConverters = { type ElementToPacketMsgConverters = {
[K in keyof SendMessageTypeElementMap]: ( [K in keyof SendMessageTypeElementMap]: (
sendElement: MessageElement sendElement: MessageElement
) => IPacketMsgElement<SendMessageTypeElementMap[K]>; ) => IPacketMsgElement<SendMessageTypeElementMap[K]>;
} };
export type rawMsgWithSendMsg = { export type rawMsgWithSendMsg = {
senderUin: number; senderUin: number;
senderUid?: string; senderUid?: string;
senderName: string; senderName: string;
groupId?: number; groupId?: number;
time: number; time: number;
msg: PacketSendMsgElement[] msg: PacketSendMsgElement[]
} };
// TODO: make it become adapter? // TODO: make it become adapter?
export class PacketMsgConverter { export class PacketMsgConverter {
private isValidElementType(type: ElementType): type is keyof ElementToPacketMsgConverters { private isValidElementType (type: ElementType): type is keyof ElementToPacketMsgConverters {
return SupportedElementTypes.includes(type); return SupportedElementTypes.includes(type);
} }
private readonly rawToPacketMsgConverters: ElementToPacketMsgConverters = { private readonly rawToPacketMsgConverters: ElementToPacketMsgConverters = {
[ElementType.TEXT]: (element) => { [ElementType.TEXT]: (element) => {
if (element.textElement?.atType) { if (element.textElement?.atType) {
return new PacketMsgAtElement(element as SendTextElement); return new PacketMsgAtElement(element as SendTextElement);
} }
return new PacketMsgTextElement(element as SendTextElement); return new PacketMsgTextElement(element as SendTextElement);
}, },
[ElementType.PIC]: (element) => { [ElementType.PIC]: (element) => {
return new PacketMsgPicElement(element as SendPicElement); return new PacketMsgPicElement(element as SendPicElement);
}, },
[ElementType.REPLY]: (element) => { [ElementType.REPLY]: (element) => {
return new PacketMsgReplyElement(element as SendReplyElement); return new PacketMsgReplyElement(element as SendReplyElement);
}, },
[ElementType.FACE]: (element) => { [ElementType.FACE]: (element) => {
return new PacketMsgFaceElement(element as SendFaceElement); return new PacketMsgFaceElement(element as SendFaceElement);
}, },
[ElementType.MFACE]: (element) => { [ElementType.MFACE]: (element) => {
return new PacketMsgMarkFaceElement(element as SendMarketFaceElement); return new PacketMsgMarkFaceElement(element as SendMarketFaceElement);
}, },
[ElementType.VIDEO]: (element) => { [ElementType.VIDEO]: (element) => {
return new PacketMsgVideoElement(element as SendVideoElement); return new PacketMsgVideoElement(element as SendVideoElement);
}, },
[ElementType.FILE]: (element) => { [ElementType.FILE]: (element) => {
return new PacketMsgFileElement(element as SendFileElement); return new PacketMsgFileElement(element as SendFileElement);
}, },
[ElementType.PTT]: (element) => { [ElementType.PTT]: (element) => {
return new PacketMsgPttElement(element as SendPttElement); return new PacketMsgPttElement(element as SendPttElement);
}, },
[ElementType.ARK]: (element) => { [ElementType.ARK]: (element) => {
return new PacketMsgLightAppElement(element as SendArkElement); return new PacketMsgLightAppElement(element as SendArkElement);
}, },
[ElementType.MARKDOWN]: (element) => { [ElementType.MARKDOWN]: (element) => {
return new PacketMsgMarkDownElement(element as SendMarkdownElement); return new PacketMsgMarkDownElement(element as SendMarkdownElement);
}, },
[ElementType.MULTIFORWARD]: (element) => { [ElementType.MULTIFORWARD]: (element) => {
return new PacketMultiMsgElement(element as SendMultiForwardMsgElement); return new PacketMultiMsgElement(element as SendMultiForwardMsgElement);
} },
};
rawMsgWithSendMsgToPacketMsg (msg: rawMsgWithSendMsg): PacketMsg {
return {
senderUid: msg.senderUid ?? '',
senderUin: msg.senderUin,
senderName: msg.senderName,
groupId: msg.groupId,
time: msg.time,
msg: msg.msg.map((element) => {
if (!this.isValidElementType(element.elementType)) return null;
return this.rawToPacketMsgConverters[element.elementType](element as MessageElement);
}).filter((e) => e !== null),
}; };
}
rawMsgWithSendMsgToPacketMsg(msg: rawMsgWithSendMsg): PacketMsg { rawMsgToPacketMsg (msg: RawMessage, ctxPeer: Peer): PacketMsg {
return { return {
senderUid: msg.senderUid ?? '', seq: +msg.msgSeq,
senderUin: msg.senderUin, groupId: ctxPeer.chatType === ChatType.KCHATTYPEGROUP ? +msg.peerUid : undefined,
senderName: msg.senderName, senderUid: msg.senderUid,
groupId: msg.groupId, senderUin: +msg.senderUin,
time: msg.time, senderName: msg.sendMemberName && msg.sendMemberName !== ''
msg: msg.msg.map((element) => { ? msg.sendMemberName
if (!this.isValidElementType(element.elementType)) return null; : msg.sendNickName && msg.sendNickName !== ''
return this.rawToPacketMsgConverters[element.elementType](element as MessageElement); ? msg.sendNickName
}).filter((e) => e !== null) : 'QQ用户',
}; time: +msg.msgTime,
} msg: msg.elements.map((element) => {
if (!this.isValidElementType(element.elementType)) return null;
return this.rawToPacketMsgConverters[element.elementType](element);
}).filter((e) => e !== null),
};
}
rawMsgToPacketMsg(msg: RawMessage, ctxPeer: Peer): PacketMsg { packetMsgToRaw (msg: NapProtoDecodeStructType<typeof Elem>[]): [MessageElement, NapProtoDecodeStructType<typeof Elem> | null][] {
return { const converters = [PacketMsgTextElement.parseElement,
seq: +msg.msgSeq, PacketMsgAtElement.parseElement, PacketMsgReplyElement.parseElement, PacketMsgPicElement.parseElement];
groupId: ctxPeer.chatType === ChatType.KCHATTYPEGROUP ? +msg.peerUid : undefined, return msg.map((element) => {
senderUid: msg.senderUid, for (const converter of converters) {
senderUin: +msg.senderUin, const result = converter(element);
senderName: msg.sendMemberName && msg.sendMemberName !== '' if (result) return result;
? msg.sendMemberName }
: msg.sendNickName && msg.sendNickName !== '' return null;
? msg.sendNickName }).filter((e) => e !== null);
: 'QQ用户', }
time: +msg.msgTime,
msg: msg.elements.map((element) => {
if (!this.isValidElementType(element.elementType)) return null;
return this.rawToPacketMsgConverters[element.elementType](element);
}).filter((e) => e !== null)
};
}
packetMsgToRaw(msg: NapProtoDecodeStructType<typeof Elem>[]): [MessageElement, NapProtoDecodeStructType<typeof Elem> | null][] {
const converters = [PacketMsgTextElement.parseElement,
PacketMsgAtElement.parseElement, PacketMsgReplyElement.parseElement, PacketMsgPicElement.parseElement];
return msg.map((element) => {
for (const converter of converters) {
const result = converter(element);
if (result) return result;
}
return null;
}).filter((e) => e !== null);
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,15 @@
import { IPacketMsgElement } from '@/core/packet/message/element'; import { IPacketMsgElement } from '@/core/packet/message/element';
import {SendMessageElement, SendMultiForwardMsgElement} from '@/core'; import { SendMessageElement, SendMultiForwardMsgElement } from '@/core';
export type PacketSendMsgElement = SendMessageElement | SendMultiForwardMsgElement export type PacketSendMsgElement = SendMessageElement | SendMultiForwardMsgElement;
export interface PacketMsg { export interface PacketMsg {
seq?: number; seq?: number;
clientSeq?: number; clientSeq?: number;
groupId?: number; groupId?: number;
senderUid: string; senderUid: string;
senderUin: number; senderUin: number;
senderName: string; senderName: string;
time: number; time: number;
msg: IPacketMsgElement<PacketSendMsgElement>[] msg: IPacketMsgElement<PacketSendMsgElement>[]
} }

View File

@ -5,27 +5,27 @@ 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 () {
super(); super();
} }
build(groupUin: number, voiceId: string, text: string, sessionId: number, chatType: AIVoiceChatType): OidbPacket { build (groupUin: number, voiceId: string, text: string, sessionId: number, chatType: AIVoiceChatType): OidbPacket {
const data = new NapProtoMsg(proto.OidbSvcTrpcTcp0X929B_0).encode({ const data = new NapProtoMsg(proto.OidbSvcTrpcTcp0X929B_0).encode({
groupUin: groupUin, groupUin,
voiceId: voiceId, voiceId,
text: text, text,
chatType: chatType, chatType,
session: { session: {
sessionId: sessionId sessionId,
} },
}); });
return OidbBase.build(0x929B, 0, data); return OidbBase.build(0x929B, 0, data);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.OidbSvcTrpcTcp0X929B_0Resp).decode(oidbBody); return new NapProtoMsg(proto.OidbSvcTrpcTcp0X929B_0Resp).decode(oidbBody);
} }
} }
export default new GetAiVoice(); export default new GetAiVoice();

View File

@ -4,50 +4,50 @@ import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/core/packet/t
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 () {
super(); super();
} }
build(req: MiniAppReqParams): OidbPacket { build (req: MiniAppReqParams): OidbPacket {
const data = new NapProtoMsg(proto.MiniAppAdaptShareInfoReq).encode({ const data = new NapProtoMsg(proto.MiniAppAdaptShareInfoReq).encode({
appId: req.sdkId, appId: req.sdkId,
body: { body: {
extInfo: { extInfo: {
field2: Buffer.alloc(0) field2: Buffer.alloc(0),
}, },
appid: req.appId, appid: req.appId,
title: req.title, title: req.title,
desc: req.desc, desc: req.desc,
time: BigInt(Date.now()), time: BigInt(Date.now()),
scene: req.scene, scene: req.scene,
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: PacketBufBuilder(data) data: PacketBufBuilder(data),
}; };
} }
parse(data: Buffer) { parse (data: Buffer) {
return new NapProtoMsg(proto.MiniAppAdaptShareInfoResp).decode(data); return new NapProtoMsg(proto.MiniAppAdaptShareInfoResp).decode(data);
} }
} }
export default new GetMiniAppAdaptShareInfo(); export default new GetMiniAppAdaptShareInfo();

View File

@ -4,22 +4,22 @@ 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 () {
super(); super();
} }
build(uin: number): OidbPacket { build (uin: number): OidbPacket {
const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0XFE1_2).encode({ const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0XFE1_2).encode({
uin: uin, uin,
key: [{ key: 27372 }] key: [{ key: 27372 }],
}); });
return OidbBase.build(0XFE1, 2, body); return OidbBase.build(0XFE1, 2, body);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.OidbSvcTrpcTcp0XFE1_2RSP).decode(oidbBody); return new NapProtoMsg(proto.OidbSvcTrpcTcp0XFE1_2RSP).decode(oidbBody);
} }
} }
export default new GetStrangerInfo(); export default new GetStrangerInfo();

View File

@ -4,34 +4,34 @@ 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 () {
super(); super();
} }
build(url: string): OidbPacket { build (url: string): OidbPacket {
const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0xE07_0).encode( const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0xE07_0).encode(
{ {
version: 1, version: 1,
client: 0, client: 0,
entrance: 1, entrance: 1,
ocrReqBody: { ocrReqBody: {
imageUrl: url, imageUrl: url,
originMd5: '', originMd5: '',
afterCompressMd5: '', afterCompressMd5: '',
afterCompressFileSize: '', afterCompressFileSize: '',
afterCompressWeight: '', afterCompressWeight: '',
afterCompressHeight: '', afterCompressHeight: '',
isCut: false, isCut: false,
} },
} }
); );
return OidbBase.build(0XEB7, 1, body, false, false); return OidbBase.build(0XEB7, 1, body, false, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const base = OidbBase.parse(data); const base = OidbBase.parse(data);
return new NapProtoMsg(proto.OidbSvcTrpcTcp0xE07_0_Response).decode(base.body); return new NapProtoMsg(proto.OidbSvcTrpcTcp0xE07_0_Response).decode(base.body);
} }
} }
export default new ImageOCR(); export default new ImageOCR();

View File

@ -4,32 +4,32 @@ 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 MoveGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6Response> { class MoveGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6Response> {
constructor() { constructor () {
super(); super();
} }
build(groupUin: number, fileUUID: string, currentParentDirectory: string, targetParentDirectory: string): OidbPacket { build (groupUin: number, fileUUID: string, currentParentDirectory: string, targetParentDirectory: string): OidbPacket {
const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6).encode({ const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6).encode({
move: { move: {
groupUin: groupUin, groupUin,
appId: 5, appId: 5,
busId: 102, busId: 102,
fileId: fileUUID, fileId: fileUUID,
parentDirectory: currentParentDirectory, parentDirectory: currentParentDirectory,
targetDirectory: targetParentDirectory, targetDirectory: targetParentDirectory,
} },
}); });
return OidbBase.build(0x6D6, 5, body, true, false); return OidbBase.build(0x6D6, 5, body, true, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
const res = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6Response).decode(oidbBody); const res = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6Response).decode(oidbBody);
if (res.move.retCode !== 0) { if (res.move.retCode !== 0) {
throw new Error(`sendGroupFileMoveReq error: ${res.move.clientWording} (code=${res.move.retCode})`); throw new Error(`sendGroupFileMoveReq error: ${res.move.clientWording} (code=${res.move.retCode})`);
}
return res;
} }
return res;
}
} }
export default new MoveGroupFile(); export default new MoveGroupFile();

View File

@ -4,31 +4,31 @@ 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 RenameGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6Response> { class RenameGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6Response> {
constructor() { constructor () {
super(); super();
} }
build(groupUin: number, fileUUID: string, currentParentDirectory: string, newName: string): OidbPacket { build (groupUin: number, fileUUID: string, currentParentDirectory: string, newName: string): OidbPacket {
const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6).encode({ const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6).encode({
rename: { rename: {
groupUin: groupUin, groupUin,
busId: 102, busId: 102,
fileId: fileUUID, fileId: fileUUID,
parentFolder: currentParentDirectory, parentFolder: currentParentDirectory,
newFileName: newName, newFileName: newName,
} },
}); });
return OidbBase.build(0x6D6, 4, body, true, false); return OidbBase.build(0x6D6, 4, body, true, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
const res = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6Response).decode(oidbBody); const res = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6Response).decode(oidbBody);
if (res.rename.retCode !== 0) { if (res.rename.retCode !== 0) {
throw new Error(`sendGroupFileRenameReq error: ${res.rename.clientWording} (code=${res.rename.retCode})`); throw new Error(`sendGroupFileRenameReq error: ${res.rename.clientWording} (code=${res.rename.retCode})`);
}
return res;
} }
return res;
}
} }
export default new RenameGroupFile(); export default new RenameGroupFile();

View File

@ -4,30 +4,30 @@ 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 () {
super(); super();
} }
build(groupUin: number, fileUUID: string): OidbPacket { build (groupUin: number, fileUUID: string): OidbPacket {
const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6).encode({ const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6).encode({
download: { download: {
groupUin: groupUin, groupUin,
appId: 7, appId: 7,
busId: 102, busId: 102,
fileId: fileUUID fileId: fileUUID,
} },
}); });
return OidbBase.build(0x6D6, 2, body, true, false); return OidbBase.build(0x6D6, 2, body, true, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
const res = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6Response).decode(oidbBody); const res = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6Response).decode(oidbBody);
if (res.download.retCode !== 0) { if (res.download.retCode !== 0) {
throw new Error(`sendGroupFileDownloadReq error: ${res.download.clientWording} (code=${res.download.retCode})`); throw new Error(`sendGroupFileDownloadReq error: ${res.download.clientWording} (code=${res.download.retCode})`);
}
return res;
} }
return res;
}
} }
export default new DownloadGroupFile(); export default new DownloadGroupFile();

View File

@ -5,46 +5,46 @@ import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
import { IndexNode } from '@/core/packet/transformer/proto'; import { IndexNode } from '@/core/packet/transformer/proto';
class DownloadGroupImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> { class DownloadGroupImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
constructor() { constructor () {
super(); super();
} }
build(group_uin: number, node: NapProtoEncodeStructType<typeof IndexNode>): OidbPacket { build (group_uin: number, node: NapProtoEncodeStructType<typeof IndexNode>): OidbPacket {
const body = new NapProtoMsg(proto.NTV2RichMediaReq).encode({ const body = new NapProtoMsg(proto.NTV2RichMediaReq).encode({
reqHead: { reqHead: {
common: { common: {
requestId: 1, requestId: 1,
command: 200 command: 200,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
businessType: 1, businessType: 1,
sceneType: 2, sceneType: 2,
group: { group: {
groupUin: group_uin groupUin: group_uin,
} },
}, },
client: { client: {
agentType: 2, agentType: 2,
} },
}, },
download: { download: {
node: node, node,
download: { download: {
video: { video: {
busiType: 0, busiType: 0,
sceneType: 0 sceneType: 0,
} },
} },
} },
}); });
return OidbBase.build(0x11C4, 200, body, true, false); return OidbBase.build(0x11C4, 200, body, true, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody); return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody);
} }
} }
export default new DownloadGroupImage(); export default new DownloadGroupImage();

View File

@ -5,46 +5,46 @@ import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
import { IndexNode } from '@/core/packet/transformer/proto'; import { IndexNode } from '@/core/packet/transformer/proto';
class DownloadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp> { class DownloadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
constructor() { constructor () {
super(); super();
} }
build(groupUin: number, node: NapProtoEncodeStructType<typeof IndexNode>): OidbPacket { build (groupUin: number, node: NapProtoEncodeStructType<typeof IndexNode>): OidbPacket {
const body = new NapProtoMsg(proto.NTV2RichMediaReq).encode({ const body = new NapProtoMsg(proto.NTV2RichMediaReq).encode({
reqHead: { reqHead: {
common: { common: {
requestId: 1, requestId: 1,
command: 200 command: 200,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
businessType: 2, businessType: 2,
sceneType: 2, sceneType: 2,
group: { group: {
groupUin: groupUin groupUin,
} },
}, },
client: { client: {
agentType: 2, agentType: 2,
} },
}, },
download: { download: {
node: node, node,
download: { download: {
video: { video: {
busiType: 0, busiType: 0,
sceneType: 0 sceneType: 0,
} },
} },
} },
}); });
return OidbBase.build(0x11EA, 200, body, true, false); return OidbBase.build(0x11EA, 200, body, true, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody); return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody);
} }
} }
export default new DownloadGroupVideo(); export default new DownloadGroupVideo();

View File

@ -5,47 +5,47 @@ 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 () {
super(); super();
} }
build(selfUid: string, node: NapProtoEncodeStructType<typeof IndexNode>): OidbPacket { build (selfUid: string, node: NapProtoEncodeStructType<typeof IndexNode>): OidbPacket {
const body = new NapProtoMsg(proto.NTV2RichMediaReq).encode({ const body = new NapProtoMsg(proto.NTV2RichMediaReq).encode({
reqHead: { reqHead: {
common: { common: {
requestId: 1, requestId: 1,
command: 200 command: 200,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
businessType: 1, businessType: 1,
sceneType: 1, sceneType: 1,
c2C: { c2C: {
accountType: 2, accountType: 2,
targetUid: selfUid targetUid: selfUid,
}, },
}, },
client: { client: {
agentType: 2, agentType: 2,
} },
}, },
download: { download: {
node: node, node,
download: { download: {
video: { video: {
busiType: 0, busiType: 0,
sceneType: 0 sceneType: 0,
} },
} },
} },
}); });
return OidbBase.build(0x11C5, 200, body, true, false); return OidbBase.build(0x11C5, 200, body, true, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody); return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody);
} }
} }
export default new DownloadImage(); export default new DownloadImage();

View File

@ -4,32 +4,32 @@ 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 () {
super(); super();
} }
build(fileUUID: string, fileHash: string, senderUid: string, receiverUid: string): OidbPacket { build (fileUUID: string, fileHash: string, senderUid: string, receiverUid: string): OidbPacket {
const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37_800).encode({ const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37_800).encode({
subCommand: 800, subCommand: 800,
field2: 0, field2: 0,
body: { body: {
senderUid: senderUid, senderUid,
receiverUid: receiverUid, receiverUid,
fileUuid: fileUUID, fileUuid: fileUUID,
fileHash: fileHash, fileHash,
}, },
field101: 3, field101: 3,
field102: 1, field102: 1,
field200: 1, field200: 1,
}); });
return OidbBase.build(0xE37, 800, body, false, false); return OidbBase.build(0xE37, 800, body, false, false);
} }
// TODO:check // TODO:check
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37Response).decode(oidbBody); return new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37Response).decode(oidbBody);
} }
} }
export default new DownloadOfflineFile(); export default new DownloadOfflineFile();

View File

@ -4,33 +4,33 @@ 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 () {
super(); super();
} }
build(selfUid: string, fileUUID: string, fileHash: string): OidbPacket { build (selfUid: string, fileUUID: string, fileHash: string): OidbPacket {
const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37_1200).encode({ const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37_1200).encode({
subCommand: 1200, subCommand: 1200,
field2: 1, field2: 1,
body: { body: {
receiverUid: selfUid, receiverUid: selfUid,
fileUuid: fileUUID, fileUuid: fileUUID,
type: 2, type: 2,
fileHash: fileHash, fileHash,
t2: 0 t2: 0,
}, },
field101: 3, field101: 3,
field102: 103, field102: 103,
field200: 1, field200: 1,
field99999: Buffer.from([0xc0, 0x85, 0x2c, 0x01]) field99999: Buffer.from([0xc0, 0x85, 0x2c, 0x01]),
}); });
return OidbBase.build(0xE37, 1200, body, false, false); return OidbBase.build(0xE37, 1200, body, false, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37_1200Response).decode(oidbBody); return new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37_1200Response).decode(oidbBody);
} }
} }
export default new DownloadPrivateFile(); export default new DownloadPrivateFile();

View File

@ -5,47 +5,47 @@ import OidbBase from '@/core/packet/transformer/oidb/oidbBase';
import { IndexNode } from '@/core/packet/transformer/proto'; import { IndexNode } from '@/core/packet/transformer/proto';
class DownloadVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp> { class DownloadVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
constructor() { constructor () {
super(); super();
} }
build(selfUid: string, node: NapProtoEncodeStructType<typeof IndexNode>): OidbPacket { build (selfUid: string, node: NapProtoEncodeStructType<typeof IndexNode>): OidbPacket {
const body = new NapProtoMsg(proto.NTV2RichMediaReq).encode({ const body = new NapProtoMsg(proto.NTV2RichMediaReq).encode({
reqHead: { reqHead: {
common: { common: {
requestId: 1, requestId: 1,
command: 200 command: 200,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
businessType: 2, businessType: 2,
sceneType: 1, sceneType: 1,
c2C: { c2C: {
accountType: 2, accountType: 2,
targetUid: selfUid targetUid: selfUid,
}, },
}, },
client: { client: {
agentType: 2, agentType: 2,
} },
}, },
download: { download: {
node: node, node,
download: { download: {
video: { video: {
busiType: 0, busiType: 0,
sceneType: 0 sceneType: 0,
} },
} },
} },
}); });
return OidbBase.build(0x11E9, 200, body, true, false); return OidbBase.build(0x11E9, 200, body, true, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody); return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody);
} }
} }
export default new DownloadVideo(); export default new DownloadVideo();

View File

@ -3,35 +3,35 @@ import { NapProtoMsg } from '@napneko/nap-proto-core';
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/core/packet/transformer/base'; import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/core/packet/transformer/base';
class FetchSessionKey extends PacketTransformer<typeof proto.HttpConn0x6ff_501Response> { class FetchSessionKey extends PacketTransformer<typeof proto.HttpConn0x6ff_501Response> {
constructor() { constructor () {
super(); super();
} }
build(): OidbPacket { build (): OidbPacket {
const req = new NapProtoMsg(proto.HttpConn0x6ff_501).encode({ const req = new NapProtoMsg(proto.HttpConn0x6ff_501).encode({
httpConn: { httpConn: {
field1: 0, field1: 0,
field2: 0, field2: 0,
field3: 16, field3: 16,
field4: 1, field4: 1,
field6: 3, field6: 3,
serviceTypes: [1, 5, 10, 21], serviceTypes: [1, 5, 10, 21],
// tgt: "", // TODO: do we really need tgt? seems not // tgt: "", // TODO: do we really need tgt? seems not
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: PacketBufBuilder(req) data: PacketBufBuilder(req),
}; };
} }
parse(data: Buffer) { parse (data: Buffer) {
return new NapProtoMsg(proto.HttpConn0x6ff_501Response).decode(data); return new NapProtoMsg(proto.HttpConn0x6ff_501Response).decode(data);
} }
} }
export default new FetchSessionKey(); export default new FetchSessionKey();

View File

@ -5,34 +5,34 @@ 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 () {
super(); super();
} }
build(groupUin: number, file: PacketMsgFileElement): OidbPacket { build (groupUin: number, file: PacketMsgFileElement): OidbPacket {
const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6).encode({ const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6).encode({
file: { file: {
groupUin: groupUin, groupUin,
appId: 4, appId: 4,
busId: 102, busId: 102,
entrance: 6, entrance: 6,
targetDirectory: '/', // TODO: targetDirectory: '/', // TODO:
fileName: file.fileName, fileName: file.fileName,
localDirectory: `/${file.fileName}`, localDirectory: `/${file.fileName}`,
fileSize: BigInt(file.fileSize), fileSize: BigInt(file.fileSize),
fileMd5: file.fileMd5, fileMd5: file.fileMd5,
fileSha1: file.fileSha1, fileSha1: file.fileSha1,
fileSha3: Buffer.alloc(0), fileSha3: Buffer.alloc(0),
field15: true field15: true,
} },
}); });
return OidbBase.build(0x6D6, 0, body, true, false); return OidbBase.build(0x6D6, 0, body, true, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6Response).decode(oidbBody); return new NapProtoMsg(proto.OidbSvcTrpcTcp0x6D6Response).decode(oidbBody);
} }
} }
export default new UploadGroupFile(); export default new UploadGroupFile();

View File

@ -6,85 +6,85 @@ 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 () {
super(); super();
} }
build(groupUin: number, img: PacketMsgPicElement): OidbPacket { build (groupUin: number, img: PacketMsgPicElement): OidbPacket {
const data = new NapProtoMsg(proto.NTV2RichMediaReq).encode( const data = new NapProtoMsg(proto.NTV2RichMediaReq).encode(
{
reqHead: {
common: {
requestId: 1,
command: 100,
},
scene: {
requestType: 2,
businessType: 1,
sceneType: 2,
group: {
groupUin,
},
},
client: {
agentType: 2,
},
},
upload: {
uploadInfo: [
{ {
reqHead: { fileInfo: {
common: { fileSize: +img.size,
requestId: 1, fileHash: img.md5,
command: 100 fileSha1: img.sha1!,
}, fileName: img.name,
scene: { type: {
requestType: 2, type: 1,
businessType: 1, picFormat: img.picType, // TODO: extend NapCat imgType /cc @MliKiowa
sceneType: 2, videoFormat: 0,
group: { voiceFormat: 0,
groupUin: groupUin
},
},
client: {
agentType: 2
}
}, },
upload: { width: img.width,
uploadInfo: [ height: img.height,
{ time: 0,
fileInfo: { original: 1,
fileSize: +img.size, },
fileHash: img.md5, subFileType: 0,
fileSha1: img.sha1!, },
fileName: img.name, ],
type: { tryFastUploadCompleted: true,
type: 1, srvSendMsg: false,
picFormat: img.picType, //TODO: extend NapCat imgType /cc @MliKiowa clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'),
videoFormat: 0, compatQMsgSceneType: 2,
voiceFormat: 0, extBizInfo: {
}, pic: {
width: img.width, bizType: img.picSubType,
height: img.height, bytesPbReserveTroop: {
time: 0, subType: img.picSubType,
original: 1 },
}, textSummary: img.summary,
subFileType: 0, },
} video: {
], bytesPbReserve: Buffer.alloc(0),
tryFastUploadCompleted: true, },
srvSendMsg: false, ptt: {
clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'), bytesPbReserve: Buffer.alloc(0),
compatQMsgSceneType: 2, bytesReserve: Buffer.alloc(0),
extBizInfo: { bytesGeneralFlags: Buffer.alloc(0),
pic: { },
bizType: img.picSubType, },
bytesPbReserveTroop: { clientSeq: 0,
subType: img.picSubType, noNeedCompatMsg: false,
}, },
textSummary: img.summary, }
}, );
video: { return OidbBase.build(0x11C4, 100, data, true, false);
bytesPbReserve: Buffer.alloc(0), }
},
ptt: {
bytesPbReserve: Buffer.alloc(0),
bytesReserve: Buffer.alloc(0),
bytesGeneralFlags: Buffer.alloc(0),
}
},
clientSeq: 0,
noNeedCompatMsg: false,
}
}
);
return OidbBase.build(0x11C4, 100, data, true, false);
}
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody); return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody);
} }
} }
export default new UploadGroupImage(); export default new UploadGroupImage();

View File

@ -6,99 +6,99 @@ 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 () {
super(); super();
} }
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: {
requestId: 3, requestId: 3,
command: 100 command: 100,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
businessType: 2, businessType: 2,
sceneType: 2, sceneType: 2,
group: { group: {
groupUin: groupUin groupUin,
}, },
}, },
client: { client: {
agentType: 2 agentType: 2,
} },
},
upload: {
uploadInfo: [
{
fileInfo: {
fileSize: +video.fileSize,
fileHash: video.fileMd5,
fileSha1: video.fileSha1,
fileName: 'nya.mp4',
type: {
type: 2,
picFormat: 0,
videoFormat: 0,
voiceFormat: 0,
},
height: 0,
width: 0,
time: 0,
original: 0,
}, },
upload: { subFileType: 0,
uploadInfo: [ }, {
{ fileInfo: {
fileInfo: { fileSize: +video.thumbSize,
fileSize: +video.fileSize, fileHash: video.thumbMd5,
fileHash: video.fileMd5, fileSha1: video.thumbSha1,
fileSha1: video.fileSha1, fileName: 'nya.jpg',
fileName: 'nya.mp4', type: {
type: { type: 1,
type: 2, picFormat: 0,
picFormat: 0, videoFormat: 0,
videoFormat: 0, voiceFormat: 0,
voiceFormat: 0 },
}, height: video.thumbHeight,
height: 0, width: video.thumbWidth,
width: 0, time: 0,
time: 0, original: 0,
original: 0 },
}, subFileType: 100,
subFileType: 0 },
}, { ],
fileInfo: { tryFastUploadCompleted: true,
fileSize: +video.thumbSize, srvSendMsg: false,
fileHash: video.thumbMd5, clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'),
fileSha1: video.thumbSha1, compatQMsgSceneType: 2,
fileName: 'nya.jpg', extBizInfo: {
type: { pic: {
type: 1, bizType: 0,
picFormat: 0, textSummary: 'Nya~',
videoFormat: 0, },
voiceFormat: 0 video: {
}, bytesPbReserve: Buffer.from([0x80, 0x01, 0x00]),
height: video.thumbHeight, },
width: video.thumbWidth, ptt: {
time: 0, bytesPbReserve: Buffer.alloc(0),
original: 0 bytesReserve: Buffer.alloc(0),
}, bytesGeneralFlags: Buffer.alloc(0),
subFileType: 100 },
} },
], clientSeq: 0,
tryFastUploadCompleted: true, noNeedCompatMsg: false,
srvSendMsg: false, },
clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'), });
compatQMsgSceneType: 2, return OidbBase.build(0x11EA, 100, data, true, false);
extBizInfo: { }
pic: {
bizType: 0,
textSummary: 'Nya~',
},
video: {
bytesPbReserve: Buffer.from([0x80, 0x01, 0x00]),
},
ptt: {
bytesPbReserve: Buffer.alloc(0),
bytesReserve: Buffer.alloc(0),
bytesGeneralFlags: Buffer.alloc(0),
}
},
clientSeq: 0,
noNeedCompatMsg: false
}
});
return OidbBase.build(0x11EA, 100, data, true, false);
}
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody); return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody);
} }
} }
export default new UploadGroupVideo(); export default new UploadGroupVideo();

View File

@ -6,36 +6,36 @@ 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 () {
super(); super();
} }
async build(selfUid: string, peerUid: string, file: PacketMsgFileElement): Promise<OidbPacket> { async build (selfUid: string, peerUid: string, file: PacketMsgFileElement): Promise<OidbPacket> {
const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37_1700).encode({ const body = new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37_1700).encode({
command: 1700, command: 1700,
seq: 0, seq: 0,
upload: { upload: {
senderUid: selfUid, senderUid: selfUid,
receiverUid: peerUid, receiverUid: peerUid,
fileSize: file.fileSize, fileSize: file.fileSize,
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),
}, },
businessId: 3, businessId: 3,
clientType: 1, clientType: 1,
flagSupportMediaPlatform: 1 flagSupportMediaPlatform: 1,
}); });
return OidbBase.build(0xE37, 1700, body, false, false); return OidbBase.build(0xE37, 1700, body, false, false);
} }
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37Response).decode(oidbBody); return new NapProtoMsg(proto.OidbSvcTrpcTcp0XE37Response).decode(oidbBody);
} }
} }
export default new UploadPrivateFile(); export default new UploadPrivateFile();

View File

@ -6,85 +6,85 @@ 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 () {
super(); super();
} }
build(peerUin: string, img: PacketMsgPicElement): OidbPacket { build (peerUin: string, img: PacketMsgPicElement): OidbPacket {
const data = new NapProtoMsg(proto.NTV2RichMediaReq).encode({ const data = new NapProtoMsg(proto.NTV2RichMediaReq).encode({
reqHead: { reqHead: {
common: { common: {
requestId: 1, requestId: 1,
command: 100 command: 100,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
businessType: 1, businessType: 1,
sceneType: 1, sceneType: 1,
c2C: { c2C: {
accountType: 2, accountType: 2,
targetUid: peerUin targetUid: peerUin,
}, },
}, },
client: { client: {
agentType: 2, agentType: 2,
} },
},
upload: {
uploadInfo: [
{
fileInfo: {
fileSize: +img.size,
fileHash: img.md5,
fileSha1: img.sha1!,
fileName: img.name,
type: {
type: 1,
picFormat: img.picType, // TODO: extend NapCat imgType /cc @MliKiowa
videoFormat: 0,
voiceFormat: 0,
},
width: img.width,
height: img.height,
time: 0,
original: 1,
}, },
upload: { subFileType: 0,
uploadInfo: [ },
{ ],
fileInfo: { tryFastUploadCompleted: true,
fileSize: +img.size, srvSendMsg: false,
fileHash: img.md5, clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'),
fileSha1: img.sha1!, compatQMsgSceneType: 1,
fileName: img.name, extBizInfo: {
type: { pic: {
type: 1, bizType: img.picSubType,
picFormat: img.picType, //TODO: extend NapCat imgType /cc @MliKiowa bytesPbReserveC2C: {
videoFormat: 0, subType: img.picSubType,
voiceFormat: 0, },
}, textSummary: img.summary,
width: img.width, },
height: img.height, video: {
time: 0, bytesPbReserve: Buffer.alloc(0),
original: 1 },
}, ptt: {
subFileType: 0, bytesPbReserve: Buffer.alloc(0),
} bytesReserve: Buffer.alloc(0),
], bytesGeneralFlags: Buffer.alloc(0),
tryFastUploadCompleted: true, },
srvSendMsg: false, },
clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'), clientSeq: 0,
compatQMsgSceneType: 1, noNeedCompatMsg: false,
extBizInfo: { },
pic: {
bizType: img.picSubType,
bytesPbReserveC2C: {
subType: img.picSubType,
},
textSummary: img.summary,
},
video: {
bytesPbReserve: Buffer.alloc(0),
},
ptt: {
bytesPbReserve: Buffer.alloc(0),
bytesReserve: Buffer.alloc(0),
bytesGeneralFlags: Buffer.alloc(0),
}
},
clientSeq: 0,
noNeedCompatMsg: false,
}
}
);
return OidbBase.build(0x11C5, 100, data,true, false);
} }
);
return OidbBase.build(0x11C5, 100, data, true, false);
}
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody); return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody);
} }
} }
export default new UploadPrivateImage(); export default new UploadPrivateImage();

View File

@ -6,76 +6,76 @@ 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 () {
super(); super();
} }
build(peerUin: string, ptt: PacketMsgPttElement): OidbPacket { build (peerUin: string, ptt: PacketMsgPttElement): OidbPacket {
const data = new NapProtoMsg(proto.NTV2RichMediaReq).encode({ const data = new NapProtoMsg(proto.NTV2RichMediaReq).encode({
reqHead: { reqHead: {
common: { common: {
requestId: 4, requestId: 4,
command: 100 command: 100,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
businessType: 3, businessType: 3,
sceneType: 1, sceneType: 1,
c2C: { c2C: {
accountType: 2, accountType: 2,
targetUid: peerUin targetUid: peerUin,
} },
}, },
client: { client: {
agentType: 2 agentType: 2,
} },
},
upload: {
uploadInfo: [
{
fileInfo: {
fileSize: ptt.fileSize,
fileHash: ptt.fileMd5,
fileSha1: ptt.fileSha1,
fileName: `${ptt.fileMd5}.amr`,
type: {
type: 3,
picFormat: 0,
videoFormat: 0,
voiceFormat: 1,
},
height: 0,
width: 0,
time: ptt.fileDuration,
original: 0,
}, },
upload: { subFileType: 0,
uploadInfo: [ },
{ ],
fileInfo: { tryFastUploadCompleted: true,
fileSize: ptt.fileSize, srvSendMsg: false,
fileHash: ptt.fileMd5, clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'),
fileSha1: ptt.fileSha1, compatQMsgSceneType: 1,
fileName: `${ptt.fileMd5}.amr`, extBizInfo: {
type: { pic: {
type: 3, textSummary: 'Nya~',
picFormat: 0, },
videoFormat: 0, ptt: {
voiceFormat: 1 bytesReserve: Buffer.from([0x08, 0x00, 0x38, 0x00]),
}, bytesGeneralFlags: Buffer.from([0x9a, 0x01, 0x0b, 0xaa, 0x03, 0x08, 0x08, 0x04, 0x12, 0x04, 0x00, 0x00, 0x00, 0x00]),
height: 0, },
width: 0, },
time: ptt.fileDuration, clientSeq: 0,
original: 0 noNeedCompatMsg: false,
}, },
subFileType: 0 });
} return OidbBase.build(0x126D, 100, data, true, false);
], }
tryFastUploadCompleted: true,
srvSendMsg: false,
clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'),
compatQMsgSceneType: 1,
extBizInfo: {
pic: {
textSummary: 'Nya~',
},
ptt: {
bytesReserve: Buffer.from([0x08, 0x00, 0x38, 0x00]),
bytesGeneralFlags: Buffer.from([0x9a, 0x01, 0x0b, 0xaa, 0x03, 0x08, 0x08, 0x04, 0x12, 0x04, 0x00, 0x00, 0x00, 0x00]),
}
},
clientSeq: 0,
noNeedCompatMsg: false
}
});
return OidbBase.build(0x126D, 100, data, true, false);
}
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody); return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody);
} }
} }
export default new UploadPrivatePtt(); export default new UploadPrivatePtt();

View File

@ -6,100 +6,100 @@ 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 () {
super(); super();
} }
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: {
requestId: 3, requestId: 3,
command: 100 command: 100,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
businessType: 2, businessType: 2,
sceneType: 1, sceneType: 1,
c2C: { c2C: {
accountType: 2, accountType: 2,
targetUid: peerUin targetUid: peerUin,
} },
}, },
client: { client: {
agentType: 2 agentType: 2,
} },
},
upload: {
uploadInfo: [
{
fileInfo: {
fileSize: +video.fileSize,
fileHash: video.fileMd5,
fileSha1: video.fileSha1,
fileName: 'nya.mp4',
type: {
type: 2,
picFormat: 0,
videoFormat: 0,
voiceFormat: 0,
},
height: 0,
width: 0,
time: 0,
original: 0,
}, },
upload: { subFileType: 0,
uploadInfo: [ }, {
{ fileInfo: {
fileInfo: { fileSize: +video.thumbSize,
fileSize: +video.fileSize, fileHash: video.thumbMd5,
fileHash: video.fileMd5, fileSha1: video.thumbSha1,
fileSha1: video.fileSha1, fileName: 'nya.jpg',
fileName: 'nya.mp4', type: {
type: { type: 1,
type: 2, picFormat: 0,
picFormat: 0, videoFormat: 0,
videoFormat: 0, voiceFormat: 0,
voiceFormat: 0 },
}, height: video.thumbHeight,
height: 0, width: video.thumbWidth,
width: 0, time: 0,
time: 0, original: 0,
original: 0 },
}, subFileType: 100,
subFileType: 0 },
}, { ],
fileInfo: { tryFastUploadCompleted: true,
fileSize: +video.thumbSize, srvSendMsg: false,
fileHash: video.thumbMd5, clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'),
fileSha1: video.thumbSha1, compatQMsgSceneType: 2,
fileName: 'nya.jpg', extBizInfo: {
type: { pic: {
type: 1, bizType: 0,
picFormat: 0, textSummary: 'Nya~',
videoFormat: 0, },
voiceFormat: 0 video: {
}, bytesPbReserve: Buffer.from([0x80, 0x01, 0x00]),
height: video.thumbHeight, },
width: video.thumbWidth, ptt: {
time: 0, bytesPbReserve: Buffer.alloc(0),
original: 0 bytesReserve: Buffer.alloc(0),
}, bytesGeneralFlags: Buffer.alloc(0),
subFileType: 100 },
} },
], clientSeq: 0,
tryFastUploadCompleted: true, noNeedCompatMsg: false,
srvSendMsg: false, },
clientRandomId: crypto.randomBytes(8).readBigUInt64BE() & BigInt('0x7FFFFFFFFFFFFFFF'), });
compatQMsgSceneType: 2, return OidbBase.build(0x11E9, 100, data, true, false);
extBizInfo: { }
pic: {
bizType: 0,
textSummary: 'Nya~',
},
video: {
bytesPbReserve: Buffer.from([0x80, 0x01, 0x00]),
},
ptt: {
bytesPbReserve: Buffer.alloc(0),
bytesReserve: Buffer.alloc(0),
bytesGeneralFlags: Buffer.alloc(0),
}
},
clientSeq: 0,
noNeedCompatMsg: false
}
});
return OidbBase.build(0x11E9, 100, data, true, false);
}
parse(data: Buffer) { parse (data: Buffer) {
const oidbBody = OidbBase.parse(data).body; const oidbBody = OidbBase.parse(data).body;
return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody); return new NapProtoMsg(proto.NTV2RichMediaResp).decode(oidbBody);
} }
} }
export default new UploadPrivateVideo(); export default new UploadPrivateVideo();

View File

@ -3,35 +3,35 @@ import { NapProtoMsg } from '@napneko/nap-proto-core';
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/core/packet/transformer/base'; import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/core/packet/transformer/base';
class DownloadForwardMsg extends PacketTransformer<typeof proto.RecvLongMsgResp> { class DownloadForwardMsg extends PacketTransformer<typeof proto.RecvLongMsgResp> {
constructor() { constructor () {
super(); super();
} }
build(uid: string, resId: string): OidbPacket { build (uid: string, resId: string): OidbPacket {
const req = new NapProtoMsg(proto.RecvLongMsgReq).encode({ const req = new NapProtoMsg(proto.RecvLongMsgReq).encode({
info: { info: {
uid: { uid: {
uid: uid uid,
}, },
resId: resId, resId,
acquire: true acquire: true,
}, },
settings: { settings: {
field1: 2, field1: 2,
field2: 0, field2: 0,
field3: 0, field3: 0,
field4: 0 field4: 0,
} },
}); });
return { return {
cmd: 'trpc.group.long_msg_interface.MsgService.SsoRecvLongMsg', cmd: 'trpc.group.long_msg_interface.MsgService.SsoRecvLongMsg',
data: PacketBufBuilder(req) data: PacketBufBuilder(req),
}; };
} }
parse(data: Buffer) { parse (data: Buffer) {
return new NapProtoMsg(proto.RecvLongMsgResp).decode(data); return new NapProtoMsg(proto.RecvLongMsgResp).decode(data);
} }
} }
export default new DownloadForwardMsg(); export default new DownloadForwardMsg();

View File

@ -3,25 +3,25 @@ import { NapProtoMsg } from '@napneko/nap-proto-core';
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/core/packet/transformer/base'; import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/core/packet/transformer/base';
class FetchC2CMessage extends PacketTransformer<typeof proto.SsoGetC2cMsgResponse> { class FetchC2CMessage extends PacketTransformer<typeof proto.SsoGetC2cMsgResponse> {
constructor() { constructor () {
super(); super();
} }
build(targetUid: string, startSeq: number, endSeq: number): OidbPacket { build (targetUid: string, startSeq: number, endSeq: number): OidbPacket {
const req = new NapProtoMsg(proto.SsoGetC2cMsg).encode({ const req = new NapProtoMsg(proto.SsoGetC2cMsg).encode({
friendUid: targetUid, friendUid: targetUid,
startSequence: startSeq, startSequence: startSeq,
endSequence: endSeq, endSequence: endSeq,
}); });
return { return {
cmd: 'trpc.msg.register_proxy.RegisterProxy.SsoGetC2cMsg', cmd: 'trpc.msg.register_proxy.RegisterProxy.SsoGetC2cMsg',
data: PacketBufBuilder(req) data: PacketBufBuilder(req),
}; };
} }
parse(data: Buffer) { parse (data: Buffer) {
return new NapProtoMsg(proto.SsoGetC2cMsgResponse).decode(data); return new NapProtoMsg(proto.SsoGetC2cMsgResponse).decode(data);
} }
} }
export default new FetchC2CMessage(); export default new FetchC2CMessage();

View File

@ -3,28 +3,28 @@ import { NapProtoMsg } from '@napneko/nap-proto-core';
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/core/packet/transformer/base'; import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/core/packet/transformer/base';
class FetchGroupMessage extends PacketTransformer<typeof proto.SsoGetGroupMsgResponse> { class FetchGroupMessage extends PacketTransformer<typeof proto.SsoGetGroupMsgResponse> {
constructor() { constructor () {
super(); super();
} }
build(groupUin: number, startSeq: number, endSeq: number): OidbPacket { build (groupUin: number, startSeq: number, endSeq: number): OidbPacket {
const req = new NapProtoMsg(proto.SsoGetGroupMsg).encode({ const req = new NapProtoMsg(proto.SsoGetGroupMsg).encode({
info: { info: {
groupUin: groupUin, groupUin,
startSequence: startSeq, startSequence: startSeq,
endSequence: endSeq endSequence: endSeq,
}, },
direction: true direction: true,
}); });
return { return {
cmd: 'trpc.msg.register_proxy.RegisterProxy.SsoGetGroupMsg', cmd: 'trpc.msg.register_proxy.RegisterProxy.SsoGetGroupMsg',
data: PacketBufBuilder(req) data: PacketBufBuilder(req),
}; };
} }
parse(data: Buffer) { parse (data: Buffer) {
return new NapProtoMsg(proto.SsoGetGroupMsgResponse).decode(data); return new NapProtoMsg(proto.SsoGetGroupMsgResponse).decode(data);
} }
} }
export default new FetchGroupMessage(); export default new FetchGroupMessage();

View File

@ -5,47 +5,47 @@ import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/core/packet/t
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 () {
super(); super();
} }
build(selfUid: string, msg: PacketMsg[], groupUin: number = 0): OidbPacket { build (selfUid: string, msg: PacketMsg[], groupUin: number = 0): OidbPacket {
const msgBody = this.msgBuilder.buildFakeMsg(selfUid, msg); const msgBody = this.msgBuilder.buildFakeMsg(selfUid, msg);
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,
} },
}] }],
} }
); );
const payload = zlib.gzipSync(Buffer.from(longMsgResultData)); const payload = zlib.gzipSync(Buffer.from(longMsgResultData));
const req = new NapProtoMsg(proto.SendLongMsgReq).encode( const req = new NapProtoMsg(proto.SendLongMsgReq).encode(
{ {
info: { info: {
type: groupUin === 0 ? 1 : 3, type: groupUin === 0 ? 1 : 3,
uid: { uid: {
uid: groupUin === 0 ? selfUid : groupUin.toString(), uid: groupUin === 0 ? selfUid : groupUin.toString(),
}, },
groupUin: groupUin, groupUin,
payload: payload payload,
}, },
settings: { settings: {
field1: 4, field2: 1, field3: 7, field4: 0 field1: 4, field2: 1, field3: 7, field4: 0,
} },
} }
); );
return { return {
cmd: 'trpc.group.long_msg_interface.MsgService.SsoSendLongMsg', cmd: 'trpc.group.long_msg_interface.MsgService.SsoSendLongMsg',
data: PacketBufBuilder(req) data: PacketBufBuilder(req),
}; };
} }
parse(data: Buffer) { parse (data: Buffer) {
return new NapProtoMsg(proto.SendLongMsgResp).decode(data); return new NapProtoMsg(proto.SendLongMsgResp).decode(data);
} }
} }
export default new UploadForwardMsg(); export default new UploadForwardMsg();

View File

@ -2,115 +2,115 @@ 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, false, true) action: ProtoField(2, () => LongMsgAction, false, true),
}; };
export const LongMsgAction = { export const LongMsgAction = {
actionCommand: ProtoField(1, ScalarType.STRING), actionCommand: ProtoField(1, ScalarType.STRING),
actionData: ProtoField(2, () => LongMsgContent) actionData: ProtoField(2, () => LongMsgContent),
}; };
export const LongMsgContent = { export const LongMsgContent = {
msgBody: ProtoField(1, () => PushMsgBody, false, true) msgBody: ProtoField(1, () => PushMsgBody, false, true),
}; };
export const RecvLongMsgReq = { export const RecvLongMsgReq = {
info: ProtoField(1, () => RecvLongMsgInfo, true), info: ProtoField(1, () => RecvLongMsgInfo, true),
settings: ProtoField(15, () => LongMsgSettings, true) settings: ProtoField(15, () => LongMsgSettings, true),
}; };
export const RecvLongMsgInfo = { export const RecvLongMsgInfo = {
uid: ProtoField(1, () => LongMsgUid, true), uid: ProtoField(1, () => LongMsgUid, true),
resId: ProtoField(2, ScalarType.STRING, true), resId: ProtoField(2, ScalarType.STRING, true),
acquire: ProtoField(3, ScalarType.BOOL) acquire: ProtoField(3, ScalarType.BOOL),
}; };
export const LongMsgUid = { export const LongMsgUid = {
uid: ProtoField(2, ScalarType.STRING, true) uid: ProtoField(2, ScalarType.STRING, true),
}; };
export const LongMsgSettings = { export const LongMsgSettings = {
field1: ProtoField(1, ScalarType.UINT32), field1: ProtoField(1, ScalarType.UINT32),
field2: ProtoField(2, ScalarType.UINT32), field2: ProtoField(2, ScalarType.UINT32),
field3: ProtoField(3, ScalarType.UINT32), field3: ProtoField(3, ScalarType.UINT32),
field4: ProtoField(4, ScalarType.UINT32) field4: ProtoField(4, ScalarType.UINT32),
}; };
export const RecvLongMsgResp = { export const RecvLongMsgResp = {
result: ProtoField(1, () => RecvLongMsgResult), result: ProtoField(1, () => RecvLongMsgResult),
settings: ProtoField(15, () => LongMsgSettings) settings: ProtoField(15, () => LongMsgSettings),
}; };
export const RecvLongMsgResult = { export const RecvLongMsgResult = {
resId: ProtoField(3, ScalarType.STRING), resId: ProtoField(3, ScalarType.STRING),
payload: ProtoField(4, ScalarType.BYTES) payload: ProtoField(4, ScalarType.BYTES),
}; };
export const SendLongMsgReq = { export const SendLongMsgReq = {
info: ProtoField(2, () => SendLongMsgInfo), info: ProtoField(2, () => SendLongMsgInfo),
settings: ProtoField(15, () => LongMsgSettings) settings: ProtoField(15, () => LongMsgSettings),
}; };
export const SendLongMsgInfo = { export const SendLongMsgInfo = {
type: ProtoField(1, ScalarType.UINT32), type: ProtoField(1, ScalarType.UINT32),
uid: ProtoField(2, () => LongMsgUid, true), uid: ProtoField(2, () => LongMsgUid, true),
groupUin: ProtoField(3, ScalarType.UINT32, true), groupUin: ProtoField(3, ScalarType.UINT32, true),
payload: ProtoField(4, ScalarType.BYTES, true) payload: ProtoField(4, ScalarType.BYTES, true),
}; };
export const SendLongMsgResp = { export const SendLongMsgResp = {
result: ProtoField(2, () => SendLongMsgResult), result: ProtoField(2, () => SendLongMsgResult),
settings: ProtoField(15, () => LongMsgSettings) settings: ProtoField(15, () => LongMsgSettings),
}; };
export const SendLongMsgResult = { export const SendLongMsgResult = {
resId: ProtoField(3, ScalarType.STRING) resId: ProtoField(3, ScalarType.STRING),
}; };
export const SsoGetGroupMsg = { export const SsoGetGroupMsg = {
info: ProtoField(1, () => SsoGetGroupMsgInfo), info: ProtoField(1, () => SsoGetGroupMsgInfo),
direction: ProtoField(2, ScalarType.BOOL) direction: ProtoField(2, ScalarType.BOOL),
}; };
export const SsoGetGroupMsgInfo = { export const SsoGetGroupMsgInfo = {
groupUin: ProtoField(1, ScalarType.UINT32), groupUin: ProtoField(1, ScalarType.UINT32),
startSequence: ProtoField(2, ScalarType.UINT32), startSequence: ProtoField(2, ScalarType.UINT32),
endSequence: ProtoField(3, ScalarType.UINT32) endSequence: ProtoField(3, ScalarType.UINT32),
}; };
export const SsoGetGroupMsgResponse = { export const SsoGetGroupMsgResponse = {
body: ProtoField(3, () => SsoGetGroupMsgResponseBody) body: ProtoField(3, () => SsoGetGroupMsgResponseBody),
}; };
export const SsoGetGroupMsgResponseBody = { export const SsoGetGroupMsgResponseBody = {
groupUin: ProtoField(3, ScalarType.UINT32), groupUin: ProtoField(3, ScalarType.UINT32),
startSequence: ProtoField(4, ScalarType.UINT32), startSequence: ProtoField(4, ScalarType.UINT32),
endSequence: ProtoField(5, ScalarType.UINT32), endSequence: ProtoField(5, ScalarType.UINT32),
messages: ProtoField(6, () => PushMsgBody, false, true) messages: ProtoField(6, () => PushMsgBody, false, true),
}; };
export const SsoGetRoamMsg = { export const SsoGetRoamMsg = {
friendUid: ProtoField(1, ScalarType.STRING, true), friendUid: ProtoField(1, ScalarType.STRING, true),
time: ProtoField(2, ScalarType.UINT32), time: ProtoField(2, ScalarType.UINT32),
random: ProtoField(3, ScalarType.UINT32), random: ProtoField(3, ScalarType.UINT32),
count: ProtoField(4, ScalarType.UINT32), count: ProtoField(4, ScalarType.UINT32),
direction: ProtoField(5, ScalarType.BOOL) direction: ProtoField(5, ScalarType.BOOL),
}; };
export const SsoGetRoamMsgResponse = { export const SsoGetRoamMsgResponse = {
friendUid: ProtoField(3, ScalarType.STRING), friendUid: ProtoField(3, ScalarType.STRING),
timestamp: ProtoField(5, ScalarType.UINT32), timestamp: ProtoField(5, ScalarType.UINT32),
random: ProtoField(6, ScalarType.UINT32), random: ProtoField(6, ScalarType.UINT32),
messages: ProtoField(7, () => PushMsgBody, false, true) messages: ProtoField(7, () => PushMsgBody, false, true),
}; };
export const SsoGetC2cMsg = { export const SsoGetC2cMsg = {
friendUid: ProtoField(2, ScalarType.STRING, true), friendUid: ProtoField(2, ScalarType.STRING, true),
startSequence: ProtoField(3, ScalarType.UINT32), startSequence: ProtoField(3, ScalarType.UINT32),
endSequence: ProtoField(4, ScalarType.UINT32) endSequence: ProtoField(4, ScalarType.UINT32),
}; };
export const SsoGetC2cMsgResponse = { export const SsoGetC2cMsgResponse = {
friendUid: ProtoField(4, ScalarType.STRING), friendUid: ProtoField(4, ScalarType.STRING),
messages: ProtoField(7, () => PushMsgBody, false, true) messages: ProtoField(7, () => PushMsgBody, false, true),
}; };

View File

@ -1,10 +1,10 @@
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),
uid: ProtoField(2, ScalarType.STRING, true), uid: ProtoField(2, ScalarType.STRING, true),
field3: ProtoField(3, ScalarType.UINT32, true), field3: ProtoField(3, ScalarType.UINT32, true),
sig: ProtoField(4, ScalarType.UINT32, true), sig: ProtoField(4, ScalarType.UINT32, true),
receiverUin: ProtoField(5, ScalarType.UINT32, true), receiverUin: ProtoField(5, ScalarType.UINT32, true),
receiverUid: ProtoField(6, ScalarType.STRING, true), receiverUid: ProtoField(6, ScalarType.STRING, true),
}; };

View File

@ -2,164 +2,164 @@ 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),
time: ProtoField(2, ScalarType.INT32), time: ProtoField(2, ScalarType.INT32),
random: ProtoField(3, ScalarType.INT32), random: ProtoField(3, ScalarType.INT32),
color: ProtoField(4, ScalarType.INT32), color: ProtoField(4, ScalarType.INT32),
size: ProtoField(5, ScalarType.INT32), size: ProtoField(5, ScalarType.INT32),
effect: ProtoField(6, ScalarType.INT32), effect: ProtoField(6, ScalarType.INT32),
charSet: ProtoField(7, ScalarType.INT32), charSet: ProtoField(7, ScalarType.INT32),
pitchAndFamily: ProtoField(8, ScalarType.INT32), pitchAndFamily: ProtoField(8, ScalarType.INT32),
fontName: ProtoField(9, ScalarType.STRING), fontName: ProtoField(9, ScalarType.STRING),
reserveData: ProtoField(10, ScalarType.BYTES), reserveData: ProtoField(10, ScalarType.BYTES),
}; };
export const NotOnlineFile = { export const NotOnlineFile = {
fileType: ProtoField(1, ScalarType.INT32, true), fileType: ProtoField(1, ScalarType.INT32, true),
sig: ProtoField(2, ScalarType.BYTES, true), sig: ProtoField(2, ScalarType.BYTES, true),
fileUuid: ProtoField(3, ScalarType.STRING, true), fileUuid: ProtoField(3, ScalarType.STRING, true),
fileMd5: ProtoField(4, ScalarType.BYTES, true), fileMd5: ProtoField(4, ScalarType.BYTES, true),
fileName: ProtoField(5, ScalarType.STRING, true), fileName: ProtoField(5, ScalarType.STRING, true),
fileSize: ProtoField(6, ScalarType.INT64, true), fileSize: ProtoField(6, ScalarType.INT64, true),
note: ProtoField(7, ScalarType.BYTES, true), note: ProtoField(7, ScalarType.BYTES, true),
reserved: ProtoField(8, ScalarType.INT32, true), reserved: ProtoField(8, ScalarType.INT32, true),
subcmd: ProtoField(9, ScalarType.INT32, true), subcmd: ProtoField(9, ScalarType.INT32, true),
microCloud: ProtoField(10, ScalarType.INT32, true), microCloud: ProtoField(10, ScalarType.INT32, true),
bytesFileUrls: ProtoField(11, ScalarType.BYTES, false, true), bytesFileUrls: ProtoField(11, ScalarType.BYTES, false, true),
downloadFlag: ProtoField(12, ScalarType.INT32, true), downloadFlag: ProtoField(12, ScalarType.INT32, true),
dangerEvel: ProtoField(50, ScalarType.INT32, true), dangerEvel: ProtoField(50, ScalarType.INT32, true),
lifeTime: ProtoField(51, ScalarType.INT32, true), lifeTime: ProtoField(51, ScalarType.INT32, true),
uploadTime: ProtoField(52, ScalarType.INT32, true), uploadTime: ProtoField(52, ScalarType.INT32, true),
absFileType: ProtoField(53, ScalarType.INT32, true), absFileType: ProtoField(53, ScalarType.INT32, true),
clientType: ProtoField(54, ScalarType.INT32, true), clientType: ProtoField(54, ScalarType.INT32, true),
expireTime: ProtoField(55, ScalarType.INT32, true), expireTime: ProtoField(55, ScalarType.INT32, true),
pbReserve: ProtoField(56, ScalarType.BYTES, true), pbReserve: ProtoField(56, ScalarType.BYTES, true),
fileHash: ProtoField(57, ScalarType.STRING, true), fileHash: ProtoField(57, ScalarType.STRING, true),
}; };
export const Ptt = { export const Ptt = {
fileType: ProtoField(1, ScalarType.INT32), fileType: ProtoField(1, ScalarType.INT32),
srcUin: ProtoField(2, ScalarType.UINT64), srcUin: ProtoField(2, ScalarType.UINT64),
fileUuid: ProtoField(3, ScalarType.STRING), fileUuid: ProtoField(3, ScalarType.STRING),
fileMd5: ProtoField(4, ScalarType.BYTES), fileMd5: ProtoField(4, ScalarType.BYTES),
fileName: ProtoField(5, ScalarType.STRING), fileName: ProtoField(5, ScalarType.STRING),
fileSize: ProtoField(6, ScalarType.INT32), fileSize: ProtoField(6, ScalarType.INT32),
reserve: ProtoField(7, ScalarType.BYTES), reserve: ProtoField(7, ScalarType.BYTES),
fileId: ProtoField(8, ScalarType.INT32), fileId: ProtoField(8, ScalarType.INT32),
serverIp: ProtoField(9, ScalarType.INT32), serverIp: ProtoField(9, ScalarType.INT32),
serverPort: ProtoField(10, ScalarType.INT32), serverPort: ProtoField(10, ScalarType.INT32),
boolValid: ProtoField(11, ScalarType.BOOL), boolValid: ProtoField(11, ScalarType.BOOL),
signature: ProtoField(12, ScalarType.BYTES), signature: ProtoField(12, ScalarType.BYTES),
shortcut: ProtoField(13, ScalarType.BYTES), shortcut: ProtoField(13, ScalarType.BYTES),
fileKey: ProtoField(14, ScalarType.BYTES), fileKey: ProtoField(14, ScalarType.BYTES),
magicPttIndex: ProtoField(15, ScalarType.INT32), magicPttIndex: ProtoField(15, ScalarType.INT32),
voiceSwitch: ProtoField(16, ScalarType.INT32), voiceSwitch: ProtoField(16, ScalarType.INT32),
pttUrl: ProtoField(17, ScalarType.BYTES), pttUrl: ProtoField(17, ScalarType.BYTES),
groupFileKey: ProtoField(18, ScalarType.STRING), groupFileKey: ProtoField(18, ScalarType.STRING),
time: ProtoField(19, ScalarType.INT32), time: ProtoField(19, ScalarType.INT32),
downPara: ProtoField(20, ScalarType.BYTES), downPara: ProtoField(20, ScalarType.BYTES),
format: ProtoField(29, ScalarType.INT32), format: ProtoField(29, ScalarType.INT32),
pbReserve: ProtoField(30, ScalarType.BYTES), pbReserve: ProtoField(30, ScalarType.BYTES),
bytesPttUrls: ProtoField(31, ScalarType.BYTES, false, true), bytesPttUrls: ProtoField(31, ScalarType.BYTES, false, true),
downloadFlag: ProtoField(32, ScalarType.INT32), downloadFlag: ProtoField(32, ScalarType.INT32),
}; };
export const RichText = { export const RichText = {
attr: ProtoField(1, () => Attr, true), attr: ProtoField(1, () => Attr, true),
elems: ProtoField(2, () => Elem, false, true), elems: ProtoField(2, () => Elem, false, true),
notOnlineFile: ProtoField(3, () => NotOnlineFile, true), notOnlineFile: ProtoField(3, () => NotOnlineFile, true),
ptt: ProtoField(4, () => Ptt, true), ptt: ProtoField(4, () => Ptt, true),
}; };
export const ButtonExtra = { export const ButtonExtra = {
data: ProtoField(1, () => KeyboardData), data: ProtoField(1, () => KeyboardData),
}; };
export const KeyboardData = { export const KeyboardData = {
rows: ProtoField(1, () => Row, false, true), rows: ProtoField(1, () => Row, false, true),
}; };
export const Row = { export const Row = {
buttons: ProtoField(1, () => Button, false, true), buttons: ProtoField(1, () => Button, false, true),
}; };
export const Button = { export const Button = {
id: ProtoField(1, ScalarType.STRING), id: ProtoField(1, ScalarType.STRING),
renderData: ProtoField(2, () => RenderData), renderData: ProtoField(2, () => RenderData),
action: ProtoField(3, () => Action), action: ProtoField(3, () => Action),
}; };
export const RenderData = { export const RenderData = {
label: ProtoField(1, ScalarType.STRING), label: ProtoField(1, ScalarType.STRING),
visitedLabel: ProtoField(2, ScalarType.STRING), visitedLabel: ProtoField(2, ScalarType.STRING),
style: ProtoField(3, ScalarType.INT32), style: ProtoField(3, ScalarType.INT32),
}; };
export const Action = { export const Action = {
type: ProtoField(1, ScalarType.INT32), type: ProtoField(1, ScalarType.INT32),
permission: ProtoField(2, () => Permission), permission: ProtoField(2, () => Permission),
unsupportTips: ProtoField(4, ScalarType.STRING), unsupportTips: ProtoField(4, ScalarType.STRING),
data: ProtoField(5, ScalarType.STRING), data: ProtoField(5, ScalarType.STRING),
reply: ProtoField(7, ScalarType.BOOL), reply: ProtoField(7, ScalarType.BOOL),
enter: ProtoField(8, ScalarType.BOOL), enter: ProtoField(8, ScalarType.BOOL),
}; };
export const Permission = { export const Permission = {
type: ProtoField(1, ScalarType.INT32), type: ProtoField(1, ScalarType.INT32),
specifyRoleIds: ProtoField(2, ScalarType.STRING, false, true), specifyRoleIds: ProtoField(2, ScalarType.STRING, false, true),
specifyUserIds: ProtoField(3, ScalarType.STRING, false, true), specifyUserIds: ProtoField(3, ScalarType.STRING, false, true),
}; };
export const FileExtra = { export const FileExtra = {
file: ProtoField(1, () => NotOnlineFile), file: ProtoField(1, () => NotOnlineFile),
field6: ProtoField(6, () => PrivateFileExtra), field6: ProtoField(6, () => PrivateFileExtra),
}; };
export const PrivateFileExtra = { export const PrivateFileExtra = {
field2: ProtoField(2, () => PrivateFileExtraField2), field2: ProtoField(2, () => PrivateFileExtraField2),
}; };
export const PrivateFileExtraField2 = { export const PrivateFileExtraField2 = {
field1: ProtoField(1, ScalarType.UINT32), field1: ProtoField(1, ScalarType.UINT32),
fileUuid: ProtoField(4, ScalarType.STRING), fileUuid: ProtoField(4, ScalarType.STRING),
fileName: ProtoField(5, ScalarType.STRING), fileName: ProtoField(5, ScalarType.STRING),
field6: ProtoField(6, ScalarType.UINT32), field6: ProtoField(6, ScalarType.UINT32),
field7: ProtoField(7, ScalarType.BYTES), field7: ProtoField(7, ScalarType.BYTES),
field8: ProtoField(8, ScalarType.BYTES), field8: ProtoField(8, ScalarType.BYTES),
timestamp1: ProtoField(9, ScalarType.UINT32), timestamp1: ProtoField(9, ScalarType.UINT32),
fileHash: ProtoField(14, ScalarType.STRING), fileHash: ProtoField(14, ScalarType.STRING),
selfUid: ProtoField(15, ScalarType.STRING), selfUid: ProtoField(15, ScalarType.STRING),
destUid: ProtoField(16, ScalarType.STRING), destUid: ProtoField(16, ScalarType.STRING),
}; };
export const GroupFileExtra = { export const GroupFileExtra = {
field1: ProtoField(1, ScalarType.UINT32), field1: ProtoField(1, ScalarType.UINT32),
fileName: ProtoField(2, ScalarType.STRING), fileName: ProtoField(2, ScalarType.STRING),
display: ProtoField(3, ScalarType.STRING), display: ProtoField(3, ScalarType.STRING),
inner: ProtoField(7, () => GroupFileExtraInner), inner: ProtoField(7, () => GroupFileExtraInner),
}; };
export const GroupFileExtraInner = { export const GroupFileExtraInner = {
info: ProtoField(2, () => GroupFileExtraInfo), info: ProtoField(2, () => GroupFileExtraInfo),
}; };
export const GroupFileExtraInfo = { export const GroupFileExtraInfo = {
busId: ProtoField(1, ScalarType.UINT32), busId: ProtoField(1, ScalarType.UINT32),
fileId: ProtoField(2, ScalarType.STRING), fileId: ProtoField(2, ScalarType.STRING),
fileSize: ProtoField(3, ScalarType.UINT64), fileSize: ProtoField(3, ScalarType.UINT64),
fileName: ProtoField(4, ScalarType.STRING), fileName: ProtoField(4, ScalarType.STRING),
field5: ProtoField(5, ScalarType.UINT32), field5: ProtoField(5, ScalarType.UINT32),
fileSha: ProtoField(6, ScalarType.BYTES), fileSha: ProtoField(6, ScalarType.BYTES),
extInfoString: ProtoField(7, ScalarType.STRING), extInfoString: ProtoField(7, ScalarType.STRING),
fileMd5: ProtoField(8, ScalarType.BYTES), fileMd5: ProtoField(8, ScalarType.BYTES),
}; };
export const ImageExtraUrl = { export const ImageExtraUrl = {
origUrl: ProtoField(30, ScalarType.STRING), origUrl: ProtoField(30, ScalarType.STRING),
}; };
export const PokeExtra = { export const PokeExtra = {
type: ProtoField(1, ScalarType.UINT32), type: ProtoField(1, ScalarType.UINT32),
field7: ProtoField(7, ScalarType.UINT32), field7: ProtoField(7, ScalarType.UINT32),
field8: ProtoField(8, ScalarType.UINT32), field8: ProtoField(8, ScalarType.UINT32),
}; };

View File

@ -1,360 +1,360 @@
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),
face: ProtoField(2, () => Face, true), face: ProtoField(2, () => Face, true),
onlineImage: ProtoField(3, () => OnlineImage, true), onlineImage: ProtoField(3, () => OnlineImage, true),
notOnlineImage: ProtoField(4, () => NotOnlineImage, true), notOnlineImage: ProtoField(4, () => NotOnlineImage, true),
transElem: ProtoField(5, () => TransElem, true), transElem: ProtoField(5, () => TransElem, true),
marketFace: ProtoField(6, () => MarketFace, true), marketFace: ProtoField(6, () => MarketFace, true),
customFace: ProtoField(8, () => CustomFace, true), customFace: ProtoField(8, () => CustomFace, true),
elemFlags2: ProtoField(9, () => ElemFlags2, true), elemFlags2: ProtoField(9, () => ElemFlags2, true),
richMsg: ProtoField(12, () => RichMsg, true), richMsg: ProtoField(12, () => RichMsg, true),
groupFile: ProtoField(13, () => GroupFile, true), groupFile: ProtoField(13, () => GroupFile, true),
extraInfo: ProtoField(16, () => ExtraInfo, true), extraInfo: ProtoField(16, () => ExtraInfo, true),
videoFile: ProtoField(19, () => VideoFile, true), videoFile: ProtoField(19, () => VideoFile, true),
anonymousGroupMessage: ProtoField(21, () => AnonymousGroupMessage, true), anonymousGroupMessage: ProtoField(21, () => AnonymousGroupMessage, true),
customElem: ProtoField(31, () => CustomElem, true), customElem: ProtoField(31, () => CustomElem, true),
generalFlags: ProtoField(37, () => GeneralFlags, true), generalFlags: ProtoField(37, () => GeneralFlags, true),
srcMsg: ProtoField(45, () => SrcMsg, true), srcMsg: ProtoField(45, () => SrcMsg, true),
lightAppElem: ProtoField(51, () => LightAppElem, true), lightAppElem: ProtoField(51, () => LightAppElem, true),
commonElem: ProtoField(53, () => CommonElem, true), commonElem: ProtoField(53, () => CommonElem, true),
}; };
export const Text = { export const Text = {
str: ProtoField(1, ScalarType.STRING, true), str: ProtoField(1, ScalarType.STRING, true),
lint: ProtoField(2, ScalarType.STRING, true), lint: ProtoField(2, ScalarType.STRING, true),
attr6Buf: ProtoField(3, ScalarType.BYTES, true), attr6Buf: ProtoField(3, ScalarType.BYTES, true),
attr7Buf: ProtoField(4, ScalarType.BYTES, true), attr7Buf: ProtoField(4, ScalarType.BYTES, true),
buf: ProtoField(11, ScalarType.BYTES, true), buf: ProtoField(11, ScalarType.BYTES, true),
pbReserve: ProtoField(12, ScalarType.BYTES, true), pbReserve: ProtoField(12, ScalarType.BYTES, true),
}; };
export const Face = { export const Face = {
index: ProtoField(1, ScalarType.INT32, true), index: ProtoField(1, ScalarType.INT32, true),
old: ProtoField(2, ScalarType.BYTES, true), old: ProtoField(2, ScalarType.BYTES, true),
buf: ProtoField(11, ScalarType.BYTES, true), buf: ProtoField(11, ScalarType.BYTES, true),
}; };
export const OnlineImage = { export const OnlineImage = {
guid: ProtoField(1, ScalarType.BYTES), guid: ProtoField(1, ScalarType.BYTES),
filePath: ProtoField(2, ScalarType.BYTES), filePath: ProtoField(2, ScalarType.BYTES),
oldVerSendFile: ProtoField(3, ScalarType.BYTES), oldVerSendFile: ProtoField(3, ScalarType.BYTES),
}; };
export const NotOnlineImage = { export const NotOnlineImage = {
filePath: ProtoField(1, ScalarType.STRING), filePath: ProtoField(1, ScalarType.STRING),
fileLen: ProtoField(2, ScalarType.UINT32), fileLen: ProtoField(2, ScalarType.UINT32),
downloadPath: ProtoField(3, ScalarType.STRING), downloadPath: ProtoField(3, ScalarType.STRING),
oldVerSendFile: ProtoField(4, ScalarType.BYTES), oldVerSendFile: ProtoField(4, ScalarType.BYTES),
imgType: ProtoField(5, ScalarType.INT32), imgType: ProtoField(5, ScalarType.INT32),
previewsImage: ProtoField(6, ScalarType.BYTES), previewsImage: ProtoField(6, ScalarType.BYTES),
picMd5: ProtoField(7, ScalarType.BYTES), picMd5: ProtoField(7, ScalarType.BYTES),
picHeight: ProtoField(8, ScalarType.UINT32), picHeight: ProtoField(8, ScalarType.UINT32),
picWidth: ProtoField(9, ScalarType.UINT32), picWidth: ProtoField(9, ScalarType.UINT32),
resId: ProtoField(10, ScalarType.STRING), resId: ProtoField(10, ScalarType.STRING),
flag: ProtoField(11, ScalarType.BYTES), flag: ProtoField(11, ScalarType.BYTES),
thumbUrl: ProtoField(12, ScalarType.STRING), thumbUrl: ProtoField(12, ScalarType.STRING),
original: ProtoField(13, ScalarType.INT32), original: ProtoField(13, ScalarType.INT32),
bigUrl: ProtoField(14, ScalarType.STRING), bigUrl: ProtoField(14, ScalarType.STRING),
origUrl: ProtoField(15, ScalarType.STRING), origUrl: ProtoField(15, ScalarType.STRING),
bizType: ProtoField(16, ScalarType.INT32), bizType: ProtoField(16, ScalarType.INT32),
result: ProtoField(17, ScalarType.INT32), result: ProtoField(17, ScalarType.INT32),
index: ProtoField(18, ScalarType.INT32), index: ProtoField(18, ScalarType.INT32),
opFaceBuf: ProtoField(19, ScalarType.BYTES), opFaceBuf: ProtoField(19, ScalarType.BYTES),
oldPicMd5: ProtoField(20, ScalarType.BOOL), oldPicMd5: ProtoField(20, ScalarType.BOOL),
thumbWidth: ProtoField(21, ScalarType.INT32), thumbWidth: ProtoField(21, ScalarType.INT32),
thumbHeight: ProtoField(22, ScalarType.INT32), thumbHeight: ProtoField(22, ScalarType.INT32),
fileId: ProtoField(23, ScalarType.INT32), fileId: ProtoField(23, ScalarType.INT32),
showLen: ProtoField(24, ScalarType.UINT32), showLen: ProtoField(24, ScalarType.UINT32),
downloadLen: ProtoField(25, ScalarType.UINT32), downloadLen: ProtoField(25, ScalarType.UINT32),
x400Url: ProtoField(26, ScalarType.STRING), x400Url: ProtoField(26, ScalarType.STRING),
x400Width: ProtoField(27, ScalarType.INT32), x400Width: ProtoField(27, ScalarType.INT32),
x400Height: ProtoField(28, ScalarType.INT32), x400Height: ProtoField(28, ScalarType.INT32),
pbRes: ProtoField(29, () => NotOnlineImage_PbReserve), pbRes: ProtoField(29, () => NotOnlineImage_PbReserve),
}; };
export const NotOnlineImage_PbReserve = { export const NotOnlineImage_PbReserve = {
subType: ProtoField(1, ScalarType.INT32), subType: ProtoField(1, ScalarType.INT32),
field3: ProtoField(3, ScalarType.INT32), field3: ProtoField(3, ScalarType.INT32),
field4: ProtoField(4, ScalarType.INT32), field4: ProtoField(4, ScalarType.INT32),
summary: ProtoField(8, ScalarType.STRING), summary: ProtoField(8, ScalarType.STRING),
field10: ProtoField(10, ScalarType.INT32), field10: ProtoField(10, ScalarType.INT32),
field20: ProtoField(20, () => NotOnlineImage_PbReserve2), field20: ProtoField(20, () => NotOnlineImage_PbReserve2),
url: ProtoField(30, ScalarType.STRING), url: ProtoField(30, ScalarType.STRING),
md5Str: ProtoField(31, ScalarType.STRING), md5Str: ProtoField(31, ScalarType.STRING),
}; };
export const NotOnlineImage_PbReserve2 = { export const NotOnlineImage_PbReserve2 = {
field1: ProtoField(1, ScalarType.INT32), field1: ProtoField(1, ScalarType.INT32),
field2: ProtoField(2, ScalarType.STRING), field2: ProtoField(2, ScalarType.STRING),
field3: ProtoField(3, ScalarType.INT32), field3: ProtoField(3, ScalarType.INT32),
field4: ProtoField(4, ScalarType.INT32), field4: ProtoField(4, ScalarType.INT32),
field5: ProtoField(5, ScalarType.INT32), field5: ProtoField(5, ScalarType.INT32),
field7: ProtoField(7, ScalarType.STRING), field7: ProtoField(7, ScalarType.STRING),
}; };
export const TransElem = { export const TransElem = {
elemType: ProtoField(1, ScalarType.INT32), elemType: ProtoField(1, ScalarType.INT32),
elemValue: ProtoField(2, ScalarType.BYTES), elemValue: ProtoField(2, ScalarType.BYTES),
}; };
export const MarketFace = { export const MarketFace = {
faceName: ProtoField(1, ScalarType.STRING), faceName: ProtoField(1, ScalarType.STRING),
itemType: ProtoField(2, ScalarType.INT32), itemType: ProtoField(2, ScalarType.INT32),
faceInfo: ProtoField(3, ScalarType.INT32), faceInfo: ProtoField(3, ScalarType.INT32),
faceId: ProtoField(4, ScalarType.BYTES), faceId: ProtoField(4, ScalarType.BYTES),
tabId: ProtoField(5, ScalarType.INT32), tabId: ProtoField(5, ScalarType.INT32),
subType: ProtoField(6, ScalarType.INT32), subType: ProtoField(6, ScalarType.INT32),
key: ProtoField(7, ScalarType.STRING), key: ProtoField(7, ScalarType.STRING),
param: ProtoField(8, ScalarType.BYTES), param: ProtoField(8, ScalarType.BYTES),
mediaType: ProtoField(9, ScalarType.INT32), mediaType: ProtoField(9, ScalarType.INT32),
imageWidth: ProtoField(10, ScalarType.INT32), imageWidth: ProtoField(10, ScalarType.INT32),
imageHeight: ProtoField(11, ScalarType.INT32), imageHeight: ProtoField(11, ScalarType.INT32),
mobileparam: ProtoField(12, ScalarType.BYTES), mobileparam: ProtoField(12, ScalarType.BYTES),
pbReserve: ProtoField(13, () => MarketFacePbRes), pbReserve: ProtoField(13, () => MarketFacePbRes),
}; };
export const MarketFacePbRes = { export const MarketFacePbRes = {
field8: ProtoField(8, ScalarType.INT32) field8: ProtoField(8, ScalarType.INT32),
}; };
export const CustomFace = { export const CustomFace = {
guid: ProtoField(1, ScalarType.BYTES), guid: ProtoField(1, ScalarType.BYTES),
filePath: ProtoField(2, ScalarType.STRING), filePath: ProtoField(2, ScalarType.STRING),
shortcut: ProtoField(3, ScalarType.STRING), shortcut: ProtoField(3, ScalarType.STRING),
buffer: ProtoField(4, ScalarType.BYTES), buffer: ProtoField(4, ScalarType.BYTES),
flag: ProtoField(5, ScalarType.BYTES), flag: ProtoField(5, ScalarType.BYTES),
oldData: ProtoField(6, ScalarType.BYTES, true), oldData: ProtoField(6, ScalarType.BYTES, true),
fileId: ProtoField(7, ScalarType.UINT32), fileId: ProtoField(7, ScalarType.UINT32),
serverIp: ProtoField(8, ScalarType.INT32, true), serverIp: ProtoField(8, ScalarType.INT32, true),
serverPort: ProtoField(9, ScalarType.INT32, true), serverPort: ProtoField(9, ScalarType.INT32, true),
fileType: ProtoField(10, ScalarType.INT32), fileType: ProtoField(10, ScalarType.INT32),
signature: ProtoField(11, ScalarType.BYTES), signature: ProtoField(11, ScalarType.BYTES),
useful: ProtoField(12, ScalarType.INT32), useful: ProtoField(12, ScalarType.INT32),
md5: ProtoField(13, ScalarType.BYTES), md5: ProtoField(13, ScalarType.BYTES),
thumbUrl: ProtoField(14, ScalarType.STRING), thumbUrl: ProtoField(14, ScalarType.STRING),
bigUrl: ProtoField(15, ScalarType.STRING), bigUrl: ProtoField(15, ScalarType.STRING),
origUrl: ProtoField(16, ScalarType.STRING), origUrl: ProtoField(16, ScalarType.STRING),
bizType: ProtoField(17, ScalarType.INT32), bizType: ProtoField(17, ScalarType.INT32),
repeatIndex: ProtoField(18, ScalarType.INT32), repeatIndex: ProtoField(18, ScalarType.INT32),
repeatImage: ProtoField(19, ScalarType.INT32), repeatImage: ProtoField(19, ScalarType.INT32),
imageType: ProtoField(20, ScalarType.INT32), imageType: ProtoField(20, ScalarType.INT32),
index: ProtoField(21, ScalarType.INT32), index: ProtoField(21, ScalarType.INT32),
width: ProtoField(22, ScalarType.INT32), width: ProtoField(22, ScalarType.INT32),
height: ProtoField(23, ScalarType.INT32), height: ProtoField(23, ScalarType.INT32),
source: ProtoField(24, ScalarType.INT32), source: ProtoField(24, ScalarType.INT32),
size: ProtoField(25, ScalarType.UINT32), size: ProtoField(25, ScalarType.UINT32),
origin: ProtoField(26, ScalarType.INT32), origin: ProtoField(26, ScalarType.INT32),
thumbWidth: ProtoField(27, ScalarType.INT32, true), thumbWidth: ProtoField(27, ScalarType.INT32, true),
thumbHeight: ProtoField(28, ScalarType.INT32, true), thumbHeight: ProtoField(28, ScalarType.INT32, true),
showLen: ProtoField(29, ScalarType.INT32), showLen: ProtoField(29, ScalarType.INT32),
downloadLen: ProtoField(30, ScalarType.INT32), downloadLen: ProtoField(30, ScalarType.INT32),
x400Url: ProtoField(31, ScalarType.STRING, true), x400Url: ProtoField(31, ScalarType.STRING, true),
x400Width: ProtoField(32, ScalarType.INT32), x400Width: ProtoField(32, ScalarType.INT32),
x400Height: ProtoField(33, ScalarType.INT32), x400Height: ProtoField(33, ScalarType.INT32),
pbRes: ProtoField(34, () => CustomFace_PbReserve, true), pbRes: ProtoField(34, () => CustomFace_PbReserve, true),
}; };
export const CustomFace_PbReserve = { export const CustomFace_PbReserve = {
subType: ProtoField(1, ScalarType.INT32), subType: ProtoField(1, ScalarType.INT32),
summary: ProtoField(9, ScalarType.STRING), summary: ProtoField(9, ScalarType.STRING),
}; };
export const ElemFlags2 = { export const ElemFlags2 = {
colorTextId: ProtoField(1, ScalarType.UINT32), colorTextId: ProtoField(1, ScalarType.UINT32),
msgId: ProtoField(2, ScalarType.UINT64), msgId: ProtoField(2, ScalarType.UINT64),
whisperSessionId: ProtoField(3, ScalarType.UINT32), whisperSessionId: ProtoField(3, ScalarType.UINT32),
pttChangeBit: ProtoField(4, ScalarType.UINT32), pttChangeBit: ProtoField(4, ScalarType.UINT32),
vipStatus: ProtoField(5, ScalarType.UINT32), vipStatus: ProtoField(5, ScalarType.UINT32),
compatibleId: ProtoField(6, ScalarType.UINT32), compatibleId: ProtoField(6, ScalarType.UINT32),
insts: ProtoField(7, () => Instance, false, true), insts: ProtoField(7, () => Instance, false, true),
msgRptCnt: ProtoField(8, ScalarType.UINT32), msgRptCnt: ProtoField(8, ScalarType.UINT32),
srcInst: ProtoField(9, () => Instance), srcInst: ProtoField(9, () => Instance),
longtitude: ProtoField(10, ScalarType.UINT32), longtitude: ProtoField(10, ScalarType.UINT32),
latitude: ProtoField(11, ScalarType.UINT32), latitude: ProtoField(11, ScalarType.UINT32),
customFont: ProtoField(12, ScalarType.UINT32), customFont: ProtoField(12, ScalarType.UINT32),
pcSupportDef: ProtoField(13, () => PcSupportDef), pcSupportDef: ProtoField(13, () => PcSupportDef),
crmFlags: ProtoField(14, ScalarType.UINT32, true), crmFlags: ProtoField(14, ScalarType.UINT32, true),
}; };
export const PcSupportDef = { export const PcSupportDef = {
pcPtlBegin: ProtoField(1, ScalarType.UINT32), pcPtlBegin: ProtoField(1, ScalarType.UINT32),
pcPtlEnd: ProtoField(2, ScalarType.UINT32), pcPtlEnd: ProtoField(2, ScalarType.UINT32),
macPtlBegin: ProtoField(3, ScalarType.UINT32), macPtlBegin: ProtoField(3, ScalarType.UINT32),
macPtlEnd: ProtoField(4, ScalarType.UINT32), macPtlEnd: ProtoField(4, ScalarType.UINT32),
ptlsSupport: ProtoField(5, ScalarType.INT32, false, true), ptlsSupport: ProtoField(5, ScalarType.INT32, false, true),
ptlsNotSupport: ProtoField(6, ScalarType.UINT32, false, true), ptlsNotSupport: ProtoField(6, ScalarType.UINT32, false, true),
}; };
export const Instance = { export const Instance = {
appId: ProtoField(1, ScalarType.UINT32), appId: ProtoField(1, ScalarType.UINT32),
instId: ProtoField(2, ScalarType.UINT32), instId: ProtoField(2, ScalarType.UINT32),
}; };
export const RichMsg = { export const RichMsg = {
template1: ProtoField(1, ScalarType.BYTES, true), template1: ProtoField(1, ScalarType.BYTES, true),
serviceId: ProtoField(2, ScalarType.INT32, true), serviceId: ProtoField(2, ScalarType.INT32, true),
msgResId: ProtoField(3, ScalarType.BYTES, true), msgResId: ProtoField(3, ScalarType.BYTES, true),
rand: ProtoField(4, ScalarType.INT32, true), rand: ProtoField(4, ScalarType.INT32, true),
seq: ProtoField(5, ScalarType.UINT32, true), seq: ProtoField(5, ScalarType.UINT32, true),
}; };
export const GroupFile = { export const GroupFile = {
filename: ProtoField(1, ScalarType.BYTES), filename: ProtoField(1, ScalarType.BYTES),
fileSize: ProtoField(2, ScalarType.UINT64), fileSize: ProtoField(2, ScalarType.UINT64),
fileId: ProtoField(3, ScalarType.BYTES), fileId: ProtoField(3, ScalarType.BYTES),
batchId: ProtoField(4, ScalarType.BYTES), batchId: ProtoField(4, ScalarType.BYTES),
fileKey: ProtoField(5, ScalarType.BYTES), fileKey: ProtoField(5, ScalarType.BYTES),
mark: ProtoField(6, ScalarType.BYTES), mark: ProtoField(6, ScalarType.BYTES),
sequence: ProtoField(7, ScalarType.UINT64), sequence: ProtoField(7, ScalarType.UINT64),
batchItemId: ProtoField(8, ScalarType.BYTES), batchItemId: ProtoField(8, ScalarType.BYTES),
feedMsgTime: ProtoField(9, ScalarType.INT32), feedMsgTime: ProtoField(9, ScalarType.INT32),
pbReserve: ProtoField(10, ScalarType.BYTES), pbReserve: ProtoField(10, ScalarType.BYTES),
}; };
export const ExtraInfo = { export const ExtraInfo = {
nick: ProtoField(1, ScalarType.BYTES), nick: ProtoField(1, ScalarType.BYTES),
groupCard: ProtoField(2, ScalarType.BYTES), groupCard: ProtoField(2, ScalarType.BYTES),
level: ProtoField(3, ScalarType.INT32), level: ProtoField(3, ScalarType.INT32),
flags: ProtoField(4, ScalarType.INT32), flags: ProtoField(4, ScalarType.INT32),
groupMask: ProtoField(5, ScalarType.INT32), groupMask: ProtoField(5, ScalarType.INT32),
msgTailId: ProtoField(6, ScalarType.INT32), msgTailId: ProtoField(6, ScalarType.INT32),
senderTitle: ProtoField(7, ScalarType.BYTES), senderTitle: ProtoField(7, ScalarType.BYTES),
apnsTips: ProtoField(8, ScalarType.BYTES), apnsTips: ProtoField(8, ScalarType.BYTES),
uin: ProtoField(9, ScalarType.UINT64), uin: ProtoField(9, ScalarType.UINT64),
msgStateFlag: ProtoField(10, ScalarType.INT32), msgStateFlag: ProtoField(10, ScalarType.INT32),
apnsSoundType: ProtoField(11, ScalarType.INT32), apnsSoundType: ProtoField(11, ScalarType.INT32),
newGroupFlag: ProtoField(12, ScalarType.INT32), newGroupFlag: ProtoField(12, ScalarType.INT32),
}; };
export const VideoFile = { export const VideoFile = {
fileUuid: ProtoField(1, ScalarType.STRING), fileUuid: ProtoField(1, ScalarType.STRING),
fileMd5: ProtoField(2, ScalarType.BYTES), fileMd5: ProtoField(2, ScalarType.BYTES),
fileName: ProtoField(3, ScalarType.STRING), fileName: ProtoField(3, ScalarType.STRING),
fileFormat: ProtoField(4, ScalarType.INT32), fileFormat: ProtoField(4, ScalarType.INT32),
fileTime: ProtoField(5, ScalarType.INT32), fileTime: ProtoField(5, ScalarType.INT32),
fileSize: ProtoField(6, ScalarType.INT32), fileSize: ProtoField(6, ScalarType.INT32),
thumbWidth: ProtoField(7, ScalarType.INT32), thumbWidth: ProtoField(7, ScalarType.INT32),
thumbHeight: ProtoField(8, ScalarType.INT32), thumbHeight: ProtoField(8, ScalarType.INT32),
thumbFileMd5: ProtoField(9, ScalarType.BYTES), thumbFileMd5: ProtoField(9, ScalarType.BYTES),
source: ProtoField(10, ScalarType.BYTES), source: ProtoField(10, ScalarType.BYTES),
thumbFileSize: ProtoField(11, ScalarType.INT32), thumbFileSize: ProtoField(11, ScalarType.INT32),
busiType: ProtoField(12, ScalarType.INT32), busiType: ProtoField(12, ScalarType.INT32),
fromChatType: ProtoField(13, ScalarType.INT32), fromChatType: ProtoField(13, ScalarType.INT32),
toChatType: ProtoField(14, ScalarType.INT32), toChatType: ProtoField(14, ScalarType.INT32),
boolSupportProgressive: ProtoField(15, ScalarType.BOOL), boolSupportProgressive: ProtoField(15, ScalarType.BOOL),
fileWidth: ProtoField(16, ScalarType.INT32), fileWidth: ProtoField(16, ScalarType.INT32),
fileHeight: ProtoField(17, ScalarType.INT32), fileHeight: ProtoField(17, ScalarType.INT32),
subBusiType: ProtoField(18, ScalarType.INT32), subBusiType: ProtoField(18, ScalarType.INT32),
videoAttr: ProtoField(19, ScalarType.INT32), videoAttr: ProtoField(19, ScalarType.INT32),
bytesThumbFileUrls: ProtoField(20, ScalarType.BYTES, false, true), bytesThumbFileUrls: ProtoField(20, ScalarType.BYTES, false, true),
bytesVideoFileUrls: ProtoField(21, ScalarType.BYTES, false, true), bytesVideoFileUrls: ProtoField(21, ScalarType.BYTES, false, true),
thumbDownloadFlag: ProtoField(22, ScalarType.INT32), thumbDownloadFlag: ProtoField(22, ScalarType.INT32),
videoDownloadFlag: ProtoField(23, ScalarType.INT32), videoDownloadFlag: ProtoField(23, ScalarType.INT32),
pbReserve: ProtoField(24, ScalarType.BYTES), pbReserve: ProtoField(24, ScalarType.BYTES),
}; };
export const AnonymousGroupMessage = { export const AnonymousGroupMessage = {
flags: ProtoField(1, ScalarType.INT32), flags: ProtoField(1, ScalarType.INT32),
anonId: ProtoField(2, ScalarType.BYTES), anonId: ProtoField(2, ScalarType.BYTES),
anonNick: ProtoField(3, ScalarType.BYTES), anonNick: ProtoField(3, ScalarType.BYTES),
headPortrait: ProtoField(4, ScalarType.INT32), headPortrait: ProtoField(4, ScalarType.INT32),
expireTime: ProtoField(5, ScalarType.INT32), expireTime: ProtoField(5, ScalarType.INT32),
bubbleId: ProtoField(6, ScalarType.INT32), bubbleId: ProtoField(6, ScalarType.INT32),
rankColor: ProtoField(7, ScalarType.BYTES), rankColor: ProtoField(7, ScalarType.BYTES),
}; };
export const CustomElem = { export const CustomElem = {
desc: ProtoField(1, ScalarType.BYTES), desc: ProtoField(1, ScalarType.BYTES),
data: ProtoField(2, ScalarType.BYTES), data: ProtoField(2, ScalarType.BYTES),
enumType: ProtoField(3, ScalarType.INT32), enumType: ProtoField(3, ScalarType.INT32),
ext: ProtoField(4, ScalarType.BYTES), ext: ProtoField(4, ScalarType.BYTES),
sound: ProtoField(5, ScalarType.BYTES), sound: ProtoField(5, ScalarType.BYTES),
}; };
export const GeneralFlags = { export const GeneralFlags = {
bubbleDiyTextId: ProtoField(1, ScalarType.INT32), bubbleDiyTextId: ProtoField(1, ScalarType.INT32),
groupFlagNew: ProtoField(2, ScalarType.INT32), groupFlagNew: ProtoField(2, ScalarType.INT32),
uin: ProtoField(3, ScalarType.UINT64), uin: ProtoField(3, ScalarType.UINT64),
rpId: ProtoField(4, ScalarType.BYTES), rpId: ProtoField(4, ScalarType.BYTES),
prpFold: ProtoField(5, ScalarType.INT32), prpFold: ProtoField(5, ScalarType.INT32),
longTextFlag: ProtoField(6, ScalarType.INT32), longTextFlag: ProtoField(6, ScalarType.INT32),
longTextResId: ProtoField(7, ScalarType.STRING, true), longTextResId: ProtoField(7, ScalarType.STRING, true),
groupType: ProtoField(8, ScalarType.INT32), groupType: ProtoField(8, ScalarType.INT32),
toUinFlag: ProtoField(9, ScalarType.INT32), toUinFlag: ProtoField(9, ScalarType.INT32),
glamourLevel: ProtoField(10, ScalarType.INT32), glamourLevel: ProtoField(10, ScalarType.INT32),
memberLevel: ProtoField(11, ScalarType.INT32), memberLevel: ProtoField(11, ScalarType.INT32),
groupRankSeq: ProtoField(12, ScalarType.UINT64), groupRankSeq: ProtoField(12, ScalarType.UINT64),
olympicTorch: ProtoField(13, ScalarType.INT32), olympicTorch: ProtoField(13, ScalarType.INT32),
babyqGuideMsgCookie: ProtoField(14, ScalarType.BYTES), babyqGuideMsgCookie: ProtoField(14, ScalarType.BYTES),
uin32ExpertFlag: ProtoField(15, ScalarType.INT32), uin32ExpertFlag: ProtoField(15, ScalarType.INT32),
bubbleSubId: ProtoField(16, ScalarType.INT32), bubbleSubId: ProtoField(16, ScalarType.INT32),
pendantId: ProtoField(17, ScalarType.UINT64), pendantId: ProtoField(17, ScalarType.UINT64),
rpIndex: ProtoField(18, ScalarType.BYTES), rpIndex: ProtoField(18, ScalarType.BYTES),
pbReserve: ProtoField(19, ScalarType.BYTES), pbReserve: ProtoField(19, ScalarType.BYTES),
}; };
export const SrcMsg = { export const SrcMsg = {
origSeqs: ProtoField(1, ScalarType.UINT32, false, true), origSeqs: ProtoField(1, ScalarType.UINT32, false, true),
senderUin: ProtoField(2, ScalarType.UINT64), senderUin: ProtoField(2, ScalarType.UINT64),
time: ProtoField(3, ScalarType.INT32, true), time: ProtoField(3, ScalarType.INT32, true),
flag: ProtoField(4, ScalarType.INT32, true), flag: ProtoField(4, ScalarType.INT32, true),
elems: ProtoField(5, () => Elem, false, true), elems: ProtoField(5, () => Elem, false, true),
type: ProtoField(6, ScalarType.INT32, true), type: ProtoField(6, ScalarType.INT32, true),
richMsg: ProtoField(7, ScalarType.BYTES, true), richMsg: ProtoField(7, ScalarType.BYTES, true),
pbReserve: ProtoField(8, () => SrcMsgPbRes, true), pbReserve: ProtoField(8, () => SrcMsgPbRes, true),
sourceMsg: ProtoField(9, ScalarType.BYTES, true), sourceMsg: ProtoField(9, ScalarType.BYTES, true),
toUin: ProtoField(10, ScalarType.UINT64, true), toUin: ProtoField(10, ScalarType.UINT64, true),
troopName: ProtoField(11, ScalarType.BYTES, true), troopName: ProtoField(11, ScalarType.BYTES, true),
}; };
export const SrcMsgPbRes = { export const SrcMsgPbRes = {
messageId: ProtoField(3, ScalarType.UINT64), messageId: ProtoField(3, ScalarType.UINT64),
senderUid: ProtoField(6, ScalarType.STRING, true), senderUid: ProtoField(6, ScalarType.STRING, true),
receiverUid: ProtoField(7, ScalarType.STRING, true), receiverUid: ProtoField(7, ScalarType.STRING, true),
friendSeq: ProtoField(8, ScalarType.UINT32, true), friendSeq: ProtoField(8, ScalarType.UINT32, true),
}; };
export const LightAppElem = { export const LightAppElem = {
data: ProtoField(1, ScalarType.BYTES), data: ProtoField(1, ScalarType.BYTES),
msgResid: ProtoField(2, ScalarType.BYTES, true), msgResid: ProtoField(2, ScalarType.BYTES, true),
}; };
export const CommonElem = { export const CommonElem = {
serviceType: ProtoField(1, ScalarType.INT32), serviceType: ProtoField(1, ScalarType.INT32),
pbElem: ProtoField(2, ScalarType.BYTES), pbElem: ProtoField(2, ScalarType.BYTES),
businessType: ProtoField(3, ScalarType.UINT32), businessType: ProtoField(3, ScalarType.UINT32),
}; };
export const FaceExtra = { export const FaceExtra = {
faceId: ProtoField(1, ScalarType.INT32, true), faceId: ProtoField(1, ScalarType.INT32, true),
}; };
export const MentionExtra = { export const MentionExtra = {
type: ProtoField(3, ScalarType.INT32, true), type: ProtoField(3, ScalarType.INT32, true),
uin: ProtoField(4, ScalarType.UINT32, true), uin: ProtoField(4, ScalarType.UINT32, true),
field5: ProtoField(5, ScalarType.INT32, true), field5: ProtoField(5, ScalarType.INT32, true),
uid: ProtoField(9, ScalarType.STRING, true), uid: ProtoField(9, ScalarType.STRING, true),
}; };
export const QBigFaceExtra = { export const QBigFaceExtra = {
AniStickerPackId: ProtoField(1, ScalarType.STRING, true), AniStickerPackId: ProtoField(1, ScalarType.STRING, true),
AniStickerId: ProtoField(2, ScalarType.STRING, true), AniStickerId: ProtoField(2, ScalarType.STRING, true),
faceId: ProtoField(3, ScalarType.INT32, true), faceId: ProtoField(3, ScalarType.INT32, true),
sourceType: ProtoField(4, ScalarType.INT32, true), sourceType: ProtoField(4, ScalarType.INT32, true),
AniStickerType: ProtoField(5, ScalarType.INT32, true), AniStickerType: ProtoField(5, ScalarType.INT32, true),
resultId: ProtoField(6, ScalarType.STRING, true), resultId: ProtoField(6, ScalarType.STRING, true),
preview: ProtoField(7, ScalarType.STRING, true), preview: ProtoField(7, ScalarType.STRING, true),
randomType: ProtoField(9, ScalarType.INT32, true), randomType: ProtoField(9, ScalarType.INT32, true),
}; };
export const QSmallFaceExtra = { export const QSmallFaceExtra = {
faceId: ProtoField(1, ScalarType.UINT32), faceId: ProtoField(1, ScalarType.UINT32),
preview: ProtoField(2, ScalarType.STRING), preview: ProtoField(2, ScalarType.STRING),
preview2: ProtoField(3, ScalarType.STRING), preview2: ProtoField(3, ScalarType.STRING),
}; };
export const MarkdownData = { export const MarkdownData = {
content: ProtoField(1, ScalarType.STRING) content: ProtoField(1, ScalarType.STRING),
}; };

View File

@ -1,18 +1,18 @@
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),
groupUin: ProtoField(2, ScalarType.UINT32), groupUin: ProtoField(2, ScalarType.UINT32),
field3: ProtoField(3, () => GroupRecallMsgField3), field3: ProtoField(3, () => GroupRecallMsgField3),
field4: ProtoField(4, () => GroupRecallMsgField4), field4: ProtoField(4, () => GroupRecallMsgField4),
}; };
export const GroupRecallMsgField3 = { export const GroupRecallMsgField3 = {
sequence: ProtoField(1, ScalarType.UINT32), sequence: ProtoField(1, ScalarType.UINT32),
random: ProtoField(2, ScalarType.UINT32), random: ProtoField(2, ScalarType.UINT32),
field3: ProtoField(3, ScalarType.UINT32), field3: ProtoField(3, ScalarType.UINT32),
}; };
export const GroupRecallMsgField4 = { export const GroupRecallMsgField4 = {
field1: ProtoField(1, ScalarType.UINT32), field1: ProtoField(1, ScalarType.UINT32),
}; };

View File

@ -1,18 +1,18 @@
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),
isPromote: ProtoField(2, ScalarType.BOOL), isPromote: ProtoField(2, ScalarType.BOOL),
}; };
export const GroupAdminBody = { export const GroupAdminBody = {
extraDisable: ProtoField(1, () => GroupAdminExtra), extraDisable: ProtoField(1, () => GroupAdminExtra),
extraEnable: ProtoField(2, () => GroupAdminExtra), extraEnable: ProtoField(2, () => GroupAdminExtra),
}; };
export const GroupAdmin = { export const GroupAdmin = {
groupUin: ProtoField(1, ScalarType.UINT32), groupUin: ProtoField(1, ScalarType.UINT32),
flag: ProtoField(2, ScalarType.UINT32), flag: ProtoField(2, ScalarType.UINT32),
isPromote: ProtoField(3, ScalarType.BOOL), isPromote: ProtoField(3, ScalarType.BOOL),
body: ProtoField(4, () => GroupAdminBody), body: ProtoField(4, () => GroupAdminBody),
}; };

View File

@ -1,139 +1,138 @@
import { ProtoField, ScalarType } from '@napneko/nap-proto-core'; import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
import { import {
C2C, C2C,
ForwardHead, ForwardHead,
Grp, Grp,
GrpTmp, GrpTmp,
ResponseForward, ResponseForward,
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),
subType: ProtoField(2, ScalarType.UINT32, true), subType: ProtoField(2, ScalarType.UINT32, true),
c2cCmd: ProtoField(3, ScalarType.UINT32, true), c2cCmd: ProtoField(3, ScalarType.UINT32, true),
ranDom: ProtoField(4, ScalarType.UINT32, true), ranDom: ProtoField(4, ScalarType.UINT32, true),
sequence: ProtoField(5, ScalarType.UINT32, true), sequence: ProtoField(5, ScalarType.UINT32, true),
timeStamp: ProtoField(6, ScalarType.UINT32, true), timeStamp: ProtoField(6, ScalarType.UINT32, true),
pkgNum: ProtoField(7, ScalarType.UINT64, true), pkgNum: ProtoField(7, ScalarType.UINT64, true),
pkgIndex: ProtoField(8, ScalarType.UINT32, true), pkgIndex: ProtoField(8, ScalarType.UINT32, true),
divSeq: ProtoField(9, ScalarType.UINT32, true), divSeq: ProtoField(9, ScalarType.UINT32, true),
autoReply: ProtoField(10, ScalarType.UINT32), autoReply: ProtoField(10, ScalarType.UINT32),
ntMsgSeq: ProtoField(10, ScalarType.UINT32, true), ntMsgSeq: ProtoField(10, ScalarType.UINT32, true),
newId: ProtoField(12, ScalarType.UINT64, true), newId: ProtoField(12, ScalarType.UINT64, true),
forward: ProtoField(15, () => ForwardHead, true), forward: ProtoField(15, () => ForwardHead, true),
}; };
export const MessageBody = { export const MessageBody = {
richText: ProtoField(1, () => RichText, true), richText: ProtoField(1, () => RichText, true),
msgContent: ProtoField(2, ScalarType.BYTES, true), msgContent: ProtoField(2, ScalarType.BYTES, true),
msgEncryptContent: ProtoField(3, ScalarType.BYTES, true), msgEncryptContent: ProtoField(3, ScalarType.BYTES, true),
}; };
export const Message = { export const Message = {
routingHead: ProtoField(1, () => RoutingHead, true), routingHead: ProtoField(1, () => RoutingHead, true),
contentHead: ProtoField(2, () => ContentHead, true), contentHead: ProtoField(2, () => ContentHead, true),
body: ProtoField(3, () => MessageBody, true), body: ProtoField(3, () => MessageBody, true),
clientSequence: ProtoField(4, ScalarType.UINT32, true), clientSequence: ProtoField(4, ScalarType.UINT32, true),
random: ProtoField(5, ScalarType.UINT32, true), random: ProtoField(5, ScalarType.UINT32, true),
syncCookie: ProtoField(6, ScalarType.BYTES, true), syncCookie: ProtoField(6, ScalarType.BYTES, true),
via: ProtoField(8, ScalarType.UINT32, true), via: ProtoField(8, ScalarType.UINT32, true),
dataStatist: ProtoField(9, ScalarType.UINT32, true), dataStatist: ProtoField(9, ScalarType.UINT32, true),
ctrl: ProtoField(12, () => MessageControl, true), ctrl: ProtoField(12, () => MessageControl, true),
multiSendSeq: ProtoField(14, ScalarType.UINT32), multiSendSeq: ProtoField(14, ScalarType.UINT32),
}; };
export const MessageControl = { export const MessageControl = {
msgFlag: ProtoField(1, ScalarType.INT32), msgFlag: ProtoField(1, ScalarType.INT32),
}; };
export const PushMsg = { export const PushMsg = {
message: ProtoField(1, () => PushMsgBody), message: ProtoField(1, () => PushMsgBody),
status: ProtoField(3, ScalarType.INT32, true), status: ProtoField(3, ScalarType.INT32, true),
pingFlag: ProtoField(5, ScalarType.INT32, true), pingFlag: ProtoField(5, ScalarType.INT32, true),
generalFlag: ProtoField(9, ScalarType.INT32, true), generalFlag: ProtoField(9, ScalarType.INT32, true),
}; };
export const GroupChangeInfo = { export const GroupChangeInfo = {
operator: ProtoField(1, () => GroupChangeOperator, true), operator: ProtoField(1, () => GroupChangeOperator, true),
}; };
export const GroupChangeOperator = { export const GroupChangeOperator = {
operatorUid: ProtoField(1, ScalarType.STRING, true), operatorUid: ProtoField(1, ScalarType.STRING, true),
}; };
export const GroupChange = { export const GroupChange = {
groupUin: ProtoField(1, ScalarType.UINT32), groupUin: ProtoField(1, ScalarType.UINT32),
flag: ProtoField(2, ScalarType.UINT32), flag: ProtoField(2, ScalarType.UINT32),
memberUid: ProtoField(3, ScalarType.STRING, true), memberUid: ProtoField(3, ScalarType.STRING, true),
decreaseType: ProtoField(4, ScalarType.UINT32), decreaseType: ProtoField(4, ScalarType.UINT32),
operatorInfo: ProtoField(5, ScalarType.BYTES, true), operatorInfo: ProtoField(5, ScalarType.BYTES, true),
increaseType: ProtoField(6, ScalarType.UINT32), increaseType: ProtoField(6, ScalarType.UINT32),
field7: ProtoField(7, ScalarType.BYTES, true), field7: ProtoField(7, ScalarType.BYTES, true),
}; };
// Group Reaction Related // Group Reaction Related
export const GroupReactionDataInnerDataTarget = { export const GroupReactionDataInnerDataTarget = {
seq: ProtoField(1, ScalarType.UINT64, true), seq: ProtoField(1, ScalarType.UINT64, true),
}; };
export const GroupReactionDataContent = { export const GroupReactionDataContent = {
code: ProtoField(1, ScalarType.STRING, true), code: ProtoField(1, ScalarType.STRING, true),
count: ProtoField(3, ScalarType.UINT32, true), count: ProtoField(3, ScalarType.UINT32, true),
operatorUid: ProtoField(4, ScalarType.STRING, true), operatorUid: ProtoField(4, ScalarType.STRING, true),
type: ProtoField(5, ScalarType.UINT32, true), type: ProtoField(5, ScalarType.UINT32, true),
}; };
export const GroupReactionDataInnerData = { export const GroupReactionDataInnerData = {
groupReactionTarget: ProtoField(2, () => GroupReactionDataInnerDataTarget, true), groupReactionTarget: ProtoField(2, () => GroupReactionDataInnerDataTarget, true),
groupReactionDataContent: ProtoField(3, () => GroupReactionDataContent, true), groupReactionDataContent: ProtoField(3, () => GroupReactionDataContent, true),
}; };
export const GroupReactionDataInner = { export const GroupReactionDataInner = {
data: ProtoField(1, () => GroupReactionDataInnerData, true), data: ProtoField(1, () => GroupReactionDataInnerData, true),
}; };
export const GroupReactionData = { export const GroupReactionData = {
data: ProtoField(1, () => GroupReactionDataInner, true), data: ProtoField(1, () => GroupReactionDataInner, true),
}; };
export const GroupReactNotify = { export const GroupReactNotify = {
groupUin: ProtoField(4, ScalarType.UINT64, true), groupUin: ProtoField(4, ScalarType.UINT64, true),
field13: ProtoField(13, ScalarType.UINT32, true), field13: ProtoField(13, ScalarType.UINT32, true),
groupReactionData: ProtoField(44, () => GroupReactionData, true), groupReactionData: ProtoField(44, () => GroupReactionData, true),
}; };
// Group Invite Related // Group Invite Related
export const GroupInvite = { export const GroupInvite = {
groupUin: ProtoField(1, ScalarType.UINT32), groupUin: ProtoField(1, ScalarType.UINT32),
field2: ProtoField(2, ScalarType.UINT32), field2: ProtoField(2, ScalarType.UINT32),
field3: ProtoField(2, ScalarType.UINT32), field3: ProtoField(2, ScalarType.UINT32),
field4: ProtoField(2, ScalarType.UINT32), field4: ProtoField(2, ScalarType.UINT32),
invitorUid: ProtoField(5, ScalarType.STRING), invitorUid: ProtoField(5, ScalarType.STRING),
}; };
export const PushMsgBody = { export const PushMsgBody = {
responseHead: ProtoField(1, () => ResponseHead), responseHead: ProtoField(1, () => ResponseHead),
contentHead: ProtoField(2, () => ContentHead), contentHead: ProtoField(2, () => ContentHead),
body: ProtoField(3, () => MessageBody, true), body: ProtoField(3, () => MessageBody, true),
}; };
export const ResponseHead = { export const ResponseHead = {
fromUin: ProtoField(1, ScalarType.UINT32), fromUin: ProtoField(1, ScalarType.UINT32),
fromUid: ProtoField(2, ScalarType.STRING, true), fromUid: ProtoField(2, ScalarType.STRING, true),
type: ProtoField(3, ScalarType.UINT32), type: ProtoField(3, ScalarType.UINT32),
sigMap: ProtoField(4, ScalarType.UINT32), sigMap: ProtoField(4, ScalarType.UINT32),
toUin: ProtoField(5, ScalarType.UINT32), toUin: ProtoField(5, ScalarType.UINT32),
toUid: ProtoField(6, ScalarType.STRING, true), toUid: ProtoField(6, ScalarType.STRING, true),
forward: ProtoField(7, () => ResponseForward, true), forward: ProtoField(7, () => ResponseForward, true),
grp: ProtoField(8, () => ResponseGrp, true), grp: ProtoField(8, () => ResponseGrp, true),
}; };
export const RoutingHead = { export const RoutingHead = {
c2c: ProtoField(1, () => C2C, true), c2c: ProtoField(1, () => C2C, true),
grp: ProtoField(2, () => Grp, true), grp: ProtoField(2, () => Grp, true),
grpTmp: ProtoField(3, () => GrpTmp, true), grpTmp: ProtoField(3, () => GrpTmp, true),
wpaTmp: ProtoField(6, () => WPATmp, true), wpaTmp: ProtoField(6, () => WPATmp, true),
trans0X211: ProtoField(15, () => Trans0X211, true), trans0X211: ProtoField(15, () => Trans0X211, true),
}; };

View File

@ -1,21 +1,21 @@
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),
instId: ProtoField(2, ScalarType.UINT32), instId: ProtoField(2, ScalarType.UINT32),
appId: ProtoField(3, ScalarType.UINT32), appId: ProtoField(3, ScalarType.UINT32),
longMessageFlag: ProtoField(4, ScalarType.UINT32), longMessageFlag: ProtoField(4, ScalarType.UINT32),
reserved: ProtoField(5, ScalarType.BYTES), reserved: ProtoField(5, ScalarType.BYTES),
}; };
export const FriendRecallInfo = { export const FriendRecallInfo = {
fromUid: ProtoField(1, ScalarType.STRING), fromUid: ProtoField(1, ScalarType.STRING),
toUid: ProtoField(2, ScalarType.STRING), toUid: ProtoField(2, ScalarType.STRING),
sequence: ProtoField(3, ScalarType.UINT32), sequence: ProtoField(3, ScalarType.UINT32),
newId: ProtoField(4, ScalarType.UINT64), newId: ProtoField(4, ScalarType.UINT64),
time: ProtoField(5, ScalarType.UINT32), time: ProtoField(5, ScalarType.UINT32),
random: ProtoField(6, ScalarType.UINT32), random: ProtoField(6, ScalarType.UINT32),
pkgNum: ProtoField(7, ScalarType.UINT32), pkgNum: ProtoField(7, ScalarType.UINT32),
pkgIndex: ProtoField(8, ScalarType.UINT32), pkgIndex: ProtoField(8, ScalarType.UINT32),
divSeq: ProtoField(9, ScalarType.UINT32), divSeq: ProtoField(9, ScalarType.UINT32),
}; };

View File

@ -1,40 +1,40 @@
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),
field2: ProtoField(2, ScalarType.UINT32, true), field2: ProtoField(2, ScalarType.UINT32, true),
field3: ProtoField(3, ScalarType.UINT32, true), field3: ProtoField(3, ScalarType.UINT32, true),
unknownBase64: ProtoField(5, ScalarType.STRING, true), unknownBase64: ProtoField(5, ScalarType.STRING, true),
avatar: ProtoField(6, ScalarType.STRING, true), avatar: ProtoField(6, ScalarType.STRING, true),
}; };
export const Grp = { export const Grp = {
groupCode: ProtoField(1, ScalarType.UINT32, true), groupCode: ProtoField(1, ScalarType.UINT32, true),
}; };
export const GrpTmp = { export const GrpTmp = {
groupUin: ProtoField(1, ScalarType.UINT32, true), groupUin: ProtoField(1, ScalarType.UINT32, true),
toUin: ProtoField(2, ScalarType.UINT32, true), toUin: ProtoField(2, ScalarType.UINT32, true),
}; };
export const ResponseForward = { export const ResponseForward = {
friendName: ProtoField(6, ScalarType.STRING, true), friendName: ProtoField(6, ScalarType.STRING, true),
}; };
export const ResponseGrp = { export const ResponseGrp = {
groupUin: ProtoField(1, ScalarType.UINT32), groupUin: ProtoField(1, ScalarType.UINT32),
memberName: ProtoField(4, ScalarType.STRING), memberName: ProtoField(4, ScalarType.STRING),
unknown5: ProtoField(5, ScalarType.UINT32), unknown5: ProtoField(5, ScalarType.UINT32),
groupName: ProtoField(7, ScalarType.STRING), groupName: ProtoField(7, ScalarType.STRING),
}; };
export const Trans0X211 = { export const Trans0X211 = {
toUin: ProtoField(1, ScalarType.UINT64, true), toUin: ProtoField(1, ScalarType.UINT64, true),
ccCmd: ProtoField(2, ScalarType.UINT32, true), ccCmd: ProtoField(2, ScalarType.UINT32, true),
uid: ProtoField(8, ScalarType.STRING, true), uid: ProtoField(8, ScalarType.STRING, true),
}; };
export const WPATmp = { export const WPATmp = {
toUin: ProtoField(1, ScalarType.UINT64), toUin: ProtoField(1, ScalarType.UINT64),
sig: ProtoField(2, ScalarType.BYTES), sig: ProtoField(2, ScalarType.BYTES),
}; };