### 🚀 Изменено - Упрощение архитектуры - **Генерация миниатюр**: Полностью удалена из Quoter, теперь управляется Vercel Edge API - **Очистка legacy кода**: Удалены все функции генерации миниатюр и сложность - **Документация**: Сокращена с 17 файлов до 7, следуя принципам KISS/DRY - **Смена фокуса**: Quoter теперь сосредоточен на upload + storage, Vercel обрабатывает миниатюры - **Логирование запросов**: Добавлена аналитика источников для оптимизации CORS whitelist - **Реализация таймаутов**: Добавлены настраиваемые таймауты для S3, Redis и внешних операций - **Упрощенная безопасность**: Удален сложный rate limiting, оставлена только необходимая защита upload ### 📝 Обновлено - Консолидирована документация в практическую структуру: - Основной README.md с быстрым стартом - docs/SETUP.md для конфигурации и развертывания - Упрощенный features.md с фокусом на основную функциональность - Добавлен акцент на Vercel по всему коду и документации ### 🗑️ Удалено - Избыточные файлы документации (api-reference, deployment, development, и т.д.) - Дублирующийся контент в нескольких документах - Излишне детальная документация для простого файлового прокси 💋 **Упрощение**: KISS принцип применен - убрали избыточность, оставили суть.
91 lines
2.2 KiB
Markdown
91 lines
2.2 KiB
Markdown
# Quoter 🚀
|
|
|
|
> Simple file upload proxy with quotas. Upload to S3, thumbnails via Vercel.
|
|
|
|
**Focus**: Upload + Storage. Thumbnails managed by Vercel Edge API for better performance.
|
|
|
|
## What it does
|
|
|
|
- 📤 **Upload files** to S3/Storj with user quotas
|
|
- 🔐 **JWT authentication** with session management
|
|
- 📦 **File serving** with caching and optimization
|
|
- 🌐 **CORS support** for web apps
|
|
|
|
## 🚀 Quick Start
|
|
|
|
```bash
|
|
# Setup
|
|
cargo build
|
|
cp .env.example .env # Configure environment
|
|
cargo run
|
|
|
|
# Test
|
|
curl http://localhost:8080/ # Health check
|
|
```
|
|
|
|
## 🔧 API
|
|
|
|
| Method | Endpoint | Description |
|
|
|--------|----------|-------------|
|
|
| `GET` | `/` | Health check or user info (need auth token) |
|
|
| `POST` | `/` | Upload file (need auth token) |
|
|
| `GET` | `/{filename}` | Get file or thumbnail |
|
|
|
|
### Upload file
|
|
```bash
|
|
curl -X POST http://localhost:8080/ \
|
|
-H "Authorization: Bearer your-token" \
|
|
-F "file=@image.jpg"
|
|
```
|
|
|
|
### Get thumbnail
|
|
```bash
|
|
# Legacy thumbnails (fallback only)
|
|
curl http://localhost:8080/image_300.jpg
|
|
|
|
# 💡 Recommended: Use Vercel Image API
|
|
https://yoursite.com/_next/image?url=https://files.dscrs.site/image.jpg&w=300&q=75
|
|
```
|
|
|
|
## 🏗️ Architecture & Setup
|
|
|
|
**Simple 3-tier architecture:**
|
|
- **Upload**: Quoter (auth + quotas + S3 storage)
|
|
- **Download**: Vercel Edge API (thumbnails + optimization)
|
|
- **Storage**: S3/Storj (files) + Redis (quotas/cache)
|
|
|
|
```
|
|
Upload: Client → Quoter → S3/Storj
|
|
Download: Client → Vercel → Quoter (fallback)
|
|
```
|
|
|
|
💋 **Simplified approach**: Quoter handles uploads, Vercel handles thumbnails.
|
|
|
|
## 📋 Environment Setup
|
|
|
|
```bash
|
|
# Required
|
|
REDIS_URL=redis://localhost:6379
|
|
STORJ_ACCESS_KEY=your-key
|
|
STORJ_SECRET_KEY=your-secret
|
|
JWT_SECRET=your-secret
|
|
|
|
# Optional
|
|
PORT=8080
|
|
RUST_LOG=info
|
|
```
|
|
|
|
## 🧪 Testing
|
|
|
|
```bash
|
|
cargo test # 36 tests passing
|
|
./scripts/test-coverage.sh # Coverage report
|
|
```
|
|
|
|
## 📚 Documentation
|
|
|
|
- [`docs/configuration.md`](./docs/configuration.md) - Environment setup
|
|
- [`docs/architecture.md`](./docs/architecture.md) - Technical details
|
|
- [`docs/vercel-og-integration.md`](./docs/vercel-og-integration.md) - Vercel integration
|
|
|
|
For detailed setup and deployment instructions, see the docs folder. |