Skip to content

Переделка фронтенда - #82

Open
Andrey1771 wants to merge 95 commits into
mainfrom
new_frontend
Open

Andrey1771 wants to merge 95 commits into
mainfrom
new_frontend

Conversation

@Andrey1771

Copy link
Copy Markdown
Owner

No description provided.

Andrey1771 and others added 30 commits July 16, 2026 01:08
…а + подписки

Implements email newsletter infrastructure with subscriber management, campaign scheduling, and automatic deals digest.

Backend:
- NewsletterService: subscription (double opt-in for guests, instant for logged-in users), confirmation, unsubscribe
- NewsletterDispatcher: queues and sends campaigns, manages automatic daily deals digest
- Admin endpoints for subscriber list, stats, CSV export, and campaign management
- SMTP mail sender with HTML/plain-text support, markdown-lite body renderer
- Localized system emails (en, ru, uk, pl) with per-subscriber language
- Rate limiting (6 subscriptions per IP per hour)
- Integration tests with ephemeral MongoDB, capturing mail, and test auth handler

Frontend:
- Subscription forms on deals page and homepage with inline validation and status feedback
- Confirm/unsubscribe pages triggered by email links (one-click, no sign-in required)
- Personal newsletter settings in account preferences (linked to backend subscription)
- Admin newsletter page: subscriber search/filter/export, campaign composer with live preview, campaign history
- Visual effects: scroll-reveal animations, floating elements, texture overlays
- Local storage to avoid re-prompting on already-subscribed device

Database: MongoDB indexes on subscriber email (unique), confirm/unsubscribe tokens; campaign and state collections.
…проекта + исправления бота + возврат его старого кода + чистка от лишнего

Major architectural refactoring:

- **Bot separation**: Move bot to standalone `SuperBot.BotApi` container with separate Dockerfile. Bot now handles only Telegram communication (webhooks, messages, payments).

- **Event-driven**: Site and bot communicate via MongoDB outbox (`BotOutboxEvent`), not direct coupling. Site publishes events; bot worker consumes them. Enables independent scaling and deployment.

- **New features**:
  - Telegram Mini App (/tg): In-app storefront with Telegram Stars payments
  - Account linking: Deep-links (/start <token>) bind Telegram to site account
  - Telegram Stars payments: XTR currency for game purchases in bot
  - BTCPay crypto (testnet demo): Alternative payment method
  - Game discount alerts: Wishlist notifications via Telegram
  - Support escalation: Chat issues routed to admin Telegram
  - BotOutbox worker: Processes events, sends notifications

- **Cleanup**:
  - Remove unused features: Investment, TopUp, Withdrawal, International Transfers commands/handlers
  - Remove YooKassa integration
  - Remove Steam orders legacy code
  - Remove in-memory bot state (move to MongoDB for stateless replicas)
  - Remove JSON resource service (now MongoDB-backed)

- **Refactoring**:
  - `BotStateService` → `MongoBotStateService` (persistent across restarts)
  - `KeyFulfillmentService` in Infrastructure (shared by site and bot)
  - Game cover resolution logic (`GameCoverUrlResolver`)
  - Bot state removed from ChatState, only DialogState remains
  - Keycloak integration in bot-api for admin/account endpoints
  - nginx routing updated for bot upstream (/api/Telegram, /api/admin/bot, /api/miniapp)

- **Frontend**:
  - Mini App page (Telegram WebApp SDK, theme-aware, cart, checkout)
  - Telegram linking UI in account settings
  - Cart deep-link support from bot (/cart?add=gameId)
  - Crypto payment UI (BTCPay testnet)
  - Bot status admin page (webhook, broadcast, logs)

docker-compose.yml updated with bot service. All configs in .env.example.
Implement idempotent order finalization via both client-side confirm and Stripe webhooks. Extract pricing calculation to server (CheckoutPricingService) to prevent price manipulation — client now sends only gameId+quantity. Add StripeWebhookController to handle payment_intent.succeeded events, ensuring orders survive if customer closes tab. Refactor PaymentsController to delegate finalization logic to OrderFinalizationService. Update frontend checkout to request auth before payment and trust server totals.
…ачи в админку

Prevent price tampering by moving price calculation to the server for crypto payments, mirroring the Stripe checkout approach. Client now sends only gameId and quantity; the server computes pricing using the catalog. Additionally, track fulfillment failures separately from payment failures to ensure admin visibility of key delivery issues.
Adds PaymentReconciliationService to handle refunds and chargebacks post-payment, updating order status and flagging issues for admin review. Implements webhook handlers for `charge.refunded` and `charge.dispute.created` events. Moves currency determination to server-side only for security—clients can no longer specify currency in requests. Adds GetByPaymentIntentIdAsync to order repository for efficient order lookup by Stripe PaymentIntent ID. Updates documentation with webhook event details and local development instructions for Stripe CLI.
…перебора

Replace concurrent read-write pattern with atomic lock claiming using MongoDB FindOneAndUpdateAsync. This eliminates the race condition where multiple finalizers (client confirm + webhook) could both attempt to create duplicate orders.

Also optimize order lookups by using GetByPaymentIntentIdAsync with the ix_orders_payment_intent_unique index instead of fetching all user orders into memory.
Implements deduplication for Stripe webhook events to handle their 'at-least-once' delivery guarantee, preventing duplicate order processing. Adds logic to reuse existing payment intents instead of creating new ones for each cart change, reducing dashboard clutter and improving payment funnel. Includes idempotency keys for payment intent creation and better logging for troubleshooting webhook and payment issues.
Add guest-delivery verification and improve key-pool handling. New flow: guest orders set RequiresDeliveryVerification and keys are held until the buyer clicks an HMAC-signed verification link. Implemented IDeliveryMailer (DeliveryMailService), DeliveryVerificationTokenService, resend/verify endpoints, and UI for guest email, resend and delivery-confirmed page. Added UnverifiedOrderRefundService to auto-refund unverified guest orders and wired Stripe refund support. Reworked game-key storage: GameKeyHash, partial unique index by (GameId, KeyHash), pool dedupe, void/purge/edit APIs and admin listing/overview/owed endpoints. KeyFulfillment now returns delivered keys; backfill emails buyers. Updated templates, assets, tests and MongoDB initializer.
Implements reader comments and admin moderation across backend and frontend.

Backend: adds BlogComment/BlogCommentBan entities, MongoDB DB models, AutoMapper mappings, BlogCommentMongoDbRepository, controllers (public and admin), Mongo indexes, DI registration and integration tests covering posting, listing, rate-limit, hide/delete and banning flows. Rate-limiting and ban checks included.

Frontend: comment UI (BlogComments), admin comments page and services, PostCoverArt component + styles, SortSelect refactor, ScrollToTop, blog post page/hero/toc/share/ui refinements, types and API client updates.

Overall: end-to-end support for posting, listing, moderating and banning comments, plus UI polish and tests.
…ых для демо

Add a demo seeder (docker compose profile) and a full set of idempotent, deterministic seed scripts (seeds/* + README + run-all.sh) to populate DB and uploads for demos. Introduce AdminApp as a single lazily-loaded module, update routing to /admin/* with Suspense fallback, and change webpack chunkFilename to include contenthash in production to avoid stale cache. Misc UI tweaks: manifest (app name, favicon svg, colors), use PostCoverArt for news covers and related CSS, add route-chunk-loading placeholder, and enable future BrowserRouter flags.
… + программы из Steam + настройки демо-сервера и правки
…ntry

подправил настройку скидок в админке
Из main не переносится Telegram-роутер для заказов Kwork (PR #79) — это код другого проекта, в ветке codex/add-telegram-command-system-for-bot он сохранён. Макеты каталога (docs/ui/game-catalog-*.png) уже есть в new_frontend. Старый .env из main в текущую версию не попадает.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant