mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-18 20:30:08 +08:00
refactor: 整体重构 (#1381)
* feat: pnpm new * Refactor build and release workflows, update dependencies Switch build scripts and workflows from npm to pnpm, update build and artifact paths, and simplify release workflow by removing version detection and changelog steps. Add new dependencies (silk-wasm, express, ws, node-pty-prebuilt-multiarch), update exports in package.json files, and add vite config for napcat-framework. Also, rename manifest.json for framework package and fix static asset copying in shell build config.
This commit is contained in:
parent
e2486606f9
commit
4360775eff
@ -1,2 +0,0 @@
|
|||||||
VITE_BUILD_TYPE = Production
|
|
||||||
VITE_BUILD_PLATFORM = Framework
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
VITE_BUILD_TYPE = Production
|
|
||||||
VITE_BUILD_PLATFORM = Shell
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
VITE_BUILD_TYPE = DEBUG
|
|
||||||
VITE_BUILD_PLATFORM = Shell
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
VITE_BUILD_TYPE = Production
|
|
||||||
VITE_BUILD_PLATFORM = Universal
|
|
||||||
25
.github/workflows/build.yml
vendored
25
.github/workflows/build.yml
vendored
@ -1,8 +1,9 @@
|
|||||||
name: "Build Action"
|
name: "Build Action"
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
|
|
||||||
@ -18,14 +19,16 @@ jobs:
|
|||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
- name: Build NapCat.Framework
|
- name: Build NapCat.Framework
|
||||||
run: |
|
run: |
|
||||||
npm i && cd napcat.webui && npm i && cd .. || exit 1
|
pnpm i
|
||||||
npm run build:framework && npm run depend || exit 1
|
pnpm --filter napcat-webui-frontend run build || exit 1
|
||||||
rm package-lock.json
|
pnpm run build:framework
|
||||||
|
cd packages/napcat-framework/dist
|
||||||
|
pnpm install --production
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: NapCat.Framework
|
name: NapCat.Framework
|
||||||
path: dist
|
path: packages/napcat-framework/dist
|
||||||
Build-Shell:
|
Build-Shell:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -37,11 +40,13 @@ jobs:
|
|||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
- name: Build NapCat.Shell
|
- name: Build NapCat.Shell
|
||||||
run: |
|
run: |
|
||||||
npm i && cd napcat.webui && npm i && cd .. || exit 1
|
pnpm i
|
||||||
npm run build:shell && npm run depend || exit 1
|
pnpm --filter napcat-webui-frontend run build || exit 1
|
||||||
rm package-lock.json
|
pnpm run build:shell
|
||||||
|
cd packages/napcat-shell/dist
|
||||||
|
pnpm install --production
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: NapCat.Shell
|
name: NapCat.Shell
|
||||||
path: dist
|
path: packages/napcat-shell/dist
|
||||||
|
|||||||
187
.github/workflows/release.yml
vendored
187
.github/workflows/release.yml
vendored
@ -1,153 +1,82 @@
|
|||||||
name: "Build Release"
|
name: "Build Release"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_dispatch:
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
|
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-version:
|
Build-LiteLoader:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Clone Repository
|
- name: Clone Main Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
ref: main
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract version from tag
|
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Use Node.js 20.X
|
- name: Use Node.js 20.X
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
|
- name: Build NapCat.Framework
|
||||||
|
run: |
|
||||||
|
pnpm i
|
||||||
|
pnpm --filter napcat-webui-frontend run build || exit 1
|
||||||
|
pnpm run build:framework
|
||||||
|
cd packages/napcat-framework/dist
|
||||||
|
pnpm install --production
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: NapCat.Framework
|
||||||
|
path: packages/napcat-framework/dist
|
||||||
|
|
||||||
- name: Check Version
|
|
||||||
run: |
|
|
||||||
ls
|
|
||||||
node ./script/checkVersion.cjs
|
|
||||||
sh ./checkVersion.sh
|
|
||||||
Build-LiteLoader:
|
|
||||||
needs: [check-version]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Clone Main Repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: 'NapNeko/NapCatQQ'
|
|
||||||
submodules: true
|
|
||||||
ref: main
|
|
||||||
token: ${{ secrets.NAPCAT_BUILD }}
|
|
||||||
- name: Use Node.js 20.X
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20.x
|
|
||||||
|
|
||||||
- name: Build NuCat Framework
|
|
||||||
run: |
|
|
||||||
npm i
|
|
||||||
cd napcat.webui
|
|
||||||
npm i
|
|
||||||
cd ..
|
|
||||||
npm run build:framework
|
|
||||||
cd dist
|
|
||||||
npm i --omit=dev
|
|
||||||
cd ..
|
|
||||||
- name: Upload Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: NapCat.Framework
|
|
||||||
path: dist
|
|
||||||
Build-Shell:
|
Build-Shell:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [check-version]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone Main Repository
|
- name: Clone Main Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
- name: Use Node.js 20.X
|
||||||
repository: 'NapNeko/NapCatQQ'
|
uses: actions/setup-node@v4
|
||||||
submodules: true
|
with:
|
||||||
ref: main
|
node-version: 20.x
|
||||||
token: ${{ secrets.NAPCAT_BUILD }}
|
- name: Build NapCat.Shell
|
||||||
|
run: |
|
||||||
- name: Use Node.js 20.X
|
pnpm i
|
||||||
uses: actions/setup-node@v4
|
pnpm --filter napcat-webui-frontend run build || exit 1
|
||||||
with:
|
pnpm run build:shell
|
||||||
node-version: 20.x
|
cd packages/napcat-shell/dist
|
||||||
|
pnpm install --production
|
||||||
- name: Build NuCat Shell
|
- name: Upload Artifact
|
||||||
run: |
|
uses: actions/upload-artifact@v4
|
||||||
npm i
|
with:
|
||||||
cd napcat.webui
|
name: NapCat.Shell
|
||||||
npm i
|
path: packages/napcat-shell/dist
|
||||||
cd ..
|
|
||||||
npm run build:shell
|
|
||||||
cd dist
|
|
||||||
npm i --omit=dev
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: NapCat.Shell
|
|
||||||
path: dist
|
|
||||||
|
|
||||||
release-napcat:
|
release-napcat:
|
||||||
needs: [Build-LiteLoader,Build-Shell]
|
needs: [Build-LiteLoader, Build-Shell]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Download All Artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- name: Clone Main Repository
|
- name: Compress subdirectories
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: 'NapNeko/NapCatQQ'
|
|
||||||
submodules: true
|
|
||||||
ref: main
|
|
||||||
token: ${{ secrets.NAPCAT_BUILD }}
|
|
||||||
|
|
||||||
- name: Download All Artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
|
|
||||||
- name: Compress subdirectories
|
|
||||||
run: |
|
|
||||||
cd ./NapCat.Shell/
|
|
||||||
zip -q -r NapCat.Shell.zip *
|
|
||||||
cd ..
|
|
||||||
cd ./NapCat.Framework/
|
|
||||||
zip -q -r NapCat.Framework.zip *
|
|
||||||
cd ..
|
|
||||||
rm ./NapCat.Shell.zip -rf
|
|
||||||
rm ./NapCat.Framework.zip -rf
|
|
||||||
mv ./NapCat.Shell/NapCat.Shell.zip ./
|
|
||||||
mv ./NapCat.Framework/NapCat.Framework.zip ./
|
|
||||||
- name: Extract version from tag
|
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Clone Changes Log
|
|
||||||
run: curl -o CHANGELOG.md https://fastly.jsdelivr.net/gh/NapNeko/NapCatQQ@main/docs/changelogs/CHANGELOG.v${{ env.VERSION }}.md
|
|
||||||
|
|
||||||
- name: Create Release Draft and Upload Artifacts
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
name: NapCat V${{ env.VERSION }}
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
body_path: CHANGELOG.md
|
|
||||||
files: |
|
|
||||||
NapCat.Framework.zip
|
|
||||||
NapCat.Shell.zip
|
|
||||||
draft: true
|
|
||||||
|
|
||||||
build-docker:
|
|
||||||
needs: release-napcat
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Dispatch Docker Build
|
|
||||||
run: |
|
run: |
|
||||||
curl -X POST \
|
cd ./NapCat.Shell/
|
||||||
-H "Authorization: Bearer ${{ secrets.NAPCAT_BUILD }}" \
|
zip -q -r NapCat.Shell.zip *
|
||||||
-H "Accept: application/vnd.github.v3+json" \
|
cd ..
|
||||||
https://api.github.com/repos/NapNeko/NapCat-Docker/actions/workflows/docker-publish.yml/dispatches \
|
cd ./NapCat.Framework/
|
||||||
-d '{"ref": "main"}'
|
zip -q -r NapCat.Framework.zip *
|
||||||
|
cd ..
|
||||||
|
rm ./NapCat.Shell.zip -rf
|
||||||
|
rm ./NapCat.Framework.zip -rf
|
||||||
|
mv ./NapCat.Shell/NapCat.Shell.zip ./
|
||||||
|
mv ./NapCat.Framework/NapCat.Framework.zip ./
|
||||||
|
|
||||||
|
- name: Create Release Draft and Upload Artifacts
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
name: NapCat
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
body: Automated release artifact (no version detection)
|
||||||
|
files: |
|
||||||
|
NapCat.Framework.zip
|
||||||
|
NapCat.Shell.zip
|
||||||
|
draft: true
|
||||||
115
.vscode/launch.json
vendored
115
.vscode/launch.json
vendored
@ -1,115 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "dev:shell",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"dev:shell"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "build:shell",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"build:shell"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "build:universal",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"build:universal"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "build:framework",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"build:framework"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "build:webui",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"build:webui"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "dev:universal",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"dev:universal"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "dev:framework",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"dev:framework"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "dev:webui",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"dev:webui"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "lint",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"lint"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "depend",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"depend"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "dev:depend",
|
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"run",
|
|
||||||
"dev:depend"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
35
.vscode/settings.json
vendored
35
.vscode/settings.json
vendored
@ -1,37 +1,2 @@
|
|||||||
{
|
{
|
||||||
"explorer.fileNesting.enabled": true,
|
|
||||||
"explorer.fileNesting.expand": false,
|
|
||||||
"explorer.fileNesting.patterns": {
|
|
||||||
".env.universal": ".env.*",
|
|
||||||
"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"
|
|
||||||
},
|
|
||||||
"css.customData": [
|
|
||||||
".vscode/tailwindcss.json"
|
|
||||||
],
|
|
||||||
"editor.detectIndentation": false,
|
|
||||||
"editor.tabSize": 2,
|
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"editor.formatOnType": false,
|
|
||||||
"editor.formatOnPaste": true,
|
|
||||||
"editor.formatOnSaveMode": "file",
|
|
||||||
"editor.codeActionsOnSave": {
|
|
||||||
"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,
|
|
||||||
}
|
}
|
||||||
55
.vscode/tailwindcss.json
vendored
55
.vscode/tailwindcss.json
vendored
@ -1,55 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 1.1,
|
|
||||||
"atDirectives": [
|
|
||||||
{
|
|
||||||
"name": "@tailwind",
|
|
||||||
"description": "Use the `@tailwind` directive to insert Tailwind's `base`, `components`, `utilities` and `screens` styles into your CSS.",
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"name": "Tailwind Documentation",
|
|
||||||
"url": "https://tailwindcss.com/docs/functions-and-directives#tailwind"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "@apply",
|
|
||||||
"description": "Use the `@apply` directive to inline any existing utility classes into your own custom CSS. This is useful when you find a common utility pattern in your HTML that you’d like to extract to a new component.",
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"name": "Tailwind Documentation",
|
|
||||||
"url": "https://tailwindcss.com/docs/functions-and-directives#apply"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "@responsive",
|
|
||||||
"description": "You can generate responsive variants of your own classes by wrapping their definitions in the `@responsive` directive:\n```css\n@responsive {\n .alert {\n background-color: #E53E3E;\n }\n}\n```\n",
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"name": "Tailwind Documentation",
|
|
||||||
"url": "https://tailwindcss.com/docs/functions-and-directives#responsive"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "@screen",
|
|
||||||
"description": "The `@screen` directive allows you to create media queries that reference your breakpoints by **name** instead of duplicating their values in your own CSS:\n```css\n@screen sm {\n /* ... */\n}\n```\n…gets transformed into this:\n```css\n@media (min-width: 640px) {\n /* ... */\n}\n```\n",
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"name": "Tailwind Documentation",
|
|
||||||
"url": "https://tailwindcss.com/docs/functions-and-directives#screen"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "@variants",
|
|
||||||
"description": "Generate `hover`, `focus`, `active` and other **variants** of your own utilities by wrapping their definitions in the `@variants` directive:\n```css\n@variants hover, focus {\n .btn-brand {\n background-color: #3182CE;\n }\n}\n```\n",
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"name": "Tailwind Documentation",
|
|
||||||
"url": "https://tailwindcss.com/docs/functions-and-directives#variants"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
import neostandard from 'neostandard';
|
|
||||||
|
|
||||||
/** 尾随逗号 */
|
|
||||||
const commaDangle = val => {
|
|
||||||
if (val?.rules?.['@stylistic/comma-dangle']?.[0] === 'warn') {
|
|
||||||
const rule = val?.rules?.['@stylistic/comma-dangle']?.[1];
|
|
||||||
Object.keys(rule).forEach(key => {
|
|
||||||
rule[key] = 'always-multiline';
|
|
||||||
});
|
|
||||||
val.rules['@stylistic/comma-dangle'][1] = rule;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 三元表达式 */
|
|
||||||
if (val?.rules?.['@stylistic/indent']) {
|
|
||||||
val.rules['@stylistic/indent'][2] = {
|
|
||||||
...val.rules?.['@stylistic/indent']?.[2],
|
|
||||||
flatTernaryExpressions: true,
|
|
||||||
offsetTernaryExpressions: false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 支持下划线 - 禁用 camelcase 规则 */
|
|
||||||
if (val?.rules?.camelcase) {
|
|
||||||
val.rules.camelcase = 'off';
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 未使用的变量强制报错 */
|
|
||||||
if (val?.rules?.['@typescript-eslint/no-unused-vars']) {
|
|
||||||
val.rules['@typescript-eslint/no-unused-vars'] = ['error', {
|
|
||||||
argsIgnorePattern: '^_',
|
|
||||||
varsIgnorePattern: '^_',
|
|
||||||
caughtErrorsIgnorePattern: '^_',
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 忽略的文件 */
|
|
||||||
const ignores = [
|
|
||||||
'node_modules',
|
|
||||||
'**/dist/**',
|
|
||||||
'launcher',
|
|
||||||
];
|
|
||||||
|
|
||||||
const options = neostandard({
|
|
||||||
ts: true,
|
|
||||||
ignores,
|
|
||||||
semi: true, // 强制使用分号
|
|
||||||
}).map(commaDangle);
|
|
||||||
|
|
||||||
export default options;
|
|
||||||
BIN
external/logo.png
vendored
BIN
external/logo.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 250 KiB |
BIN
logo.png
BIN
logo.png
Binary file not shown.
|
Before Width: | Height: | Size: 684 KiB After Width: | Height: | Size: 250 KiB |
15995
napcat.webui/package-lock.json
generated
15995
napcat.webui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
8223
package-lock.json
generated
8223
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
71
package.json
71
package.json
@ -4,75 +4,18 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "4.9.42",
|
"version": "4.9.42",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:universal": "npm run build:webui && npm run dev:universal || exit 1",
|
"build:shell": "pnpm --filter napcat-shell run build || exit 1",
|
||||||
"build:framework": "npm run build:webui && npm run dev:framework || exit 1",
|
"build:framework": "pnpm --filter napcat-framework run build || exit 1",
|
||||||
"build:shell": "npm run build:webui && npm run dev:shell || exit 1",
|
"build:webui": "pnpm --filter napcat-webui-frontend run build || exit 1"
|
||||||
"build:webui": "cd napcat.webui && npm run build",
|
|
||||||
"dev:universal": "vite build --mode universal",
|
|
||||||
"dev:framework": "vite build --mode framework",
|
|
||||||
"dev:shell": "vite build --mode shell",
|
|
||||||
"dev:shell-analysis": "vite build --mode shell-analysis",
|
|
||||||
"dev:webui": "cd napcat.webui && npm run dev",
|
|
||||||
"tsc": "npm run tsc:webui && npm run tsc:core",
|
|
||||||
"tsc:core": "tsc --noEmit",
|
|
||||||
"tsc:webui": "cd napcat.webui && tsc --noEmit",
|
|
||||||
"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/**/*",
|
|
||||||
"lint:fix:core": "eslint --fix src/**/*",
|
|
||||||
"lint:webui": "cd napcat.webui && eslint src/**/*",
|
|
||||||
"lint:fix:webui": "cd napcat.webui && eslint --fix src/**/*",
|
|
||||||
"depend": "cd dist && npm install --omit=dev",
|
|
||||||
"dev:depend": "npm i && cd napcat.webui && npm i",
|
|
||||||
"test:winshell": "pwsh ./tests/nodeTest.ps1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.28.0",
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
||||||
"@babel/generator": "^7.28.0",
|
"vite": "^6.4.1",
|
||||||
"@babel/parser": "^7.28.0",
|
"vite-plugin-cp": "^6.0.3"
|
||||||
"@babel/preset-typescript": "^7.24.7",
|
|
||||||
"@babel/traverse": "^7.28.0",
|
|
||||||
"@babel/types": "^7.28.2",
|
|
||||||
"@homebridge/node-pty-prebuilt-multiarch": "^0.12.0-beta.5",
|
|
||||||
"@log4js-node/log4js-api": "^1.0.2",
|
|
||||||
"@napneko/nap-proto-core": "^0.0.4",
|
|
||||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
||||||
"@rollup/plugin-typescript": "^12.1.4",
|
|
||||||
"@sinclair/typebox": "^0.34.38",
|
|
||||||
"@types/cors": "^2.8.17",
|
|
||||||
"@types/express": "^5.0.0",
|
|
||||||
"@types/multer": "^1.4.12",
|
|
||||||
"@types/node": "^22.0.1",
|
|
||||||
"@types/on-finished": "^2.3.4",
|
|
||||||
"@types/qrcode-terminal": "^0.12.2",
|
|
||||||
"@types/react-color": "^3.0.13",
|
|
||||||
"@types/type-is": "^1.6.7",
|
|
||||||
"@types/ws": "^8.5.12",
|
|
||||||
"ajv": "^8.13.0",
|
|
||||||
"async-mutex": "^0.5.0",
|
|
||||||
"commander": "^13.0.0",
|
|
||||||
"compressing": "^1.10.1",
|
|
||||||
"cors": "^2.8.5",
|
|
||||||
"esbuild": "0.25.8",
|
|
||||||
"eslint": "^9.14.0",
|
|
||||||
"express-rate-limit": "^7.5.0",
|
|
||||||
"fast-xml-parser": "^4.3.6",
|
|
||||||
"file-type": "^21.0.0",
|
|
||||||
"fs-extra": "^11.3.2",
|
|
||||||
"json5": "^2.2.3",
|
|
||||||
"multer": "^2.0.1",
|
|
||||||
"napcat.protobuf": "^1.1.4",
|
|
||||||
"neostandard": "^0.12.2",
|
|
||||||
"typescript": "^5.3.3",
|
|
||||||
"typescript-eslint": "^8.35.1",
|
|
||||||
"vite": "^7.1.1",
|
|
||||||
"vite-plugin-cp": "^6.0.0",
|
|
||||||
"vite-tsconfig-paths": "^5.1.0",
|
|
||||||
"winston": "^3.17.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^5.0.0",
|
|
||||||
"silk-wasm": "^3.6.1",
|
"silk-wasm": "^3.6.1",
|
||||||
|
"express": "^5.0.0",
|
||||||
"ws": "^8.18.3"
|
"ws": "^8.18.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
31
packages/napcat-common/package.json
Normal file
31
packages/napcat-common/package.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"name": "napcat-common",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"main": "src/index.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./src/index.ts"
|
||||||
|
},
|
||||||
|
"./src/*": {
|
||||||
|
"import": "./src/*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"compressing": "^1.10.1",
|
||||||
|
"json5": "^2.2.3",
|
||||||
|
"ajv": "^8.13.0",
|
||||||
|
"file-type": "^21.0.0",
|
||||||
|
"napcat-image-size": "workspace:*",
|
||||||
|
"napcat-core": "workspace:*",
|
||||||
|
"silk-wasm": "^3.6.1",
|
||||||
|
"winston": "^3.17.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^22.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,9 +2,9 @@ import fsPromise from 'fs/promises';
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { randomUUID } from 'crypto';
|
import { randomUUID } from 'crypto';
|
||||||
import { EncodeResult, getDuration, getWavFileInfo, isSilk, isWav } from 'silk-wasm';
|
import { EncodeResult, getDuration, getWavFileInfo, isSilk, isWav } from 'silk-wasm';
|
||||||
import { LogWrapper } from '@/common/log';
|
import { LogWrapper } from '@/napcat-common/log';
|
||||||
import { EncodeArgs } from '@/common/audio-worker';
|
import { EncodeArgs } from '@/napcat-common/audio-worker';
|
||||||
import { FFmpegService } from '@/common/ffmpeg';
|
import { FFmpegService } from '@/napcat-common/ffmpeg';
|
||||||
import { runTask } from './worker';
|
import { runTask } from './worker';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import type { NapCatCore } from '@/core';
|
import type { NapCatCore } from 'napcat-core';
|
||||||
import json5 from 'json5';
|
import json5 from 'json5';
|
||||||
import Ajv, { AnySchema, ValidateFunction } from 'ajv';
|
import Ajv, { AnySchema, ValidateFunction } from 'ajv';
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { NodeIQQNTWrapperSession } from '@/core/wrapper';
|
import { NodeIQQNTWrapperSession } from '@/napcat-core/wrapper';
|
||||||
import { randomUUID } from 'crypto';
|
import { randomUUID } from 'crypto';
|
||||||
import { ListenerNamingMapping, ServiceNamingMapping } from '@/core';
|
import { ListenerNamingMapping, ServiceNamingMapping } from '@/napcat-core';
|
||||||
|
|
||||||
interface InternalMapKey {
|
interface InternalMapKey {
|
||||||
timeout: number;
|
timeout: number;
|
||||||
@ -8,7 +8,7 @@ import { dirname, join } from 'path';
|
|||||||
import { execFile } from 'child_process';
|
import { execFile } from 'child_process';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
import { fileTypeFromFile } from 'file-type';
|
import { fileTypeFromFile } from 'file-type';
|
||||||
import { imageSizeFallBack } from '@/image-size';
|
import { imageSizeFallBack } from 'napcat-image-size/src/index';
|
||||||
import { downloadFFmpegIfNotExists } from './download-ffmpeg';
|
import { downloadFFmpegIfNotExists } from './download-ffmpeg';
|
||||||
import { LogWrapper } from './log';
|
import { LogWrapper } from './log';
|
||||||
import type { IFFmpegAdapter, VideoInfoResult } from './ffmpeg-adapter-interface';
|
import type { IFFmpegAdapter, VideoInfoResult } from './ffmpeg-adapter-interface';
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { Peer } from '@/core';
|
import { Peer } from '@/napcat-core';
|
||||||
import { randomUUID } from 'crypto';
|
import { randomUUID } from 'crypto';
|
||||||
|
|
||||||
class TimeBasedCache<K, V> {
|
class TimeBasedCache<K, V> {
|
||||||
@ -2,7 +2,7 @@ import fs from 'fs';
|
|||||||
import { stat } from 'fs/promises';
|
import { stat } from 'fs/promises';
|
||||||
import crypto, { randomUUID } from 'crypto';
|
import crypto, { randomUUID } from 'crypto';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { solveProblem } from '@/common/helper';
|
import { solveProblem } from '@/napcat-common/helper';
|
||||||
|
|
||||||
export interface HttpDownloadOptions {
|
export interface HttpDownloadOptions {
|
||||||
url: string;
|
url: string;
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import * as crypto from 'node:crypto';
|
import * as crypto from 'node:crypto';
|
||||||
import { PacketMsg } from '@/core/packet/message/message';
|
import { PacketMsg } from '@/napcat-core/packet/message/message';
|
||||||
|
|
||||||
interface ForwardMsgJson {
|
interface ForwardMsgJson {
|
||||||
app: string
|
app: string
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import { QQLevel } from '@/core';
|
import { QQLevel } from '@/napcat-core';
|
||||||
import { QQVersionConfigType } from './types';
|
import { QQVersionConfigType } from './types';
|
||||||
|
|
||||||
export async function solveProblem<T extends (...arg: any[]) => any> (func: T, ...args: Parameters<T>): Promise<ReturnType<T> | undefined> {
|
export async function solveProblem<T extends (...arg: any[]) => any> (func: T, ...args: Parameters<T>): Promise<ReturnType<T> | undefined> {
|
||||||
@ -1,8 +1,8 @@
|
|||||||
import winston, { format, transports } from 'winston';
|
import winston, { format, transports } from 'winston';
|
||||||
import { truncateString } from '@/common/helper';
|
import { truncateString } from './helper';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'node:fs/promises';
|
import fs from 'node:fs/promises';
|
||||||
import { NTMsgAtType, ChatType, ElementType, MessageElement, RawMessage, SelfInfo } from '@/core';
|
import { NTMsgAtType, ChatType, ElementType, MessageElement, RawMessage, SelfInfo } from 'napcat-core/index';
|
||||||
import EventEmitter from 'node:events';
|
import EventEmitter from 'node:events';
|
||||||
export enum LogLevel {
|
export enum LogLevel {
|
||||||
DEBUG = 'debug',
|
DEBUG = 'debug',
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { Peer } from '@/core';
|
import { Peer } from '@/napcat-core';
|
||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
|
|
||||||
export class LimitedHashTable<K, V> {
|
export class LimitedHashTable<K, V> {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { LogWrapper } from '@/common/log';
|
import { LogWrapper } from '@/napcat-common/log';
|
||||||
|
|
||||||
export function proxyHandlerOf (logger: LogWrapper) {
|
export function proxyHandlerOf (logger: LogWrapper) {
|
||||||
return {
|
return {
|
||||||
@ -1,9 +1,9 @@
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { systemPlatform } from '@/common/system';
|
import { systemPlatform } from '@/napcat-common/system';
|
||||||
import { getDefaultQQVersionConfigInfo, getQQPackageInfoPath, getQQVersionConfigPath, parseAppidFromMajor } from './helper';
|
import { getDefaultQQVersionConfigInfo, getQQPackageInfoPath, getQQVersionConfigPath, parseAppidFromMajor } from './helper';
|
||||||
import AppidTable from '@/core/external/appid.json';
|
import AppidTable from 'napcat-core/external/appid.json';
|
||||||
import { LogWrapper } from '@/common/log';
|
import { LogWrapper } from '@/napcat-common/log';
|
||||||
import { getMajorPath } from '@/core';
|
import { getMajorPath } from 'napcat-core';
|
||||||
import { QQAppidTableType, QQPackageInfoType, QQVersionConfigType } from './types';
|
import { QQAppidTableType, QQPackageInfoType, QQVersionConfigType } from './types';
|
||||||
|
|
||||||
export class QQBasicInfoWrapper {
|
export class QQBasicInfoWrapper {
|
||||||
@ -1,35 +1,20 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2021",
|
"target": "ES2021",
|
||||||
"useDefineForClassFields": true,
|
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"lib": [
|
|
||||||
"ES2021",
|
|
||||||
"DOM",
|
|
||||||
"DOM.Iterable"
|
|
||||||
],
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"experimentalDecorators": true,
|
"lib": [
|
||||||
"allowImportingTsExtensions": false,
|
"ES2021"
|
||||||
"allowSyntheticDefaultImports": true,
|
],
|
||||||
"resolveJsonModule": true,
|
"typeRoots": [
|
||||||
"isolatedModules": true,
|
"./node_modules/@types"
|
||||||
"noEmit": true,
|
],
|
||||||
"jsx": "preserve",
|
"esModuleInterop": true,
|
||||||
"strict": true,
|
"outDir": "dist",
|
||||||
"noUnusedLocals": true,
|
"rootDir": "src",
|
||||||
"noUnusedParameters": true,
|
"noEmit": false,
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"paths": {
|
"strict": true,
|
||||||
"@/*": [
|
|
||||||
"./src/*"
|
|
||||||
],
|
|
||||||
"@webapi/*": [
|
|
||||||
"./src/webui/src/*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"strictFunctionTypes": true,
|
"strictFunctionTypes": true,
|
||||||
"strictBindCallApply": true,
|
"strictBindCallApply": true,
|
||||||
@ -38,23 +23,31 @@
|
|||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noPropertyAccessFromIndexSignature": true,
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
"noUncheckedIndexedAccess": true,
|
"noUncheckedIndexedAccess": true,
|
||||||
"exactOptionalPropertyTypes": false, // 精准可选
|
"exactOptionalPropertyTypes": false,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"useUnknownInCatchVariables": true,
|
"useUnknownInCatchVariables": true,
|
||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/napcat-common/*": [
|
||||||
|
"src/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"skipLibCheck": true,
|
||||||
"skipDefaultLibCheck": true
|
"skipDefaultLibCheck": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"!@homebridge/node-pty-prebuilt-multiarch/src/eventEmitter2.ts",
|
"src/**/*.ts"
|
||||||
"!@homebridge/node-pty-prebuilt-multiarch/src/terminal.ts",
|
|
||||||
"!@napneko/nap-proto-core/NapProto.ts",
|
|
||||||
"src/**/*.ts",
|
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"node_modules/**/*",
|
"dist"
|
||||||
"node_modules/@homebridge/node-pty-prebuilt-multiarch/src/eventEmitter2.ts",
|
|
||||||
"node_modules/@homebridge/node-pty-prebuilt-multiarch/src/terminal.ts",
|
|
||||||
"node_modules/@napneko/nap-proto-core/NapProto.ts"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { MsfChangeReasonType, MsfStatusType } from '@/core/types/adapter';
|
import { MsfChangeReasonType, MsfStatusType } from '@/napcat-core/types/adapter';
|
||||||
|
|
||||||
export class NodeIDependsAdapter {
|
export class NodeIDependsAdapter {
|
||||||
onMSFStatusChange (_statusType: MsfStatusType, _changeReasonType: MsfChangeReasonType) {
|
onMSFStatusChange (_statusType: MsfStatusType, _changeReasonType: MsfChangeReasonType) {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { InstanceContext, NapCatCore } from '@/core';
|
import { InstanceContext, NapCatCore } from '@/napcat-core/index';
|
||||||
|
|
||||||
export class NTQQCollectionApi {
|
export class NTQQCollectionApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
@ -11,24 +11,24 @@ import {
|
|||||||
SendPicElement,
|
SendPicElement,
|
||||||
SendPttElement,
|
SendPttElement,
|
||||||
SendVideoElement,
|
SendVideoElement,
|
||||||
} from '@/core/types';
|
} from '@/napcat-core/types';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import fsPromises from 'fs/promises';
|
import fsPromises from 'fs/promises';
|
||||||
import { InstanceContext, NapCatCore, SearchResultItem } from '@/core';
|
import { InstanceContext, NapCatCore, SearchResultItem } from '@/napcat-core/index';
|
||||||
import { fileTypeFromFile } from 'file-type';
|
import { fileTypeFromFile } from 'file-type';
|
||||||
import { RkeyManager } from '@/core/helper/rkey';
|
import { RkeyManager } from '@/napcat-core/helper/rkey';
|
||||||
import { calculateFileMD5 } from '@/common/file';
|
import { calculateFileMD5 } from 'napcat-common/src/file';
|
||||||
import pathLib from 'node:path';
|
import pathLib from 'node:path';
|
||||||
import { defaultVideoThumbB64 } from '@/common/video';
|
import { defaultVideoThumbB64 } from 'napcat-common/src/video';
|
||||||
import { encodeSilk } from '@/common/audio';
|
import { encodeSilk } from 'napcat-common/src/audio';
|
||||||
import { SendMessageContext } from '@/onebot/api';
|
import { SendMessageContext } from 'napcat-onebot/api/msg';
|
||||||
import { getFileTypeForSendType } from '../helper/msg';
|
import { getFileTypeForSendType } from '../helper/msg';
|
||||||
import { FFmpegService } from '@/common/ffmpeg';
|
import { FFmpegService } from 'napcat-common/src/ffmpeg';
|
||||||
import { rkeyDataType } from '../types/file';
|
import { rkeyDataType } from '../types/file';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { FileId } from '../packet/transformer/proto/misc/fileid';
|
import { FileId } from '../packet/transformer/proto/misc/fileid';
|
||||||
import { imageSizeFallBack } from '@/image-size';
|
import { imageSizeFallBack } from 'napcat-image-size';
|
||||||
|
|
||||||
export class NTQQFileApi {
|
export class NTQQFileApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { FriendRequest, FriendV2 } from '@/core/types';
|
import { FriendRequest, FriendV2 } from '@/napcat-core/types';
|
||||||
import { BuddyListReqType, InstanceContext, NapCatCore } from '@/core';
|
import { BuddyListReqType, InstanceContext, NapCatCore } from '@/napcat-core/index';
|
||||||
import { LimitedHashTable } from '@/common/message-unique';
|
import { LimitedHashTable } from 'napcat-common/src/message-unique';
|
||||||
|
|
||||||
export class NTQQFriendApi {
|
export class NTQQFriendApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
@ -12,11 +12,11 @@ import {
|
|||||||
ShutUpGroupMember,
|
ShutUpGroupMember,
|
||||||
Peer,
|
Peer,
|
||||||
ChatType,
|
ChatType,
|
||||||
} from '@/core';
|
} from '@/napcat-core/index';
|
||||||
import { isNumeric, solveAsyncProblem } from '@/common/helper';
|
import { isNumeric, solveAsyncProblem } from 'napcat-common/src/helper';
|
||||||
import { LimitedHashTable } from '@/common/message-unique';
|
import { LimitedHashTable } from 'napcat-common/src/message-unique';
|
||||||
import { NTEventWrapper } from '@/common/event';
|
import { NTEventWrapper } from 'napcat-common/src/event';
|
||||||
import { CancelableTask, TaskExecutor } from '@/common/cancel-task';
|
import { CancelableTask, TaskExecutor } from 'napcat-common/src/cancel-task';
|
||||||
import { createGroupDetailInfoV2Param, createGroupExtFilter, createGroupExtInfo } from '../data';
|
import { createGroupDetailInfoV2Param, createGroupExtFilter, createGroupExtInfo } from '../data';
|
||||||
|
|
||||||
export class NTQQGroupApi {
|
export class NTQQGroupApi {
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { ChatType, GetFileListParam, Peer, RawMessage, SendMessageElement, SendStatusType } from '@/core/types';
|
import { ChatType, GetFileListParam, Peer, RawMessage, SendMessageElement, SendStatusType } from '@/napcat-core/types';
|
||||||
import { GroupFileInfoUpdateItem, InstanceContext, NapCatCore, NodeIKernelMsgService } from '@/core';
|
import { GroupFileInfoUpdateItem, InstanceContext, NapCatCore, NodeIKernelMsgService } from '@/napcat-core/index';
|
||||||
import { GeneralCallResult } from '@/core/services/common';
|
import { GeneralCallResult } from '@/napcat-core/services/common';
|
||||||
|
|
||||||
export class NTQQMsgApi {
|
export class NTQQMsgApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
@ -1,9 +1,9 @@
|
|||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import offset from '@/core/external/napi2native.json';
|
import offset from '@/napcat-core/external/napi2native.json';
|
||||||
import { InstanceContext, NapCatCore } from '@/core';
|
import { InstanceContext, NapCatCore } from '@/napcat-core/index';
|
||||||
import { LogWrapper } from '@/common/log';
|
import { LogWrapper } from 'napcat-common/src/log';
|
||||||
import { PacketClientSession } from '@/core/packet/clientSession';
|
import { PacketClientSession } from '@/napcat-core/packet/clientSession';
|
||||||
import { napCatVersion } from '@/common/version';
|
import { napCatVersion } from 'napcat-common/src/version';
|
||||||
|
|
||||||
interface OffsetType {
|
interface OffsetType {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { InstanceContext, NapCatCore } from '@/core';
|
import { InstanceContext, NapCatCore } from '@/napcat-core/index';
|
||||||
|
|
||||||
export class NTQQSystemApi {
|
export class NTQQSystemApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
@ -1,8 +1,8 @@
|
|||||||
import { ModifyProfileParams, User, UserDetailSource } from '@/core/types';
|
import { ModifyProfileParams, User, UserDetailSource } from '@/napcat-core/types';
|
||||||
import { RequestUtil } from '@/common/request';
|
import { RequestUtil } from 'napcat-common/src/request';
|
||||||
import { InstanceContext, NapCatCore, ProfileBizType } from '..';
|
import { InstanceContext, NapCatCore, ProfileBizType } from '..';
|
||||||
import { solveAsyncProblem } from '@/common/helper';
|
import { solveAsyncProblem } from 'napcat-common/src/helper';
|
||||||
import { Fallback, FallbackUtil } from '@/common/fall-back';
|
import { Fallback, FallbackUtil } from 'napcat-common/src/fall-back';
|
||||||
|
|
||||||
export class NTQQUserApi {
|
export class NTQQUserApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { RequestUtil } from '@/common/request';
|
import { RequestUtil } from 'napcat-common/src/request';
|
||||||
import {
|
import {
|
||||||
GroupEssenceMsgRet,
|
GroupEssenceMsgRet,
|
||||||
InstanceContext,
|
InstanceContext,
|
||||||
@ -6,7 +6,7 @@ import {
|
|||||||
WebApiGroupMemberRet,
|
WebApiGroupMemberRet,
|
||||||
WebApiGroupNoticeRet,
|
WebApiGroupNoticeRet,
|
||||||
WebHonorType, NapCatCore,
|
WebHonorType, NapCatCore,
|
||||||
} from '@/core';
|
} from '@/napcat-core/index';
|
||||||
|
|
||||||
import { createReadStream, readFileSync, statSync } from 'node:fs';
|
import { createReadStream, readFileSync, statSync } from 'node:fs';
|
||||||
import { createHash } from 'node:crypto';
|
import { createHash } from 'node:crypto';
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { ConfigBase } from '@/common/config-base';
|
import { ConfigBase } from 'napcat-common/src/config-base';
|
||||||
import { NapCatCore } from '@/core';
|
import { NapCatCore } from '@/napcat-core/index';
|
||||||
import { Type, Static } from '@sinclair/typebox';
|
import { Type, Static } from '@sinclair/typebox';
|
||||||
import { AnySchema } from 'ajv';
|
import { AnySchema } from 'ajv';
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { LogWrapper } from '@/common/log';
|
import { LogWrapper } from 'napcat-common/src/log';
|
||||||
import { RequestUtil } from '@/common/request';
|
import { RequestUtil } from 'napcat-common/src/request';
|
||||||
|
|
||||||
interface ServerRkeyData {
|
interface ServerRkeyData {
|
||||||
group_rkey: string;
|
group_rkey: string;
|
||||||
@ -6,8 +6,8 @@ import {
|
|||||||
NTQQSystemApi,
|
NTQQSystemApi,
|
||||||
NTQQUserApi,
|
NTQQUserApi,
|
||||||
NTQQWebApi,
|
NTQQWebApi,
|
||||||
} from '@/core/apis';
|
} from '@/napcat-core/apis';
|
||||||
import { NTQQCollectionApi } from '@/core/apis/collection';
|
import { NTQQCollectionApi } from '@/napcat-core/apis/collection';
|
||||||
import {
|
import {
|
||||||
NodeIQQNTWrapperSession,
|
NodeIQQNTWrapperSession,
|
||||||
NodeQQNTWrapperUtil,
|
NodeQQNTWrapperUtil,
|
||||||
@ -15,26 +15,26 @@ import {
|
|||||||
VendorType,
|
VendorType,
|
||||||
WrapperNodeApi,
|
WrapperNodeApi,
|
||||||
WrapperSessionInitConfig,
|
WrapperSessionInitConfig,
|
||||||
} from '@/core/wrapper';
|
} from '@/napcat-core/wrapper';
|
||||||
import { LogLevel, LogWrapper } from '@/common/log';
|
import { LogLevel, LogWrapper } from 'napcat-common/src/log';
|
||||||
import { NodeIKernelLoginService } from '@/core/services';
|
import { NodeIKernelLoginService } from '@/napcat-core/services';
|
||||||
import { QQBasicInfoWrapper } from '@/common/qq-basic-info';
|
import { QQBasicInfoWrapper } from 'napcat-common/src/qq-basic-info';
|
||||||
import { NapCatPathWrapper } from '@/common/path';
|
import { NapCatPathWrapper } from 'napcat-common/src/path';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { hostname, systemName, systemVersion } from '@/common/system';
|
import { hostname, systemName, systemVersion } from 'napcat-common/src/system';
|
||||||
import { NTEventWrapper } from '@/common/event';
|
import { NTEventWrapper } from 'napcat-common/src/event';
|
||||||
import { KickedOffLineInfo, SelfInfo, SelfStatusInfo } from '@/core/types';
|
import { KickedOffLineInfo, SelfInfo, SelfStatusInfo } from '@/napcat-core/types';
|
||||||
import { NapCatConfigLoader, NapcatConfigSchema } from '@/core/helper/config';
|
import { NapCatConfigLoader, NapcatConfigSchema } from '@/napcat-core/helper/config';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import { NodeIKernelMsgListener, NodeIKernelProfileListener } from '@/core/listeners';
|
import { NodeIKernelMsgListener, NodeIKernelProfileListener } from '@/napcat-core/listeners';
|
||||||
import { proxiedListenerOf } from '@/common/proxy-handler';
|
import { proxiedListenerOf } from 'napcat-common/src/proxy-handler';
|
||||||
import { NTQQPacketApi } from './apis/packet';
|
import { NTQQPacketApi } from './apis/packet';
|
||||||
import { NativePacketHandler } from './packet/handler/client';
|
import { NativePacketHandler } from './packet/handler/client';
|
||||||
export * from './wrapper';
|
export * from './wrapper';
|
||||||
export * from './types';
|
export * from './types/index';
|
||||||
export * from './services';
|
export * from './services/index';
|
||||||
export * from './listeners';
|
export * from './listeners/index';
|
||||||
|
|
||||||
export enum NapCatCoreWorkingEnv {
|
export enum NapCatCoreWorkingEnv {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { BuddyCategoryType, FriendRequestNotify } from '@/core/types';
|
import { BuddyCategoryType, FriendRequestNotify } from '@/napcat-core/types';
|
||||||
|
|
||||||
export type OnBuddyChangeParams = BuddyCategoryType[];
|
export type OnBuddyChangeParams = BuddyCategoryType[];
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { DataSource, Group, GroupDetailInfo, GroupListUpdateType, GroupMember, GroupNotify, ShutUpGroupMember } from '@/core/types';
|
import { DataSource, Group, GroupDetailInfo, GroupListUpdateType, GroupMember, GroupNotify, ShutUpGroupMember } from '@/napcat-core/types';
|
||||||
|
|
||||||
export class NodeIKernelGroupListener {
|
export class NodeIKernelGroupListener {
|
||||||
onGroupListInited (_listEmpty: boolean): any { }
|
onGroupListInited (_listEmpty: boolean): any { }
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { ChatType, KickedOffLineInfo, RawMessage } from '@/core/types';
|
import { ChatType, KickedOffLineInfo, RawMessage } from '@/napcat-core/types';
|
||||||
import { CommonFileInfo } from '@/core';
|
import { CommonFileInfo } from '@/napcat-core';
|
||||||
|
|
||||||
export interface OnRichMediaDownloadCompleteParams {
|
export interface OnRichMediaDownloadCompleteParams {
|
||||||
fileModelId: string,
|
fileModelId: string,
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { User, UserDetailInfoListenerArg } from '@/core/types';
|
import { User, UserDetailInfoListenerArg } from '@/napcat-core/types';
|
||||||
|
|
||||||
export class NodeIKernelProfileListener {
|
export class NodeIKernelProfileListener {
|
||||||
onUserDetailInfoChanged (_arg: UserDetailInfoListenerArg): void {
|
onUserDetailInfoChanged (_arg: UserDetailInfoListenerArg): void {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { ChatType, RawMessage } from '@/core';
|
import { ChatType, RawMessage } from '@/napcat-core/index';
|
||||||
export interface SearchGroupInfo {
|
export interface SearchGroupInfo {
|
||||||
groupCode: string;
|
groupCode: string;
|
||||||
ownerUid: string;
|
ownerUid: string;
|
||||||
31
packages/napcat-core/package.json
Normal file
31
packages/napcat-core/package.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"name": "napcat-core",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"main": "index.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./index.ts"
|
||||||
|
},
|
||||||
|
"./*": {
|
||||||
|
"import": "./*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@protobuf-ts/runtime": "^2.11.1",
|
||||||
|
"@napneko/nap-proto-core": "^0.0.4",
|
||||||
|
"ajv": "^8.13.0",
|
||||||
|
"@sinclair/typebox": "^0.34.38",
|
||||||
|
"file-type": "^21.0.0",
|
||||||
|
"napcat-image-size": "workspace:*",
|
||||||
|
"napcat-common": "workspace:*",
|
||||||
|
"napcat-onebot": "workspace:*"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^22.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,10 +2,10 @@ import path, { dirname } from 'path';
|
|||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { constants } from 'node:os';
|
import { constants } from 'node:os';
|
||||||
import { LogStack } from '@/core/packet/context/clientContext';
|
import { LogStack } from '@/napcat-core/packet/context/clientContext';
|
||||||
import { NapCoreContext } from '@/core/packet/context/napCoreContext';
|
import { NapCoreContext } from '@/napcat-core/packet/context/napCoreContext';
|
||||||
import { PacketLogger } from '@/core/packet/context/loggerContext';
|
import { PacketLogger } from '@/napcat-core/packet/context/loggerContext';
|
||||||
import { OidbPacket, PacketBuf } from '@/core/packet/transformer/base';
|
import { OidbPacket, PacketBuf } from '@/napcat-core/packet/transformer/base';
|
||||||
export interface RecvPacket {
|
export interface RecvPacket {
|
||||||
type: string, // 仅recv
|
type: string, // 仅recv
|
||||||
data: RecvPacketData;
|
data: RecvPacketData;
|
||||||
@ -71,7 +71,7 @@ export class NativePacketClient {
|
|||||||
if (!rsp) {
|
if (!rsp) {
|
||||||
this.napcore
|
this.napcore
|
||||||
.sendSsoCmdReqByContend(cmd, data)
|
.sendSsoCmdReqByContend(cmd, data)
|
||||||
.catch(err =>
|
.catch((err: any) =>
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
`[PacketClient] sendPacket 无响应命令发送失败 cmd=${cmd} err=${err}`
|
`[PacketClient] sendPacket 无响应命令发送失败 cmd=${cmd} err=${err}`
|
||||||
)
|
)
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { PacketContext } from '@/core/packet/context/packetContext';
|
import { PacketContext } from '@/napcat-core/packet/context/packetContext';
|
||||||
import { NapCatCore } from '@/core';
|
import { NapCatCore } from '@/napcat-core/index';
|
||||||
|
|
||||||
export class PacketClientSession {
|
export class PacketClientSession {
|
||||||
private readonly context: PacketContext;
|
private readonly context: PacketContext;
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { NativePacketClient } from '@/core/packet/client/nativeClient';
|
import { NativePacketClient } from '@/napcat-core/packet/client/nativeClient';
|
||||||
import { OidbPacket } from '@/core/packet/transformer/base';
|
import { OidbPacket } from '@/napcat-core/packet/transformer/base';
|
||||||
import { PacketLogger } from '@/core/packet/context/loggerContext';
|
import { PacketLogger } from '@/napcat-core/packet/context/loggerContext';
|
||||||
import { NapCoreContext } from '@/core/packet/context/napCoreContext';
|
import { NapCoreContext } from '@/napcat-core/packet/context/napCoreContext';
|
||||||
|
|
||||||
export class LogStack {
|
export class LogStack {
|
||||||
private stack: string[] = [];
|
private stack: string[] = [];
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { LogLevel, LogWrapper } from '@/common/log';
|
import { LogLevel, LogWrapper } from 'napcat-common/src/log';
|
||||||
import { NapCoreContext } from '@/core/packet/context/napCoreContext';
|
import { NapCoreContext } from '@/napcat-core/packet/context/napCoreContext';
|
||||||
|
|
||||||
// TODO: check bind?
|
// TODO: check bind?
|
||||||
export class PacketLogger {
|
export class PacketLogger {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { NapCatCore } from '@/core';
|
import { NapCatCore } from '@/napcat-core/index';
|
||||||
|
|
||||||
export interface NapCoreCompatBasicInfo {
|
export interface NapCoreCompatBasicInfo {
|
||||||
readonly requireMinNTQQBuild: (buildVer: string) => boolean;
|
readonly requireMinNTQQBuild: (buildVer: string) => boolean;
|
||||||
@ -1,23 +1,23 @@
|
|||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import { PacketContext } from '@/core/packet/context/packetContext';
|
import { PacketContext } from '@/napcat-core/packet/context/packetContext';
|
||||||
import * as trans from '@/core/packet/transformer';
|
import * as trans from '@/napcat-core/packet/transformer';
|
||||||
import { PacketMsg } from '@/core/packet/message/message';
|
import { PacketMsg } from '@/napcat-core/packet/message/message';
|
||||||
import {
|
import {
|
||||||
PacketMsgFileElement,
|
PacketMsgFileElement,
|
||||||
PacketMsgPicElement,
|
PacketMsgPicElement,
|
||||||
PacketMsgPttElement,
|
PacketMsgPttElement,
|
||||||
PacketMsgReplyElement,
|
PacketMsgReplyElement,
|
||||||
PacketMsgVideoElement,
|
PacketMsgVideoElement,
|
||||||
} from '@/core/packet/message/element';
|
} from '@/napcat-core/packet/message/element';
|
||||||
import { ChatType, MsgSourceType, NTMsgType, RawMessage } from '@/core';
|
import { ChatType, MsgSourceType, NTMsgType, RawMessage } from '@/napcat-core';
|
||||||
import { MiniAppRawData, MiniAppReqParams } from '@/core/packet/entities/miniApp';
|
import { MiniAppRawData, MiniAppReqParams } from '@/napcat-core/packet/entities/miniApp';
|
||||||
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
import { AIVoiceChatType } from '@/napcat-core/packet/entities/aiChat';
|
||||||
import { NapProtoDecodeStructType, NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoDecodeStructType, NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { IndexNode, LongMsgResult, MsgInfo, PushMsgBody } from '@/core/packet/transformer/proto';
|
import { IndexNode, LongMsgResult, MsgInfo, PushMsgBody } from '@/napcat-core/packet/transformer/proto';
|
||||||
import { OidbPacket } from '@/core/packet/transformer/base';
|
import { OidbPacket } from '@/napcat-core/packet/transformer/base';
|
||||||
import { ImageOcrResult } from '@/core/packet/entities/ocrResult';
|
import { ImageOcrResult } from '@/napcat-core/packet/entities/ocrResult';
|
||||||
import { gunzipSync } from 'zlib';
|
import { gunzipSync } from 'zlib';
|
||||||
import { PacketMsgConverter } from '@/core/packet/message/converter';
|
import { PacketMsgConverter } from '@/napcat-core/packet/message/converter';
|
||||||
|
|
||||||
export class PacketOperationContext {
|
export class PacketOperationContext {
|
||||||
private readonly context: PacketContext;
|
private readonly context: PacketContext;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user