Add release hash script and NapCat file-hash UI
Add a new .github/scripts/publish-release-hash.mjs to compute SHA512 for Shell/Framework napcat.mjs, maintain a release.json (keep last 100 entries) and write it to a separate hash repo. Wire the script into .github/workflows/release.yml to clone NapNeko/napcat-release-hash and publish hashes on release. Backend: expose GET /base/GetNapCatFileHash to compute napcat.mjs SHA512. Frontend: add WebUIManager.GetNapCatFileHash and show a join-password snippet on About page by combining file hash and user UIN (hashed with CryptoJS); update About page links to QQ groups. Update README and localized docs to list community QQ groups. Error handling and basic logging added.
This commit is contained in:
1 parent
fbba3d5ade
commit
4c8419d5ab
13 files changed
+274
-13
No files matched your search
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* publish-release-hash.mjs
|
||||
*
|
||||
* 读取 release.json(不存在则创建),追加新版本的 Shell/Framework napcat.mjs SHA512,
|
||||
* 保留最近 100 条后写回文件。
|
||||
*
|
||||
* 用法:
|
||||
* node .github/scripts/publish-release-hash.mjs \
|
||||
* --version v4.9.0 \
|
||||
* --shell ./artifacts/NapCat.Shell/napcat.mjs \
|
||||
* --framework ./artifacts/NapCat.Framework/napcat.mjs \
|
||||
* --file ./hash-repo/release.json
|
||||
*/
|
||||
|
||||
import crypto from 'node:crypto';
|
||||
import fs from 'node:fs';
|
||||
|
||||
// ─── CLI 参数解析 ────────────────────────────────────────────────────────────
|
||||
|
||||
function parseArgs () {
|
||||
const args = process.argv.slice(2);
|
||||
const result = {};
|
||||
for (let i = 0; i < args.length; i += 2) {
|
||||
result[args[i].replace(/^--/, '')] = args[i + 1];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const { version, shell: shellPath, framework: frameworkPath, file: outputFile } = parseArgs();
|
||||
|
||||
if (!version || !shellPath || !frameworkPath || !outputFile) {
|
||||
console.error('Usage: node publish-release-hash.mjs --version <v> --shell <path> --framework <path> --file <path>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// ─── 工具函数 ────────────────────────────────────────────────────────────────
|
||||
|
||||
function sha512File (filePath) {
|
||||
if (!fs.existsSync(filePath)) {
|
||||
throw new Error(`File not found: ${filePath}`);
|
||||
}
|
||||
const buf = fs.readFileSync(filePath);
|
||||
return crypto.createHash('sha512').update(buf).digest('hex');
|
||||
}
|
||||
|
||||
// ─── 主逻辑 ──────────────────────────────────────────────────────────────────
|
||||
|
||||
const MAX_ENTRIES = 100;
|
||||
|
||||
// 1. 计算哈希
|
||||
console.log(`Computing SHA512 for Shell: ${shellPath}`);
|
||||
const shellHash = sha512File(shellPath);
|
||||
console.log(`Shell SHA512: ${shellHash}`);
|
||||
|
||||
console.log(`Computing SHA512 for Framework: ${frameworkPath}`);
|
||||
const frameworkHash = sha512File(frameworkPath);
|
||||
console.log(`Framework SHA512: ${frameworkHash}`);
|
||||
|
||||
// 2. 读取现有 release.json,不存在则创建空数组
|
||||
let entries = [];
|
||||
if (fs.existsSync(outputFile)) {
|
||||
entries = JSON.parse(fs.readFileSync(outputFile, 'utf-8'));
|
||||
console.log(`Loaded existing ${outputFile} with ${entries.length} entries.`);
|
||||
} else {
|
||||
console.log(`${outputFile} not found, will create it.`);
|
||||
}
|
||||
|
||||
// 3. 追加新条目,去除同版本旧条目,滚动保留最近 MAX_ENTRIES 条
|
||||
const newEntry = {
|
||||
version,
|
||||
shell: { sha512: shellHash },
|
||||
framework: { sha512: frameworkHash },
|
||||
updatedAt: new Date().toISOString(),
|
||||
};
|
||||
|
||||
const updated = [
|
||||
...entries.filter(e => e.version !== version),
|
||||
newEntry,
|
||||
].slice(-MAX_ENTRIES);
|
||||
|
||||
// 4. 写回文件
|
||||
fs.writeFileSync(outputFile, JSON.stringify(updated, null, 2) + '\n', 'utf-8');
|
||||
console.log(`✅ Written ${updated.length} entries to ${outputFile}`);
|
||||
@@ -478,3 +478,31 @@ jobs:
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-binary @apifox_payload.json
|
||||
|
||||
- name: Publish release hash
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION="${GITHUB_REF#refs/tags/}"
|
||||
HASH_REPO="NapNeko/napcat-release-hash"
|
||||
CLONE_URL="https://x-access-token:${GH_TOKEN}@github.com/${HASH_REPO}.git"
|
||||
|
||||
git clone "$CLONE_URL" hash-repo
|
||||
|
||||
node .github/scripts/publish-release-hash.mjs \
|
||||
--version "$VERSION" \
|
||||
--shell "./artifacts/NapCat.Shell/napcat.mjs" \
|
||||
--framework "./artifacts/NapCat.Framework/napcat.mjs" \
|
||||
--file "./hash-repo/release.json"
|
||||
|
||||
cd hash-repo
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add release.json
|
||||
if git diff --cached --quiet; then
|
||||
echo "No changes to commit"
|
||||
else
|
||||
git commit -m "chore: update release hash for ${VERSION}"
|
||||
git push origin HEAD:main || git push origin HEAD:master
|
||||
fi
|
||||
|
||||
@@ -14,7 +14,16 @@ English | [简体中文](./docs/README_zh-CN.md) | [繁體中文](./docs/README_
|
||||
---
|
||||
|
||||
## Notice
|
||||
NapCat is currently looking for a new primary maintainer. Please email nanaeonn@outlook.com if you are interested. No public community groups will be established during this period, but NapCat will continue to receive regular updates.
|
||||
NapCat is currently looking for a new primary maintainer. Please email nanaeonn@outlook.com if you are interested.
|
||||
|
||||
### Community Groups
|
||||
|
||||
You can get the join password directly from the **About** page of the WebUI.
|
||||
|
||||
- [[NapCat Family] Happy Family] 1090875633: https://qm.qq.com/q/VwpnklcXqo
|
||||
- [[NapCat Family] Royal Relatives] 1059714215: https://qm.qq.com/q/gq18RH7o7S
|
||||
- [[NapCat Family] Loving Family] 1085662710: https://qm.qq.com/q/XyiyGPqa42
|
||||
- [[NapCat Family] Joyful Family] 1085359803: https://qm.qq.com/q/E4nfkGD6oK
|
||||
|
||||
## Welcome
|
||||
|
||||
@@ -50,6 +59,9 @@ Download the latest version from the [Release](https://github.com/NapNeko/NapCat
|
||||
| DeepWiki | [](https://deepwiki.com/NapNeko/NapCatQQ) |
|
||||
|:-:|:-:|
|
||||
|
||||
| QQ Groups | [Happy Family](https://qm.qq.com/q/VwpnklcXqo) | [Royal Relatives](https://qm.qq.com/q/gq18RH7o7S) | [Loving Family](https://qm.qq.com/q/XyiyGPqa42) | [Joyful Family](https://qm.qq.com/q/E4nfkGD6oK) |
|
||||
|:-:|:-:|:-:|:-:|:-:|
|
||||
|
||||
> Please do not mention this project in other communities (including other protocol-side or related application-side projects) to avoid disputes. If you have suggestions, please discuss them in the official group or submit a PR.
|
||||
|
||||
## Thanks
|
||||
|
||||
+13
-1
@@ -16,7 +16,16 @@ _إطار عمل حديث على جانب البروتوكول مبني على N
|
||||
---
|
||||
|
||||
## إعلان
|
||||
يبحث NapCat حالياً عن مشرف رئيسي جديد. يرجى التواصل عبر البريد الإلكتروني nanaeonn@outlook.com. لن يتم إنشاء مجموعات مجتمع عامة خلال هذه الفترة، لكن NapCat يضمن استمرار التحديثات المنتظمة.
|
||||
يبحث NapCat حالياً عن مشرف رئيسي جديد. يرجى التواصل عبر البريد الإلكتروني nanaeonn@outlook.com.
|
||||
|
||||
### مجموعات المجتمع
|
||||
|
||||
يمكنك الحصول على كلمة مرور الانضمام مباشرةً من **صفحة "حول" في WebUI**:
|
||||
|
||||
- [NapCat Family] Happy Family 1090875633:https://qm.qq.com/q/VwpnklcXqo
|
||||
- [NapCat Family] Royal Relatives 1059714215:https://qm.qq.com/q/gq18RH7o7S
|
||||
- [NapCat Family] Loving Family 1085662710:https://qm.qq.com/q/XyiyGPqa42
|
||||
- [NapCat Family] Joyful Family 1085359803:https://qm.qq.com/q/E4nfkGD6oK
|
||||
|
||||
## مرحباً
|
||||
|
||||
@@ -52,6 +61,9 @@ _إطار عمل حديث على جانب البروتوكول مبني على N
|
||||
| DeepWiki | [](https://deepwiki.com/NapNeko/NapCatQQ) |
|
||||
|:-:|:-:|
|
||||
|
||||
| مجموعات QQ | [Happy Family](https://qm.qq.com/q/VwpnklcXqo) | [Royal Relatives](https://qm.qq.com/q/gq18RH7o7S) | [Loving Family](https://qm.qq.com/q/XyiyGPqa42) | [Joyful Family](https://qm.qq.com/q/E4nfkGD6oK) |
|
||||
|:-:|:-:|:-:|:-:|:-:|
|
||||
|
||||
> يرجى عدم ذكر هذا المشروع في مجتمعات أخرى (بما في ذلك مشاريع البروتوكول الأخرى / مشاريع التطبيقات ذات الصلة) لتجنب الخلافات. إذا كانت لديك اقتراحات، يرجى مناقشتها في المجموعة الرسمية أو تقديم PR.
|
||||
|
||||
## شكر وتقدير
|
||||
|
||||
+13
-1
@@ -14,7 +14,16 @@ _NTQQをベースにした最新のプロトコル側フレームワーク._
|
||||
---
|
||||
|
||||
## お知らせ
|
||||
NapCat は現在、新しいメインメンテナーを募集しています。nanaeonn@outlook.com までメールでご連絡ください。この期間中、公開コミュニティグループは設立しませんが、NapCat は通常通りの更新を保証します。
|
||||
NapCat は現在、新しいメインメンテナーを募集しています。nanaeonn@outlook.com までメールでご連絡ください。
|
||||
|
||||
### コミュニティグループ
|
||||
|
||||
**WebUI の「について」ページ** から参加パスワードを直接取得できます:
|
||||
|
||||
- [NapCat Family] Happy Family 1090875633:https://qm.qq.com/q/VwpnklcXqo
|
||||
- [NapCat Family] Royal Relatives 1059714215:https://qm.qq.com/q/gq18RH7o7S
|
||||
- [NapCat Family] Loving Family 1085662710:https://qm.qq.com/q/XyiyGPqa42
|
||||
- [NapCat Family] Joyful Family 1085359803:https://qm.qq.com/q/E4nfkGD6oK
|
||||
|
||||
## ようこそ
|
||||
|
||||
@@ -50,6 +59,9 @@ NapCat は現在、新しいメインメンテナーを募集しています。n
|
||||
| DeepWiki | [](https://deepwiki.com/NapNeko/NapCatQQ) |
|
||||
|:-:|:-:|
|
||||
|
||||
| QQ グループ | [Happy Family](https://qm.qq.com/q/VwpnklcXqo) | [Royal Relatives](https://qm.qq.com/q/gq18RH7o7S) | [Loving Family](https://qm.qq.com/q/XyiyGPqa42) | [Joyful Family](https://qm.qq.com/q/E4nfkGD6oK) |
|
||||
|:-:|:-:|:-:|:-:|:-:|
|
||||
|
||||
> 他のコミュニティでこのプロジェクト(他のプロトコル側/関連アプリケーション側のプロジェクトを含む)に言及して論争を引き起こさないでください。提案がある場合は、公式交流グループで議論するか、PRを提出してください。
|
||||
|
||||
## 謝辞
|
||||
|
||||
+11
-1
@@ -14,8 +14,15 @@ _NTQQ 기반으로 구현된 최신 프로토콜 사이드 프레임워크._
|
||||
---
|
||||
|
||||
## 공지
|
||||
NapCat은 현재 새로운 주요 메인테이너를 찾고 있습니다. nanaeonn@outlook.com 으로 이메일을 보내주세요. 이 기간 동안 공개 커뮤니티 그룹은 만들어지지 않지만, NapCat은 정기적인 업데이트를 보장합니다.
|
||||
NapCat은 현재 새로운 주요 메인테이너를 찾고 있습니다. nanaeonn@outlook.com 으로 이메일을 보내주세요.
|
||||
### 커뮤니티 그룹
|
||||
|
||||
**WebUI 의 「정보」페이지** 에서 입장 비밀번호를 바로 확인할 수 있습니다:
|
||||
|
||||
- [NapCat Family] Happy Family 1090875633:https://qm.qq.com/q/VwpnklcXqo
|
||||
- [NapCat Family] Royal Relatives 1059714215:https://qm.qq.com/q/gq18RH7o7S
|
||||
- [NapCat Family] Loving Family 1085662710:https://qm.qq.com/q/XyiyGPqa42
|
||||
- [NapCat Family] Joyful Family 1085359803:https://qm.qq.com/q/E4nfkGD6oK
|
||||
## 환영합니다
|
||||
|
||||
- NapCatQQ는 NTQQ를 기반으로 한 최신 Bot 프로토콜 구현체입니다
|
||||
@@ -50,6 +57,9 @@ NapCat은 현재 새로운 주요 메인테이너를 찾고 있습니다. nanaeo
|
||||
| DeepWiki | [](https://deepwiki.com/NapNeko/NapCatQQ) |
|
||||
|:-:|:-:|
|
||||
|
||||
| QQ 그룹 | [Happy Family](https://qm.qq.com/q/VwpnklcXqo) | [Royal Relatives](https://qm.qq.com/q/gq18RH7o7S) | [Loving Family](https://qm.qq.com/q/XyiyGPqa42) | [Joyful Family](https://qm.qq.com/q/E4nfkGD6oK) |
|
||||
|:-:|:-:|:-:|:-:|:-:|
|
||||
|
||||
> 다른 커뮤니티에서 이 프로젝트(다른 프로토콜 측/관련 애플리케이션 측 프로젝트 포함)를 언급하여 논쟁을 일으키지 마세요. 제안이 있으시면 공식 그룹에서 토론하거나 PR을 제출해 주세요.
|
||||
|
||||
## 감사의 말
|
||||
|
||||
+13
-1
@@ -14,7 +14,16 @@ _Современный фреймворк на стороне протокол
|
||||
---
|
||||
|
||||
## Объявление
|
||||
NapCat в настоящее время ищет нового основного мейнтейнера. Пожалуйста, свяжитесь с нами по электронной почте nanaeonn@outlook.com. В этот период публичные группы сообщества создаваться не будут, но NapCat гарантирует регулярные обновления.
|
||||
NapCat в настоящее время ищет нового основного мейнтейнера. Пожалуйста, свяжитесь с нами по электронной почте nanaeonn@outlook.com.
|
||||
|
||||
### Группы сообщества
|
||||
|
||||
Пароль для вступления можно получить прямо на **странице «О программе» в WebUI**:
|
||||
|
||||
- [NapCat Family] Happy Family 1090875633:https://qm.qq.com/q/VwpnklcXqo
|
||||
- [NapCat Family] Royal Relatives 1059714215:https://qm.qq.com/q/gq18RH7o7S
|
||||
- [NapCat Family] Loving Family 1085662710:https://qm.qq.com/q/XyiyGPqa42
|
||||
- [NapCat Family] Joyful Family 1085359803:https://qm.qq.com/q/E4nfkGD6oK
|
||||
|
||||
## Добро пожаловать
|
||||
|
||||
@@ -50,6 +59,9 @@ NapCat в настоящее время ищет нового основного
|
||||
| DeepWiki | [](https://deepwiki.com/NapNeko/NapCatQQ) |
|
||||
|:-:|:-:|
|
||||
|
||||
| QQ группы | [Happy Family](https://qm.qq.com/q/VwpnklcXqo) | [Royal Relatives](https://qm.qq.com/q/gq18RH7o7S) | [Loving Family](https://qm.qq.com/q/XyiyGPqa42) | [Joyful Family](https://qm.qq.com/q/E4nfkGD6oK) |
|
||||
|:-:|:-:|:-:|:-:|:-:|
|
||||
|
||||
> Пожалуйста, не упоминайте данный проект (включая другие протокольные/прикладные проекты) в других сообществах во избежание споров. Если у вас есть предложения, обсуждайте их в официальной группе или отправляйте PR.
|
||||
|
||||
## Благодарности
|
||||
|
||||
+13
-1
@@ -14,7 +14,16 @@ _基于 NTQQ 实现的现代化协议端框架._
|
||||
---
|
||||
|
||||
## 公告
|
||||
NapCat 当前正在寻找新的主要维护者,欢迎email到 nanaeonn@outlook.com ,在此期不会建立任何公开社区交流群,Napcat会保证此期间的正常更新。
|
||||
NapCat 当前正在寻找新的主要维护者,欢迎email到 nanaeonn@outlook.com 。
|
||||
|
||||
### 交流群
|
||||
|
||||
可直接在 **WebUI 关于页面** 获取入群密码:
|
||||
|
||||
- 点击链接加入群聊【[NapCat家族群] 欢乐一家亲】1090875633:https://qm.qq.com/q/VwpnklcXqo
|
||||
- 点击链接加入群聊【[NapCat家族群] 皇亲国戚】1059714215:https://qm.qq.com/q/gq18RH7o7S
|
||||
- 点击链接加入群聊【[NapCat家族群] 相亲相爱一家人】1085662710:https://qm.qq.com/q/XyiyGPqa42
|
||||
- 点击链接加入群聊【[NapCat家族群] 开心家族】1085359803 :https://qm.qq.com/q/E4nfkGD6oK
|
||||
|
||||
## 欢迎
|
||||
|
||||
@@ -50,6 +59,9 @@ NapCat 当前正在寻找新的主要维护者,欢迎email到 nanaeonn@outlook
|
||||
| DeepWiki | [](https://deepwiki.com/NapNeko/NapCatQQ) |
|
||||
|:-:|:-:|
|
||||
|
||||
| QQ 群 | [欢乐一家亲](https://qm.qq.com/q/VwpnklcXqo) | [皇亲国戚](https://qm.qq.com/q/gq18RH7o7S) | [相亲相爱一家人](https://qm.qq.com/q/XyiyGPqa42) | [开心家族](https://qm.qq.com/q/E4nfkGD6oK) |
|
||||
|:-:|:-:|:-:|:-:|:-:|
|
||||
|
||||
> 请不要在其余社区提及本项目(包括其余协议端/相关应用端项目)引发争论,如有建议到达官方交流群讨论或PR。
|
||||
|
||||
## 致谢
|
||||
|
||||
+13
-1
@@ -14,7 +14,16 @@ _基於 NTQQ 實現的現代化協議端框架._
|
||||
---
|
||||
|
||||
## 公告
|
||||
NapCat 目前正在尋找新的主要維護者,歡迎透過 email 聯繫 nanaeonn@outlook.com。在此期間不會建立任何公開社群交流群,NapCat 會保證此期間的正常更新。
|
||||
NapCat 目前正在尋找新的主要維護者,歡迎透過 email 聯繫 nanaeonn@outlook.com。
|
||||
|
||||
### 交流群
|
||||
|
||||
可直接在 **WebUI 關於頁面** 取得入群密碼:
|
||||
|
||||
- 點擊連結加入群聊【[NapCat家族群] 歡樂一家親】1090875633:https://qm.qq.com/q/VwpnklcXqo
|
||||
- 點擊連結加入群聊【[NapCat家族群] 皇親國戚】1059714215:https://qm.qq.com/q/gq18RH7o7S
|
||||
- 點擊連結加入群聊【[NapCat家族群] 相親相愛一家人】1085662710:https://qm.qq.com/q/XyiyGPqa42
|
||||
- 點擊連結加入群聊【[NapCat家族群] 開心家族】1085359803:https://qm.qq.com/q/E4nfkGD6oK
|
||||
|
||||
## 歡迎
|
||||
|
||||
@@ -50,6 +59,9 @@ NapCat 目前正在尋找新的主要維護者,歡迎透過 email 聯繫 nanae
|
||||
| DeepWiki | [](https://deepwiki.com/NapNeko/NapCatQQ) |
|
||||
|:-:|:-:|
|
||||
|
||||
| QQ 群 | [歡樂一家親](https://qm.qq.com/q/VwpnklcXqo) | [皇親國戚](https://qm.qq.com/q/gq18RH7o7S) | [相親相愛一家人](https://qm.qq.com/q/XyiyGPqa42) | [開心家族](https://qm.qq.com/q/E4nfkGD6oK) |
|
||||
|:-:|:-:|:-:|:-:|:-:|
|
||||
|
||||
> 請不要在其他社群提及本專案(包括其他協議端/相關應用端專案)以免引發爭論。如有建議,請到官方交流群討論或提交 PR。
|
||||
|
||||
## 致謝
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { RequestHandler } from 'express';
|
||||
import { WebUiDataRuntime } from '@/napcat-webui-backend/src/helper/Data';
|
||||
|
||||
import { sendSuccess } from '@/napcat-webui-backend/src/utils/response';
|
||||
import { WebUiConfig } from '@/napcat-webui-backend/index';
|
||||
import { sendSuccess, sendError } from '@/napcat-webui-backend/src/utils/response';
|
||||
import { WebUiConfig, webUiPathWrapper } from '@/napcat-webui-backend/index';
|
||||
import { getLatestTag, getAllTags, compareSemVer } from 'napcat-common/src/helper';
|
||||
import { getLatestActionArtifacts, getMirrorConfig } from '@/napcat-common/src/mirror';
|
||||
import { NapCatCoreWorkingEnv } from '@/napcat-webui-backend/src/types';
|
||||
import crypto from 'crypto';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export const GetNapCatVersion: RequestHandler = (_, res) => {
|
||||
const data = WebUiDataRuntime.GetNapCatVersion();
|
||||
@@ -178,3 +181,14 @@ export const GetMirrorsHandler: RequestHandler = (_, res) => {
|
||||
const config = getMirrorConfig();
|
||||
sendSuccess(res, { mirrors: config.fileMirrors });
|
||||
};
|
||||
|
||||
export const GetNapCatFileHashHandler: RequestHandler = (_, res) => {
|
||||
try {
|
||||
const filePath = path.join(webUiPathWrapper.binaryPath, 'napcat.mjs');
|
||||
const fileBuffer = fs.readFileSync(filePath);
|
||||
const hash = crypto.createHash('sha512').update(fileBuffer).digest('hex');
|
||||
sendSuccess(res, { hash, file: 'napcat.mjs', algorithm: 'sha512' });
|
||||
} catch (error) {
|
||||
sendError(res, `无法计算 napcat.mjs 的 hash:${(error as Error).message}`);
|
||||
}
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Router } from 'express';
|
||||
import { GetThemeConfigHandler, GetNapCatVersion, QQVersionHandler, SetThemeConfigHandler, getLatestTagHandler, getAllReleasesHandler, GetMirrorsHandler } from '../api/BaseInfo';
|
||||
import { GetThemeConfigHandler, GetNapCatVersion, QQVersionHandler, SetThemeConfigHandler, getLatestTagHandler, getAllReleasesHandler, GetMirrorsHandler, GetNapCatFileHashHandler } from '../api/BaseInfo';
|
||||
import { StatusRealTimeHandler } from '@/napcat-webui-backend/src/api/Status';
|
||||
import { GetProxyHandler } from '../api/Proxy';
|
||||
|
||||
@@ -14,5 +14,6 @@ router.get('/GetSysStatusRealTime', StatusRealTimeHandler);
|
||||
router.get('/proxy', GetProxyHandler);
|
||||
router.get('/Theme', GetThemeConfigHandler);
|
||||
router.post('/SetTheme', SetThemeConfigHandler);
|
||||
router.get('/GetNapCatFileHash', GetNapCatFileHashHandler);
|
||||
|
||||
export { router as BaseRouter };
|
||||
@@ -340,4 +340,11 @@ export default class WebUIManager {
|
||||
);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
public static async GetNapCatFileHash () {
|
||||
const { data } = await serverRequest.get<ServerResponse<{ hash: string; file: string; algorithm: string; }>>(
|
||||
'/base/GetNapCatFileHash'
|
||||
);
|
||||
return data.data;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,9 @@ import { Chip } from '@heroui/chip';
|
||||
import { Divider } from '@heroui/divider';
|
||||
import { Image } from '@heroui/image';
|
||||
import { Link } from '@heroui/link';
|
||||
import { Snippet } from '@heroui/snippet';
|
||||
import { Spinner } from '@heroui/spinner';
|
||||
import { Tooltip } from '@heroui/tooltip';
|
||||
import { useRequest } from 'ahooks';
|
||||
import {
|
||||
BsCodeSlash,
|
||||
@@ -16,7 +18,10 @@ import {
|
||||
} from 'react-icons/bs';
|
||||
import { IoDocument, IoRocketSharp } from 'react-icons/io5';
|
||||
|
||||
import CryptoJS from 'crypto-js';
|
||||
|
||||
import logo from '@/assets/images/logo.png';
|
||||
import QQManager from '@/controllers/qq_manager';
|
||||
import WebUIManager from '@/controllers/webui_manager';
|
||||
|
||||
function VersionInfo () {
|
||||
@@ -38,6 +43,41 @@ function VersionInfo () {
|
||||
);
|
||||
}
|
||||
|
||||
function NapCatFileHash () {
|
||||
const { data: hashData, loading: hashLoading, error: hashError } = useRequest(WebUIManager.GetNapCatFileHash);
|
||||
const { data: loginData, loading: loginLoading, error: loginError } = useRequest(QQManager.getQQLoginInfo);
|
||||
|
||||
const loading = hashLoading || loginLoading;
|
||||
const error = hashError || loginError;
|
||||
|
||||
const password = hashData && loginData?.uin
|
||||
? CryptoJS.SHA512(hashData.hash + loginData.uin).toString()
|
||||
: null;
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2 text-sm font-medium text-default-700">
|
||||
<span>入群密码</span>
|
||||
{loading && <Spinner size="sm" color="default" />}
|
||||
</div>
|
||||
{error ? (
|
||||
<Chip color="warning" variant="flat" size="sm">无法计算:{(error as Error).message}</Chip>
|
||||
) : loading ? null : password ? (
|
||||
<Tooltip content="复制此值作为入群密码" placement="top">
|
||||
<Snippet
|
||||
size="sm"
|
||||
variant="flat"
|
||||
className="w-full text-xs"
|
||||
symbol=""
|
||||
>
|
||||
{password}
|
||||
</Snippet>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function AboutPage () {
|
||||
const features = [
|
||||
{
|
||||
@@ -69,8 +109,10 @@ export default function AboutPage () {
|
||||
const links = [
|
||||
{ icon: <BsGithub />, name: 'GitHub', href: 'https://github.com/NapNeko/NapCatQQ' },
|
||||
{ icon: <BsTelegram />, name: 'Telegram', href: 'https://t.me/napcatqq' },
|
||||
{ icon: <BsTencentQq />, name: 'QQ 群 1', href: 'https://qm.qq.com/q/F9cgs1N3Mc' },
|
||||
{ icon: <BsTencentQq />, name: 'QQ 群 2', href: 'https://qm.qq.com/q/hSt0u9PVn' },
|
||||
{ icon: <BsTencentQq />, name: '交流群 欢乐一家亲', href: 'https://qm.qq.com/q/VwpnklcXqo' },
|
||||
{ icon: <BsTencentQq />, name: '交流群 皇亲国戚', href: 'https://qm.qq.com/q/gq18RH7o7S' },
|
||||
{ icon: <BsTencentQq />, name: '交流群 相亲相爱一家人', href: 'https://qm.qq.com/q/XyiyGPqa42' },
|
||||
{ icon: <BsTencentQq />, name: '交流群 开心家族', href: 'https://qm.qq.com/q/E4nfkGD6oK' },
|
||||
{ icon: <IoDocument />, name: '文档', href: 'https://napcat.napneko.icu/' },
|
||||
];
|
||||
|
||||
@@ -139,7 +181,11 @@ export default function AboutPage () {
|
||||
<CardHeader className="pb-0 pt-4 px-4">
|
||||
<h2 className="text-lg font-bold">相关资源</h2>
|
||||
</CardHeader>
|
||||
<CardBody className="py-4">
|
||||
<CardBody className="py-4 space-y-4">
|
||||
<NapCatFileHash />
|
||||
<p className="text-xs text-default-400 px-1">
|
||||
复制上方密码,作为加入 QQ 群的入群密码。
|
||||
</p>
|
||||
<div className="flex flex-col gap-2">
|
||||
{links.map((link, idx) => (
|
||||
<Link
|
||||
|
||||
Reference in new issue
Block a user