Commit Graph
1 Commits
Author SHA1 Message Date
Abolfazl Ranjbaran 6498c34fff feat(plans): free vs pro subscription with per-file caps and operator grants
- two plans in sokhan/core/plans.py: free (10-min files, 30 min/month)
  and pro (180-min files, 1200 min/month, only while unexpired);
  expired subscribers fall back to free limits automatically
- both upload paths enforce the gates: POST /jobs probes duration before
  creating the job, POST /v1/audio/transcriptions after the inline decode;
  over-limit uploads answer HTTP 402 with detail.code file_too_long or
  quota_exceeded and the stored audio is deleted on rejection
- operator API: GET/POST /admin/users/{email}/plan behind a constant-time
  X-Admin-Key (503 unless ADMIN_API_KEY is set); pro grants take N days
  and renewals stack on the remaining time
- GET /plans publishes the catalogue; GET /quota reports plan, expiry and
  the per-file cap
- bot: /upgrade renders the catalogue, /quota is plan-aware, voices longer
  than the cap are refused before download, 402 codes map to dedicated
  Persian messages (FileTooLongError vs QuotaError)
- web: upload screen shows plan + per-file cap and renders targeted 402
  messages (fa/en); ApiError now parses structured detail codes
- alembic 0004 adds users.plan / plan_expires_at; .env.example, README and
  CHANGELOG 1.4.0 updated; stale __version__ 1.1.0 -> 1.4.0
- tests: 18 backend plan/subscription tests + 4 bot client tests
  (httpx.MockTransport); suite 176 passed, ruff + mypy clean
2026-11-23 07:56:57 +00:00