Add referral system and user balance tracking

Introduce balance field to User model with Alembic migration. Add
referral menu, admin /refpay command, and deep link sharing. Update
Dockerfile to multi-stage build and add Postgres service to compose.
Fix deep link parsing logic and conditional proxy initialization.
This commit is contained in:
2026-04-10 22:20:53 +07:00
parent 60de871e0c
commit 0ed0ad2b92
17 changed files with 337 additions and 80 deletions

29
.env.example Normal file
View File

@@ -0,0 +1,29 @@
# Telegram Bot Token (Required)
# Get it from @BotFather on Telegram
BOT_TOKEN=your_bot_token_here
# Telegram Admin Group ID (Required)
# The numeric ID of the group where admin notifications will be sent
ADMIN_GROUP_ID=your_admin_group_id_here
# Remnawave Configuration (Required)
REMNAWAVE_URL=https://your-remnawave-instance.com
REMNAWAVE_TOKEN=your_remnawave_api_token_here
SUBSCRIPTION_URL=https://your-subscription-page.com
# PostgreSQL Database Configuration
# These variables are used by docker-compose to set up the database container
POSTGRES_USER=malenia
POSTGRES_PASSWORD=change_me_to_a_secure_password
POSTGRES_DB=malenia_db
# Proxy Configuration (Optional)
# Leave empty if no proxy is needed
PROXY=
# Pricing and Limits Configuration (Optional - defaults provided in code)
MIN_DEVICES=3
MAX_DEVICES=12
PER_DEVICE_COST=50
WHITELIST_COST=100
WHITELIST_DEVICE_THRESHOLD=6