diff --git a/docs/en-gb/projects/delta-force-guide/api.md b/docs/en-gb/projects/delta-force-guide/api.md new file mode 100644 index 0000000..13eb5b6 --- /dev/null +++ b/docs/en-gb/projects/delta-force-guide/api.md @@ -0,0 +1,91 @@ +--- +title: Delta Force Guide API +--- + +## Backend API Overview + +The backend is a Spring Boot 3 application organised under the base package `com.onixbyte.deltaforceguide`: + +| Package | Description | +|---------------------------------------------|-----------------------------------| +| `controller` | REST API endpoint controllers | +| `service` | Business logic layer | +| `repository` | MyBatis data access layer | +| `domain` | JPA entity and domain objects | +| `config` | Spring configuration (security, cache, etc.) | +| `properties` | Configuration property classes | +| `enumeration` | Enumerated types | +| `shared` | Shared utilities | + +## API Endpoints + +### Authentication + +| Method | Path | Description | Auth | +|--------|-----------------------|--------------------------|------| +| `POST` | `/api/auth/login` | Log in with credentials | No | +| `POST` | `/api/auth/refresh` | Refresh access token | No | +| `GET` | `/api/auth/profile` | Get current user profile | Yes | + +### Firearms + +| Method | Path | Description | +|----------|-----------------------|--------------------------| +| `GET` | `/api/firearms` | List firearms (paginated, filterable by type) | +| `GET` | `/api/firearms/:id` | Get firearm by ID | +| `POST` | `/api/firearms` | Create a new firearm | +| `PUT` | `/api/firearms/:id` | Update an existing firearm | +| `DELETE` | `/api/firearms/:id` | Remove a firearm | + +### Modifications + +| Method | Path | Description | +|----------|-----------------------------------|--------------------------------| +| `GET` | `/api/modifications` | List modifications (paginated, filterable by firearm and tags) | +| `GET` | `/api/modifications/:id` | Get modification by ID | +| `POST` | `/api/modifications` | Create a modification | +| `POST` | `/api/modifications/batch` | Batch create modifications | +| `PUT` | `/api/modifications/:id` | Update a modification | +| `DELETE` | `/api/modifications/:id` | Remove a modification | +| `DELETE` | `/api/modifications/batch-delete` | Batch remove modifications | + +### Tags + +| Method | Path | Description | +|--------|-----------------------|-----------------------| +| `GET` | `/api/tags` | List all tags | + +## Frontend Routes + +| Path | Layout | Page | Description | +|---------------|-------------|-------------------|---------------------------------| +| `/` | Hero Layout | Firearms Browser | Home page — firearm list | +| `/firearms` | Hero Layout | Firearms Browser | Firearm detail and search | +| `/mod-codes` | Hero Layout | Modification Codes| Modification code library | +| `/legal` | Hero Layout | Legal | Legal and privacy information | +| `/login` | Empty Layout| Login | User authentication page | + +## Frontend State Management + +Redux Toolkit with Redux Persist manages: + +- **Auth state** — Access tokens, refresh tokens, user profile +- **Settings state** — User preferences persisted to local storage + +## API Client + +The frontend uses a shared `WebClient` wrapper around Axios that handles: + +- Base URL configuration (pointing to the backend API) +- JWT access token injection via request interceptors +- Automatic token refresh on 401 responses + +## Infrastructure + +| Component | Technology | +|---------------|-----------------------------| +| Database | PostgreSQL (with Flyway migrations) | +| Cache | Redis (session/token storage) | +| File Storage | AWS S3 (firearm images) | +| Containerisation | Docker | +| Deployment | Docker Compose behind Nginx | diff --git a/docs/en-gb/projects/delta-force-guide/index.mdx b/docs/en-gb/projects/delta-force-guide/index.mdx new file mode 100644 index 0000000..b4e22ac --- /dev/null +++ b/docs/en-gb/projects/delta-force-guide/index.mdx @@ -0,0 +1,48 @@ +--- +title: Delta Force Guide +--- + +import { Tabs, Tab } from "@rspress/core/theme" + +## Introduction + +Delta Force Guide is a full-stack web application providing a searchable library of firearm modification codes for the game Delta Force. It consists of two components: + +- **Web Frontend** — A React-based SPA for browsing, filtering, and copying modification codes. +- **Backend Server** — A Spring Boot REST API handling data persistence, authentication, and content management. + +The live site is available at **[dfguide.onixbyte.cn](https://dfguide.onixbyte.cn)**. + +## Features + +- **Firearm Browser** — Browse a curated list of in-game firearms with detailed stats. +- **Modification Code Library** — Search and filter modification codes by weapon, mode, and tags. +- **One-Click Copy** — Copy modification codes directly from the interface. +- **Efficient Rendering** — Large lists rendered smoothly with window virtualisation. +- **Authentication** — User login with JWT-based auth and CAPTCHA verification. +- **Admin Panel** — Full CRUD operations for firearms and modification data. +- **Static-Friendly** — Frontend deployed as a static site with API proxy. + +## Architecture + +| Component | Tech Stack | +|---------------|---------------------------------------------------------------| +| **Frontend** | React 19, TypeScript, Tailwind CSS 4, Ant Design 6, React Router 7, Redux Toolkit, TanStack Virtual | +| **Backend** | Spring Boot 3, Java 21, PostgreSQL, MyBatis, Flyway, Redis | +| **Auth** | JWT (access + refresh tokens), CAPTCHA integration | +| **Storage** | AWS S3 for image uploads | + +The frontend is a static site served by Vite, communicating with the Spring Boot REST API backend. Authentication uses JWT access and refresh tokens with Redis-backed refresh token management. + +## Repositories + +- [delta-force-guide-server](https://github.com/onixbyte/delta-force-guide-server) — Spring Boot backend +- [delta-force-guide-web](https://github.com/onixbyte/delta-force-guide-web) — React frontend + +## Quick Links + +- **Live Site:** [dfguide.onixbyte.cn](https://dfguide.onixbyte.cn) + +## License + +Delta Force Guide is open-source software released under the MIT Licence. diff --git a/docs/zh-hans/projects/delta-force-guide/api.md b/docs/zh-hans/projects/delta-force-guide/api.md new file mode 100644 index 0000000..47ebe05 --- /dev/null +++ b/docs/zh-hans/projects/delta-force-guide/api.md @@ -0,0 +1,91 @@ +--- +title: Delta Force Guide API +--- + +## 后端 API 概览 + +后端是基于 Spring Boot 3 的应用程序,代码组织在基础包 `com.onixbyte.deltaforceguide` 下: + +| 包 | 描述 | +|---|---| +| `controller` | REST API 端点控制器 | +| `service` | 业务逻辑层 | +| `repository` | MyBatis 数据访问层 | +| `domain` | JPA 实体与领域对象 | +| `config` | Spring 配置(安全、缓存等) | +| `properties` | 配置属性类 | +| `enumeration` | 枚举类型 | +| `shared` | 共享工具类 | + +## API 端点 + +### 认证 + +| 方法 | 路径 | 描述 | 认证 | +|---|---|---|---| +| `POST` | `/api/auth/login` | 使用凭证登录 | 否 | +| `POST` | `/api/auth/refresh` | 刷新 access token | 否 | +| `GET` | `/api/auth/profile` | 获取当前用户信息 | 是 | + +### 枪械 + +| 方法 | 路径 | 描述 | +|---|---|---| +| `GET` | `/api/firearms` | 枪械列表(分页,可按类型筛选) | +| `GET` | `/api/firearms/:id` | 按 ID 获取枪械详情 | +| `POST` | `/api/firearms` | 创建新枪械 | +| `PUT` | `/api/firearms/:id` | 更新枪械信息 | +| `DELETE` | `/api/firearms/:id` | 删除枪械 | + +### 改装 + +| 方法 | 路径 | 描述 | +|---|---|---| +| `GET` | `/api/modifications` | 改装列表(分页,可按枪械和标签筛选) | +| `GET` | `/api/modifications/:id` | 按 ID 获取改装详情 | +| `POST` | `/api/modifications` | 创建改装 | +| `POST` | `/api/modifications/batch` | 批量创建改装 | +| `PUT` | `/api/modifications/:id` | 更新改装 | +| `DELETE` | `/api/modifications/:id` | 删除改装 | +| `DELETE` | `/api/modifications/batch-delete` | 批量删除改装 | + +### 标签 + +| 方法 | 路径 | 描述 | +|---|---|---| +| `GET` | `/api/tags` | 获取所有标签 | + +## 前端路由 + +| 路径 | 布局 | 页面 | 描述 | +|---|---|---|---| +| `/` | 主布局 | 枪械浏览 | 首页 — 枪械列表 | +| `/firearms` | 主布局 | 枪械浏览 | 枪械详情与搜索 | +| `/mod-codes` | 主布局 | 改装代码 | 改装代码库 | +| `/legal` | 主布局 | 法律信息 | 法律与隐私信息 | +| `/login` | 空白布局 | 登录 | 用户认证页面 | + +## 前端状态管理 + +Redux Toolkit 结合 Redux Persist 管理以下状态: + +- **认证状态** — Access token、refresh token、用户信息 +- **设置状态** — 用户偏好,持久化至本地存储 + +## API 客户端 + +前端使用基于 Axios 封装的共享 `WebClient`,提供以下能力: + +- 基础 URL 配置(指向后端 API) +- 通过请求拦截器自动注入 JWT access token +- 在收到 401 响应时自动刷新 token + +## 基础设施 + +| 组件 | 技术 | +|---|---| +| 数据库 | PostgreSQL(使用 Flyway 进行数据库迁移) | +| 缓存 | Redis(会话和 token 存储) | +| 文件存储 | AWS S3(枪械图片) | +| 容器化 | Docker | +| 部署 | Docker Compose + Nginx | diff --git a/docs/zh-hans/projects/delta-force-guide/index.mdx b/docs/zh-hans/projects/delta-force-guide/index.mdx new file mode 100644 index 0000000..26bd9c6 --- /dev/null +++ b/docs/zh-hans/projects/delta-force-guide/index.mdx @@ -0,0 +1,48 @@ +--- +title: Delta Force Guide +--- + +import { Tabs, Tab } from "@rspress/core/theme" + +## 介绍 + +Delta Force Guide 是一个全栈 Web 应用,为游戏 Delta Force(三角洲部队)提供可搜索的枪械改装代码库。项目包含两个组件: + +- **Web 前端** — 基于 React 的单页应用,用于浏览、筛选和复制改装代码。 +- **后端服务** — 基于 Spring Boot 的 REST API,处理数据持久化、身份认证和内容管理。 + +线上站点位于 **[dfguide.onixbyte.cn](https://dfguide.onixbyte.cn)**。 + +## 特性 + +- **枪械浏览** — 浏览精选的游戏内枪械列表及详细属性。 +- **改装代码库** — 按武器、模式和标签搜索筛选改装代码。 +- **一键复制** — 直接从界面复制改装代码。 +- **高效渲染** — 通过窗口虚拟化实现大列表的流畅渲染。 +- **身份认证** — 支持用户登录,采用 JWT 认证和验证码校验。 +- **后台管理** — 枪械与改装数据完整的增删改查功能。 +- **静态友好** — 前端以静态站点部署,通过 API 代理与后端通信。 + +## 架构 + +| 组件 | 技术栈 | +|---|---| +| **前端** | React 19、TypeScript、Tailwind CSS 4、Ant Design 6、React Router 7、Redux Toolkit、TanStack Virtual | +| **后端** | Spring Boot 3、Java 21、PostgreSQL、MyBatis、Flyway、Redis | +| **认证** | JWT(access 和 refresh token)、验证码集成 | +| **存储** | AWS S3(图片上传) | + +前端是由 Vite 构建的静态站点,通过 API 与 Spring Boot 后端通信。认证采用 JWT access 和 refresh token 机制,refresh token 通过 Redis 管理。 + +## 代码仓库 + +- [delta-force-guide-server](https://github.com/onixbyte/delta-force-guide-server) — Spring Boot 后端 +- [delta-force-guide-web](https://github.com/onixbyte/delta-force-guide-web) — React 前端 + +## 快速链接 + +- **线上站点:** [dfguide.onixbyte.cn](https://dfguide.onixbyte.cn) + +## 许可证 + +Delta Force Guide 是采用 MIT 许可证发布的开源软件。