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",

View File

@ -6,7 +6,7 @@ import {
PacketMsgFileElement, PacketMsgFileElement,
PacketMsgPicElement, PacketMsgPicElement,
PacketMsgPttElement, PacketMsgPttElement,
PacketMsgVideoElement PacketMsgVideoElement,
} from '@/core/packet/message/element'; } from '@/core/packet/message/element';
import { ChatType, Peer } from '@/core'; import { ChatType, Peer } from '@/core';
import { calculateSha1, calculateSha1StreamBytes, computeMd5AndLengthWithLimit } from '@/core/packet/utils/crypto/hash'; import { calculateSha1, calculateSha1StreamBytes, computeMd5AndLengthWithLimit } from '@/core/packet/utils/crypto/hash';
@ -79,7 +79,7 @@ export class PacketHighwayContext {
this.logger.debug(`[Highway PrepareUpload] server addr add: ${int32ip2str(addr.ip)}:${addr.port}`); this.logger.debug(`[Highway PrepareUpload] server addr add: ${int32ip2str(addr.ip)}:${addr.port}`);
this.sig.serverAddr.push({ this.sig.serverAddr.push({
ip: int32ip2str(addr.ip), ip: int32ip2str(addr.ip),
port: addr.port port: addr.port,
}); });
this.hwClient.changeServer(int32ip2str(addr.ip), addr.port); this.hwClient.changeServer(int32ip2str(addr.ip), addr.port);
} }
@ -151,13 +151,13 @@ export class PacketHighwayContext {
fileUuid: index.fileUuid, fileUuid: index.fileUuid,
uKey: ukey, uKey: ukey,
network: { network: {
ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S) ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S),
}, },
msgInfoBody: preRespData.upload.msgInfo.msgInfoBody, msgInfoBody: preRespData.upload.msgInfo.msgInfoBody,
blockSize: BlockSize, blockSize: BlockSize,
hash: { hash: {
fileSha1: [sha1] fileSha1: [sha1],
} },
}); });
await this.hwClient.upload( await this.hwClient.upload(
1004, 1004,
@ -188,13 +188,13 @@ export class PacketHighwayContext {
fileUuid: index.fileUuid, fileUuid: index.fileUuid,
uKey: ukey, uKey: ukey,
network: { network: {
ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S) ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S),
}, },
msgInfoBody: preRespData.upload.msgInfo.msgInfoBody, msgInfoBody: preRespData.upload.msgInfo.msgInfoBody,
blockSize: BlockSize, blockSize: BlockSize,
hash: { hash: {
fileSha1: [sha1] fileSha1: [sha1],
} },
}); });
await this.hwClient.upload( await this.hwClient.upload(
1003, 1003,
@ -225,13 +225,13 @@ export class PacketHighwayContext {
fileUuid: index.fileUuid, fileUuid: index.fileUuid,
uKey: ukey, uKey: ukey,
network: { network: {
ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S) ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S),
}, },
msgInfoBody: preRespData.upload.msgInfo.msgInfoBody, msgInfoBody: preRespData.upload.msgInfo.msgInfoBody,
blockSize: BlockSize, blockSize: BlockSize,
hash: { hash: {
fileSha1: await calculateSha1StreamBytes(video.filePath) fileSha1: await calculateSha1StreamBytes(video.filePath),
} },
}); });
await this.hwClient.upload( await this.hwClient.upload(
1005, 1005,
@ -253,13 +253,13 @@ export class PacketHighwayContext {
fileUuid: index.fileUuid, fileUuid: index.fileUuid,
uKey: subFile!.uKey, uKey: subFile!.uKey,
network: { network: {
ipv4S: oidbIpv4s2HighwayIpv4s(subFile!.ipv4S) ipv4S: oidbIpv4s2HighwayIpv4s(subFile!.ipv4S),
}, },
msgInfoBody: preRespData.upload.msgInfo.msgInfoBody, msgInfoBody: preRespData.upload.msgInfo.msgInfoBody,
blockSize: BlockSize, blockSize: BlockSize,
hash: { hash: {
fileSha1: [sha1] fileSha1: [sha1],
} },
}); });
await this.hwClient.upload( await this.hwClient.upload(
1006, 1006,
@ -290,13 +290,13 @@ export class PacketHighwayContext {
fileUuid: index.fileUuid, fileUuid: index.fileUuid,
uKey: ukey, uKey: ukey,
network: { network: {
ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S) ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S),
}, },
msgInfoBody: preRespData.upload.msgInfo.msgInfoBody, msgInfoBody: preRespData.upload.msgInfo.msgInfoBody,
blockSize: BlockSize, blockSize: BlockSize,
hash: { hash: {
fileSha1: await calculateSha1StreamBytes(video.filePath) fileSha1: await calculateSha1StreamBytes(video.filePath),
} },
}); });
await this.hwClient.upload( await this.hwClient.upload(
1001, 1001,
@ -318,13 +318,13 @@ export class PacketHighwayContext {
fileUuid: index.fileUuid, fileUuid: index.fileUuid,
uKey: subFile!.uKey, uKey: subFile!.uKey,
network: { network: {
ipv4S: oidbIpv4s2HighwayIpv4s(subFile!.ipv4S) ipv4S: oidbIpv4s2HighwayIpv4s(subFile!.ipv4S),
}, },
msgInfoBody: preRespData.upload.msgInfo.msgInfoBody, msgInfoBody: preRespData.upload.msgInfo.msgInfoBody,
blockSize: BlockSize, blockSize: BlockSize,
hash: { hash: {
fileSha1: [sha1] fileSha1: [sha1],
} },
}); });
await this.hwClient.upload( await this.hwClient.upload(
1002, 1002,
@ -354,13 +354,13 @@ export class PacketHighwayContext {
fileUuid: index.fileUuid, fileUuid: index.fileUuid,
uKey: ukey, uKey: ukey,
network: { network: {
ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S) ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S),
}, },
msgInfoBody: preRespData.upload.msgInfo.msgInfoBody, msgInfoBody: preRespData.upload.msgInfo.msgInfoBody,
blockSize: BlockSize, blockSize: BlockSize,
hash: { hash: {
fileSha1: [sha1] fileSha1: [sha1],
} },
}); });
await this.hwClient.upload( await this.hwClient.upload(
1008, 1008,
@ -390,13 +390,13 @@ export class PacketHighwayContext {
fileUuid: index.fileUuid, fileUuid: index.fileUuid,
uKey: ukey, uKey: ukey,
network: { network: {
ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S) ipv4S: oidbIpv4s2HighwayIpv4s(preRespData.upload.ipv4S),
}, },
msgInfoBody: preRespData.upload.msgInfo.msgInfoBody, msgInfoBody: preRespData.upload.msgInfo.msgInfoBody,
blockSize: BlockSize, blockSize: BlockSize,
hash: { hash: {
fileSha1: [sha1] fileSha1: [sha1],
} },
}); });
await this.hwClient.upload( await this.hwClient.upload(
1007, 1007,
@ -442,10 +442,10 @@ export class PacketHighwayContext {
appId: '100', appId: '100',
terminalType: 3, terminalType: 3,
clientVer: '1.1.1', clientVer: '1.1.1',
unknown: 4 unknown: 4,
}, },
fileNameInfo: { fileNameInfo: {
fileName: file.fileName fileName: file.fileName,
}, },
host: { host: {
hosts: [ hosts: [
@ -455,9 +455,9 @@ export class PacketHighwayContext {
unknown: 1, unknown: 1,
}, },
port: preRespData.upload.uploadPort, port: preRespData.upload.uploadPort,
} },
] ],
} },
}, },
unknown200: 0, unknown200: 0,
}); });
@ -503,10 +503,10 @@ export class PacketHighwayContext {
appId: '100', appId: '100',
terminalType: 3, terminalType: 3,
clientVer: '1.1.1', clientVer: '1.1.1',
unknown: 4 unknown: 4,
}, },
fileNameInfo: { fileNameInfo: {
fileName: file.fileName fileName: file.fileName,
}, },
host: { host: {
hosts: [ hosts: [
@ -516,12 +516,12 @@ export class PacketHighwayContext {
unknown: 1, unknown: 1,
}, },
port: preRespData.upload?.uploadPort, port: preRespData.upload?.uploadPort,
} },
] ],
} },
}, },
unknown200: 1, unknown200: 1,
unknown3: 0 unknown3: 0,
}); });
await this.hwClient.upload( await this.hwClient.upload(
95, 95,

View File

@ -48,7 +48,7 @@ export class HighwayHttpUploader extends IHighwayUploader {
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(),

View File

@ -17,7 +17,6 @@ class HighwayTcpUploaderTransform extends stream.Transform {
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) {

View File

@ -55,7 +55,7 @@ export abstract class IHighwayUploader {
msgLoginSigHead: { msgLoginSigHead: {
uint32LoginSigType: 8, uint32LoginSigType: 8,
appId: 1600001604, appId: 1600001604,
} },
}); });
} }

View File

@ -8,7 +8,7 @@ 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
); );
@ -29,15 +29,19 @@ export class PacketMsgBuilder {
sigMap: 0, sigMap: 0,
toUin: 0, toUin: 0,
fromUid: '', fromUid: '',
forward: node.groupId ? undefined : { forward: node.groupId
? undefined
: {
friendName: node.senderName, friendName: node.senderName,
}, },
toUid: node.groupId ? undefined : selfUid, toUid: node.groupId ? undefined : selfUid,
grp: node.groupId ? { grp: node.groupId
? {
groupUin: node.groupId, groupUin: node.groupId,
memberName: node.senderName, memberName: node.senderName,
unknown5: 2 unknown5: 2,
} : undefined, }
: undefined,
}, },
contentHead: { contentHead: {
type: node.groupId ? 82 : 9, type: node.groupId ? 82 : 9,
@ -51,15 +55,15 @@ export class PacketMsgBuilder {
field2: 0, field2: 0,
field3: node.groupId ? 1 : 2, field3: node.groupId ? 1 : 2,
unknownBase64: avatar, unknownBase64: avatar,
avatar: avatar avatar,
} },
}, },
body: { body: {
richText: { richText: {
elems: msgElement elems: msgElement,
},
msgContent,
}, },
msgContent: msgContent,
}
}; };
}); });
} }

View File

@ -14,7 +14,7 @@ import {
SendPttElement, SendPttElement,
SendReplyElement, SendReplyElement,
SendTextElement, SendTextElement,
SendVideoElement SendVideoElement,
} from '@/core'; } from '@/core';
import { import {
IPacketMsgElement, IPacketMsgElement,
@ -29,7 +29,7 @@ import {
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';
@ -46,7 +46,7 @@ const SupportedElementTypes = [
ElementType.PTT, ElementType.PTT,
ElementType.ARK, ElementType.ARK,
ElementType.MARKDOWN, ElementType.MARKDOWN,
ElementType.MULTIFORWARD ElementType.MULTIFORWARD,
]; ];
type SendMessageTypeElementMap = { type SendMessageTypeElementMap = {
@ -67,7 +67,7 @@ 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;
@ -76,7 +76,7 @@ export type rawMsgWithSendMsg = {
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 {
@ -120,7 +120,7 @@ export class PacketMsgConverter {
}, },
[ElementType.MULTIFORWARD]: (element) => { [ElementType.MULTIFORWARD]: (element) => {
return new PacketMultiMsgElement(element as SendMultiForwardMsgElement); return new PacketMultiMsgElement(element as SendMultiForwardMsgElement);
} },
}; };
rawMsgWithSendMsgToPacketMsg (msg: rawMsgWithSendMsg): PacketMsg { rawMsgWithSendMsgToPacketMsg (msg: rawMsgWithSendMsg): PacketMsg {
@ -133,7 +133,7 @@ export class PacketMsgConverter {
msg: msg.msg.map((element) => { msg: msg.msg.map((element) => {
if (!this.isValidElementType(element.elementType)) return null; if (!this.isValidElementType(element.elementType)) return null;
return this.rawToPacketMsgConverters[element.elementType](element as MessageElement); return this.rawToPacketMsgConverters[element.elementType](element as MessageElement);
}).filter((e) => e !== null) }).filter((e) => e !== null),
}; };
} }
@ -152,7 +152,7 @@ export class PacketMsgConverter {
msg: msg.elements.map((element) => { msg: msg.elements.map((element) => {
if (!this.isValidElementType(element.elementType)) return null; if (!this.isValidElementType(element.elementType)) return null;
return this.rawToPacketMsgConverters[element.elementType](element); return this.rawToPacketMsgConverters[element.elementType](element);
}).filter((e) => e !== null) }).filter((e) => e !== null),
}; };
} }

View File

@ -31,7 +31,7 @@ import {
SendMultiForwardMsgElement, SendMultiForwardMsgElement,
SendTextElement, SendTextElement,
SendVideoElement, SendVideoElement,
Peer Peer,
} from '@/core'; } from '@/core';
import { ForwardMsgBuilder } from '@/common/forward-msg-builder'; import { ForwardMsgBuilder } from '@/common/forward-msg-builder';
import { PacketMsg, PacketSendMsgElement } from '@/core/packet/message/message'; import { PacketMsg, PacketSendMsgElement } from '@/core/packet/message/message';
@ -42,7 +42,6 @@ type ParseElementFn = (elem: NapProtoDecodeStructType<typeof Elem>) => ParseElem
// raw <-> packet // raw <-> packet
// TODO: SendStructLongMsgElement // TODO: SendStructLongMsgElement
export abstract class IPacketMsgElement<T extends PacketSendMsgElement> { export abstract class IPacketMsgElement<T extends PacketSendMsgElement> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected constructor (_rawElement: T) { protected constructor (_rawElement: T) {
} }
@ -76,8 +75,8 @@ export class PacketMsgTextElement extends IPacketMsgElement<SendTextElement> {
override buildElement (): NapProtoEncodeStructType<typeof Elem>[] { override buildElement (): NapProtoEncodeStructType<typeof Elem>[] {
return [{ return [{
text: { text: {
str: this.text str: this.text,
} },
}]; }];
} }
@ -100,10 +99,8 @@ export class PacketMsgTextElement extends IPacketMsgElement<SendTextElement> {
override toPreview (): string { override toPreview (): string {
return this.text; return this.text;
};
} }
}
export class PacketMsgAtElement extends PacketMsgTextElement { export class PacketMsgAtElement extends PacketMsgTextElement {
targetUid: string; targetUid: string;
@ -125,10 +122,11 @@ export class PacketMsgAtElement extends PacketMsgTextElement {
field5: 0, field5: 0,
uid: this.targetUid, uid: this.targetUid,
} }
) ),
} },
}]; }];
} }
static override parseElement = (elem: NapProtoDecodeStructType<typeof Elem>): ParseElementFnR => { static override parseElement = (elem: NapProtoDecodeStructType<typeof Elem>): ParseElementFnR => {
if (elem.text?.str && (elem.text?.attr6Buf?.length ?? 100) >= 11) { if (elem.text?.str && (elem.text?.attr6Buf?.length ?? 100) >= 11) {
return [{ return [{
@ -182,7 +180,7 @@ export class PacketMsgReplyElement extends IPacketMsgElement<SendReplyElement> {
elems: this.targetElems ?? [], elems: this.targetElems ?? [],
sourceMsg: new NapProtoMsg(PushMsgBody).encode(this.targetSourceMsg ?? {}), sourceMsg: new NapProtoMsg(PushMsgBody).encode(this.targetSourceMsg ?? {}),
toUin: BigInt(0), toUin: BigInt(0),
} },
}]; }];
} }
@ -193,7 +191,7 @@ export class PacketMsgReplyElement extends IPacketMsgElement<SendReplyElement> {
replyElement: { replyElement: {
replayMsgSeq: String(reserve.friendSeq ?? elem.srcMsg?.origSeqs?.[0] ?? 0), replayMsgSeq: String(reserve.friendSeq ?? elem.srcMsg?.origSeqs?.[0] ?? 0),
replayMsgId: String(reserve.messageId ?? 0), replayMsgId: String(reserve.messageId ?? 0),
senderUin: String(elem?.srcMsg ?? 0) senderUin: String(elem?.srcMsg ?? 0),
}, },
elementType: ElementType.UNKNOWN, elementType: ElementType.UNKNOWN,
elementId: '', elementId: '',
@ -231,16 +229,16 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
sourceType: 1, sourceType: 1,
resultId: this.resultId, resultId: this.resultId,
preview: '', preview: '',
randomType: 1 randomType: 1,
}), }),
businessType: 1 businessType: 1,
} },
}]; }];
} else if (this.faceId < 260) { } else if (this.faceId < 260) {
return [{ return [{
face: { face: {
index: this.faceId index: this.faceId,
} },
}]; }];
} else { } else {
return [{ return [{
@ -249,10 +247,10 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
pbElem: new NapProtoMsg(QSmallFaceExtra).encode({ pbElem: new NapProtoMsg(QSmallFaceExtra).encode({
faceId: this.faceId, faceId: this.faceId,
preview: '', preview: '',
preview2: '' preview2: '',
}), }),
businessType: 1 businessType: 1,
} },
}]; }];
} }
} }
@ -262,7 +260,7 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
return [{ return [{
faceElement: { faceElement: {
faceIndex: elem.face.index, faceIndex: elem.face.index,
faceType: FaceType.Normal faceType: FaceType.Normal,
}, },
elementType: ElementType.UNKNOWN, elementType: ElementType.UNKNOWN,
elementId: '', elementId: '',
@ -274,7 +272,7 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
return [{ return [{
faceElement: { faceElement: {
faceIndex: qface.faceId, faceIndex: qface.faceId,
faceType: FaceType.Normal faceType: FaceType.Normal,
}, },
elementType: ElementType.UNKNOWN, elementType: ElementType.UNKNOWN,
elementId: '', elementId: '',
@ -287,7 +285,7 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
return [{ return [{
faceElement: { faceElement: {
faceIndex: qface.faceId, faceIndex: qface.faceId,
faceType: FaceType.Normal faceType: FaceType.Normal,
}, },
elementType: ElementType.UNKNOWN, elementType: ElementType.UNKNOWN,
elementId: '', elementId: '',
@ -329,9 +327,9 @@ export class PacketMsgMarkFaceElement extends IPacketMsgElement<SendMarketFaceEl
imageWidth: 300, imageWidth: 300,
imageHeight: 300, imageHeight: 300,
pbReserve: { pbReserve: {
field8: 1 field8: 1,
} },
} },
}]; }];
} }
@ -365,9 +363,11 @@ export class PacketMsgPicElement extends IPacketMsgElement<SendPicElement> {
this.height = element.picElement.picHeight; this.height = element.picElement.picHeight;
this.picType = element.picElement.picType; this.picType = element.picElement.picType;
this.picSubType = element.picElement.picSubType ?? 0; this.picSubType = element.picElement.picSubType ?? 0;
this.summary = element.picElement.summary === '' ? ( this.summary = element.picElement.summary === ''
? (
element.picElement.picSubType === 0 ? '[图片]' : '[动画表情]' element.picElement.picSubType === 0 ? '[图片]' : '[动画表情]'
) : element.picElement.summary; )
: element.picElement.summary;
} }
override get valid (): boolean { override get valid (): boolean {
@ -381,7 +381,7 @@ export class PacketMsgPicElement extends IPacketMsgElement<SendPicElement> {
serviceType: 48, serviceType: 48,
pbElem: new NapProtoMsg(MsgInfo).encode(this.msgInfo), pbElem: new NapProtoMsg(MsgInfo).encode(this.msgInfo),
businessType: 10, businessType: 10,
} },
}]; }];
} }
@ -480,7 +480,7 @@ export class PacketMsgVideoElement extends IPacketMsgElement<SendVideoElement> {
serviceType: 48, serviceType: 48,
pbElem: new NapProtoMsg(MsgInfo).encode(this.msgInfo), pbElem: new NapProtoMsg(MsgInfo).encode(this.msgInfo),
businessType: 21, businessType: 21,
} },
}]; }];
} }
@ -576,8 +576,8 @@ export class PacketMsgFileElement extends IPacketMsgElement<SendFileElement> {
fileHash: this.fileHash, fileHash: this.fileHash,
selfUid: this._private_send_uid, selfUid: this._private_send_uid,
destUid: this._private_recv_uid, destUid: this._private_recv_uid,
} },
} },
}); });
} }
@ -596,15 +596,15 @@ export class PacketMsgFileElement extends IPacketMsgElement<SendFileElement> {
fileSha: this.fileSha1, fileSha: this.fileSha1,
extInfoString: '', extInfoString: '',
fileMd5: this.fileMd5, fileMd5: this.fileMd5,
} },
} },
}); });
lb.writeUInt16BE(transElemVal.length); lb.writeUInt16BE(transElemVal.length);
return [{ return [{
transElem: { transElem: {
elemType: 24, elemType: 24,
elemValue: Buffer.concat([Buffer.from([0x01]), lb, transElemVal]) // TLV elemValue: Buffer.concat([Buffer.from([0x01]), lb, transElemVal]), // TLV
} },
}]; }];
} }
@ -626,9 +626,9 @@ export class PacketMsgLightAppElement extends IPacketMsgElement<SendArkElement>
lightAppElem: { lightAppElem: {
data: Buffer.concat([ data: Buffer.concat([
Buffer.from([0x01]), Buffer.from([0x01]),
zlib.deflateSync(Buffer.from(this.payload, 'utf-8')) zlib.deflateSync(Buffer.from(this.payload, 'utf-8')),
]) ]),
} },
}]; }];
} }
@ -650,10 +650,10 @@ export class PacketMsgMarkDownElement extends IPacketMsgElement<SendMarkdownElem
commonElem: { commonElem: {
serviceType: 45, serviceType: 45,
pbElem: new NapProtoMsg(MarkdownData).encode({ pbElem: new NapProtoMsg(MarkdownData).encode({
content: this.content content: this.content,
}), }),
businessType: 1 businessType: 1,
} },
}]; }];
} }
@ -677,9 +677,9 @@ export class PacketMultiMsgElement extends IPacketMsgElement<SendMultiForwardMsg
lightAppElem: { lightAppElem: {
data: Buffer.concat([ data: Buffer.concat([
Buffer.from([0x01]), Buffer.from([0x01]),
zlib.deflateSync(Buffer.from(JSON.stringify(ForwardMsgBuilder.fromPacketMsg(this.resid, this.message)), 'utf-8')) zlib.deflateSync(Buffer.from(JSON.stringify(ForwardMsgBuilder.fromPacketMsg(this.resid, this.message)), 'utf-8')),
]) ]),
} },
}]; }];
} }

View File

@ -1,7 +1,7 @@
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;

View File

@ -11,13 +11,13 @@ class GetAiVoice extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0X929B_0Re
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);
} }

View File

@ -13,7 +13,7 @@ class GetMiniAppAdaptShareInfo extends PacketTransformer<typeof proto.MiniAppAda
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,
@ -34,14 +34,14 @@ class GetMiniAppAdaptShareInfo extends PacketTransformer<typeof proto.MiniAppAda
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),
}; };
} }

View File

@ -10,8 +10,8 @@ class GetStrangerInfo extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XFE1
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);
} }

View File

@ -22,7 +22,7 @@ class ImageOCR extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0xE07_0_Resp
afterCompressWeight: '', afterCompressWeight: '',
afterCompressHeight: '', afterCompressHeight: '',
isCut: false, isCut: false,
} },
} }
); );
return OidbBase.build(0XEB7, 1, body, false, false); return OidbBase.build(0XEB7, 1, body, false, false);

View File

@ -11,13 +11,13 @@ class MoveGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6Re
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);
} }

View File

@ -11,12 +11,12 @@ class RenameGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6
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);
} }

View File

@ -11,11 +11,11 @@ class DownloadGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6
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);
} }

View File

@ -14,29 +14,29 @@ class DownloadGroupImage extends PacketTransformer<typeof proto.NTV2RichMediaRes
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);
} }

View File

@ -14,29 +14,29 @@ class DownloadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaRes
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);
} }

View File

@ -14,7 +14,7 @@ class DownloadImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
reqHead: { reqHead: {
common: { common: {
requestId: 1, requestId: 1,
command: 200 command: 200,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
@ -22,22 +22,22 @@ class DownloadImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
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);
} }

View File

@ -13,10 +13,10 @@ class DownloadOfflineFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0
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,

View File

@ -16,13 +16,13 @@ class DownloadPrivateFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0
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);
} }

View File

@ -14,7 +14,7 @@ class DownloadVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
reqHead: { reqHead: {
common: { common: {
requestId: 1, requestId: 1,
command: 200 command: 200,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
@ -22,22 +22,22 @@ class DownloadVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
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);
} }

View File

@ -20,12 +20,12 @@ class FetchSessionKey extends PacketTransformer<typeof proto.HttpConn0x6ff_501Re
field9: 2, field9: 2,
field10: 9, field10: 9,
field11: 8, field11: 8,
ver: '1.0.1' ver: '1.0.1',
} },
}); });
return { return {
cmd: 'HttpConn.0x6ff_501', cmd: 'HttpConn.0x6ff_501',
data: PacketBufBuilder(req) data: PacketBufBuilder(req),
}; };
} }

View File

@ -12,7 +12,7 @@ class UploadGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6
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,
@ -23,8 +23,8 @@ class UploadGroupFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0x6D6
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);
} }

View File

@ -16,19 +16,19 @@ class UploadGroupImage extends PacketTransformer<typeof proto.NTV2RichMediaResp>
reqHead: { reqHead: {
common: { common: {
requestId: 1, requestId: 1,
command: 100 command: 100,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
businessType: 1, businessType: 1,
sceneType: 2, sceneType: 2,
group: { group: {
groupUin: groupUin groupUin,
}, },
}, },
client: { client: {
agentType: 2 agentType: 2,
} },
}, },
upload: { upload: {
uploadInfo: [ uploadInfo: [
@ -47,10 +47,10 @@ class UploadGroupImage extends PacketTransformer<typeof proto.NTV2RichMediaResp>
width: img.width, width: img.width,
height: img.height, height: img.height,
time: 0, time: 0,
original: 1 original: 1,
}, },
subFileType: 0, subFileType: 0,
} },
], ],
tryFastUploadCompleted: true, tryFastUploadCompleted: true,
srvSendMsg: false, srvSendMsg: false,
@ -71,11 +71,11 @@ class UploadGroupImage extends PacketTransformer<typeof proto.NTV2RichMediaResp>
bytesPbReserve: Buffer.alloc(0), bytesPbReserve: Buffer.alloc(0),
bytesReserve: Buffer.alloc(0), bytesReserve: Buffer.alloc(0),
bytesGeneralFlags: Buffer.alloc(0), bytesGeneralFlags: Buffer.alloc(0),
} },
}, },
clientSeq: 0, clientSeq: 0,
noNeedCompatMsg: false, noNeedCompatMsg: false,
} },
} }
); );
return OidbBase.build(0x11C4, 100, data, true, false); return OidbBase.build(0x11C4, 100, data, true, false);

View File

@ -16,19 +16,19 @@ class UploadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp>
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: { upload: {
uploadInfo: [ uploadInfo: [
@ -42,14 +42,14 @@ class UploadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp>
type: 2, type: 2,
picFormat: 0, picFormat: 0,
videoFormat: 0, videoFormat: 0,
voiceFormat: 0 voiceFormat: 0,
}, },
height: 0, height: 0,
width: 0, width: 0,
time: 0, time: 0,
original: 0 original: 0,
}, },
subFileType: 0 subFileType: 0,
}, { }, {
fileInfo: { fileInfo: {
fileSize: +video.thumbSize, fileSize: +video.thumbSize,
@ -60,15 +60,15 @@ class UploadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp>
type: 1, type: 1,
picFormat: 0, picFormat: 0,
videoFormat: 0, videoFormat: 0,
voiceFormat: 0 voiceFormat: 0,
}, },
height: video.thumbHeight, height: video.thumbHeight,
width: video.thumbWidth, width: video.thumbWidth,
time: 0, time: 0,
original: 0 original: 0,
},
subFileType: 100,
}, },
subFileType: 100
}
], ],
tryFastUploadCompleted: true, tryFastUploadCompleted: true,
srvSendMsg: false, srvSendMsg: false,
@ -86,11 +86,11 @@ class UploadGroupVideo extends PacketTransformer<typeof proto.NTV2RichMediaResp>
bytesPbReserve: Buffer.alloc(0), bytesPbReserve: Buffer.alloc(0),
bytesReserve: Buffer.alloc(0), bytesReserve: Buffer.alloc(0),
bytesGeneralFlags: Buffer.alloc(0), bytesGeneralFlags: Buffer.alloc(0),
} },
}, },
clientSeq: 0, clientSeq: 0,
noNeedCompatMsg: false noNeedCompatMsg: false,
} },
}); });
return OidbBase.build(0x11EA, 100, data, true, false); return OidbBase.build(0x11EA, 100, data, true, false);
} }

View File

@ -23,11 +23,11 @@ class UploadPrivateFile extends PacketTransformer<typeof proto.OidbSvcTrpcTcp0XE
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);
} }

View File

@ -15,7 +15,7 @@ class UploadPrivateImage extends PacketTransformer<typeof proto.NTV2RichMediaRes
reqHead: { reqHead: {
common: { common: {
requestId: 1, requestId: 1,
command: 100 command: 100,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
@ -23,12 +23,12 @@ class UploadPrivateImage extends PacketTransformer<typeof proto.NTV2RichMediaRes
sceneType: 1, sceneType: 1,
c2C: { c2C: {
accountType: 2, accountType: 2,
targetUid: peerUin targetUid: peerUin,
}, },
}, },
client: { client: {
agentType: 2, agentType: 2,
} },
}, },
upload: { upload: {
uploadInfo: [ uploadInfo: [
@ -47,10 +47,10 @@ class UploadPrivateImage extends PacketTransformer<typeof proto.NTV2RichMediaRes
width: img.width, width: img.width,
height: img.height, height: img.height,
time: 0, time: 0,
original: 1 original: 1,
}, },
subFileType: 0, subFileType: 0,
} },
], ],
tryFastUploadCompleted: true, tryFastUploadCompleted: true,
srvSendMsg: false, srvSendMsg: false,
@ -71,11 +71,11 @@ class UploadPrivateImage extends PacketTransformer<typeof proto.NTV2RichMediaRes
bytesPbReserve: Buffer.alloc(0), bytesPbReserve: Buffer.alloc(0),
bytesReserve: Buffer.alloc(0), bytesReserve: Buffer.alloc(0),
bytesGeneralFlags: Buffer.alloc(0), bytesGeneralFlags: Buffer.alloc(0),
} },
}, },
clientSeq: 0, clientSeq: 0,
noNeedCompatMsg: false, noNeedCompatMsg: false,
} },
} }
); );
return OidbBase.build(0x11C5, 100, data, true, false); return OidbBase.build(0x11C5, 100, data, true, false);

View File

@ -15,7 +15,7 @@ class UploadPrivatePtt extends PacketTransformer<typeof proto.NTV2RichMediaResp>
reqHead: { reqHead: {
common: { common: {
requestId: 4, requestId: 4,
command: 100 command: 100,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
@ -23,12 +23,12 @@ class UploadPrivatePtt extends PacketTransformer<typeof proto.NTV2RichMediaResp>
sceneType: 1, sceneType: 1,
c2C: { c2C: {
accountType: 2, accountType: 2,
targetUid: peerUin targetUid: peerUin,
} },
}, },
client: { client: {
agentType: 2 agentType: 2,
} },
}, },
upload: { upload: {
uploadInfo: [ uploadInfo: [
@ -42,15 +42,15 @@ class UploadPrivatePtt extends PacketTransformer<typeof proto.NTV2RichMediaResp>
type: 3, type: 3,
picFormat: 0, picFormat: 0,
videoFormat: 0, videoFormat: 0,
voiceFormat: 1 voiceFormat: 1,
}, },
height: 0, height: 0,
width: 0, width: 0,
time: ptt.fileDuration, time: ptt.fileDuration,
original: 0 original: 0,
},
subFileType: 0,
}, },
subFileType: 0
}
], ],
tryFastUploadCompleted: true, tryFastUploadCompleted: true,
srvSendMsg: false, srvSendMsg: false,
@ -63,11 +63,11 @@ class UploadPrivatePtt extends PacketTransformer<typeof proto.NTV2RichMediaResp>
ptt: { ptt: {
bytesReserve: Buffer.from([0x08, 0x00, 0x38, 0x00]), bytesReserve: Buffer.from([0x08, 0x00, 0x38, 0x00]),
bytesGeneralFlags: Buffer.from([0x9a, 0x01, 0x0b, 0xaa, 0x03, 0x08, 0x08, 0x04, 0x12, 0x04, 0x00, 0x00, 0x00, 0x00]), bytesGeneralFlags: Buffer.from([0x9a, 0x01, 0x0b, 0xaa, 0x03, 0x08, 0x08, 0x04, 0x12, 0x04, 0x00, 0x00, 0x00, 0x00]),
} },
}, },
clientSeq: 0, clientSeq: 0,
noNeedCompatMsg: false noNeedCompatMsg: false,
} },
}); });
return OidbBase.build(0x126D, 100, data, true, false); return OidbBase.build(0x126D, 100, data, true, false);
} }

View File

@ -16,7 +16,7 @@ class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaRes
reqHead: { reqHead: {
common: { common: {
requestId: 3, requestId: 3,
command: 100 command: 100,
}, },
scene: { scene: {
requestType: 2, requestType: 2,
@ -24,12 +24,12 @@ class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaRes
sceneType: 1, sceneType: 1,
c2C: { c2C: {
accountType: 2, accountType: 2,
targetUid: peerUin targetUid: peerUin,
} },
}, },
client: { client: {
agentType: 2 agentType: 2,
} },
}, },
upload: { upload: {
uploadInfo: [ uploadInfo: [
@ -43,14 +43,14 @@ class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaRes
type: 2, type: 2,
picFormat: 0, picFormat: 0,
videoFormat: 0, videoFormat: 0,
voiceFormat: 0 voiceFormat: 0,
}, },
height: 0, height: 0,
width: 0, width: 0,
time: 0, time: 0,
original: 0 original: 0,
}, },
subFileType: 0 subFileType: 0,
}, { }, {
fileInfo: { fileInfo: {
fileSize: +video.thumbSize, fileSize: +video.thumbSize,
@ -61,15 +61,15 @@ class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaRes
type: 1, type: 1,
picFormat: 0, picFormat: 0,
videoFormat: 0, videoFormat: 0,
voiceFormat: 0 voiceFormat: 0,
}, },
height: video.thumbHeight, height: video.thumbHeight,
width: video.thumbWidth, width: video.thumbWidth,
time: 0, time: 0,
original: 0 original: 0,
},
subFileType: 100,
}, },
subFileType: 100
}
], ],
tryFastUploadCompleted: true, tryFastUploadCompleted: true,
srvSendMsg: false, srvSendMsg: false,
@ -87,11 +87,11 @@ class UploadPrivateVideo extends PacketTransformer<typeof proto.NTV2RichMediaRes
bytesPbReserve: Buffer.alloc(0), bytesPbReserve: Buffer.alloc(0),
bytesReserve: Buffer.alloc(0), bytesReserve: Buffer.alloc(0),
bytesGeneralFlags: Buffer.alloc(0), bytesGeneralFlags: Buffer.alloc(0),
} },
}, },
clientSeq: 0, clientSeq: 0,
noNeedCompatMsg: false noNeedCompatMsg: false,
} },
}); });
return OidbBase.build(0x11E9, 100, data, true, false); return OidbBase.build(0x11E9, 100, data, true, false);
} }

View File

@ -11,21 +11,21 @@ class DownloadForwardMsg extends PacketTransformer<typeof proto.RecvLongMsgResp>
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),
}; };
} }

View File

@ -15,7 +15,7 @@ class FetchC2CMessage extends PacketTransformer<typeof proto.SsoGetC2cMsgRespons
}); });
return { return {
cmd: 'trpc.msg.register_proxy.RegisterProxy.SsoGetC2cMsg', cmd: 'trpc.msg.register_proxy.RegisterProxy.SsoGetC2cMsg',
data: PacketBufBuilder(req) data: PacketBufBuilder(req),
}; };
} }

View File

@ -10,15 +10,15 @@ class FetchGroupMessage extends PacketTransformer<typeof proto.SsoGetGroupMsgRes
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),
}; };
} }

View File

@ -16,9 +16,9 @@ class UploadForwardMsg extends PacketTransformer<typeof proto.SendLongMsgResp> {
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));
@ -29,17 +29,17 @@ class UploadForwardMsg extends PacketTransformer<typeof proto.SendLongMsgResp> {
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),
}; };
} }

View File

@ -2,91 +2,91 @@ 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 = {
@ -94,23 +94,23 @@ export const SsoGetRoamMsg = {
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

@ -116,7 +116,7 @@ export const MarketFace = {
}; };
export const MarketFacePbRes = { export const MarketFacePbRes = {
field8: ProtoField(8, ScalarType.INT32) field8: ProtoField(8, ScalarType.INT32),
}; };
export const CustomFace = { export const CustomFace = {
@ -356,5 +356,5 @@ export const QSmallFaceExtra = {
}; };
export const MarkdownData = { export const MarkdownData = {
content: ProtoField(1, ScalarType.STRING) content: ProtoField(1, ScalarType.STRING),
}; };

View File

@ -7,7 +7,7 @@ import {
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 = {
@ -136,4 +136,3 @@ export const RoutingHead = {
wpaTmp: ProtoField(6, () => WPATmp, true), wpaTmp: ProtoField(6, () => WPATmp, true),
trans0X211: ProtoField(15, () => Trans0X211, true), trans0X211: ProtoField(15, () => Trans0X211, true),
}; };