chore: sync local updates

This commit is contained in:
2026-05-16 19:03:34 +08:00
parent acba445550
commit 42100c2d0a
102 changed files with 4007 additions and 1477 deletions

View File

@@ -3,7 +3,7 @@
## Project Structure & Module Organization
- `mengyaprofile-frontend/`: React (Create React App) UI (`src/`, `public/`).
- `mengyaprofile-backend/`: Flask API (`app.py`) plus site content in `data/*.json` and assets in `data/logo/`, `data/background/`.
- `mengyaprofile-backend/`: Flask API (`app.py`, `db.py`) plus SQLite默认 `data/site.db`,由 `schema.sql` 定义)与静态资源 `data/logo/``data/background/`。首次启动若库为空会写入最小占位行;内容通过管理后台或直连数据库维护。
- Root `*.bat`: Windows helper scripts for starting/building locally.
## Build, Test, and Development Commands
@@ -22,14 +22,14 @@ npm test # Jest/RTL in watch mode
npm run build # production build to ./build
```
- Windows shortcuts: `start-backend.bat`, `start-frontend.bat`, `build-frontend.bat`.
- Windows / 根目录脚本: `dev.bat``build.bat`(见仓库根目录)。
- Docker (optional): `docker compose -f mengyaprofile-backend/docker-compose.yml up -d --build` (adjust the volume path for your machine).
## Coding Style & Naming Conventions
- Python: PEP 8, 4-space indents; keep API routes under `/api/*` in `mengyaprofile-backend/app.py`.
- React: 2-space indents; components live in `mengyaprofile-frontend/src/components/` with `PascalCase` filenames (e.g., `TechStackSection.js`).
- Data files: edit `mengyaprofile-backend/data/*.json` (UTF-8). Prefer stable keys and keep lists ordered to produce readable diffs.
- 站点内容:维护 `data/site.db`(表 `profile``project` / `project_tag` / `project_tech_tag``contact``techstack_section` / `techstack_item`),或通过 `/admin``X-Admin-Token` 调用 `/api/admin/*`
## Testing Guidelines
@@ -39,9 +39,9 @@ npm run build # production build to ./build
## Commit & Pull Request Guidelines
- Current Git history uses short subjects (e.g., “Initial commit”, “初始化提交”); keep messages concise and scoped (`frontend: ...`, `backend: ...`).
- PRs: describe behavior changes, link issues, include screenshots for UI changes, and call out any `data/*.json` schema updates.
- PRs: describe behavior changes, link issues, include screenshots for UI changes, and call out any `schema.sql` / API shape changes.
## Security & Configuration Tips
- “Admin mode” is client-side (`/admin?token=...`) and not a security boundary—do not store secrets in this repo.
- Useful env vars: backend `RUN_MODE`, `DATA_DIR`, `BACKGROUND_DIR`, `PORT`; frontend `REACT_APP_API_URL` (use `.env.local`).
- Useful env vars: backend `RUN_MODE`, `DATA_DIR`, `DATABASE_PATH`(可选,默认 `DATA_DIR/site.db`, `BACKGROUND_DIR`, `ADMIN_TOKEN`(管理写接口,默认 `shumengya520`,生产务必修改), `PORT`; frontend `REACT_APP_API_URL` (use `.env.local`)。主页头像连点 5 次2 秒内累计重置)弹出 token 验证,通过后进入 `/admin` 管理页;写操作须请求头 `X-Admin-Token`