Commit Graph

55 Commits

Author SHA1 Message Date
c0mrade 335be66980 feat: multi-subscription support (1 user = N subscriptions)
- Add MULTI_TARIFF_ENABLED feature flag for gradual rollout
- Migration 0041: remove unique constraint on subscriptions.user_id
- Migration 0042: add remnawave_short_id (NOT NULL, UNIQUE) to subscriptions
- Each subscription gets its own Remnawave user (user_{tg_id}_{short_id})
- Add _resolve_subscription() to all 30+ bot handlers for per-subscription routing
- Add my_subscriptions.py with list/detail views and delegation handlers
- Refactor cabinet subscription.py (4687 lines -> 10 focused modules)
- Add subscription_id parameter to all cabinet API endpoints
- Adapt all services: autopay, wheel, contests, campaign, guest purchase,
  monitoring, blocked users, account merge, promo codes, payments
- Replace all user.subscription (singular) with user.subscriptions iteration
- IDOR protection via get_subscription_by_id_for_user on all endpoints
- Full backward compatibility: MULTI_TARIFF_ENABLED=False = legacy behavior
2026-03-23 18:37:17 +03:00
Fringg 67da390371 feat: show both bot and cabinet referral links everywhere
Previously the bot showed only one referral link (cabinet when CABINET_URL
is set, bot otherwise). Users who received the cabinet link were confused —
they opened a web registration form instead of being directed to the bot.

Now the bot, cabinet API, and miniapp API all return both links:
- Bot link (t.me deep link) — always shown
- Cabinet link (web registration) — shown when CABINET_URL is configured

Changes:
- Add get_bot_referral_link() and get_cabinet_referral_link() to config
- Refactor config methods to eliminate code duplication
- Update bot referral handler to display both links
- Fix switch_inline_query 256-char limit with auto-truncation
- Add html_escape() to all user-controlled strings in HTML messages
- Add translations for 5 new keys in all 5 locale files (ru/en/ua/zh/fa)
- Simplify cabinet route to use new methods instead of inline URL construction
- Add bot_referral_link to MiniApp API schema and response
2026-03-20 23:12:22 +03:00
firewookie fd3466b75c fix PR problems 2026-03-10 14:29:29 +05:00
c0mrade 9a2aea038a chore: add uv package manager and ruff linter configuration
- Add pyproject.toml with uv and ruff configuration
- Pin Python version to 3.13 via .python-version
- Add Makefile commands: lint, format, fix
- Apply ruff formatting to entire codebase
- Remove unused imports (base64 in yookassa/simple_subscription)
- Update .gitignore for new config files
2026-01-24 17:45:27 +03:00
Egor c9cbb81054 Add files via upload 2026-01-23 11:29:08 +03:00
Egor b7a05f7cd1 Update miniapp.py 2026-01-20 02:14:42 +03:00
Egor 2e77c5b74e Update miniapp.py 2026-01-15 17:34:39 +03:00
Egor 0ac2a7a62b Update miniapp.py 2026-01-12 17:58:50 +03:00
Egor 76b521879e Update miniapp.py 2026-01-11 05:21:03 +03:00
Egor 1586a3fe9a Update miniapp.py 2026-01-11 05:08:21 +03:00
Egor cda70afdef Update miniapp.py 2026-01-11 04:57:32 +03:00
Egor 9dacd3be24 Update miniapp.py 2026-01-11 04:51:06 +03:00
Egor b213f7deb4 Update miniapp.py 2026-01-11 04:08:11 +03:00
Egor 3117d02c2f Update miniapp.py 2026-01-11 02:58:08 +03:00
Egor deae83d2cd Update miniapp.py 2026-01-11 02:20:43 +03:00
Egor c5a35cd254 Update miniapp.py 2026-01-10 21:36:31 +03:00
Egor 60846ad06b Update miniapp.py 2026-01-10 21:29:55 +03:00
Egor 16e70bff46 Update miniapp.py 2026-01-10 21:14:40 +03:00
Egor cfdfe1ccd1 Update miniapp.py 2026-01-07 17:34:39 +03:00
Egor 48cb19170b Update miniapp.py 2026-01-07 02:24:30 +03:00
Egor f5a6dbdeec Serve miniapp app-config and fix maintenance schema 2025-11-25 04:26:54 +03:00
Egor a3532e5878 Handle CryptoBot renewal payload fallbacks 2025-11-11 13:06:10 +03:00
Egor 68c125ba14 feat: expose integration metadata for miniapp payments 2025-11-11 08:11:42 +03:00
Egor cb6d51ed3d Remove trial squad override setting 2025-11-08 07:55:24 +03:00
Egor aa03384012 Remove referred user reward setting 2025-10-31 20:38:38 +03:00
Egor 0c93516056 feat: make MulenPay display name configurable 2025-10-19 01:55:10 +03:00
Egor 436efcdd3e Add WATA payment support to miniapp API and tests 2025-10-15 01:50:34 +03:00
Egor e1b7af2990 Use configured Happ redirect template in miniapp 2025-10-12 03:09:25 +03:00
Egor fe98d4391f Allow same-day autopay normalization 2025-10-11 05:48:04 +03:00
Egor d327ad9379 Revert "Revert "Hide connection lists until subscription is active"" 2025-10-11 03:29:49 +03:00
Egor 5cb4479a70 Revert "Add floating connect button for installation guide" 2025-10-11 03:29:35 +03:00
Egor 15ed087142 Refine mini app connect entry point 2025-10-11 03:27:06 +03:00
Egor 001f35ed89 Adjust subscription purchase card spacing 2025-10-10 21:36:44 +03:00
Egor 51a1db0680 Hide inactive miniapp servers during purchase 2025-10-10 10:52:11 +03:00
Egor b2f88e75d5 Revert "Harden miniapp purchase period resolution" 2025-10-10 09:59:22 +03:00
Egor 2a7969716a Harden miniapp purchase period resolution 2025-10-10 09:57:37 +03:00
Egor 36ac94468a Fix miniapp confirmations and guard traffic updates 2025-10-10 07:19:38 +03:00
Egor 7027fa91c3 Revert "Add miniapp subscription settings API endpoints" 2025-10-10 06:12:48 +03:00
Egor e6923a0d0a Add miniapp subscription settings API endpoints 2025-10-10 06:07:53 +03:00
Egor b5c8b4218c Preserve normalized Stars invoice amounts 2025-10-10 04:48:50 +03:00
Egor aa763403c6 Add device removal support to miniapp 2025-10-09 08:01:13 +03:00
Egor 790cd6bab3 Update referral terms labels 2025-10-09 07:40:57 +03:00
Egor a83bc25bd0 Improve promo code button layout on mini app 2025-10-09 06:32:34 +03:00
Egor dcd9074136 Expose legal documents in mini app 2025-10-09 06:02:37 +03:00
Egor 1d09006b7c Display active test access promo offers 2025-10-09 05:19:44 +03:00
Egor 63edfa852d Improve promo section presentation and discounts 2025-10-09 04:03:37 +03:00
Egor 7c96b0f71c Add purchase link support to mini app error state 2025-10-01 06:01:12 +03:00
Egor 450d75227b Revert "Revert "Revert "Add configurable purchase link and direct Happ flow in miniapp""" 2025-10-01 05:26:48 +03:00
Egor 777e243bcd Revert "Revert "Add configurable purchase link and direct Happ flow in miniapp"" 2025-10-01 05:24:52 +03:00
Egor e26223a7d8 Revert "Add configurable purchase link and direct Happ flow in miniapp" 2025-10-01 05:24:28 +03:00