docs: add i18n support with Chinese as default language

- Configure VitePress locales with zh-CN as root and en-US as /en/
- Translate all documentation to Chinese (31 files)
- Create English documentation under /en/ directory
- Add Chinese UI labels for navigation and pagination
- Language switcher now available in site header

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
Estrella Pan
2026-01-27 07:57:13 +01:00
parent 7e9f3a707a
commit 03bf265651
63 changed files with 4750 additions and 1414 deletions

View File

@@ -1,26 +1,26 @@
# REST API Reference
# REST API 参考
AutoBangumi exposes a REST API at `/api/v1`. All endpoints (except login and setup) require JWT authentication.
AutoBangumi 在 `/api/v1` 路径下提供 REST API。除登录和设置向导外,所有端点都需要 JWT 认证。
**Base URL:** `http://your-host:7892/api/v1`
**基础 URL:** `http://your-host:7892/api/v1`
**Authentication:** Include the JWT token as a cookie or `Authorization: Bearer <token>` header.
**认证:** 将 JWT 令牌作为 cookie 或 `Authorization: Bearer <token>` 请求头传入。
**Interactive Docs:** When running in development mode, Swagger UI is available at `http://your-host:7892/docs`.
**交互式文档:** 在开发模式下运行时,可在 `http://your-host:7892/docs` 访问 Swagger UI。
---
## Authentication
## 认证
### Login
### 登录
```
POST /auth/login
```
Authenticate with username and password.
使用用户名和密码进行认证。
**Request Body:**
**请求体:**
```json
{
"username": "string",
@@ -28,33 +28,33 @@ Authenticate with username and password.
}
```
**Response:** Sets authentication cookie with JWT token.
**响应:** 设置包含 JWT 令牌的认证 cookie。
### Refresh Token
### 刷新令牌
```
GET /auth/refresh_token
```
Refresh the current authentication token.
刷新当前的认证令牌。
### Logout
### 登出
```
GET /auth/logout
```
Clear authentication cookies and log out.
清除认证 cookie 并登出。
### Update Credentials
### 更新凭据
```
POST /auth/update
```
Update username and/or password.
更新用户名和/或密码。
**Request Body:**
**请求体:**
```json
{
"username": "string",
@@ -66,194 +66,194 @@ Update username and/or password.
## Passkey / WebAuthn <Badge type="tip" text="v3.2+" />
Passwordless authentication using WebAuthn/FIDO2 Passkeys.
使用 WebAuthn/FIDO2 Passkey 进行无密码认证。
### Register Passkey
### 注册 Passkey
```
POST /passkey/register/options
```
Get WebAuthn registration options (challenge, relying party info).
获取 WebAuthn 注册选项(质询、依赖方信息)。
```
POST /passkey/register/verify
```
Verify and save the Passkey registration response from the browser.
验证并保存来自浏览器的 Passkey 注册响应。
### Authenticate with Passkey
### 使用 Passkey 认证
```
POST /passkey/auth/options
```
Get WebAuthn authentication challenge options.
获取 WebAuthn 认证质询选项。
```
POST /passkey/auth/verify
```
Verify the Passkey authentication response and issue a JWT token.
验证 Passkey 认证响应并签发 JWT 令牌。
### Manage Passkeys
### 管理 Passkey
```
GET /passkey/list
```
List all registered Passkeys for the current user.
列出当前用户所有已注册的 Passkey。
```
POST /passkey/delete
```
Delete a registered Passkey by credential ID.
通过凭据 ID 删除已注册的 Passkey。
---
## Configuration
## 配置
### Get Configuration
### 获取配置
```
GET /config/get
```
Retrieve the current application configuration.
获取当前应用程序配置。
**Response:** Full configuration object including `program`, `downloader`, `rss_parser`, `bangumi_manager`, `notification`, `proxy`, and `experimental_openai` sections.
**响应:** 完整配置对象,包括 `program`、`downloader`、`rss_parser`、`bangumi_manager`、`notification`、`proxy` 和 `experimental_openai` 部分。
### Update Configuration
### 更新配置
```
PATCH /config/update
```
Partially update the application configuration. Only include fields you want to change.
部分更新应用程序配置。只需包含您想要更改的字段。
**Request Body:** Partial configuration object.
**请求体:** 部分配置对象。
---
## Bangumi (Anime Rules)
## 番剧(动画规则)
### List All Bangumi
### 列出所有番剧
```
GET /bangumi/get/all
```
Get all anime download rules.
获取所有动画下载规则。
### Get Bangumi by ID
### 通过 ID 获取番剧
```
GET /bangumi/get/{bangumi_id}
```
Get a specific anime rule by ID.
通过 ID 获取特定动画规则。
### Update Bangumi
### 更新番剧
```
PATCH /bangumi/update/{bangumi_id}
```
Update an anime rule's metadata (title, season, episode offset, etc.).
更新动画规则的元数据(标题、季度、集数偏移等)。
### Delete Bangumi
### 删除番剧
```
DELETE /bangumi/delete/{bangumi_id}
```
Delete a single anime rule and its associated torrents.
删除单个动画规则及其关联的种子。
```
DELETE /bangumi/delete/many/
```
Batch delete multiple anime rules.
批量删除多个动画规则。
**Request Body:**
**请求体:**
```json
{
"bangumi_ids": [1, 2, 3]
}
```
### Disable / Enable Bangumi
### 禁用/启用番剧
```
DELETE /bangumi/disable/{bangumi_id}
```
Disable an anime rule (keeps files, stops downloading).
禁用动画规则(保留文件,停止下载)。
```
DELETE /bangumi/disable/many/
```
Batch disable multiple anime rules.
批量禁用多个动画规则。
```
GET /bangumi/enable/{bangumi_id}
```
Re-enable a previously disabled anime rule.
重新启用之前禁用的动画规则。
### Poster Refresh
### 刷新海报
```
GET /bangumi/refresh/poster/all
```
Refresh poster images for all anime from TMDB.
从 TMDB 刷新所有动画的海报图片。
```
GET /bangumi/refresh/poster/{bangumi_id}
```
Refresh the poster image for a specific anime.
刷新特定动画的海报图片。
### Calendar
### 日历
```
GET /bangumi/refresh/calendar
```
Refresh the anime broadcast calendar data from Bangumi.tv.
从 Bangumi.tv 刷新动画放送日历数据。
### Reset All
### 重置全部
```
GET /bangumi/reset/all
```
Delete all anime rules. Use with caution.
删除所有动画规则。请谨慎使用。
---
## RSS Feeds
## RSS 订阅源
### List All Feeds
### 列出所有订阅源
```
GET /rss
```
Get all configured RSS feeds.
获取所有已配置的 RSS 订阅源。
### Add Feed
### 添加订阅源
```
POST /rss/add
```
Add a new RSS feed subscription.
添加新的 RSS 订阅源。
**Request Body:**
**请求体:**
```json
{
"url": "string",
@@ -262,79 +262,79 @@ Add a new RSS feed subscription.
}
```
### Enable / Disable Feeds
### 启用/禁用订阅源
```
POST /rss/enable/many
```
Enable multiple RSS feeds.
启用多个 RSS 订阅源。
```
PATCH /rss/disable/{rss_id}
```
Disable a single RSS feed.
禁用单个 RSS 订阅源。
```
POST /rss/disable/many
```
Batch disable multiple RSS feeds.
批量禁用多个 RSS 订阅源。
### Delete Feeds
### 删除订阅源
```
DELETE /rss/delete/{rss_id}
```
Delete a single RSS feed.
删除单个 RSS 订阅源。
```
POST /rss/delete/many
```
Batch delete multiple RSS feeds.
批量删除多个 RSS 订阅源。
### Update Feed
### 更新订阅源
```
PATCH /rss/update/{rss_id}
```
Update an RSS feed's configuration.
更新 RSS 订阅源的配置。
### Refresh Feeds
### 刷新订阅源
```
GET /rss/refresh/all
```
Manually trigger a refresh of all RSS feeds.
手动触发刷新所有 RSS 订阅源。
```
GET /rss/refresh/{rss_id}
```
Refresh a specific RSS feed.
刷新特定的 RSS 订阅源。
### Get Torrents from Feed
### 获取订阅源中的种子
```
GET /rss/torrent/{rss_id}
```
Get the list of torrents parsed from a specific RSS feed.
获取从特定 RSS 订阅源解析的种子列表。
### Analysis & Subscription
### 分析与订阅
```
POST /rss/analysis
```
Analyze an RSS URL and extract anime metadata without subscribing.
分析 RSS URL 并提取动画元数据,但不订阅。
**Request Body:**
**请求体:**
```json
{
"url": "string"
@@ -345,53 +345,53 @@ Analyze an RSS URL and extract anime metadata without subscribing.
POST /rss/collect
```
Download all episodes from an RSS feed (for completed anime).
从 RSS 订阅源下载所有剧集(用于已完结动画)。
```
POST /rss/subscribe
```
Subscribe to an RSS feed for automatic ongoing downloads.
订阅 RSS 订阅源以自动下载连载中的动画。
---
## Search
## 搜索
### Search Bangumi (Server-Sent Events)
### 搜索番剧(Server-Sent Events)
```
GET /search/bangumi?keyword={keyword}&provider={provider}
```
Search for anime torrents. Returns results as a Server-Sent Events (SSE) stream for real-time updates.
搜索动画种子。以 Server-Sent Events (SSE) 流的形式返回结果,提供实时更新。
**Query Parameters:**
- `keyword` — Search keyword
- `provider` — Search provider (e.g., `mikan`, `nyaa`, `dmhy`)
**查询参数:**
- `keyword` — 搜索关键词
- `provider` — 搜索提供者(例如 `mikan`、`nyaa`、`dmhy`)
**Response:** SSE stream with parsed search results.
**响应:** 包含解析后搜索结果的 SSE 流。
### List Search Providers
### 列出搜索提供者
```
GET /search/provider
```
Get the list of available search providers.
获取可用搜索提供者的列表。
---
## Program Control
## 程序控制
### Get Status
### 获取状态
```
GET /status
```
Get program status including version, running state, and first_run flag.
获取程序状态,包括版本、运行状态和 first_run 标志。
**Response:**
**响应:**
```json
{
"status": "running",
@@ -400,99 +400,99 @@ Get program status including version, running state, and first_run flag.
}
```
### Start Program
### 启动程序
```
GET /start
```
Start the main program (RSS checking, downloading, renaming).
启动主程序(RSS 检查、下载、重命名)。
### Restart Program
### 重启程序
```
GET /restart
```
Restart the main program.
重启主程序。
### Stop Program
### 停止程序
```
GET /stop
```
Stop the main program (WebUI remains accessible).
停止主程序(WebUI 仍可访问)。
### Shutdown
### 关闭
```
GET /shutdown
```
Shutdown the entire application (restarts the Docker container).
关闭整个应用程序(重启 Docker 容器)。
### Check Downloader
### 检查下载器
```
GET /check/downloader
```
Test connectivity to the configured downloader (qBittorrent).
测试与已配置的下载器(qBittorrent)的连接。
---
## Downloader Management <Badge type="tip" text="v3.2+" />
## 下载器管理 <Badge type="tip" text="v3.2+" />
Manage torrents in the downloader directly from AutoBangumi.
直接从 AutoBangumi 管理下载器中的种子。
### List Torrents
### 列出种子
```
GET /downloader/torrents
```
Get all torrents in the Bangumi category.
获取 Bangumi 分类中的所有种子。
### Pause Torrents
### 暂停种子
```
POST /downloader/torrents/pause
```
Pause torrents by hash.
通过哈希暂停种子。
**Request Body:**
**请求体:**
```json
{
"hashes": ["hash1", "hash2"]
}
```
### Resume Torrents
### 恢复种子
```
POST /downloader/torrents/resume
```
Resume paused torrents by hash.
通过哈希恢复已暂停的种子。
**Request Body:**
**请求体:**
```json
{
"hashes": ["hash1", "hash2"]
}
```
### Delete Torrents
### 删除种子
```
POST /downloader/torrents/delete
```
Delete torrents with optional file deletion.
删除种子,可选择是否删除文件。
**Request Body:**
**请求体:**
```json
{
"hashes": ["hash1", "hash2"],
@@ -502,34 +502,34 @@ Delete torrents with optional file deletion.
---
## Setup Wizard <Badge type="tip" text="v3.2+" />
## 设置向导 <Badge type="tip" text="v3.2+" />
These endpoints are only available during first-run setup (before setup is complete). They do **not** require authentication. After setup completes, all endpoints return `403 Forbidden`.
这些端点仅在首次运行设置期间可用(设置完成前)。它们**不**需要认证。设置完成后,所有端点返回 `403 Forbidden`。
### Check Setup Status
### 检查设置状态
```
GET /setup/status
```
Check if setup wizard is needed (first run).
检查是否需要设置向导(首次运行)。
**Response:**
**响应:**
```json
{
"need_setup": true
}
```
### Test Downloader Connection
### 测试下载器连接
```
POST /setup/test-downloader
```
Test connection to a downloader with provided credentials.
使用提供的凭据测试与下载器的连接。
**Request Body:**
**请求体:**
```json
{
"type": "qbittorrent",
@@ -540,30 +540,30 @@ Test connection to a downloader with provided credentials.
}
```
### Test RSS Feed
### 测试 RSS 订阅源
```
POST /setup/test-rss
```
Validate an RSS feed URL is accessible and parseable.
验证 RSS 订阅源 URL 是否可访问和可解析。
**Request Body:**
**请求体:**
```json
{
"url": "https://mikanime.tv/RSS/MyBangumi?token=xxx"
}
```
### Test Notification
### 测试通知
```
POST /setup/test-notification
```
Send a test notification with provided settings.
使用提供的设置发送测试通知。
**Request Body:**
**请求体:**
```json
{
"type": "telegram",
@@ -572,48 +572,48 @@ Send a test notification with provided settings.
}
```
### Complete Setup
### 完成设置
```
POST /setup/complete
```
Save all configuration and mark setup as complete. Creates the sentinel file `config/.setup_complete`.
保存所有配置并将设置标记为完成。创建标记文件 `config/.setup_complete`。
**Request Body:** Full configuration object.
**请求体:** 完整配置对象。
---
## Logs
## 日志
### Get Logs
### 获取日志
```
GET /log
```
Retrieve the full application log file.
获取完整的应用程序日志文件。
### Clear Logs
### 清除日志
```
GET /log/clear
```
Clear the log file.
清除日志文件。
---
## Response Format
## 响应格式
All API responses follow a consistent format:
所有 API 响应遵循统一格式:
```json
{
"msg_en": "Success message in English",
"msg_zh": "Success message in Chinese",
"msg_zh": "成功消息(中文)",
"status": true
}
```
Error responses include appropriate HTTP status codes (400, 401, 403, 404, 500) with error messages in both languages.
错误响应包含适当的 HTTP 状态码(400、401、403、404、500)以及中英文错误消息。