feat: Add configurable draw cycles, improve UX

Backend:
- Add configurable draw cycle settings (minutes/hourly/daily/weekly/custom)
- Add CYCLE_TYPE, CYCLE_INTERVAL_*, CYCLE_DAILY_TIME, CYCLE_WEEKLY_* env vars
- Add SALES_CLOSE_BEFORE_DRAW_MINUTES and CYCLES_TO_GENERATE_AHEAD
- Fix SQLite parameter issue in scheduler

Frontend:
- Add 'Save This Link' section with copy button on ticket status page
- Improve draw animation to show immediately when draw starts
- Show 'Waiting for next round...' instead of 'Drawing Now!' after draw
- Hide Buy Tickets button when waiting for next round
- Skip draw animation if no tickets were sold
- Keep winner screen open longer (15s) for next cycle to load
- Auto-refresh to next lottery cycle after draw

Telegram Bot:
- Various improvements and fixes
This commit is contained in:
Michilis
2025-11-28 03:24:17 +00:00
parent f743a6749c
commit 918d3bc31e
21 changed files with 584 additions and 140 deletions

View File

@@ -73,6 +73,46 @@ DEFAULT_HOUSE_FEE_PERCENT=5
# Maximum Lightning payout attempts before drawing a new winner
PAYOUT_MAX_ATTEMPTS=2
# ======================
# Draw Cycle Configuration
# ======================
# Cycle type: "minutes" | "hourly" | "daily" | "weekly" | "custom"
CYCLE_TYPE=hourly
# ---- For MINUTES cycle ----
# Draw every X minutes (e.g., 30 = every 30 minutes)
CYCLE_INTERVAL_MINUTES=60
# ---- For HOURLY cycle ----
# Draw every X hours (e.g., 1 = every hour, 4 = every 4 hours)
CYCLE_INTERVAL_HOURS=1
# ---- For DAILY cycle ----
# Draw time in 24-hour format (HH:MM in UTC)
# Example: 18:00 = 6 PM UTC
CYCLE_DAILY_TIME=18:00
# ---- For WEEKLY cycle ----
# Day of week: 0=Sunday, 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday
CYCLE_WEEKLY_DAY=6
# Draw time in 24-hour format (HH:MM in UTC)
CYCLE_WEEKLY_TIME=20:00
# ---- For CUSTOM cycle (advanced) ----
# Cron expression for custom schedules
# Format: "minute hour day-of-month month day-of-week"
# Example: "0 */4 * * *" = every 4 hours
# Example: "0 20 * * 6" = every Saturday at 8 PM
# Example: "30 12,18 * * *" = 12:30 PM and 6:30 PM daily
CYCLE_CRON_EXPRESSION=0 * * * *
# ---- Sales Window ----
# How many minutes before the draw to stop accepting tickets
SALES_CLOSE_BEFORE_DRAW_MINUTES=5
# How many cycles to pre-generate in advance
CYCLES_TO_GENERATE_AHEAD=5
# ======================
# Notes
# ======================