继续提交

This commit is contained in:
2025-12-13 21:33:26 +08:00
parent 7a731d44e3
commit fa77e0a65f
2215 changed files with 392858 additions and 2 deletions

View File

@@ -0,0 +1,35 @@
# Mengya Drift Bottle Backend
Flask API that powers the React frontend located in `../mengyadriftbottle-frontend`.
## Features
- JSON-first `/api` endpoints for throwing, picking up, and reacting to bottles
- Rate limiting per IP (5 seconds) for throw/pickup actions
- File-backed persistence with automatic schema upgrades
- Lightweight token portal via `/admin?token=...` for quick moderation
- Full legacy dashboard (`/admin/login`) preserved for session-based moderation
- CORS enabled for local development via Vite
## Quick Start
```bash
cd mengyadriftbottle-backend
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python app.py
```
The server listens on `http://localhost:5002` by default and exposes the API under `http://localhost:5002/api`.
## Environment Variables
| Name | Description | Default |
| ---- | ----------- | ------- |
| `DRIFT_BOTTLE_SECRET` | Secret key for Flask sessions | Random value generated at runtime |
| `DRIFT_BOTTLE_ADMIN_TOKEN` | Token required for `/admin?token=...` | `shumengya520` |
## File Storage
Bottle data, config, mottos, and filter words continue to use the JSON files located at the repository root (`../bottles.json`, etc.). The backend automatically creates them if missing.