Initial commit: crypto_key API key manager with PM2 and Ubuntu deploy docs

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-05-19 00:54:27 +08:00
commit 0203a65973
14 changed files with 1140 additions and 0 deletions
+106
View File
@@ -0,0 +1,106 @@
# crypto_key — 币圈 API 密钥管理工具
本地 Web 工具,管理多个交易所/平台 API 账户(账户名称、API Key、API Secret)。数据保存在本地 `data.json`,无登录。
| 项目 | 说明 |
|------|------|
| 仓库 | [git.bz121.com/dekun/crypto_key](https://git.bz121.com/dekun/crypto_key.git) |
| Ubuntu 部署路径 | `/opt/crypto_key` |
| 服务端口 | `5200` |
| 进程守护 | PM2 |
---
## 功能
- 账户数量不限,每项含 `username` / `api_key` / `api_secret`
- 黑色专业界面,列表展示 + 每项 3 个复制按钮(**复制始终为明文**)
- 可选界面打码显示,不影响复制内容
- 数据持久化至 `data.json`
---
## Ubuntu 服务器部署(/opt
完整步骤见 **[DEPLOY.md](./DEPLOY.md)**。
```bash
sudo git clone https://git.bz121.com/dekun/crypto_key.git /opt/crypto_key
cd /opt/crypto_key
sudo bash scripts/install-ubuntu.sh
```
访问(需在本机或通过 SSH 隧道):**http://127.0.0.1:5200**
```bash
pm2 status
pm2 logs api-key-manager
```
---
## 本地开发
```bash
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.py
```
浏览器打开 http://127.0.0.1:5200
PM2 守护:`./pm2-start.sh`Linux)或 `.\pm2-start.ps1`Windows
---
## 文件说明
| 文件 | 说明 |
|------|------|
| `app.py` | Flask 后端 |
| `index.html` | 前端页面 |
| `ecosystem.config.cjs` | PM2 配置 |
| `scripts/install-ubuntu.sh` | Ubuntu 一键安装 |
| `DEPLOY.md` | 完整部署文档 |
---
## 数据格式
```json
{
"id": "uuid",
"username": "账户名称",
"api_key": "API Key",
"api_secret": "API Secret"
}
```
---
## API
| 方法 | 路径 | 说明 |
|------|------|------|
| GET | `/` | 前端页面 |
| GET | `/api/accounts` | 获取全部账户 |
| POST | `/api/accounts` | 新增账户 |
| DELETE | `/api/accounts/<id>` | 删除账户 |
---
## 安全提示
- 无认证,仅绑定 `127.0.0.1`,请勿暴露公网
- `data.json` 为明文密钥,已 `.gitignore`,请定期备份
---
## 依赖
```
flask>=3.0.0,<4.0.0
```
服务器另需:Python 3.8+、Node.jsPM2