feat: implement hybrid database architecture and frontend encryption

- Add PostgreSQL + SQLite hybrid database support with automatic switching
- Implement frontend AES-GCM + RSA-OAEP encryption for sensitive data
- Add comprehensive DatabaseInterface with all required methods
- Fix compilation issues with interface consistency
- Update all database method signatures to use DatabaseInterface
- Add missing UpdateTraderInitialBalance method to PostgreSQL implementation
- Integrate RSA public key distribution via /api/config endpoint
- Add frontend crypto service with proper error handling
- Support graceful degradation between encrypted and plaintext transmission
- Add directory creation for RSA keys and PEM parsing fixes
- Test both SQLite and PostgreSQL modes successfully

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
icy
2025-11-06 01:50:06 +08:00
parent aecc5e58a1
commit 65053518d6
104 changed files with 16864 additions and 4152 deletions

View File

@@ -197,7 +197,7 @@ Details: [详情链接]
### 法律 & 合规
- ✅ 明确说明这是开源贡献,不是雇佣关系
- ✅ 确保贡献者同意 MIT License
- ✅ 确保贡献者同意 AGPL-3.0 License
- ✅ 保留最终合并决定权
### 资金管理

View File

@@ -23,7 +23,7 @@ Choose the method that best fits your needs:
**Quick Start:**
```bash
cp config.example.jsonc config.json
cp config.json.example config.json
./start.sh start --build
```

View File

@@ -21,7 +21,7 @@
**快速开始:**
```bash
cp config.example.jsonc config.json
cp config.json.example config.json
./start.sh start --build
```

View File

@@ -50,7 +50,7 @@ docker compose --version # Docker 24+ includes this, no separate installation n
```bash
# Copy configuration template
cp config.example.jsonc config.json
cp config.json.example config.json
# Edit configuration file with your API keys
nano config.json # or use any other editor
@@ -267,7 +267,7 @@ kill -9 <PID>
# ~~ls -la config.json~~
# ~~If not exists, copy template~~
# ~~cp config.example.jsonc config.json~~
# ~~cp config.json.example config.json~~
*Note: Now using SQLite database for configuration storage, no longer need config.json*
```

View File

@@ -55,7 +55,7 @@ docker compose --version # Docker 24+ 自带,无需单独安装
```bash
# 复制配置文件模板
cp config.example.jsonc config.json
cp config.json.example config.json
# 编辑配置文件,填入你的 API 密钥
nano config.json # 或使用其他编辑器
@@ -270,7 +270,7 @@ kill -9 <PID>
ls -la config.json
# 如果不存在,复制模板
cp config.example.jsonc config.json
cp config.json.example config.json
```
### 健康检查失败

View File

@@ -3,7 +3,7 @@
[![Go Version](https://img.shields.io/badge/Go-1.21+-00ADD8?style=flat&logo=go)](https://golang.org/)
[![React](https://img.shields.io/badge/React-18+-61DAFB?style=flat&logo=react)](https://reactjs.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?style=flat&logo=typescript)](https://www.typescriptlang.org/)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![License](https://img.shields.io/badge/License-AGPL--3.0-blue.svg)](LICENSE)
[![Backed by Amber.ac](https://img.shields.io/badge/Backed%20by-Amber.ac-orange.svg)](https://amber.ac)
**Языки / Languages:** [English](../../../README.md) | [中文](../zh-CN/README.md) | [Українська](../uk/README.md) | [Русский](../ru/README.md)
@@ -285,7 +285,7 @@ Docker автоматически обрабатывает все зависим
#### Шаг 1: Подготовьте конфигурацию
```bash
# Скопируйте шаблон конфигурации
cp config.example.jsonc config.json
cp config.json.example config.json
# Отредактируйте и заполните ваши API ключи
nano config.json # или используйте любой редактор
@@ -320,6 +320,7 @@ docker compose up -d --build
- **Русский**: См. документацию Docker (скоро будет доступно)
- **English**: See [DOCKER_DEPLOY.en.md](DOCKER_DEPLOY.en.md)
- **中文**: 查看 [DOCKER_DEPLOY.md](DOCKER_DEPLOY.md)
- **日本語**: [DOCKER_DEPLOY.ja.md](DOCKER_DEPLOY.ja.md)を参照
---
@@ -423,7 +424,7 @@ cd ..
**Шаг 1**: Скопируйте и переименуйте файл примера конфигурации
```bash
cp config.example.jsonc config.json
cp config.json.example config.json
```
**Шаг 2**: Отредактируйте `config.json` и заполните ваши API ключи

View File

@@ -3,7 +3,7 @@
[![Go Version](https://img.shields.io/badge/Go-1.21+-00ADD8?style=flat&logo=go)](https://golang.org/)
[![React](https://img.shields.io/badge/React-18+-61DAFB?style=flat&logo=react)](https://reactjs.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?style=flat&logo=typescript)](https://www.typescriptlang.org/)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![License](https://img.shields.io/badge/License-AGPL--3.0-blue.svg)](LICENSE)
[![Backed by Amber.ac](https://img.shields.io/badge/Backed%20by-Amber.ac-orange.svg)](https://amber.ac)
**Мови / Languages:** [English](../../../README.md) | [中文](../zh-CN/README.md) | [Українська](../uk/README.md) | [Русский](../ru/README.md)
@@ -288,7 +288,7 @@ Docker автоматично обробляє всі залежності (Go,
#### Крок 1: Підготуйте конфігурацію
```bash
# Скопіюйте шаблон конфігурації
cp config.example.jsonc config.json
cp config.json.example config.json
# Відредагуйте та заповніть ваші API ключі
nano config.json # або використайте будь-який редактор
@@ -323,6 +323,7 @@ docker compose up -d --build
- **Українська**: Дивіться документацію Docker (скоро буде доступно)
- **English**: See [DOCKER_DEPLOY.en.md](DOCKER_DEPLOY.en.md)
- **中文**: 查看 [DOCKER_DEPLOY.md](DOCKER_DEPLOY.md)
- **日本語**: [DOCKER_DEPLOY.ja.md](DOCKER_DEPLOY.ja.md)を参照
---
@@ -426,7 +427,7 @@ cd ..
**Крок 1**: Скопіюйте та перейменуйте файл прикладу конфігурації
```bash
cp config.example.jsonc config.json
cp config.json.example config.json
```
**Крок 2**: Відредагуйте `config.json` та заповніть ваші API ключі

View File

@@ -3,7 +3,7 @@
[![Go Version](https://img.shields.io/badge/Go-1.21+-00ADD8?style=flat&logo=go)](https://golang.org/)
[![React](https://img.shields.io/badge/React-18+-61DAFB?style=flat&logo=react)](https://reactjs.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?style=flat&logo=typescript)](https://www.typescriptlang.org/)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![License](https://img.shields.io/badge/License-AGPL--3.0-blue.svg)](LICENSE)
[![Backed by Amber.ac](https://img.shields.io/badge/Backed%20by-Amber.ac-orange.svg)](https://amber.ac)
**语言 / Languages:** [English](../../../README.md) | [中文](../zh-CN/README.md) | [Українська](../uk/README.md) | [Русский](../ru/README.md)
@@ -283,7 +283,7 @@ Docker会自动处理所有依赖Go、Node.js、TA-Lib和环境配置
#### 步骤1准备配置文件
```bash
# 复制配置文件模板
cp config.example.jsonc config.json
cp config.json.example config.json
# 编辑并填入你的API密钥
nano config.json # 或使用其他编辑器
@@ -319,6 +319,7 @@ docker compose up -d --build
**📖 详细的Docker部署教程故障排查和高级配置**
- **中文**: 查看 [DOCKER_DEPLOY.md](DOCKER_DEPLOY.md)
- **English**: See [DOCKER_DEPLOY.en.md](DOCKER_DEPLOY.en.md)
- **日本語**: [DOCKER_DEPLOY.ja.md](DOCKER_DEPLOY.ja.md)を参照
---
@@ -422,7 +423,7 @@ cd ..
~~**步骤1**:复制并重命名示例配置文件~~
```bash
cp config.example.jsonc config.json
cp config.json.example config.json
```
~~**步骤2**:编辑`config.json`填入您的API密钥~~
@@ -1262,7 +1263,15 @@ sudo apt-get install libta-lib0-dev
## 📄 开源协议
MIT License - 详见 [LICENSE](LICENSE) 文件
本项目采用 **GNU Affero 通用公共许可证 v3.0 (AGPL-3.0)** - 详见 [LICENSE](LICENSE) 文件
**这意味着什么:**
- ✅ 你可以使用、修改和分发此软件
- ✅ 你必须公开你修改版本的源代码
- ✅ 如果你在服务器上运行修改版本,必须向用户提供源代码
- ✅ 所有衍生作品也必须使用 AGPL-3.0 许可证
如需商业许可或有疑问,请联系维护者。
---