Compare commits

..

14 Commits

Author SHA1 Message Date
手瓜一十雪
f43c1eadd7 release: 1.5.9 2024-06-21 17:26:16 +08:00
手瓜一十雪
ae4b4e7ff9 release: v1.5.9 2024-06-21 17:25:05 +08:00
手瓜一十雪
68b9771fa9 Merge pull request #78 from NapNeko/dependabot/npm_and_yarn/types/uuid-10.0.0
build(deps-dev): bump @types/uuid from 9.0.8 to 10.0.0
2024-06-21 16:50:15 +08:00
手瓜一十雪
114c98f4cf style: lint 2024-06-21 16:49:31 +08:00
手瓜一十雪
685dc74742 build: 1.5.9 - test3 2024-06-21 16:45:36 +08:00
dependabot[bot]
56966961dc build(deps-dev): bump @types/uuid from 9.0.8 to 10.0.0
Bumps [@types/uuid](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/uuid) from 9.0.8 to 10.0.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/uuid)

---
updated-dependencies:
- dependency-name: "@types/uuid"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-21 08:35:16 +00:00
手瓜一十雪
75b8002616 build: 1.5.9 - refactor 2024-06-21 16:24:49 +08:00
手瓜一十雪
6cd2d14e85 build: 1.5.9 - test2 2024-06-21 16:23:53 +08:00
手瓜一十雪
d11ad0585b build: 1.5.9 - test 2024-06-21 15:57:56 +08:00
手瓜一十雪
ccbb641a8e refactor: sign尝试 2024-06-21 13:29:14 +08:00
手瓜一十雪
5695d10a86 refactor: cache 2024-06-21 12:07:40 +08:00
手瓜一十雪
185f167c5f build: 1.5.9 - refactor cache 2024-06-21 11:21:09 +08:00
手瓜一十雪
9cf38a439b refactor: cache 2024-06-21 11:19:36 +08:00
手瓜一十雪
de65cd810c docs: v1.5.9 todo 2024-06-20 21:25:51 +08:00
1010 changed files with 17542 additions and 57209 deletions

View File

@@ -5,20 +5,17 @@ root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
end_of_line = lf|crlf
insert_final_newline = true
# Matches multiple files with brace expansion notation
# Set default charset
charset = utf-8
# 4 space indentation
# 2 space indentation
[*.{cjs,mjs,js,jsx,ts,tsx,css,scss,sass,html,json}]
indent_style = space
indent_size = 4
[*.bat]
charset = latin1
indent_size = 2
# Unfortunately, EditorConfig doesn't support space configuration inside import braces directly.
# You'll need to rely on your linter/formatter like ESLint or Prettier for that.

1
.env.development Normal file
View File

@@ -0,0 +1 @@
VITE_BUILD_TYPE = Development

View File

@@ -1,2 +0,0 @@
VITE_BUILD_TYPE = Production
VITE_BUILD_PLATFORM = Framework

View File

@@ -1,2 +1 @@
VITE_BUILD_TYPE = Production
VITE_BUILD_PLATFORM = Shell

View File

@@ -1,2 +0,0 @@
VITE_BUILD_TYPE = Production
VITE_BUILD_PLATFORM = Universal

68
.eslintrc.cjs Normal file
View File

@@ -0,0 +1,68 @@
module.exports = {
'env': {
'browser': true,
'es2021': true,
'node': true
},
'ignorePatterns': ['src/core/', 'src/core.lib/','src/proto/'],
'extends': [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
'overrides': [
{
'env': {
'node': true
},
'files': [
'.eslintrc.{js,cjs}'
],
'parserOptions': {
'sourceType': 'script'
}
}
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaVersion': 'latest',
'sourceType': 'module'
},
'plugins': [
'@typescript-eslint',
'import'
],
'settings': {
'import/parsers': {
'@typescript-eslint/parser': ['.ts']
},
'import/resolver': {
'typescript': {
'alwaysTryTypes': true
}
}
},
'rules': {
'indent': [
'error',
2
],
'linebreak-style': [
'error',
'unix'
],
'quotes': [
'error',
'single'
],
'semi': [
'error',
'always'
],
'no-unused-vars': 'off',
'no-async-promise-executor': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-var-requires': 'off',
'object-curly-spacing': ['error', 'always'],
}
};

View File

@@ -15,7 +15,7 @@ body:
attributes:
label: 系统版本
description: 运行 QQNT 的系统版本
placeholder: Windows 11 24H2
placeholder: Windows 10 Pro Workstation 22H2
validations:
required: true
- type: input
@@ -23,7 +23,7 @@ body:
attributes:
label: QQNT 版本
description: 可在 QQNT 的「关于」的设置页中找到
placeholder: 9.9.16-29927
placeholder: 9.9.7-21804
validations:
required: true
- type: input
@@ -39,21 +39,21 @@ body:
attributes:
label: OneBot 客户端
description: 连接至 NapCat 的客户端版本信息
placeholder: Karin 1.0.0
placeholder: Overflow 2.16.0-2cf7991-SNAPSHOT
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: 发生了什么?
description: 填写你认为的 NapCat 的常行为
description: 填写你认为的 NapCat 的不正常行为
validations:
required: true
- type: textarea
id: how-reproduce
attributes:
label: 如何复现
description: 填写应当如何操作才能触发这个常行为
description: 填写应当如何操作才能触发这个不正常行为
placeholder: |
1. xxx
2. xxx
@@ -78,4 +78,4 @@ body:
attributes:
label: OneBot 客户端运行日志
description: 粘贴 OneBot 客户端的相关日志内容到此处
render: shell
render: shell

View File

@@ -1,6 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
interval: "daily"

View File

@@ -1,47 +1,74 @@
name: "Build Action"
name: "Build"
on:
push:
pull_request:
workflow_dispatch:
push:
branches:
- main
permissions: write-all
jobs:
Build-LiteLoader:
build-linux:
if: ${{ startsWith(github.event.head_commit.message, 'build:') }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target_platform: [linux]
target_arch: [x64, arm64]
steps:
- name: Clone Main Repository
uses: actions/checkout@v4
- name: Use Node.js 20.X
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Build NapCat.Framework
run: |
npm i && cd napcat.webui && npm i && cd .. || exit 1
npm run build:framework && npm run depend || exit 1
rm package-lock.json
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: NapCat.Framework
path: dist
Build-Shell:
- 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 Linux
run: |
npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
npm run build:prod
cd dist
npm i --omit=dev --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
cd ..
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }}
path: dist
build-win32:
if: ${{ startsWith(github.event.head_commit.message, 'build:') }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target_platform: [win32]
target_arch: [x64,ia32]
steps:
- name: Clone Main Repository
uses: actions/checkout@v4
- name: Use Node.js 20.X
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Build NapCat.Shell
run: |
npm i && cd napcat.webui && npm i && cd .. || exit 1
npm run build:shell && npm run depend || exit 1
rm package-lock.json
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: NapCat.Shell
path: dist
- 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 Linux
run: |
npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
npm run build:prod
cd dist
npm i --omit=dev --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
cd ..
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }}
path: dist

View File

@@ -1,4 +1,4 @@
name: "Build Release"
name: "release"
on:
push:
@@ -30,9 +30,14 @@ jobs:
ls
node ./script/checkVersion.cjs
sh ./checkVersion.sh
Build-LiteLoader:
build-linux:
needs: [check-version]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target_platform: [linux]
target_arch: [x64, arm64]
steps:
- name: Clone Main Repository
uses: actions/checkout@v4
@@ -46,24 +51,28 @@ jobs:
with:
node-version: 20.x
- name: Build NuCat Framework
- name: Build NuCat Linux
run: |
npm i
cd napcat.webui
npm i
cd ..
npm run build:framework
export NAPCAT_BUILDSYS=${{ matrix.target_platform }}
export NAPCAT_BUILDARCH=${{ matrix.target_arch }}
npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
npm run build:prod
cd dist
npm i --omit=dev
npm i --omit=dev --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
cd ..
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: NapCat.Framework
name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }}
path: dist
Build-Shell:
build-win32:
runs-on: ubuntu-latest
needs: [check-version]
strategy:
fail-fast: false
matrix:
target_platform: [win32]
target_arch: [x64,ia32]
steps:
- name: Clone Main Repository
uses: actions/checkout@v4
@@ -78,61 +87,36 @@ jobs:
with:
node-version: 20.x
- name: Build NuCat Shell
- name: Build NuCat Linux
run: |
npm i
cd napcat.webui
npm i
cd ..
npm run build:shell
export NAPCAT_BUILDSYS=${{ matrix.target_platform }}
export NAPCAT_BUILDARCH=${{ matrix.target_arch }}
npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
npm run build:prod
cd dist
npm i --omit=dev
npm i --omit=dev --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
cd ..
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: NapCat.Shell
name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }}
path: dist
release-napcat:
needs: [Build-LiteLoader,Build-Shell]
needs: [build-win32,build-linux]
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: 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 ./
mkdir ./NapCat.Framework.Windows.Once
unzip -q ./external/LiteLoaderWrapper.zip -d ./NapCat.Framework.Windows.Once
cd ./NapCat.Framework.Windows.Once
ls
mkdir -p ./LL/plugins/NapCatQQ
unzip -q ../NapCat.Framework.zip -d ./LL/plugins/NapCatQQ
zip -q -r NapCat.Framework.Windows.Once.zip *
cd ..
mv ./NapCat.Framework.Windows.Once/NapCat.Framework.Windows.Once.zip ./
for dir in */; do
base=$(basename "$dir")
zip -r "${base}.zip" "$dir"
done
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
@@ -146,7 +130,9 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
body_path: CHANGELOG.md
files: |
NapCat.Framework.zip
NapCat.Shell.zip
NapCat.Framework.Windows.Once.zip
NapCat.win32.x64.zip
NapCat.linux.x64.zip
NapCat.linux.arm64.zip
# NapCat.darwin.x64.zip
# NapCat.darwin.arm64.zip
draft: true

6
.gitignore vendored
View File

@@ -5,13 +5,13 @@ pnpm-lock.yaml
out/
dist/
/src/core.lib/common/
devconfig/*
/localdebug/
# Editor
.vscode/*
!.vscode/extensions.json
.idea/*
# Build
*.db
checkVersion.sh
bun.lockb
checkVersion.sh

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule "src/core"]
path = src/core
url = https://github.com/NapNeko/core.git
branch = master

View File

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

115
.vscode/launch.json vendored
View File

@@ -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"
]
}
]
}

10
.vscode/settings.json vendored
View File

@@ -1,10 +0,0 @@
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
".env.universal": ".env.*",
"tsconfig.json": "tsconfig.*.json, env.d.ts, vite.config.ts",
"package.json": "package-lock.json, eslint*, .prettier*, .editorconfig, manifest.json, logo.png, .gitignore, LICENSE"
},
"css.customData": [".vscode/tailwindcss.json"],
}

View File

@@ -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 youd 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"
}
]
}
]
}

View File

@@ -1,128 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
nanaeonn@outlook.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

32
LICENSE
View File

@@ -1,19 +1,21 @@
Limited Redistribution License for NapCat
MIT License
Copyright © 2024 Mlikiowa
Copyright (c) 2024 NapCatQQ
1. Usage and Reproduction:
- Unauthorized use, reproduction, modification, or distribution of this code is prohibited without explicit permission from the main author of the NapCat repository.
2. Redistribution:
- Redistribution of this code is permitted, provided that the full text of this license is included, and the source and copyright information is clearly stated.
- Minor modifications and extensions are allowed for redistribution purposes, but the modified code must not be publicly released.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
3. Non-Commercial Use:
- This code is not to be used for any commercial purposes.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
4. Additional Permissions:
- Any rights not explicitly addressed in this license must be requested from and granted by the main author of the NapCat repository.
5. Disclaimer:
- This code is provided "as is," without any express or implied warranties, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. In no event shall the author be liable for any damages or other liability arising from, out of, or in connection with the use or distribution of this code.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,62 +1,33 @@
<div align="center">
# NapCat
![NapCatQQ](https://socialify.git.ci/NapNeko/NapCatQQ/image?font=Jost&logo=https%3A%2F%2Fnapneko.github.io%2Fassets%2Fnewlogo.png&name=1&owner=1&pattern=Diagonal+Stripes&stargazers=1&theme=Auto)
_Modern protocol-side framework implemented based on NTQQ._
> 云起兮风生,心向远方兮路未曾至.
<img src="https://socialify.git.ci/NapNeko/NapCatQQ/image?description=1&language=1&logo=https%3A%2F%2Fraw.githubusercontent.com%2FNapNeko%2FNapCatQQ%2Fmain%2Flogo.png&name=1&stargazers=1&theme=Auto" alt="NapCatQQ" width="640" height="320" />
</div>
---
## 项目介绍
## Welcome
+ NapCatQQ is a modern implementation of the Bot protocol based on NTQQ.
- NapCatQQ 是现代化的基于 NTQQ 的 Bot 协议端实现
NapCatQQ 是基于 PC NTQQ 本体实现一套无头 Bot 框架。
## Feature
名字寓意 瞌睡猫QQ像睡着了一样在后台低占用运行的无需GUI界面的NTQQ。
+ **Easy to Use**
- 作为初学者能够轻松使用.
+ **Quick and Efficient**
- 在低内存操作系统长时运行.
+ **Rich API Interface**
- 完整实现了大部分标准接口.
+ **Stable and Reliable**
- 持续稳定的开发与维护.
## Quick Start
## 如何使用
可前往 [Release](https://github.com/NapNeko/NapCatQQ/releases/) 页面下载最新版本
**首次使用**请务必查看如下文档看使用教程
**首次使用** 请务必前往 [官方文档](https://napneko.github.io/) 查看使用文档与教程
## Link
| Docs | [![Github.IO](https://img.shields.io/badge/docs%20on-Github.IO-orange)](https://napneko.github.io/) | [![Cloudflare.Worker](https://img.shields.io/badge/docs%20on-Cloudflare.Worker-black)](https://doc.napneko.icu/) | [![Cloudflare.HKServer](https://img.shields.io/badge/docs%20on-Cloudflare.HKServer-informational)](https://napcat.napneko.icu/) |
|:-:|:-:|:-:|:-:|
## 项目声明
| Docs | [![Cloudflare.Pages](https://img.shields.io/badge/docs%20on-Cloudflare.Pages-blue)](https://napneko.pages.dev/) | [![Server.Other](https://img.shields.io/badge/docs%20on-Server.Other-green)](https://docs.napcat.cyou/) | [![NapCat.Wiki](https://img.shields.io/badge/docs%20on-NapCat.Wiki-red)](https://www.napcat.wiki) |
|:-:|:-:|:-:|:-:|
* 请不要在无关地方宣传NapCatQQ本项目只是用于学习 node 相关知识,切勿用于违法用途
| Contact | [![QQ Group#1](https://img.shields.io/badge/QQ%20Group%231-Join-blue)](https://qm.qq.com/q/I6LU87a0Yq) | [![QQ Group#2](https://img.shields.io/badge/QQ%20Group%232-Join-blue)](https://qm.qq.com/q/HaRcfrHpUk) | [![Telegram](https://img.shields.io/badge/Telegram-MelodicMoonlight-blue)](https://t.me/MelodicMoonlight) |
|:-:|:-:|:-:|:-:|
* NapCat 不会收集用户隐私信息,但是未来可能会为了更好的利于 NapCat 的优化会收集一些设备信息,如 cpu 架构,系统版本等
## 相关链接
[Telegram Link](https://t.me/+nLZEnpne-pQ1OWFl)
## Thanks
## 鸣谢名单
+ [Lagrange](https://github.com/LagrangeDev/Lagrange.Core) 对本项目的大力支持 参考部分代码 已获授权
[Lagrange](https://github.com/LagrangeDev/Lagrange.Core)
+ [LLOneBot](https://github.com/LLOneBot/LLOneBot) 相关的开发曾参与本项目部分开发
+ 不过最最重要的 还是需要感谢屏幕前的你哦~
---
## License
本项目采用 混合协议 开源,因此使用本项目时,你需要注意以下几点:
1. 第三方库代码或修改部分遵循其原始开源许可.
2. 本项目获取部分项目授权而不受部分约束
2. 项目其余逻辑代码采用[本仓库开源许可](./LICENSE).
**本仓库仅用于提高易用性,实现消息推送类功能,此外,禁止任何项目未经仓库主作者授权基于 NapCat 代码开发。使用请遵守当地法律法规,由此造成的问题由使用者和提供违规使用教程者负责。**
<!--
QQ群545402644
-->

View File

@@ -1,11 +0,0 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| > 4.0 | :white_check_mark: |
| < 4.0 | :x: |
## Reporting a Vulnerability
you should open an issue

View File

@@ -0,0 +1,12 @@
# v1.5.9
QQ Version: Windows 9.9.11-24815 / Linux 3.2.9-24815
## 修复与优化
* 优化缓存问题
* 修复poke异常上报
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,17 @@
# v1.3.3
QQ Version: Windows 9.9.9-23424 / Linux 3.2.7-23361
## 修复与优化
* 尝试修复多开崩溃问题
* 修复群列表更新问题
* 修复兼容性问题支持Win7
* 修复下载 http 资源缺少UA
* 优化少量消息合并转发速度
* 修复加载群通知时出现 getUserDetailInfo timeout 导致程序崩溃
## 新增与调整
* 新增设置群公告 Api: /_send_group_notice
* 新增重启实现 包括重启快速登录/普通重启 副作用: 原进程 无法清理
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,18 @@
# v1.3.5
QQ Version: Windows 9.9.9-23424 / Linux 3.2.7-23361
## 修复与优化
* 优化启动脚本
* 修复非管理时群成员减少事件上报 **无法获取操作者与操作类型**
* 修复快速重启进程清理问题
* 优化配置文件格式 支持自动更新配置 但仍然建议 **备份配置**
* 修复正向反向ws多个客户端周期多次心跳问题
## 新增与调整
* 支持WebUi热重载
* 新增启动输出WEBUI秘钥
* 新增群荣誉信息 /get_group_honor_info
* 支持获取群系统消息 /get_group_system_msg
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,11 @@
# v1.3.6
QQ Version: Windows 9.9.9-23424 / Linux 3.2.7-23361
## 修复与优化
* 修复戳一戳多次上报问题
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,15 @@
# v1.3.8
QQ Version: Windows 9.9.9-23873 / Linux 3.2.7-23361
## 修复与优化
* 优化打包后体积问题
* 修复QQ等级获取
* 兼容 9.7.x 版本换行符 统一为 \n
* 修复处理加群请求 字段异常情况
* 修复退群通知问题
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,11 @@
# v1.3.9
QQ Version: Windows 9.9.10-23873 / Linux 3.2.7-23361
## 修复与优化
* 修复QQ等级获取与兼容性问题
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,12 @@
# v1.4.0
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
## 新增与调整
* 支持空间Cookies获取
* 支持获取在线设备 API /get_online_clients
* 支持图片OCR API /.ocr_image /ocr_image
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,14 @@
# v1.4.1
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 提高部分Api兼容性
* 优化日志膨胀问题
* 在线状态刷新问题修复
## 新增与调整
* 支持非管理群 本地记录时间数据 (建议 **备份配置 清空配置 重新配置**)
* 新增英译中接口 Api: /translate_en2zh
* 新增群文件管理相关扩展接口 Api: /get_group_file_count /get_group_file_list /set_group_file_folder /del_group_file /del_group_file_folder
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,12 @@
# v1.4.2
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 修复获取群文件列表Api
* 修复退群通知问题
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,11 @@
# v1.4.3
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 修复名片通知
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,10 @@
# v1.4.4
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 更新
* **重大更新:**更新了版本号
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,12 @@
# v1.4.5
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 紧急修复二维扫码问题
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,12 @@
# v1.4.6
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 优化整体稳定性
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,11 @@
# v1.4.7
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 临时扩展 Api: GoCQHTTPUploadGroupFile folder_id字段 用于选择文件夹
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,12 @@
# v1.4.8
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 优化Guid的生成方式
* 支持临时消息获取群来源
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,11 @@
# v1.4.9
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 修复接口调用问题 接口标准化 APIset_group_add_request
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,11 @@
# v1.5.0
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 修正各Api默认值
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,12 @@
# v1.5.1
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 支持 新Api: set_self_profile 可设置个性签名
* 修复 Api: get_group_system_msg
* 整理日志、添加颜色、使用统一的日志函数以提高日志可读性
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,13 @@
# v1.5.2
QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 替换Uid/Uin为内部实现
* 增加HttpApi调用稳定性
* 修复 GetMsg 兼容性
## 新增与调整
* 支持真正意义上的陌生人信息获取 Api: GoCQHTTP_GetStrangerInfo
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,15 @@
# v1.5.3
QQ Version: Windows 9.9.11-24568 / Linux 3.2.9-23568
## 修复与优化
* 修复引用消息id问题
* 修复添加好友的通知
## 新增与调整
* 扩展群分享Json生成
* 扩展关于收藏的一系列接口
* 支持专属群头衔获取
* 支持视频获取直链
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,11 @@
# v1.5.4
QQ Version: Windows 9.9.11-24568 / Linux 3.2.9-23568
## 修复与优化
* 紧急修复视频与文件问题
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,11 @@
# v1.5.5
QQ Version: Windows 9.9.11-24568 / Linux 3.2.9-23568
## 修复与优化
* 紧急修复一些问题
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,11 @@
# v1.5.6
QQ Version: Windows 9.9.11-24568 / Linux 3.2.9-24568
## 修复与优化
* 修复一些问题
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,11 @@
# v1.5.7
QQ Version: Windows 9.9.11-24568 / Linux 3.2.9-24568
## 修复与优化
* 修复一些问题
## 新增与调整
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

View File

@@ -0,0 +1,14 @@
# v1.5.8
QQ Version: Windows 9.9.11-24568 / Linux 3.2.9-24568
## 修复与优化
* 修复视频文件残留问题
* 重构 getcookies接口 支持大部分常见域
## 新增与调整
* 日志大小限制
* 支持 QQ音乐 卡片 无签名支持时 启用内置方法(缺点没有封面 限速1min/条)
* 支持Window X86-32机器
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)

2
docs/develop/Android.md Normal file
View File

@@ -0,0 +1,2 @@
# 开始
jadx 跳转于 `com.tencent.qqnt.kernel.*`

View File

@@ -0,0 +1,42 @@
# Android
```java
GroupMemberExtReq groupMemberExtReq = new GroupMemberExtReq();
groupMemberExtReq.sourceType = MemberExtSourceType.TITLETYPE.ordinal();
groupMemberExtReq.groupCode = longOrNull.longValue();
groupMemberExtReq.beginUin = "0";
groupMemberExtReq.dataTime = "0";
Long[] lArr = new Long[1];
AppInterface a2 = dVar.a();
lArr[0] = Long.valueOf(a2 != null ? a2.getLongAccountUin() : 0L);
arrayListOf = CollectionsKt__CollectionsKt.arrayListOf(lArr);
groupMemberExtReq.uinList = arrayListOf;
MemberExtInfoFilter memberExtInfoFilter = new MemberExtInfoFilter();
memberExtInfoFilter.memberLevelInfoUin = 1;
memberExtInfoFilter.memberLevelInfoPoint = 1;
memberExtInfoFilter.memberLevelInfoActiveDay = 1;
memberExtInfoFilter.memberLevelInfoLevel = 1;
memberExtInfoFilter.levelName = 1;
memberExtInfoFilter.dataTime = 1;
memberExtInfoFilter.sysShowFlag = 1;
memberExtInfoFilter.userShowFlag = 1;
memberExtInfoFilter.userShowFlagNew = 1;
memberExtInfoFilter.levelNameNew = 1;
Unit unit = Unit.INSTANCE;
groupMemberExtReq.memberExtFilter = memberExtInfoFilter;
troopLevelFrequencyControl.f(troopUin, new TroopListRepo$fetchTroopLevelInfo$2(b2, groupMemberExtReq, troopUin, new com.tencent.qqnt.troopmemberlist.report.c("fetchTroopLevelInfo")));
```
# Win
参数解析位于 sub_181456A10(24108) -> wrapper.node(24108)+1456A10
IGroupService.GetMemberExt(param: object);
param展开如下
```
groupCode string
beginUin string
dataTime string
uinList Array<string>
uinNum string
groupType string
richCardNameVer string
sourceType number
memberExtFilter object// 参数解析位于 sub_18145A6D0(24108) -> wrapper.node(24108)+145A6D0
```

View File

@@ -0,0 +1,48 @@
public static final int C2C_PIC_DOWNLOAD = 1004;
public static final String C2C_PIC_DOWNLOAD_DOMAIN = "c2cpicdw.qpic.cn";
public static final String C2C_PIC_DOWNLOAD_QUIC_DOMAIN = "c2cpicdw.quic.qpic.cn";
public static final int FLAG_NOT_UPLOAD = 3;
public static final int FLAG_UPLOADINFO_ERROR = 4;
public static final int GROUP_PIC_DOWNLOAD = 1000;
public static final String GROUP_PIC_DOWNLOAD_DOMAIN = "gchat.qpic.cn";
public static final String GROUP_PIC_DOWNLOAD_QUIC_DOMAIN = "gchat.quic.qpic.cn";
public static final String GUILD_PIC_DOWNLOAD_DOMAIN = "gchat.qpic.cn/qmeetpic";
public static final boolean NEW_STORE_FLAG = true;
public static final String PTT_VIDEO_DOWNLOAD_DOMAIN = "grouptalk.c2c.qq.com";
protected static final int AVIF_DECODE_EXCEPTION = 4;
protected static final int AVIF_DECODE_FAIL = 1;
protected static final int AVIF_DECODE_FAIL_SO_FAIL = 2;
protected static final int AVIF_DECODE_FAIL_UNKNOWN = 6;
protected static final int AVIF_DECODE_FILETYPE_ERROR = 5;
protected static final int AVIF_DECODE_OOM = 3;
protected static final int AVIF_DECODE_RENAME_FAIL = 7;
protected static final int AVIF_DECODE_SUC = 0;
public static final String AVIF_FILE_SUFFIX = ".avif";
public static final int AVIF_REQ_APPRUNTIME_NULL = 12;
public static final int AVIF_REQ_CODEC_UNSURPPORT = 5;
protected static final int AVIF_REQ_DENSITY_UNSURPPORT = 10;
protected static final int AVIF_REQ_FLASH_PHOTO = 9;
protected static final int AVIF_REQ_HAS_TMP_AVIF = 7;
protected static final int AVIF_REQ_INVALID_MSG_RECORD = 2;
protected static final int AVIF_REQ_IS_RAW_PHOTO = 3;
protected static final int AVIF_REQ_OUTPUTSTREAM_UNSURPPORT = 11;
protected static final int AVIF_REQ_OVERSIZE = 6;
protected static final int AVIF_REQ_RETRY = 1;
public static final int AVIF_REQ_SO_DOWNLOAD_FAILED = 8;
protected static final int AVIF_REQ_SUC = 0;
public static final int AVIF_REQ_SWITCH_CLOSE = 4;
public static final String C2C_PIC_DOWNLOAD_ERROR_CODE = "C2CPicDownloadErrorCode";
static final int DOWNLOAD_ST_COMPLETE = 1;
static final int DOWNLOAD_ST_HEAD = 2;
static final int DOWNLOAD_ST_LEFT = 4;
static final int DOWNLOAD_ST_PART = 3;
private static final int ENCRYPT_APPID = 1600000226;
public static final String GROUP_PIC_DOWNLOAD_ERROR_CODE = "GroupPicDownloadErrorCode";
public static final String KEY_PIC_DOWNLOAD_ERROR_CODE = "param_detail_code";
protected static final int QUIC_FAIL_IP_LIST_EMPTY = 1;
protected static final int QUIC_FAIL_REQUEST_HTTPS = 3;
protected static final int QUIC_FAIL_REQUEST_QUIC = 2;
protected static final int QUIC_FAIL_SO_LOAD = 4;
public static final String REPORT_TAG_DIRECT_DOWNLOAD_FAIL = "report_direct_download_fail";
public static final String REQ_PARAM_AVIF = "tp=avif";

View File

@@ -0,0 +1,444 @@
```java
MsgConstant
int ARKSTRUCTELEMENTSUBTYPETENCENTDOCFROMMINIAPP = 1;
int ARKSTRUCTELEMENTSUBTYPETENCENTDOCFROMPLUSPANEL = 2;
int ARKSTRUCTELEMENTSUBTYPEUNKNOWN = 0;
int ATTYPEALL = 1;
int ATTYPECATEGORY = 512;
int ATTYPECHANNEL = 16;
int ATTYPEME = 4;
int ATTYPEONE = 2;
int ATTYPEONLINE = 64;
int ATTYPEROLE = 8;
int ATTYPESUMMON = 32;
int ATTYPESUMMONONLINE = 128;
int ATTYPESUMMONROLE = 256;
int ATTYPEUNKNOWN = 0;
int CALENDARELEMSUBTYPECOMMON = 3;
int CALENDARELEMSUBTYPESTRONG = 1;
int CALENDARELEMSUBTYPEUNKNOWN = 0;
int CALENDARELEMSUBTYPEWEAK = 2;
int FACEBUBBLEELEMSUBTYPENORMAL = 1;
int FACEBUBBLEELEMSUBTYPEUNKNOWN = 0;
int FETCHLONGMSGERRCODEMSGEXPIRED = 196;
int FILEELEMENTSUBTYPEAI = 16;
int FILEELEMENTSUBTYPEAPP = 11;
int FILEELEMENTSUBTYPEAUDIO = 3;
int FILEELEMENTSUBTYPEDOC = 4;
int FILEELEMENTSUBTYPEEMOTICON = 15;
int FILEELEMENTSUBTYPEEXCEL = 6;
int FILEELEMENTSUBTYPEFOLDER = 13;
int FILEELEMENTSUBTYPEHTML = 10;
int FILEELEMENTSUBTYPEIPA = 14;
int FILEELEMENTSUBTYPENORMAL = 0;
int FILEELEMENTSUBTYPEPDF = 7;
int FILEELEMENTSUBTYPEPIC = 1;
int FILEELEMENTSUBTYPEPPT = 5;
int FILEELEMENTSUBTYPEPSD = 12;
int FILEELEMENTSUBTYPETXT = 8;
int FILEELEMENTSUBTYPEVIDEO = 2;
int FILEELEMENTSUBTYPEZIP = 9;
int GRAYTIPELEMENTSUBTYPEAIOOP = 15;
int GRAYTIPELEMENTSUBTYPEBLOCK = 14;
int GRAYTIPELEMENTSUBTYPEBUDDY = 5;
int GRAYTIPELEMENTSUBTYPEBUDDYNOTIFY = 9;
int GRAYTIPELEMENTSUBTYPEEMOJIREPLY = 3;
int GRAYTIPELEMENTSUBTYPEESSENCE = 7;
int GRAYTIPELEMENTSUBTYPEFEED = 6;
int GRAYTIPELEMENTSUBTYPEFEEDCHANNELMSG = 11;
int GRAYTIPELEMENTSUBTYPEFILE = 10;
int GRAYTIPELEMENTSUBTYPEGROUP = 4;
int GRAYTIPELEMENTSUBTYPEGROUPNOTIFY = 8;
int GRAYTIPELEMENTSUBTYPEJSON = 17;
int GRAYTIPELEMENTSUBTYPELOCALMSG = 13;
int GRAYTIPELEMENTSUBTYPEPROCLAMATION = 2;
int GRAYTIPELEMENTSUBTYPEREVOKE = 1;
int GRAYTIPELEMENTSUBTYPEUNKNOWN = 0;
int GRAYTIPELEMENTSUBTYPEWALLET = 16;
int GRAYTIPELEMENTSUBTYPEXMLMSG = 12;
int INLINEKEYBOARDBUTTONRENDERSTYLEBLUEBLACKGROUND = 4;
int INLINEKEYBOARDBUTTONRENDERSTYLEBLUEBORDER = 1;
int INLINEKEYBOARDBUTTONRENDERSTYLEGRAYBORDER = 0;
int INLINEKEYBOARDBUTTONRENDERSTYLENOBORDER = 2;
int INLINEKEYBOARDBUTTONRENDERSTYLEREDCHARACTER = 3;
int INPUTSTATUSTYPECANCEL = 2;
int INPUTSTATUSTYPESPEAK = 3;
int INPUTSTATUSTYPETEXT = 1;
int KACTIVITYMSG = 22;
int KADDLOCALMSGEXTINFOTYPEPROLOGUEMSG = 1;
int KANONYMOUSATMEMSGTYPEINMSGBOX = 1001;
int KANONYMOUSFLAGFROMOTHERPEOPLE = 1;
int KANONYMOUSFLAGFROMOWN = 2;
int KANONYMOUSFLAGINVALID = 0;
int KAPPCHANNELMSG = 16;
int KATALLMSGTYPEINMSGBOX = 2000;
int KATMEMSGTYPEINMSGBOX = 1000;
int KATTRIBUTETYPEADELIEMSG = 16;
int KATTRIBUTETYPEEXTENDBUSINESS = 13;
int KATTRIBUTETYPEFEEDBACKSTATE = 17;
int KATTRIBUTETYPEGROUPHONOR = 2;
int KATTRIBUTETYPEKINGHONOR = 3;
int KATTRIBUTETYPELONGMSG = 8;
int KATTRIBUTETYPEMEMORYSTATEMSGINFO = 18;
int KATTRIBUTETYPEMSG = 0;
int KATTRIBUTETYPEMSGBOXEVENTTYPE = 14;
int KATTRIBUTETYPEPERSONAL = 1;
int KATTRIBUTETYPEPUBLICACCOUNT = 4;
int KATTRIBUTETYPEQQCONNECT = 12;
int KATTRIBUTETYPESENDMSGRSPTRANSSVRINFO = 15;
int KATTRIBUTETYPESHAREDMSGINFO = 5;
int KATTRIBUTETYPETEMPCHATGAMESESSION = 6;
int KATTRIBUTETYPETOROBOTMSG = 9;
int KATTRIBUTETYPEUININFO = 7;
int KATTRIBUTETYPEZPLAN = 11;
int KAUTOREPLYTEXTNONEINDEX = -1;
int KAVRECORDMSG = 19;
int KBUSINESSTYPGUILD = 1;
int KBUSINESSTYPNT = 0;
int KCHATTYPEADELIE = 42;
int KCHATTYPEBUDDYNOTIFY = 5;
int KCHATTYPEC2C = 1;
int KCHATTYPECIRCLE = 113;
int KCHATTYPEDATALINE = 8;
int KCHATTYPEDATALINEMQQ = 134;
int KCHATTYPEDISC = 3;
int KCHATTYPEFAV = 41;
int KCHATTYPEGAMEMESSAGE = 105;
int KCHATTYPEGAMEMESSAGEFOLDER = 116;
int KCHATTYPEGROUP = 2;
int KCHATTYPEGROUPBLESS = 133;
int KCHATTYPEGROUPGUILD = 9;
int KCHATTYPEGROUPHELPER = 7;
int KCHATTYPEGROUPNOTIFY = 6;
int KCHATTYPEGUILD = 4;
int KCHATTYPEGUILDMETA = 16;
int KCHATTYPEMATCHFRIEND = 104;
int KCHATTYPEMATCHFRIENDFOLDER = 109;
int KCHATTYPENEARBY = 106;
int KCHATTYPENEARBYASSISTANT = 107;
int KCHATTYPENEARBYFOLDER = 110;
int KCHATTYPENEARBYHELLOFOLDER = 112;
int KCHATTYPENEARBYINTERACT = 108;
int KCHATTYPEQQNOTIFY = 132;
int KCHATTYPERELATEACCOUNT = 131;
int KCHATTYPESERVICEASSISTANT = 118;
int KCHATTYPESERVICEASSISTANTSUB = 201;
int KCHATTYPESQUAREPUBLIC = 115;
int KCHATTYPESUBSCRIBEFOLDER = 30;
int KCHATTYPETEMPADDRESSBOOK = 111;
int KCHATTYPETEMPBUSSINESSCRM = 102;
int KCHATTYPETEMPC2CFROMGROUP = 100;
int KCHATTYPETEMPC2CFROMUNKNOWN = 99;
int KCHATTYPETEMPFRIENDVERIFY = 101;
int KCHATTYPETEMPNEARBYPRO = 119;
int KCHATTYPETEMPPUBLICACCOUNT = 103;
int KCHATTYPETEMPWPA = 117;
int KCHATTYPEUNKNOWN = 0;
int KCHATTYPEWEIYUN = 40;
int KCOMMONREDENVELOPEMSGTYPEINMSGBOX = 1007;
int KDOWNSOURCETYPEAIOINNER = 1;
int KDOWNSOURCETYPEBIGSCREEN = 2;
int KDOWNSOURCETYPEHISTORY = 3;
int KDOWNSOURCETYPEUNKNOWN = 0;
int KELEMTYPEACTIVITY = 25;
int KELEMTYPEACTIVITYSTATE = 41;
int KELEMTYPEACTIVITYSUBTYPECREATEMOBATEAM = 12;
int KELEMTYPEACTIVITYSUBTYPEDISBANDMOBATEAM = 11;
int KELEMTYPEACTIVITYSUBTYPEFEEDSQUARE = 10001;
int KELEMTYPEACTIVITYSUBTYPEFINISHGAME = 16;
int KELEMTYPEACTIVITYSUBTYPEFINISHMATCHTEAM = 14;
int KELEMTYPEACTIVITYSUBTYPEHOTCHAT = 10000;
int KELEMTYPEACTIVITYSUBTYPEMINIGAME = 18;
int KELEMTYPEACTIVITYSUBTYPEMUSICPLAY = 17;
int KELEMTYPEACTIVITYSUBTYPENEWSMOBA = 9;
int KELEMTYPEACTIVITYSUBTYPENOLIVE = 2;
int KELEMTYPEACTIVITYSUBTYPENOSCREENSHARE = 7;
int KELEMTYPEACTIVITYSUBTYPENOVOICE = 3;
int KELEMTYPEACTIVITYSUBTYPEONLIVE = 1;
int KELEMTYPEACTIVITYSUBTYPEONSCREENSHARE = 6;
int KELEMTYPEACTIVITYSUBTYPEONVOICE = 4;
int KELEMTYPEACTIVITYSUBTYPESTARTMATCHTEAM = 13;
int KELEMTYPEACTIVITYSUBTYPETARTGAME = 15;
int KELEMTYPEACTIVITYSUBTYPEUNKNOWN = 0;
int KELEMTYPEADELIEACTIONBAR = 44;
int KELEMTYPEADELIERECOMMENDEDMSG = 43;
int KELEMTYPEARKSTRUCT = 10;
int KELEMTYPEAVRECORD = 21;
int KELEMTYPECALENDAR = 19;
int KELEMTYPEFACE = 6;
int KELEMTYPEFACEBUBBLE = 27;
int KELEMTYPEFEED = 22;
int KELEMTYPEFILE = 3;
int KELEMTYPEGIPHY = 15;
int KELEMTYPEGRAYTIP = 8;
int KELEMTYPEINLINEKEYBOARD = 17;
int KELEMTYPEINTEXTGIFT = 18;
int KELEMTYPELIVEGIFT = 12;
int KELEMTYPEMARKDOWN = 14;
int KELEMTYPEMARKETFACE = 11;
int KELEMTYPEMULTIFORWARD = 16;
int KELEMTYPEONLINEFILE = 23;
int KELEMTYPEPIC = 2;
int KELEMTYPEPROLOGUE = 46;
int KELEMTYPEPTT = 4;
int KELEMTYPEREPLY = 7;
int KELEMTYPESHARELOCATION = 28;
int KELEMTYPESTRUCTLONGMSG = 13;
int KELEMTYPETASKTOPMSG = 29;
int KELEMTYPETEXT = 1;
int KELEMTYPETOFU = 26;
int KELEMTYPEUNKNOWN = 0;
int KELEMTYPEVIDEO = 5;
int KELEMTYPEWALLET = 9;
int KELEMTYPEYOLOGAMERESULT = 20;
int KENTERAIO = 1;
int KEXITAIO = 2;
int KFEEDBACKBUTTONTYPEDISLIKE = 2;
int KFEEDBACKBUTTONTYPELIKE = 1;
int KFEEDBACKBUTTONTYPEPROMPTCLICK = 5;
int KFEEDBACKBUTTONTYPEREGENERATE = 4;
int KFEEDBACKBUTTONTYPEUNKNOWN = 0;
int KFEEDBACKOPTLIKE = 1;
int KFEEDBACKOPTUNKNOWN = 0;
int KFEEDBACKOPTUNLIKE = 2;
int KFRIENDNEWADDEDMSGTYPEINMSGBOX = 1008;
int KGAMEBOXNEWMSGTYPEINMSGBOX = 3000;
int KGIFTATMEMSGTYPEINMSGBOX = 1005;
int KGROUPFILEATALLMSGTYPEINMSGBOX = 2001;
int KGROUPHOMEWORK = 20000;
int KGROUPHOMEWORKTASK = 20001;
int KGROUPKEYWORDMSGTYPEINMSGBOX = 2006;
int KGROUPMANNOUNCEATALLMSGTYPEINMSGBOX = 2004;
int KGROUPTASKATALLMSGTYPEINMSGBOX = 2003;
int KGROUPUNREADTYPEINMSGBOX = 2007;
int KGUILDCHANNELLIST = 10;
int KHIGHLIGHTWORDINTEMPCHATTYPEINMSGBOX = 1009;
int KHOMEWORKREMINDER = 10000;
int KLIKEORDISLIKESTATEDISLIKE = 2;
int KLIKEORDISLIKESTATELIKE = 1;
int KLIKEORDISLIKESTATENONESELECTED = 0;
int KMARKETFACE = 17;
int KMEMORYSTATEMSGTYPEADELIEWELCOME = 1;
int KMEMORYSTATEMSGTYPEUNKNOWN = 0;
int KMINIPROGRAMNOTICE = 114;
int KMSGSUBTYPEARKGROUPANNOUNCE = 3;
int KMSGSUBTYPEARKGROUPANNOUNCECONFIRMREQUIRED = 4;
int KMSGSUBTYPEARKGROUPGIFTATME = 5;
int KMSGSUBTYPEARKGROUPTASKATALL = 6;
int KMSGSUBTYPEARKMULTIMSG = 7;
int KMSGSUBTYPEARKNORMAL = 0;
int KMSGSUBTYPEARKTENCENTDOCFROMMINIAPP = 1;
int KMSGSUBTYPEARKTENCENTDOCFROMPLUSPANEL = 2;
int KMSGSUBTYPEEMOTICON = 15;
int KMSGSUBTYPEFILEAPP = 11;
int KMSGSUBTYPEFILEAUDIO = 3;
int KMSGSUBTYPEFILEDOC = 4;
int KMSGSUBTYPEFILEEXCEL = 6;
int KMSGSUBTYPEFILEFOLDER = 13;
int KMSGSUBTYPEFILEHTML = 10;
int KMSGSUBTYPEFILEIPA = 14;
int KMSGSUBTYPEFILENORMAL = 0;
int KMSGSUBTYPEFILEPDF = 7;
int KMSGSUBTYPEFILEPIC = 1;
int KMSGSUBTYPEFILEPPT = 5;
int KMSGSUBTYPEFILEPSD = 12;
int KMSGSUBTYPEFILETXT = 8;
int KMSGSUBTYPEFILEVIDEO = 2;
int KMSGSUBTYPEFILEZIP = 9;
int KMSGSUBTYPELINK = 5;
int KMSGSUBTYPEMARKETFACE = 1;
int KMSGSUBTYPEMIXEMOTICON = 7;
int KMSGSUBTYPEMIXFACE = 3;
int KMSGSUBTYPEMIXMARKETFACE = 2;
int KMSGSUBTYPEMIXPIC = 1;
int KMSGSUBTYPEMIXREPLY = 4;
int KMSGSUBTYPEMIXTEXT = 0;
int KMSGSUBTYPETENCENTDOC = 6;
int KMSGTYPEARKSTRUCT = 11;
int KMSGTYPEFACEBUBBLE = 24;
int KMSGTYPEFILE = 3;
int KMSGTYPEGIFT = 14;
int KMSGTYPEGIPHY = 13;
int KMSGTYPEGRAYTIPS = 5;
int KMSGTYPEMIX = 2;
int KMSGTYPEMULTIMSGFORWARD = 8;
int KMSGTYPENULL = 1;
int KMSGTYPEONLINEFILE = 21;
int KMSGTYPEONLINEFOLDER = 27;
int KMSGTYPEPROLOGUE = 29;
int KMSGTYPEPTT = 6;
int KMSGTYPEREPLY = 9;
int KMSGTYPESHARELOCATION = 25;
int KMSGTYPESTRUCT = 4;
int KMSGTYPESTRUCTLONGMSG = 12;
int KMSGTYPETEXTGIFT = 15;
int KMSGTYPEUNKNOWN = 0;
int KMSGTYPEVIDEO = 7;
int KMSGTYPEWALLET = 10;
int KNEEDCONFIRMGROUPMANNOUNCEATALLMSGTYPEINMSGBOX = 2005;
int KNOTPASSTHROUGHEVENTTYPEUPPERBOUNDARY = 9999;
int KPTTFORMATTYPEAMR = 0;
int KPTTFORMATTYPESILK = 1;
int KPTTTRANSLATESTATUSFAIL = 3;
int KPTTTRANSLATESTATUSSUC = 2;
int KPTTTRANSLATESTATUSTRANSLATING = 1;
int KPTTTRANSLATESTATUSUNKNOWN = 0;
int KPTTVIPLEVELTYPENONE = 0;
int KPTTVIPLEVELTYPEQQVIP = 0;
int KPTTVIPLEVELTYPESVIP = 0;
int KPTTVOICECHANGETYPEBEASTMACHINE = 7;
int KPTTVOICECHANGETYPEBOY = 2;
int KPTTVOICECHANGETYPECATCHCOLD = 13;
int KPTTVOICECHANGETYPEECHO = 5;
int KPTTVOICECHANGETYPEFATGUY = 16;
int KPTTVOICECHANGETYPEFLASHING = 9;
int KPTTVOICECHANGETYPEGIRL = 1;
int KPTTVOICECHANGETYPEHORRIBLE = 3;
int KPTTVOICECHANGETYPEKINDERGARTEN = 6;
int KPTTVOICECHANGETYPEMEDAROT = 15;
int KPTTVOICECHANGETYPENONE = 0;
int KPTTVOICECHANGETYPEOPTIMUSPRIME = 8;
int KPTTVOICECHANGETYPEOUTOFDATE = 14;
int KPTTVOICECHANGETYPEPAPI = 11;
int KPTTVOICECHANGETYPEQUICK = 4;
int KPTTVOICECHANGETYPESTUTTER = 10;
int KPTTVOICECHANGETYPETRAPPEDBEAST = 12;
int KPTTVOICETYPEINTERCOM = 1;
int KPTTVOICETYPESOUNDRECORD = 2;
int KPTTVOICETYPEUNKNOW = 0;
int KPTTVOICETYPEVOICECHANGE = 3;
int KPUBLICACCOUNTTIANSHUHIGHLIGHTWORDTYPEINMSGBOX = 1010;
int KREPLYABSELEMTYPEFACE = 2;
int KREPLYABSELEMTYPEPIC = 3;
int KREPLYABSELEMTYPETEXT = 1;
int KREPLYABSELEMTYPEUNKNOWN = 0;
int KREPLYATMEMSGTYPEINMSGBOX = 1002;
int KRMDOWNTYPEORIG = 1;
int KRMDOWNTYPETHUMB = 2;
int KRMDOWNTYPEUNKNOWN = 0;
int KRMFILETHUMBSIZE128 = 128;
int KRMFILETHUMBSIZE320 = 320;
int KRMFILETHUMBSIZE384 = 384;
int KRMFILETHUMBSIZE750 = 750;
int KRMPICAIOTHUMBSIZE = 0;
int KRMPICTHUMBSIZE198 = 198;
int KRMPICTHUMBSIZE720 = 720;
int KRMPICTYPEBMP = 3;
int KRMPICTYPECHECKOTHER = 900;
int KRMPICTYPEGIF = 2;
int KRMPICTYPEJPG = 0;
int KRMPICTYPENEWPICAPNG = 2001;
int KRMPICTYPENEWPICBMP = 1005;
int KRMPICTYPENEWPICGIF = 2000;
int KRMPICTYPENEWPICJPEG = 1000;
int KRMPICTYPENEWPICPNG = 1001;
int KRMPICTYPENEWPICPROGERSSIVJPEG = 1003;
int KRMPICTYPENEWPICSHARPP = 1004;
int KRMPICTYPENEWPICWEBP = 1002;
int KRMPICTYPEPNG = 1;
int KRMPICTYPEUNKOWN = 0;
int KRMTHUMBSIZEZERO = 0;
int KRMTRNASFERSTATUSDOWNLOADING = 3;
int KRMTRNASFERSTATUSFAIL = 5;
int KRMTRNASFERSTATUSINIT = 1;
int KRMTRNASFERSTATUSSUC = 4;
int KRMTRNASFERSTATUSUNKOW = 0;
int KRMTRNASFERSTATUSUPLOADING = 2;
int KRMTRNASFERSTATUSUSERCANCEL = 6;
int KSEEKINGPARTNERFLAGSEEKING = 1;
int KSEEKINGPARTNERFLAGUNKNOWN = 0;
int KSENDSTATUSFAILED = 0;
int KSENDSTATUSSENDING = 1;
int KSENDSTATUSSUCCESS = 2;
int KSENDSTATUSSUCCESSNOSEQ = 3;
int KSENDTYPEDROPPED = 6;
int KSENDTYPELOCAL = 3;
int KSENDTYPEOTHERDEVICE = 2;
int KSENDTYPERECV = 0;
int KSENDTYPESELF = 1;
int KSENDTYPESELFFORWARD = 4;
int KSENDTYPESELFMULTIFORWARD = 5;
int KSESSIONTYPEADDRESSBOOK = 5;
int KSESSIONTYPEC2C = 1;
int KSESSIONTYPEDISC = 3;
int KSESSIONTYPEFAV = 41;
int KSESSIONTYPEGROUP = 2;
int KSESSIONTYPEGROUPBLESS = 52;
int KSESSIONTYPEGUILD = 4;
int KSESSIONTYPEGUILDMETA = 16;
int KSESSIONTYPENEARBYPRO = 54;
int KSESSIONTYPEQQNOTIFY = 51;
int KSESSIONTYPERELATEACCOUNT = 50;
int KSESSIONTYPESERVICEASSISTANT = 19;
int KSESSIONTYPESUBSCRIBEFOLDER = 30;
int KSESSIONTYPETYPEBUDDYNOTIFY = 7;
int KSESSIONTYPETYPEGROUPHELPER = 9;
int KSESSIONTYPETYPEGROUPNOTIFY = 8;
int KSESSIONTYPEUNKNOWN = 0;
int KSESSIONTYPEWEIYUN = 40;
int KSPECIALCAREMSGTYPEINMSGBOX = 1006;
int KSPECIFIEDREDENVELOPEATMEMSGTYPEINMSGBOX = 1004;
int KSPECIFIEDREDENVELOPEATONEMSGTYPEINMSGBOX = 1003;
int KTENCENTDOCTYPEADDON = 110;
int KTENCENTDOCTYPEDOC = 0;
int KTENCENTDOCTYPEDRAWING = 89;
int KTENCENTDOCTYPEDRIVE = 101;
int KTENCENTDOCTYPEFILE = 100;
int KTENCENTDOCTYPEFLOWCHART = 91;
int KTENCENTDOCTYPEFOLDER = 3;
int KTENCENTDOCTYPEFORM = 2;
int KTENCENTDOCTYPEMIND = 90;
int KTENCENTDOCTYPENOTES = 5;
int KTENCENTDOCTYPEPDF = 6;
int KTENCENTDOCTYPEPROGRAM = 7;
int KTENCENTDOCTYPESHEET = 1;
int KTENCENTDOCTYPESLIDE = 4;
int KTENCENTDOCTYPESMARTCANVAS = 8;
int KTENCENTDOCTYPESMARTSHEET = 9;
int KTENCENTDOCTYPESPEECH = 102;
int KTENCENTDOCTYPEUNKNOWN = 10;
int KTOFURECORDMSG = 23;
int KTOPMSGTYPETASK = 1;
int KTOPMSGTYPEUNKNOWN = 0;
int KTRIGGERTYPEAUTO = 1;
int KTRIGGERTYPEMANUAL = 0;
int KUNKNOWN = 0;
int KUNKNOWNTYPEINMSGBOX = 0;
int KUNREADCNTUPTYPEALLDIRECTSESSION = 4;
int KUNREADCNTUPTYPEALLFEEDSINGUILD = 6;
int KUNREADCNTUPTYPEALLGUILD = 3;
int KUNREADCNTUPTYPECATEGORY = 5;
int KUNREADCNTUPTYPECHANNEL = 1;
int KUNREADCNTUPTYPECONTACT = 0;
int KUNREADCNTUPTYPEGUILD = 2;
int KUNREADCNTUPTYPEGUILDGROUP = 7;
int KUNREADSHOWTTYPEGRAYPOINT = 2;
int KUNREADSHOWTYPEREDPOINT = 1;
int KUNREADSHOWTYPESMALLGRAYPOINT = 4;
int KUNREADSHOWTYPESMALLREDPOINT = 3;
int KUNREADSHOWTYPEUNKNOWN = 0;
int KVASGIFTCOINTYPECOIN = 0;
int KVASGIFTCOINTYPEMARKETCOIN = 1;
int KYOLOGAMERESULTMSG = 18;
int PIC_800_RECOMMENDED = 7;
int PIC_AIGC_EMOJI = 14;
int PIC_ALBUM_GIF = 11;
int PIC_COMMERCIAL_ADVERTISING = 9;
int PIC_FIND = 10;
int PIC_HOT = 2;
int PIC_HOT_EMOJI = 13;
int PIC_NORMAL = 0;
int PIC_PK = 3;
int PIC_QQZONE = 5;
int PIC_SELFIE_GIF = 8;
int PIC_SEND_FROM_TAB_SEARCH_BOX = 12;
int PIC_USER = 1;
int PIC_WISDOM_FIGURE = 4;
int REPLYORIGINALMSGSTATEHASRECALL = 1;
int REPLYORIGINALMSGSTATEUNKNOWN = 0;
int SHARELOCATIONELEMSUBTYPENORMAL = 1;
int SHARELOCATIONELEMSUBTYPEUNKNOWN = 0;
int TEXTELEMENTSUBTYPELINK = 1;
int TEXTELEMENTSUBTYPETENCENTDOC = 2;
int TEXTELEMENTSUBTYPEUNKNOWN = 0;
```

View File

@@ -0,0 +1,24 @@
# 前排提示
由于Core未处于开源非组织人员无法参与Core开发此处为Core开发提示
# 准备工具
frida ida-pro jadx x64dbg ce 内部调试脚本
## ida-pro
1. 用于快速分析入参和返回类型
2. 通过静态QLog推测语义
3. 提取Listener与Service (常用)
## frida
1. 用于动态获取QLog推测语义
2. 捕捉Native函数 实际入参与数据 分析中间流程
## jadx
1. 通过其它平台实现 静态获取QLog推测语义
2. 提供部分未调用代码 参考
## x64dbg
1. 验证IDA的Hook点
## 内部脚本
1. 提取Listener与Service (不调用无类型 不推荐)
2. 获取NT调用流程

View File

@@ -1,32 +0,0 @@
import eslint from '@eslint/js';
import tsEslintPlugin from '@typescript-eslint/eslint-plugin';
import tsEslintParser from '@typescript-eslint/parser';
import globals from "globals";
const customTsFlatConfig = [
{
name: 'typescript-eslint/base',
languageOptions: {
parser: tsEslintParser,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
NodeJS: 'readonly', // 添加 NodeJS 全局变量
},
},
files: ['**/*.{ts,tsx}'],
rules: {
...tsEslintPlugin.configs.recommended.rules,
'quotes': ['error', 'single'], // 使用单引号
'semi': ['error', 'always'], // 强制使用分号
'indent': ['error', 4], // 使用 4 空格缩进
},
plugins: {
'@typescript-eslint': tsEslintPlugin,
},
ignores: ['src/webui/**'], // 忽略 src/webui/ 目录所有文件
},
];
export default [eslint.configs.recommended, ...customTsFlatConfig];

Binary file not shown.

BIN
external/logo.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -1,32 +0,0 @@
@echo off
chcp 65001
set NAPCAT_PATCH_PACKAGE=%cd%\qqnt.json
set NAPCAT_LOAD_PATH=%cd%\loadNapCat.js
set NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll
set NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe
set NAPCAT_MAIN_PATH=%cd%\napcat.mjs
:loop_read
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ" /v "UninstallString"') do (
set RetString=%%b
goto :napcat_boot
)
:napcat_boot
for %%a in ("%RetString%") do (
set "pathWithoutUninstall=%%~dpa"
)
SET QQPath=%pathWithoutUninstall%QQ.exe
if not exist "%QQpath%" (
echo provided QQ path is invalid
pause
exit /b
)
set NAPCAT_MAIN_PATH=%NAPCAT_MAIN_PATH:\=/%
echo (async () =^> {await import("file:///%NAPCAT_MAIN_PATH%")})() > "%NAPCAT_LOAD_PATH%"
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %1
pause

View File

@@ -1,33 +0,0 @@
@echo off
chcp 65001
set NAPCAT_PATCH_PACKAGE=%cd%\qqnt.json
set NAPCAT_LOAD_PATH=%cd%\loadNapCat.js
set NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll
set NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe
set NAPCAT_MAIN_PATH=%cd%\napcat.mjs
:loop_read
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ" /v "UninstallString"') do (
set RetString=%%b
goto :napcat_boot
)
:napcat_boot
for %%a in ("%RetString%") do (
set "pathWithoutUninstall=%%~dpa"
)
SET QQPath=%pathWithoutUninstall%QQ.exe
if not exist "%QQpath%" (
echo provided QQ path is invalid
pause
exit /b
)
set NAPCAT_MAIN_PATH=%NAPCAT_MAIN_PATH:\=/%
echo (async () =^> {await import("file:///%NAPCAT_MAIN_PATH%")})() > "%NAPCAT_LOAD_PATH%"
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %1
REM "%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" 123456
pause

View File

@@ -1,40 +0,0 @@
@echo off
chcp 65001
net session >nul 2>&1
if %errorLevel% == 0 (
echo Administrator mode detected.
) else (
echo Please run this script in administrator mode.
powershell -Command "Start-Process 'cmd.exe' -ArgumentList '/c cd /d \"%cd%\" && \"%~f0\" %1' -Verb runAs"
exit
)
set NAPCAT_PATCH_PACKAGE=%cd%\qqnt.json
set NAPCAT_LOAD_PATH=%cd%\loadNapCat.js
set NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll
set NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe
set NAPCAT_MAIN_PATH=%cd%\napcat.mjs
:loop_read
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ" /v "UninstallString"') do (
set RetString=%%b
goto :napcat_boot
)
:napcat_boot
for %%a in ("%RetString%") do (
set "pathWithoutUninstall=%%~dpa"
)
SET QQPath=%pathWithoutUninstall%QQ.exe
if not exist "%QQPath%" (
echo provided QQ path is invalid
pause
exit /b
)
set NAPCAT_MAIN_PATH=%NAPCAT_MAIN_PATH:\=/%
echo (async () =^> {await import("file:///%NAPCAT_MAIN_PATH%")})() > "%NAPCAT_LOAD_PATH%"
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %1
REM "%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" 123456

View File

@@ -1,39 +0,0 @@
@echo off
chcp 65001
net session >nul 2>&1
if %errorLevel% == 0 (
echo Administrator mode detected.
) else (
echo Please run this script in administrator mode.
powershell -Command "Start-Process 'wt.exe' -ArgumentList 'cmd /c cd /d \"%cd%\" && \"%~f0\" %1' -Verb runAs"
exit
)
set NAPCAT_PATCH_PACKAGE=%cd%\qqnt.json
set NAPCAT_LOAD_PATH=%cd%\loadNapCat.js
set NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll
set NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe
set NAPCAT_MAIN_PATH=%cd%\napcat.mjs
:loop_read
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ" /v "UninstallString"') do (
set RetString=%%b
goto :napcat_boot
)
:napcat_boot
for %%a in ("%RetString%") do (
set "pathWithoutUninstall=%%~dpa"
)
SET QQPath=%pathWithoutUninstall%QQ.exe
if not exist "%QQPath%" (
echo provided QQ path is invalid
pause
exit /b
)
set NAPCAT_MAIN_PATH=%NAPCAT_MAIN_PATH:\=/%
echo (async () =^> {await import("file:///%NAPCAT_MAIN_PATH%")})() > "%NAPCAT_LOAD_PATH%"
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %1

View File

@@ -1,5 +0,0 @@
const path = require('path');
const CurrentPath = path.dirname(__filename);
(async () => {
await import("file://" + path.join(CurrentPath, './napcat/napcat.mjs'));
})();

View File

@@ -1,42 +0,0 @@
{
"name": "qq-chat",
"version": "9.9.18-32793",
"verHash": "d43f097e",
"linuxVersion": "3.2.16-32793",
"linuxVerHash": "ee4bd910",
"private": true,
"description": "QQ",
"productName": "QQ",
"author": {
"name": "Tencent",
"email": "QQ-Team@tencent.com"
},
"homepage": "https://im.qq.com",
"sideEffects": true,
"bin": {
"qd": "externals/devtools/cli/index.js"
},
"appid": {
"win32": "537258389",
"darwin": "537258412",
"linux": "537258424"
},
"main": "./loadNapCat.js",
"peerDependenciesMeta": {
"*": {
"optional": true
}
},
"pnpm": {
"patchedDependencies": {
"@vue/runtime-dom@3.5.12": "patches/@vue__runtime-dom@3.5.12.patch",
"@swc/helpers@0.5.3": "patches/@swc__helpers@0.5.3.patch",
"vuex@4.1.0": "patches/vuex@4.1.0.patch"
}
},
"buildVersion": "32793",
"isPureShell": true,
"isByteCodeShell": true,
"platform": "win32",
"eleArch": "x64"
}

View File

@@ -1,4 +0,0 @@
@echo off
REM ./launcher.bat 123456
REM ./launcher-win10.bat 123456
REM 带有REM的为注释 删掉你需要的系统的那行REM这三个单词 修改QQ本脚本启动即可

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 684 KiB

After

Width:  |  Height:  |  Size: 208 KiB

View File

@@ -1,29 +0,0 @@
{
"manifest_version": 4,
"type": "extension",
"name": "NapCatQQ",
"slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现",
"version": "4.7.1",
"icon": "./logo.png",
"authors": [
{
"name": "NapNeko",
"link": "https://github.com/NapNeko"
}
],
"repository": {
"repo": "NapNeko/NapCatQQ",
"branch": "main"
},
"platform": [
"win32",
"linux",
"darwin"
],
"injects": {
"renderer": "./renderer.js",
"main": "./liteloader.cjs",
"preload": "./preload.cjs"
}
}

View File

@@ -1 +0,0 @@
VITE_DEBUG_BACKEND_URL="http://127.0.0.1:6099"

View File

@@ -1,32 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# NPM LOCK files
package-lock.json
yarn.lock
pnpm-lock.yaml
dist.zip

View File

@@ -1 +0,0 @@
public-hoist-pattern[]=*@heroui/*

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,21 +0,0 @@
MIT License
Copyright (c) 2024 bietiaop
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,32 +0,0 @@
# NapCat WebUI
## 功能
- WebUI登录
- QQ登录
- 网络配置
- OneBot/WebUI配置
- 日志查看(实时日志、历史日志)
- HTTP调试
- WS调试
- 在线音乐播放器,支持网易云音乐歌单(大屏在页面右下角,小屏在页面下方)
如果你有更多功能需求,欢迎在 issue 中提出。
# License
[MIT](LICENSE)
# Related Projects
- [NapCat](https://github.com/NapNeko/NapCatQQ/)
- [Karin](https://github.com/KarinJS/Karin/)
# Thanks to
- [Vercel](https://vercel.com/)
- [React](https://react.dev/)
- [HeroUI](https://nextui.org/)
- and more open-source projects
感谢群友“维拉”提供的在线音乐API。

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

@@ -1,23 +0,0 @@
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NapCat WebUI</title>
<meta key="title" content="NapCat WebUI" property="og:title" />
<meta content="NapCat WebUI基于React+tailwind+NextUI" property="og:description" />
<meta content="NapCat WebUI基于React+tailwind+NextUI" name="description" />
<meta key="viewport"
content="viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
name="viewport" />
<link href="/favicon.ico" rel="icon" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

View File

@@ -1,129 +0,0 @@
{
"name": "napcat-webui",
"private": true,
"version": "0.0.6",
"type": "module",
"scripts": {
"dev": "vite --host=0.0.0.0",
"build": "tsc && vite build",
"lint": "eslint -c eslint.config.mjs ./src/**/**/*.{ts,tsx} --fix",
"preview": "vite preview"
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@heroui/accordion": "^2.2.8",
"@heroui/avatar": "2.2.7",
"@heroui/breadcrumbs": "2.2.7",
"@heroui/button": "2.2.10",
"@heroui/card": "2.2.10",
"@heroui/checkbox": "2.3.9",
"@heroui/chip": "2.2.7",
"@heroui/code": "2.2.7",
"@heroui/dropdown": "2.3.10",
"@heroui/form": "2.1.9",
"@heroui/image": "2.2.6",
"@heroui/input": "2.4.10",
"@heroui/kbd": "2.2.7",
"@heroui/link": "2.2.8",
"@heroui/listbox": "2.3.10",
"@heroui/modal": "2.2.8",
"@heroui/navbar": "2.2.9",
"@heroui/pagination": "^2.2.9",
"@heroui/popover": "2.3.10",
"@heroui/select": "2.4.10",
"@heroui/skeleton": "^2.2.6",
"@heroui/slider": "2.4.8",
"@heroui/snippet": "2.2.11",
"@heroui/spinner": "2.2.7",
"@heroui/switch": "2.2.9",
"@heroui/system": "2.4.7",
"@heroui/table": "^2.2.9",
"@heroui/tabs": "2.2.8",
"@heroui/theme": "2.4.6",
"@heroui/tooltip": "2.2.8",
"@monaco-editor/loader": "^1.4.0",
"@monaco-editor/react": "4.7.0-rc.0",
"@react-aria/visually-hidden": "^3.8.19",
"@reduxjs/toolkit": "^2.5.1",
"@uidotdev/usehooks": "^2.4.1",
"@xterm/addon-canvas": "^0.7.0",
"@xterm/addon-fit": "^0.10.0",
"@xterm/addon-web-links": "^0.11.0",
"@xterm/xterm": "^5.5.0",
"ahooks": "^3.8.4",
"axios": "^1.7.9",
"clsx": "^2.1.1",
"echarts": "^5.5.1",
"event-source-polyfill": "^1.0.31",
"framer-motion": "^12.0.6",
"monaco-editor": "^0.52.2",
"motion": "^12.0.6",
"path-browserify": "^1.0.1",
"qface": "^1.4.1",
"qrcode.react": "^4.2.0",
"quill": "^2.0.3",
"react": "^19.0.0",
"react-color": "^2.19.3",
"react-dom": "^19.0.0",
"react-dropzone": "^14.3.5",
"react-error-boundary": "^5.0.0",
"react-hook-form": "^7.54.2",
"react-hot-toast": "^2.4.1",
"react-icons": "^5.4.0",
"react-markdown": "^9.0.3",
"react-photo-view": "^1.2.7",
"react-redux": "^9.2.0",
"react-responsive": "^10.0.0",
"react-router-dom": "^7.1.4",
"react-use-websocket": "^4.11.1",
"react-window": "^1.8.11",
"remark-gfm": "^4.0.0",
"tailwind-variants": "^0.3.0",
"tailwindcss": "^3.4.17",
"zod": "^3.24.1"
},
"devDependencies": {
"@eslint/js": "^9.19.0",
"@react-types/shared": "^3.26.0",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"@types/event-source-polyfill": "^1.0.5",
"@types/fabric": "^5.3.9",
"@types/node": "^22.12.0",
"@types/path-browserify": "^1.0.3",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@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",
"autoprefixer": "^10.4.20",
"eslint": "^9.19.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-node": "^11.1.0",
"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",
"globals": "^15.14.0",
"postcss": "^8.5.1",
"prettier": "^3.4.2",
"typescript": "^5.7.3",
"vite": "^6.0.5",
"vite-plugin-static-copy": "^2.2.0",
"vite-tsconfig-paths": "^5.1.4"
},
"overrides": {
"ahooks": {
"react": "$react",
"react-dom": "$react-dom"
},
"react-window": {
"react": "$react",
"react-dom": "$react-dom"
}
}
}

View File

@@ -1,6 +0,0 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -1,5 +0,0 @@
{
"rewrites": [
{ "source": "/(.*)", "destination": "/" }
]
}

View File

@@ -1,90 +0,0 @@
import { Suspense, lazy, useEffect } from 'react'
import { Provider } from 'react-redux'
import { Route, Routes, useNavigate } from 'react-router-dom'
import PageBackground from '@/components/page_background'
import PageLoading from '@/components/page_loading'
import Toaster from '@/components/toaster'
import DialogProvider from '@/contexts/dialog'
import AudioProvider from '@/contexts/songs'
import useAuth from '@/hooks/auth'
import store from '@/store'
const WebLoginPage = lazy(() => import('@/pages/web_login'))
const IndexPage = lazy(() => import('@/pages/index'))
const QQLoginPage = lazy(() => import('@/pages/qq_login'))
const DashboardIndexPage = lazy(() => import('@/pages/dashboard'))
const AboutPage = lazy(() => import('@/pages/dashboard/about'))
const ConfigPage = lazy(() => import('@/pages/dashboard/config'))
const DebugPage = lazy(() => import('@/pages/dashboard/debug'))
const HttpDebug = lazy(() => import('@/pages/dashboard/debug/http'))
const WSDebug = lazy(() => import('@/pages/dashboard/debug/websocket'))
const FileManagerPage = lazy(() => import('@/pages/dashboard/file_manager'))
const LogsPage = lazy(() => import('@/pages/dashboard/logs'))
const NetworkPage = lazy(() => import('@/pages/dashboard/network'))
const TerminalPage = lazy(() => import('@/pages/dashboard/terminal'))
function App() {
return (
<DialogProvider>
<Provider store={store}>
<PageBackground />
<Toaster />
<AudioProvider>
<Suspense fallback={<PageLoading />}>
<AuthChecker>
<AppRoutes />
</AuthChecker>
</Suspense>
</AudioProvider>
</Provider>
</DialogProvider>
)
}
function AuthChecker({ children }: { children: React.ReactNode }) {
const { isAuth } = useAuth()
const navigate = useNavigate()
useEffect(() => {
if (!isAuth) {
const search = new URLSearchParams(window.location.search)
const token = search.get('token')
let url = '/web_login'
if (token) {
url += `?token=${token}`
}
navigate(url, { replace: true })
}
}, [isAuth, navigate])
return <>{children}</>
}
function AppRoutes() {
return (
<Routes>
<Route path="/" element={<IndexPage />}>
<Route index element={<DashboardIndexPage />} />
<Route path="network" element={<NetworkPage />} />
<Route path="config" element={<ConfigPage />} />
<Route path="logs" element={<LogsPage />} />
<Route path="debug" element={<DebugPage />}>
<Route path="ws" element={<WSDebug />} />
<Route path="http" element={<HttpDebug />} />
</Route>
<Route path="file_manager" element={<FileManagerPage />} />
<Route path="terminal" element={<TerminalPage />} />
<Route path="about" element={<AboutPage />} />
</Route>
<Route path="/qq_login" element={<QQLoginPage />} />
<Route path="/web_login" element={<WebLoginPage />} />
</Routes>
)
}
export default App

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 684 KiB

View File

@@ -1,36 +0,0 @@
import { Popover, PopoverContent, PopoverTrigger } from '@heroui/popover'
import React from 'react'
import { ColorResult, SketchPicker } from 'react-color'
// 假定 heroui 提供的 Popover组件
interface ColorPickerProps {
color: string
onChange: (color: ColorResult) => void
}
const ColorPicker: React.FC<ColorPickerProps> = ({ color, onChange }) => {
const handleChange = (colorResult: ColorResult) => {
onChange(colorResult)
}
return (
<Popover triggerScaleOnOpen={false}>
<PopoverTrigger>
<div
className="w-36 h-8 rounded-md cursor-pointer border border-content4"
style={{ background: color }}
/>
</PopoverTrigger>
<PopoverContent>
<SketchPicker
color={color}
onChange={handleChange}
className="!bg-transparent !shadow-none"
/>
</PopoverContent>
</Popover>
)
}
export default ColorPicker

View File

@@ -1,425 +0,0 @@
import { Button } from '@heroui/button'
import { Card, CardBody, CardHeader } from '@heroui/card'
import { Image } from '@heroui/image'
import { Popover, PopoverContent, PopoverTrigger } from '@heroui/popover'
import { Slider } from '@heroui/slider'
import { Tooltip } from '@heroui/tooltip'
import { useLocalStorage } from '@uidotdev/usehooks'
import clsx from 'clsx'
import { useEffect, useRef, useState } from 'react'
import {
BiSolidSkipNextCircle,
BiSolidSkipPreviousCircle
} from 'react-icons/bi'
import {
FaPause,
FaPlay,
FaRegHandPointRight,
FaRepeat,
FaShuffle
} from 'react-icons/fa6'
import { TbRepeatOnce } from 'react-icons/tb'
import { useMediaQuery } from 'react-responsive'
import { PlayMode } from '@/const/enum'
import key from '@/const/key'
import { VolumeHighIcon, VolumeLowIcon } from './icons'
export interface AudioPlayerProps
extends React.AudioHTMLAttributes<HTMLAudioElement> {
src: string
title?: string
artist?: string
cover?: string
pressNext?: () => void
pressPrevious?: () => void
onPlayEnd?: () => void
onChangeMode?: (mode: PlayMode) => void
mode?: PlayMode
}
export default function AudioPlayer(props: AudioPlayerProps) {
const {
src,
pressNext,
pressPrevious,
cover = 'https://nextui.org/images/album-cover.png',
title = '未知',
artist = '未知',
onTimeUpdate,
onLoadedData,
onPlay,
onPause,
onPlayEnd,
onChangeMode,
autoPlay,
mode = PlayMode.Loop,
...rest
} = props
const [currentTime, setCurrentTime] = useState(0)
const [duration, setDuration] = useState(0)
const [isPlaying, setIsPlaying] = useState(false)
const [volume, setVolume] = useState(100)
const [isCollapsed, setIsCollapsed] = useLocalStorage(
key.isCollapsedMusicPlayer,
false
)
const audioRef = useRef<HTMLAudioElement>(null)
const cardRef = useRef<HTMLDivElement>(null)
const startY = useRef(0)
const startX = useRef(0)
const [translateY, setTranslateY] = useState(0)
const [translateX, setTranslateX] = useState(0)
const isSmallScreen = useMediaQuery({ maxWidth: 767 })
const isMediumUp = useMediaQuery({ minWidth: 768 })
const shouldAdd = useRef(false)
const currentProgress = (currentTime / duration) * 100
const [storageAutoPlay, setStorageAutoPlay] = useLocalStorage(
key.autoPlay,
true
)
const handleTimeUpdate = (event: React.SyntheticEvent<HTMLAudioElement>) => {
const audio = event.target as HTMLAudioElement
setCurrentTime(audio.currentTime)
onTimeUpdate?.(event)
}
const handleLoadedData = (event: React.SyntheticEvent<HTMLAudioElement>) => {
const audio = event.target as HTMLAudioElement
setDuration(audio.duration)
onLoadedData?.(event)
}
const handlePlay = (e: React.SyntheticEvent<HTMLAudioElement>) => {
setIsPlaying(true)
setStorageAutoPlay(true)
onPlay?.(e)
}
const handlePause = (e: React.SyntheticEvent<HTMLAudioElement>) => {
setIsPlaying(false)
onPause?.(e)
}
const changeMode = () => {
const modes = [PlayMode.Loop, PlayMode.Random, PlayMode.Single]
const currentIndex = modes.findIndex((_mode) => _mode === mode)
const nextIndex = currentIndex + 1
const nextMode = modes[nextIndex] || modes[0]
onChangeMode?.(nextMode)
}
const volumeChange = (value: number) => {
setVolume(value)
}
useEffect(() => {
const audio = audioRef.current
if (audio) {
audio.volume = volume / 100
}
}, [volume])
const handleTouchStart = (e: React.TouchEvent) => {
startY.current = e.touches[0].clientY
startX.current = e.touches[0].clientX
}
const handleTouchMove = (e: React.TouchEvent) => {
const deltaY = e.touches[0].clientY - startY.current
const deltaX = e.touches[0].clientX - startX.current
const container = cardRef.current
const header = cardRef.current?.querySelector('[data-header]')
const headerHeight = header?.clientHeight || 20
const addHeight = (container?.clientHeight || headerHeight) - headerHeight
const _shouldAdd = isCollapsed && deltaY < 0
if (isSmallScreen) {
shouldAdd.current = _shouldAdd
setTranslateY(_shouldAdd ? deltaY + addHeight : deltaY)
} else {
setTranslateX(deltaX)
}
}
const handleTouchEnd = () => {
if (isSmallScreen) {
const container = cardRef.current
const header = cardRef.current?.querySelector('[data-header]')
const headerHeight = header?.clientHeight || 20
const addHeight = (container?.clientHeight || headerHeight) - headerHeight
const _translateY = translateY - (shouldAdd.current ? addHeight : 0)
if (_translateY > 100) {
setIsCollapsed(true)
} else if (_translateY < -100) {
setIsCollapsed(false)
}
setTranslateY(0)
} else {
if (translateX > 100) {
setIsCollapsed(true)
} else if (translateX < -100) {
setIsCollapsed(false)
}
setTranslateX(0)
}
}
const dragTranslate = isSmallScreen
? translateY
? `translateY(${translateY}px)`
: ''
: translateX
? `translateX(${translateX}px)`
: ''
const collapsedTranslate = isCollapsed
? isSmallScreen
? 'translateY(90%)'
: 'translateX(96%)'
: ''
const translateStyle = dragTranslate || collapsedTranslate
if (!src) return null
return (
<div
className={clsx(
'fixed right-0 bottom-0 z-[52] w-full md:w-96',
!translateX && !translateY && 'transition-transform',
isCollapsed && 'md:hover:!translate-x-80'
)}
style={{
transform: translateStyle
}}
>
<audio
src={src}
onLoadedData={handleLoadedData}
onTimeUpdate={handleTimeUpdate}
onPlay={handlePlay}
onPause={handlePause}
onEnded={onPlayEnd}
autoPlay={autoPlay ?? storageAutoPlay}
{...rest}
controls={false}
hidden
ref={audioRef}
/>
<Card
ref={cardRef}
className={clsx(
'border-none bg-background/60 dark:bg-default-300/50 w-full max-w-full transform transition-transform backdrop-blur-md duration-300 overflow-visible',
isSmallScreen ? 'rounded-t-3xl' : 'md:rounded-l-xl'
)}
classNames={{
body: 'p-0'
}}
shadow="sm"
radius="none"
>
{isMediumUp && (
<Button
isIconOnly
className={clsx(
'absolute data-[hover]:bg-foreground/10 text-lg z-50',
isCollapsed
? 'top-0 left-0 w-full h-full rounded-xl bg-opacity-0 hover:bg-opacity-30'
: 'top-3 -left-8 rounded-l-full bg-opacity-50 backdrop-blur-md'
)}
variant="solid"
color="primary"
size="sm"
onPress={() => setIsCollapsed(!isCollapsed)}
>
<FaRegHandPointRight />
</Button>
)}
{isSmallScreen && (
<CardHeader
data-header
className="flex-row justify-center pt-4"
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd}
onClick={() => setIsCollapsed(!isCollapsed)}
>
<div className="w-24 h-2 rounded-full bg-content2-foreground shadow-sm"></div>
</CardHeader>
)}
<CardBody>
<div className="grid grid-cols-6 md:grid-cols-12 gap-6 md:gap-4 items-center justify-center overflow-hidden p-6 md:p-2 m-0">
<div className="relative col-span-6 md:col-span-4 flex justify-center">
<Image
alt="Album cover"
className="object-cover"
classNames={{
wrapper: 'w-36 aspect-square md:w-24 flex',
img: 'block w-full h-full'
}}
shadow="md"
src={cover}
width="100%"
/>
</div>
<div className="flex flex-col col-span-6 md:col-span-8">
<div className="flex flex-col gap-0">
<h1 className="font-medium truncate">{title}</h1>
<p className="text-xs text-foreground/80 truncate">{artist}</p>
</div>
<div className="flex flex-col">
<Slider
aria-label="Music progress"
classNames={{
track: 'bg-default-500/30 border-none',
thumb: 'w-2 h-2 after:w-1.5 after:h-1.5',
filler: 'rounded-full'
}}
color="foreground"
value={currentProgress || 0}
defaultValue={0}
size="sm"
onChange={(value) => {
value = Array.isArray(value) ? value[0] : value
const audio = audioRef.current
if (audio) {
audio.currentTime = (value / 100) * duration
}
}}
/>
<div className="flex justify-between h-3">
<p className="text-xs">
{Math.floor(currentTime / 60)}:
{Math.floor(currentTime % 60)
.toString()
.padStart(2, '0')}
</p>
<p className="text-xs text-foreground/50">
{Math.floor(duration / 60)}:
{Math.floor(duration % 60)
.toString()
.padStart(2, '0')}
</p>
</div>
</div>
<div className="flex w-full items-center justify-center">
<Tooltip
content={
mode === PlayMode.Loop
? '列表循环'
: mode === PlayMode.Random
? '随机播放'
: '单曲循环'
}
>
<Button
isIconOnly
className="data-[hover]:bg-foreground/10 text-lg md:text-medium"
radius="full"
variant="light"
size="md"
onPress={changeMode}
>
{mode === PlayMode.Loop && (
<FaRepeat className="text-foreground/80" />
)}
{mode === PlayMode.Random && (
<FaShuffle className="text-foreground/80" />
)}
{mode === PlayMode.Single && (
<TbRepeatOnce className="text-foreground/80 text-xl" />
)}
</Button>
</Tooltip>
<Tooltip content="上一首">
<Button
isIconOnly
className="data-[hover]:bg-foreground/10 text-2xl md:text-xl"
radius="full"
variant="light"
size="md"
onPress={pressPrevious}
>
<BiSolidSkipPreviousCircle />
</Button>
</Tooltip>
<Tooltip content={isPlaying ? '暂停' : '播放'}>
<Button
isIconOnly
className="data-[hover]:bg-foreground/10 text-3xl md:text-3xl"
radius="full"
variant="light"
size="lg"
onPress={() => {
if (isPlaying) {
audioRef.current?.pause()
setStorageAutoPlay(false)
} else {
audioRef.current?.play()
}
}}
>
{isPlaying ? <FaPause /> : <FaPlay className="ml-1" />}
</Button>
</Tooltip>
<Tooltip content="下一首">
<Button
isIconOnly
className="data-[hover]:bg-foreground/10 text-2xl md:text-xl"
radius="full"
variant="light"
size="md"
onPress={pressNext}
>
<BiSolidSkipNextCircle />
</Button>
</Tooltip>
<Popover
placement="top"
classNames={{
content: 'bg-opacity-30 backdrop-blur-md'
}}
>
<PopoverTrigger>
<Button
isIconOnly
className="data-[hover]:bg-foreground/10 text-xl md:text-xl"
radius="full"
variant="light"
size="md"
>
<VolumeHighIcon />
</Button>
</PopoverTrigger>
<PopoverContent>
<Slider
orientation="vertical"
showTooltip
aria-label="Volume"
className="h-40"
color="primary"
defaultValue={volume}
onChange={(value) => {
value = Array.isArray(value) ? value[0] : value
volumeChange(value)
}}
startContent={<VolumeHighIcon className="text-2xl" />}
size="sm"
endContent={<VolumeLowIcon className="text-2xl" />}
/>
</PopoverContent>
</Popover>
</div>
</div>
</div>
</CardBody>
</Card>
</div>
)
}

View File

@@ -1,208 +0,0 @@
import { Button } from '@heroui/button'
import {
Dropdown,
DropdownItem,
DropdownMenu,
DropdownTrigger
} from '@heroui/dropdown'
import { Tooltip } from '@heroui/tooltip'
import { FaRegCircleQuestion } from 'react-icons/fa6'
import { IoAddCircleOutline } from 'react-icons/io5'
import {
HTTPClientIcon,
HTTPServerIcon,
PCIcon,
PlusIcon,
WebsocketIcon
} from '../icons'
export interface AddButtonProps {
onOpen: (key: keyof OneBotConfig['network']) => void
}
const AddButton: React.FC<AddButtonProps> = (props) => {
const { onOpen } = props
return (
<Dropdown
classNames={{
content: 'bg-opacity-30 backdrop-blur-md'
}}
placement="right"
>
<DropdownTrigger>
<Button
color="primary"
startContent={<IoAddCircleOutline className="text-2xl" />}
>
</Button>
</DropdownTrigger>
<DropdownMenu
aria-label="Create Network Config"
color="primary"
variant="flat"
onAction={(key) => {
onOpen(key as keyof OneBotConfig['network'])
}}
>
<DropdownItem
key="title"
isReadOnly
className="cursor-default hover:!bg-transparent"
textValue="title"
>
<div className="flex items-center gap-2 justify-center">
<div className="w-5 h-5 -ml-3">
<PlusIcon />
</div>
<div className="text-primary-400"></div>
</div>
</DropdownItem>
<DropdownItem
key="httpServers"
textValue="httpServers"
startContent={
<div className="w-6 h-6">
<HTTPServerIcon />
</div>
}
>
<div className="flex gap-1 items-center">
HTTP服务器
<Tooltip
content="「由NapCat建立」一个HTTP服务器你可以「使用框架连接」此服务器或者「自己构造请求发送」至此服务器。NapCat会根据你配置的IP和端口等建立一个地址你或者你的框架应该连接到这个地址。"
showArrow
className="max-w-64"
>
<Button
isIconOnly
radius="full"
size="sm"
variant="light"
className="w-4 h-4 min-w-0"
>
<FaRegCircleQuestion />
</Button>
</Tooltip>
</div>
</DropdownItem>
<DropdownItem
key="httpSseServers"
textValue="httpSseServers"
startContent={
<div className="w-6 h-6">
<HTTPServerIcon />
</div>
}
>
<div className="flex gap-1 items-center">
HTTP SSE服务器
<Tooltip
content="「由NapCat建立」一个HTTP SSE服务器你可以「使用框架连接」此服务器或者「自己构造请求发送」至此服务器。NapCat会根据你配置的IP和端口等建立一个地址你或者你的框架应该连接到这个地址。"
showArrow
className="max-w-64"
>
<Button
isIconOnly
radius="full"
size="sm"
variant="light"
className="w-4 h-4 min-w-0"
>
<FaRegCircleQuestion />
</Button>
</Tooltip>
</div>
</DropdownItem>
<DropdownItem
key="httpClients"
textValue="httpClients"
startContent={
<div className="w-6 h-6">
<HTTPClientIcon />
</div>
}
>
<div className="flex gap-1 items-center">
HTTP客户端
<Tooltip
content="「由框架或者你自己建立」的一个用于「接收」NapCat向你发送请求的客户端通常框架会提供一个HTTP地址。这个地址是你使用的框架提供的NapCat会主动连接它。"
showArrow
className="max-w-64"
>
<Button
isIconOnly
radius="full"
size="sm"
variant="light"
className="w-4 h-4 min-w-0"
>
<FaRegCircleQuestion />
</Button>
</Tooltip>
</div>
</DropdownItem>
<DropdownItem
key="websocketServers"
textValue="websocketServers"
startContent={
<div className="w-6 h-6">
<WebsocketIcon />
</div>
}
>
<div className="flex gap-1 items-center">
Websocket服务器
<Tooltip
content="「由NapCat建立」一个WebSocket服务器你的框架应该连接到此服务器。NapCat会根据你配置的IP和端口等建立一个WebSocket地址你或者你的框架应该连接到这个地址。"
showArrow
className="max-w-64"
>
<Button
isIconOnly
radius="full"
size="sm"
variant="light"
className="w-4 h-4 min-w-0"
>
<FaRegCircleQuestion />
</Button>
</Tooltip>
</div>
</DropdownItem>
<DropdownItem
key="websocketClients"
textValue="websocketClients"
startContent={
<div className="w-6 h-6">
<PCIcon />
</div>
}
>
<div className="flex gap-1 items-center">
Websocket客户端
<Tooltip
content="「由框架或者你自己建立」的WebSocket通常框架会「提供」一个ws地址NapCat会主动连接它。"
showArrow
className="max-w-64"
>
<Button
isIconOnly
radius="full"
size="sm"
variant="light"
className="w-4 h-4 min-w-0"
>
<FaRegCircleQuestion />
</Button>
</Tooltip>
</div>
</DropdownItem>
</DropdownMenu>
</Dropdown>
)
}
export default AddButton

View File

@@ -1,59 +0,0 @@
import { Button } from '@heroui/button'
import clsx from 'clsx'
import toast from 'react-hot-toast'
import { IoMdRefresh } from 'react-icons/io'
export interface SaveButtonsProps {
onSubmit: () => void
reset: () => void
refresh?: () => void
isSubmitting: boolean
className?: string
}
const SaveButtons: React.FC<SaveButtonsProps> = ({
onSubmit,
reset,
isSubmitting,
refresh,
className
}) => (
<div
className={clsx(
'max-w-full mx-3 w-96 flex flex-col justify-center gap-3',
className
)}
>
<div className="flex items-center justify-center gap-2 mt-5">
<Button
color="default"
onPress={() => {
reset()
toast.success('重置成功')
}}
>
</Button>
<Button
color="primary"
isLoading={isSubmitting}
onPress={() => onSubmit()}
>
</Button>
{refresh && (
<Button
isIconOnly
color="secondary"
radius="full"
variant="flat"
onPress={() => refresh()}
>
<IoMdRefresh size={24} />
</Button>
)}
</div>
</div>
)
export default SaveButtons

View File

@@ -1,254 +0,0 @@
import { Button } from '@heroui/button'
import { Input } from '@heroui/input'
import { Popover, PopoverContent, PopoverTrigger } from '@heroui/popover'
import { Tooltip } from '@heroui/tooltip'
import clsx from 'clsx'
import { useEffect, useRef, useState } from 'react'
import toast from 'react-hot-toast'
import { FaMicrophone } from 'react-icons/fa6'
import { IoMic } from 'react-icons/io5'
import { MdEdit, MdUpload } from 'react-icons/md'
import useShowStructuredMessage from '@/hooks/use_show_strcuted_message'
import { isURI } from '@/utils/url'
import type { OB11Segment } from '@/types/onebot'
const AudioInsert = () => {
const [audioUrl, setAudioUrl] = useState<string>('')
const audioInputRef = useRef<HTMLInputElement>(null)
const showStructuredMessage = useShowStructuredMessage()
const showAudioSegment = (file: string) => {
const messages: OB11Segment[] = [
{
type: 'record',
data: {
file: file
}
}
]
showStructuredMessage(messages)
}
const [isRecording, setIsRecording] = useState(false)
const mediaRecorderRef = useRef<MediaRecorder | null>(null)
const audioChunksRef = useRef<Blob[]>([])
const [audioPreview, setAudioPreview] = useState<string | null>(null)
const [showPreview, setShowPreview] = useState(false)
const streamRef = useRef<MediaStream | null>(null)
const [recordingTime, setRecordingTime] = useState(0)
const recordingIntervalRef = useRef<NodeJS.Timeout | null>(null)
useEffect(() => {
if (isRecording) {
navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => {
streamRef.current = stream
const recorder = new MediaRecorder(stream)
mediaRecorderRef.current = recorder
recorder.start()
recorder.ondataavailable = (event) => {
if (event.data.size > 0) {
audioChunksRef.current.push(event.data)
}
}
recorder.onstop = () => {
if (audioChunksRef.current.length > 0) {
const audioBlob = new Blob(audioChunksRef.current, {
type: 'audio/wav'
})
const reader = new FileReader()
reader.readAsDataURL(audioBlob)
reader.onloadend = () => {
const base64Audio = reader.result as string
setAudioPreview(base64Audio)
setShowPreview(true)
}
audioChunksRef.current = []
}
stream.getTracks().forEach((track) => track.stop())
}
})
recordingIntervalRef.current = setInterval(() => {
setRecordingTime((prevTime) => prevTime + 1)
}, 1000)
} else {
mediaRecorderRef.current?.stop()
if (recordingIntervalRef.current) {
clearInterval(recordingIntervalRef.current)
recordingIntervalRef.current = null
}
}
}, [isRecording])
const startRecording = () => {
setAudioPreview(null)
setShowPreview(false)
setRecordingTime(0)
setIsRecording(true)
}
const stopRecording = () => {
setIsRecording(false)
}
const handleShowPreview = () => {
if (audioPreview) {
showAudioSegment(audioPreview)
}
}
const formatTime = (time: number) => {
const minutes = Math.floor(time / 60)
const seconds = time % 60
return `${minutes}:${seconds.toString().padStart(2, '0')}`
}
return (
<>
<Popover>
<Tooltip content="发送音频">
<div className="max-w-fit">
<PopoverTrigger>
<Button color="primary" variant="flat" isIconOnly radius="full">
<IoMic className="text-xl" />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="flex-row gap-2 p-4">
<Tooltip content="上传音频">
<Button
className="text-lg"
color="primary"
isIconOnly
variant="flat"
radius="full"
onPress={() => {
audioInputRef?.current?.click()
}}
>
<MdUpload />
</Button>
</Tooltip>
<Popover>
<Tooltip content="输入音频地址">
<div className="max-w-fit">
<PopoverTrigger tooltip="输入音频地址">
<Button
className="text-lg"
color="primary"
isIconOnly
variant="flat"
radius="full"
>
<MdEdit />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="flex-row gap-1 p-2">
<Input
value={audioUrl}
onChange={(e) => setAudioUrl(e.target.value)}
placeholder="请输入音频地址"
/>
<Button
color="primary"
variant="flat"
isIconOnly
radius="full"
onPress={() => {
if (!isURI(audioUrl)) {
toast.error('请输入正确的音频地址')
return
}
showAudioSegment(audioUrl)
setAudioUrl('')
}}
>
<FaMicrophone />
</Button>
</PopoverContent>
</Popover>
<Popover>
<Tooltip content="录制音频">
<div className="max-w-fit">
<PopoverTrigger>
<Button
className="text-lg"
color="primary"
isIconOnly
variant="flat"
radius="full"
>
<IoMic />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="flex-col gap-2 p-4">
<div className="flex gap-2">
<Button
color={isRecording ? 'primary' : 'primary'}
variant="flat"
onPress={isRecording ? stopRecording : startRecording}
>
{isRecording ? '停止录制' : '开始录制'}
</Button>
{showPreview && audioPreview && (
<Button
color="primary"
variant="flat"
onPress={handleShowPreview}
>
</Button>
)}
</div>
{(isRecording || audioPreview) && (
<div className="flex gap-1 items-center">
<span
className={clsx(
'w-4 h-4 rounded-full',
isRecording
? 'animate-pulse bg-primary-400'
: 'bg-success-400'
)}
></span>
<span>: {formatTime(recordingTime)}</span>
</div>
)}
{showPreview && audioPreview && (
<audio controls src={audioPreview} />
)}
</PopoverContent>
</Popover>
</PopoverContent>
</Popover>
<input
type="file"
ref={audioInputRef}
hidden
accept="audio/*"
className="hidden"
onChange={(e) => {
const file = e.target.files?.[0]
if (!file) {
return
}
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = (event) => {
const dataURL = event.target?.result
showAudioSegment(dataURL as string)
e.target.value = ''
}
}}
/>
</>
)
}
export default AudioInsert

View File

@@ -1,31 +0,0 @@
import { Button } from '@heroui/button'
import { Tooltip } from '@heroui/tooltip'
import { BsDice3Fill } from 'react-icons/bs'
import useShowStructuredMessage from '@/hooks/use_show_strcuted_message'
const DiceInsert = () => {
const showStructuredMessage = useShowStructuredMessage()
return (
<Tooltip content="发送骰子">
<Button
color="primary"
variant="flat"
isIconOnly
radius="full"
onPress={() => {
showStructuredMessage([
{
type: 'dice'
}
])
}}
>
<BsDice3Fill className="text-lg" />
</Button>
</Tooltip>
)
}
export default DiceInsert

View File

@@ -1,83 +0,0 @@
import { Button } from '@heroui/button'
import { Image } from '@heroui/image'
import { Popover, PopoverContent, PopoverTrigger } from '@heroui/popover'
import { Tooltip } from '@heroui/tooltip'
import { data, getUrl } from 'qface'
import { useEffect, useRef, useState } from 'react'
import { MdEmojiEmotions } from 'react-icons/md'
import { EmojiValue } from '../formats/emoji_blot'
const emojis = data.map((item) => {
return {
alt: item.QDes,
src: getUrl(item.QSid),
id: item.QSid
} as EmojiValue
})
export interface EmojiPickerProps {
onInsertEmoji: (emoji: EmojiValue) => void
onOpenChange: (open: boolean) => void
}
const EmojiPicker = ({ onInsertEmoji, onOpenChange }: EmojiPickerProps) => {
const [visibleEmojis, setVisibleEmojis] = useState<EmojiValue[]>([])
const [isPopoverOpen, setIsPopoverOpen] = useState<boolean>(false)
const containerRef = useRef<HTMLDivElement>(null)
useEffect(() => {
if (isPopoverOpen) {
setVisibleEmojis([]) // Reset visible emojis
requestAnimationFrame(() => loadEmojis()) // Start loading emojis
}
}, [isPopoverOpen])
const loadEmojis = (index = 0, batchSize = 10) => {
if (index < emojis.length) {
setVisibleEmojis((prev) => [
...prev,
...emojis.slice(index, index + batchSize)
])
requestAnimationFrame(() => loadEmojis(index + batchSize, batchSize))
}
}
return (
<div ref={containerRef}>
<Popover
portalContainer={containerRef.current!}
shouldCloseOnScroll={false}
placement="right-start"
onOpenChange={(v) => {
onOpenChange(v)
setIsPopoverOpen(v)
}}
>
<Tooltip content="插入表情">
<div className="max-w-fit">
<PopoverTrigger>
<Button color="primary" variant="flat" isIconOnly radius="full">
<MdEmojiEmotions className="text-xl" />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="grid grid-cols-8 gap-1 flex-wrap justify-start items-start overflow-y-auto max-w-full max-h-96 p-2">
{visibleEmojis.map((emoji) => (
<Button
key={emoji.id}
color="primary"
variant="flat"
isIconOnly
radius="full"
onPress={() => onInsertEmoji(emoji)}
>
<Image src={emoji.src} alt={emoji.alt} className="w-6 h-6" />
</Button>
))}
</PopoverContent>
</Popover>
</div>
)
}
export default EmojiPicker

View File

@@ -1,125 +0,0 @@
import { Button } from '@heroui/button'
import { Input } from '@heroui/input'
import { Popover, PopoverContent, PopoverTrigger } from '@heroui/popover'
import { Tooltip } from '@heroui/tooltip'
import { useRef, useState } from 'react'
import toast from 'react-hot-toast'
import { FaFolder } from 'react-icons/fa6'
import { LuFilePlus2 } from 'react-icons/lu'
import { MdEdit, MdUpload } from 'react-icons/md'
import useShowStructuredMessage from '@/hooks/use_show_strcuted_message'
import { isURI } from '@/utils/url'
import type { OB11Segment } from '@/types/onebot'
const FileInsert = () => {
const [fileUrl, setFileUrl] = useState<string>('')
const fileInputRef = useRef<HTMLInputElement>(null)
const showStructuredMessage = useShowStructuredMessage()
const showFileSegment = (file: string) => {
const messages: OB11Segment[] = [
{
type: 'file',
data: {
file: file
}
}
]
showStructuredMessage(messages)
}
return (
<>
<Popover>
<Tooltip content="发送文件">
<div className="max-w-fit">
<PopoverTrigger>
<Button color="primary" variant="flat" isIconOnly radius="full">
<FaFolder className="text-lg" />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="flex-row gap-2 p-4">
<Tooltip content="上传文件">
<Button
className="text-lg"
color="primary"
isIconOnly
variant="flat"
radius="full"
onPress={() => {
fileInputRef?.current?.click()
}}
>
<MdUpload />
</Button>
</Tooltip>
<Popover>
<Tooltip content="输入文件地址">
<div className="max-w-fit">
<PopoverTrigger tooltip="输入文件地址">
<Button
className="text-lg"
color="primary"
isIconOnly
variant="flat"
radius="full"
>
<MdEdit />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="flex-row gap-1 p-2">
<Input
value={fileUrl}
onChange={(e) => setFileUrl(e.target.value)}
placeholder="请输入文件地址"
/>
<Button
color="primary"
variant="flat"
isIconOnly
radius="full"
onPress={() => {
if (!isURI(fileUrl)) {
toast.error('请输入正确的文件地址')
return
}
showFileSegment(fileUrl)
setFileUrl('')
}}
>
<LuFilePlus2 />
</Button>
</PopoverContent>
</Popover>
</PopoverContent>
</Popover>
<input
type="file"
ref={fileInputRef}
hidden
className="hidden"
onChange={(e) => {
const file = e.target.files?.[0]
if (!file) {
return
}
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = (event) => {
const dataURL = event.target?.result
showFileSegment(dataURL as string)
e.target.value = ''
}
}}
/>
</>
)
}
export default FileInsert

View File

@@ -1,114 +0,0 @@
import { Button } from '@heroui/button'
import { Input } from '@heroui/input'
import { Popover, PopoverContent, PopoverTrigger } from '@heroui/popover'
import { Tooltip } from '@heroui/tooltip'
import { useRef, useState } from 'react'
import toast from 'react-hot-toast'
import { MdAddPhotoAlternate, MdEdit, MdImage, MdUpload } from 'react-icons/md'
import { isURI } from '@/utils/url'
export interface ImageInsertProps {
insertImage: (url: string) => void
onOpenChange: (open: boolean) => void
}
const ImageInsert = ({ insertImage, onOpenChange }: ImageInsertProps) => {
const [imgUrl, setImgUrl] = useState<string>('')
const imageInputRef = useRef<HTMLInputElement>(null)
return (
<>
<Popover onOpenChange={onOpenChange}>
<Tooltip content="插入图片">
<div className="max-w-fit">
<PopoverTrigger>
<Button color="primary" variant="flat" isIconOnly radius="full">
<MdImage className="text-xl" />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="flex-row gap-2 p-4">
<Tooltip content="上传图片">
<Button
className="text-lg"
color="primary"
isIconOnly
variant="flat"
radius="full"
onPress={() => {
imageInputRef?.current?.click()
}}
>
<MdUpload />
</Button>
</Tooltip>
<Popover>
<Tooltip content="输入图片地址">
<div className="max-w-fit">
<PopoverTrigger tooltip="输入图片地址">
<Button
className="text-lg"
color="primary"
isIconOnly
variant="flat"
radius="full"
>
<MdEdit />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="flex-row gap-1 p-2">
<Input
value={imgUrl}
onChange={(e) => setImgUrl(e.target.value)}
placeholder="请输入图片地址"
/>
<Button
color="primary"
variant="flat"
isIconOnly
radius="full"
onPress={() => {
if (!isURI(imgUrl)) {
toast.error('请输入正确的图片地址')
return
}
insertImage(imgUrl)
setImgUrl('')
}}
>
<MdAddPhotoAlternate />
</Button>
</PopoverContent>
</Popover>
</PopoverContent>
</Popover>
<input
type="file"
ref={imageInputRef}
hidden
accept="image/*"
className="hidden"
onChange={(e) => {
const file = e.target.files?.[0]
if (!file) {
return
}
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = (event) => {
const dataURL = event.target?.result
insertImage(dataURL as string)
e.target.value = ''
}
}}
/>
</>
)
}
export default ImageInsert

View File

@@ -1,256 +0,0 @@
import { Button } from '@heroui/button'
import { Form } from '@heroui/form'
import { Input } from '@heroui/input'
import { Popover, PopoverContent, PopoverTrigger } from '@heroui/popover'
import { Select, SelectItem } from '@heroui/select'
import type { SharedSelection } from '@heroui/system'
import { Tab, Tabs } from '@heroui/tabs'
import { Tooltip } from '@heroui/tooltip'
import type { Key } from '@react-types/shared'
import { useRef, useState } from 'react'
import { Controller, useForm } from 'react-hook-form'
import toast from 'react-hot-toast'
import { IoMusicalNotes } from 'react-icons/io5'
import { TbMusicPlus } from 'react-icons/tb'
import useShowStructuredMessage from '@/hooks/use_show_strcuted_message'
import { isURI } from '@/utils/url'
import type {
CustomMusicSegment,
MusicSegment,
OB11Segment
} from '@/types/onebot'
type MusicData = CustomMusicSegment['data'] | MusicSegment['data']
const MusicInsert = () => {
const [musicId, setMusicId] = useState<string>('')
const [musicType, setMusicType] = useState<SharedSelection>(new Set(['163']))
const [mode, setMode] = useState<Key>('default')
const containerRef = useRef<HTMLDivElement>(null)
const { control, handleSubmit, reset } = useForm<
Omit<CustomMusicSegment['data'], 'type'>
>({
defaultValues: {
url: '',
audio: '',
title: '',
image: '',
content: ''
}
})
const showStructuredMessage = useShowStructuredMessage()
const showMusicSegment = (data: MusicData) => {
const messages: OB11Segment[] = []
if (data.type === 'custom') {
messages.push({
type: 'music',
data: {
...data,
type: 'custom'
}
})
} else {
messages.push({
type: 'music',
data
})
}
showStructuredMessage(messages)
}
const onSubmit = (data: Omit<CustomMusicSegment['data'], 'type'>) => {
showMusicSegment({
type: 'custom',
...data
})
reset()
}
return (
<div ref={containerRef} className="overflow-visible">
<Popover
placement="right-start"
shouldCloseOnScroll={false}
portalContainer={containerRef.current!}
>
<Tooltip content="发送音乐">
<div className="max-w-fit">
<PopoverTrigger>
<Button color="primary" variant="flat" isIconOnly radius="full">
<IoMusicalNotes className="text-xl" />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="gap-2 p-4">
<Tabs
placement="top"
className="w-96"
fullWidth
selectedKey={mode}
onSelectionChange={setMode}
>
<Tab title="主流平台" key="default" className="flex flex-col gap-2">
<Select
onClick={(e) => e.stopPropagation()}
aria-label="音乐平台"
selectedKeys={musicType}
label="音乐平台"
placeholder="请选择音乐平台"
items={[
{
name: 'QQ音乐',
id: 'qq'
},
{
name: '网易云音乐',
id: '163'
},
{
name: '虾米音乐',
id: 'xm'
}
]}
onSelectionChange={setMusicType}
>
{(item) => (
<SelectItem key={item.id} value={item.id}>
{item.name}
</SelectItem>
)}
</Select>
<Input
value={musicId}
onChange={(e) => setMusicId(e.target.value)}
placeholder="请输入音乐ID"
label="音乐ID"
/>
<Button
fullWidth
size="lg"
color="primary"
variant="flat"
radius="full"
onPress={() => {
if (!musicId) {
toast.error('请输入音乐ID')
return
}
showMusicSegment({
type: Array.from(
musicType
)[0] as MusicSegment['data']['type'],
id: musicId
})
setMusicId('')
}}
startContent={<TbMusicPlus />}
>
{Array.from(musicType)[0] === '163' ? '网易云' : 'QQ'}
</Button>
</Tab>
<Tab
title="自定义音乐"
key="custom"
className="flex flex-col gap-2"
>
<Form
onSubmit={handleSubmit(onSubmit)}
className="flex flex-col gap-2"
validationBehavior="native"
>
<Controller
name="url"
control={control}
render={({ field }) => (
<Input
{...field}
isRequired
validate={(v) => {
return !isURI(v) ? '请输入正确的音乐URL' : null
}}
size="sm"
placeholder="请输入音乐URL"
label="音乐URL"
/>
)}
/>
<Controller
name="audio"
control={control}
render={({ field }) => (
<Input
{...field}
isRequired
validate={(v) => {
return !isURI(v) ? '请输入正确的音频URL' : null
}}
size="sm"
placeholder="请输入音频URL"
label="音频URL"
/>
)}
/>
<Controller
name="title"
control={control}
render={({ field }) => (
<Input
{...field}
isRequired
size="sm"
errorMessage="请输入音乐标题"
placeholder="请输入音乐标题"
label="音乐标题"
/>
)}
/>
<Controller
name="image"
control={control}
render={({ field }) => (
<Input
{...field}
size="sm"
placeholder="请输入封面图片URL"
label="封面图片URL"
/>
)}
/>
<Controller
name="content"
control={control}
render={({ field }) => (
<Input
{...field}
size="sm"
placeholder="请输入音乐描述"
label="音乐描述"
/>
)}
/>
<Button
fullWidth
size="lg"
color="primary"
variant="flat"
radius="full"
type="submit"
startContent={<TbMusicPlus />}
>
</Button>
</Form>
</Tab>
</Tabs>
</PopoverContent>
</Popover>
</div>
)
}
export default MusicInsert

View File

@@ -1,58 +0,0 @@
import { Button } from '@heroui/button'
import { Input } from '@heroui/input'
import { Popover, PopoverContent, PopoverTrigger } from '@heroui/popover'
import { Tooltip } from '@heroui/tooltip'
import { useState } from 'react'
import { BsChatQuoteFill } from 'react-icons/bs'
import { MdAdd } from 'react-icons/md'
export interface ReplyInsertProps {
insertReply: (messageId: string) => void
}
const ReplyInsert = ({ insertReply }: ReplyInsertProps) => {
const [replyId, setReplyId] = useState<string>('')
return (
<>
<Popover>
<Tooltip content="回复消息">
<div className="max-w-fit">
<PopoverTrigger>
<Button color="primary" variant="flat" isIconOnly radius="full">
<BsChatQuoteFill className="text-lg" />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="flex-row gap-2 p-4">
<Input
placeholder="输入消息 ID"
value={replyId}
onChange={(e) => {
const value = e.target.value
const isNumberReg = /^(?:0|(?:-?[1-9]\d*))$/
if (isNumberReg.test(value)) {
setReplyId(value)
}
}}
/>
<Button
color="primary"
variant="flat"
radius="full"
isIconOnly
onPress={() => {
insertReply(replyId)
setReplyId('')
}}
>
<MdAdd />
</Button>
</PopoverContent>
</Popover>
</>
)
}
export default ReplyInsert

View File

@@ -1,31 +0,0 @@
import { Button } from '@heroui/button'
import { Tooltip } from '@heroui/tooltip'
import { LiaHandScissors } from 'react-icons/lia'
import useShowStructuredMessage from '@/hooks/use_show_strcuted_message'
const RPSInsert = () => {
const showStructuredMessage = useShowStructuredMessage()
return (
<Tooltip content="发送猜拳">
<Button
color="primary"
variant="flat"
isIconOnly
radius="full"
onPress={() => {
showStructuredMessage([
{
type: 'rps'
}
])
}}
>
<LiaHandScissors className="text-2xl" />
</Button>
</Tooltip>
)
}
export default RPSInsert

View File

@@ -1,32 +0,0 @@
import { Snippet } from '@heroui/snippet'
import { OB11Segment } from '@/types/onebot'
export interface ShowStructedMessageProps {
messages: OB11Segment[]
}
const ShowStructedMessage = ({ messages }: ShowStructedMessageProps) => {
return (
<Snippet
hideSymbol
tooltipProps={{
content: '点击复制'
}}
classNames={{
copyButton: 'self-start sticky top-0 right-0'
}}
className="bg-content1 h-96 overflow-y-scroll items-start"
>
{JSON.stringify(messages, null, 2)
.split('\n')
.map((line, i) => (
<span key={i} className="whitespace-pre-wrap break-all">
{line}
</span>
))}
</Snippet>
)
}
export default ShowStructedMessage

View File

@@ -1,126 +0,0 @@
import { Button } from '@heroui/button'
import { Input } from '@heroui/input'
import { Popover, PopoverContent, PopoverTrigger } from '@heroui/popover'
import { Tooltip } from '@heroui/tooltip'
import { useRef, useState } from 'react'
import toast from 'react-hot-toast'
import { IoVideocam } from 'react-icons/io5'
import { MdEdit, MdUpload } from 'react-icons/md'
import { TbVideoPlus } from 'react-icons/tb'
import useShowStructuredMessage from '@/hooks/use_show_strcuted_message'
import { isURI } from '@/utils/url'
import type { OB11Segment } from '@/types/onebot'
const VideoInsert = () => {
const [videoUrl, setVideoUrl] = useState<string>('')
const videoInputRef = useRef<HTMLInputElement>(null)
const showStructuredMessage = useShowStructuredMessage()
const showVideoSegment = (file: string) => {
const messages: OB11Segment[] = [
{
type: 'video',
data: {
file: file
}
}
]
showStructuredMessage(messages)
}
return (
<>
<Popover>
<Tooltip content="发送视频">
<div className="max-w-fit">
<PopoverTrigger>
<Button color="primary" variant="flat" isIconOnly radius="full">
<IoVideocam className="text-xl" />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="flex-row gap-2 p-4">
<Tooltip content="上传视频">
<Button
className="text-lg"
color="primary"
isIconOnly
variant="flat"
radius="full"
onPress={() => {
videoInputRef?.current?.click()
}}
>
<MdUpload />
</Button>
</Tooltip>
<Popover>
<Tooltip content="输入视频地址">
<div className="max-w-fit">
<PopoverTrigger tooltip="输入视频地址">
<Button
className="text-lg"
color="primary"
isIconOnly
variant="flat"
radius="full"
>
<MdEdit />
</Button>
</PopoverTrigger>
</div>
</Tooltip>
<PopoverContent className="flex-row gap-1 p-2">
<Input
value={videoUrl}
onChange={(e) => setVideoUrl(e.target.value)}
placeholder="请输入视频地址"
/>
<Button
color="primary"
variant="flat"
isIconOnly
radius="full"
onPress={() => {
if (!isURI(videoUrl)) {
toast.error('请输入正确的视频地址')
return
}
showVideoSegment(videoUrl)
setVideoUrl('')
}}
>
<TbVideoPlus />
</Button>
</PopoverContent>
</Popover>
</PopoverContent>
</Popover>
<input
type="file"
ref={videoInputRef}
hidden
accept="video/*"
className="hidden"
onChange={(e) => {
const file = e.target.files?.[0]
if (!file) {
return
}
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = (event) => {
const dataURL = event.target?.result
showVideoSegment(dataURL as string)
e.target.value = ''
}
}}
/>
</>
)
}
export default VideoInsert

View File

@@ -1,41 +0,0 @@
import Quill from 'quill'
// eslint-disable-next-line
const Embed = Quill.import('blots/embed') as any
export interface EmojiValue {
alt: string
src: string
id: string
}
class EmojiBlot extends Embed {
static blotName: string = 'emoji'
static tagName: string = 'img'
static classNames: string[] = ['w-6', 'h-6']
static create(value: HTMLImageElement) {
const node = super.create(value)
node.setAttribute('alt', value.alt)
node.setAttribute('src', value.src)
node.setAttribute('data-id', value.id)
node.classList.add(...EmojiBlot.classNames)
return node
}
static formats(node: HTMLImageElement): EmojiValue {
return {
alt: node.getAttribute('alt') ?? '',
src: node.getAttribute('src') ?? '',
id: node.getAttribute('data-id') ?? ''
}
}
static value(node: HTMLImageElement): EmojiValue {
return {
alt: node.getAttribute('alt') ?? '',
src: node.getAttribute('src') ?? '',
id: node.getAttribute('data-id') ?? ''
}
}
}
export default EmojiBlot

View File

@@ -1,30 +0,0 @@
import Quill from 'quill'
// eslint-disable-next-line
const Embed = Quill.import('blots/embed') as any
export interface ImageValue {
alt: string
src: string
}
class ImageBlot extends Embed {
static blotName = 'image'
static tagName = 'img'
static classNames: string[] = ['max-w-48', 'max-h-48', 'align-bottom']
static create(value: ImageValue) {
let node = super.create()
node.setAttribute('alt', value.alt)
node.setAttribute('src', value.src)
node.classList.add(...ImageBlot.classNames)
return node
}
static value(node: HTMLImageElement): ImageValue {
return {
alt: node.getAttribute('alt') ?? '',
src: node.getAttribute('src') ?? ''
}
}
}
export default ImageBlot

Some files were not shown because too many files have changed in this diff Show More