Add transfer tracking and secure admin access

This commit is contained in:
2026-07-26 11:57:57 +08:00
parent 0738953e6d
commit 7df25edd96
111 changed files with 6379 additions and 1934 deletions
+14 -8
View File
@@ -1,6 +1,6 @@
# 喵记账 · 开发手册
> 最后更新:2026-07-18
> 最后更新:2026-07-26
## 版本号规范
@@ -29,13 +29,12 @@
⚠️ **必须加 `--dart-define`,否则 App 显示 `vdev`**
### Admin Web 版本号
- 文件:`admin-web/src/App.vue`
- 变量:侧边栏底部的硬编码版本文字 `<div>v20260718-1600</div>`
- 更新方法:修改 `<div>` 内的版本号,重新构建部署
- Admin Web 不再维护独立硬编码版本号,以同次后端发布版本为准。
- 更新方法:重新构建并完整替换后端静态资源目录。
```bash
cd admin-web && npm run build
cp dist/index.html ../backend/MiaoJiZhang.Api/wwwroot/
cp -r dist/assets ../backend/MiaoJiZhang.Api/wwwroot/
find ../backend/MiaoJiZhang.Api/wwwroot -mindepth 1 -delete
cp -a dist/. ../backend/MiaoJiZhang.Api/wwwroot/
```
---
@@ -45,18 +44,25 @@
### 1. 后端
```bash
cd backend
export Admin__BootstrapUsername='admin'
export Admin__BootstrapPassword='replace-with-a-random-password-of-at-least-12-characters'
dotnet build
# 重启
powershell -Command "Get-Process dotnet | Stop-Process -Force"
dotnet run --project MiaoJiZhang.Api
```
首次启动必须设置 `Admin__BootstrapUsername` 和 `Admin__BootstrapPassword`,用于创建第一个
`super_admin`。首次登录后后台会强制修改密码;管理员创建成功后可从运行环境中移除这两个
引导变量。正式环境必须使用 HTTPS 并保持 `Admin__CookieSecure=true`。本地纯 HTTP 调试时才可
临时设置 `Admin__CookieSecure=false`。
### 2. Admin Web
```bash
cd admin-web
npm run build
cp dist/index.html ../backend/MiaoJiZhang.Api/wwwroot/
cp -r dist/assets ../backend/MiaoJiZhang.Api/wwwroot/
find ../backend/MiaoJiZhang.Api/wwwroot -mindepth 1 -delete
cp -a dist/. ../backend/MiaoJiZhang.Api/wwwroot/
```
浏览器打开 `http://localhost:5000/` 或 `http://{电脑IP}:5000/`。如界面未更新请 **Ctrl+Shift+R** 强制刷新。
+8 -5
View File
@@ -261,13 +261,16 @@ docker compose up -d
http://localhost:8080/
```
默认管理员:
首次启动前配置引导管理员:
```text
用户名:admin
密码:Admin123!@#
```bash
export Admin__BootstrapUsername='admin'
export Admin__BootstrapPassword='replace-with-a-random-password-of-at-least-12-characters'
```
首次登录后必须修改密码。正式环境使用 HTTPS,并保持 `Admin__CookieSecure=true`;不存在固定
默认密码,也不再通过请求头管理密钥登录。
检查更新示例:
```bash
@@ -278,4 +281,4 @@ curl "http://localhost:8080/api/client/v1/update?appKey=replace-with-app-key&pla
```bash
docker compose down
```
```