Webapp hardening + perf / CSP nonce-only / plugin-builder API guard + token autogen / cookie Secure / XSS fixes (QR, postMessage) / auth-me SWR dedup / SSR fetch cache / entry-capture redesign (gift/partner/referral) / payment webhooks (yoomoney sign, tribute trb_user_id) / email-only partners+referrals / INSTALL guide

This commit is contained in:
Vladless
2026-04-18 18:12:05 +00:00
parent cc2c9fbdba
commit 0b17346cb6
12 changed files with 122 additions and 15 deletions
+19 -7
View File
@@ -159,13 +159,25 @@ async def redeem_gift(
try:
from database.web_notifications import notify_web
await notify_web(
session,
tg_id=wu.tg_id,
type="gift_received",
template_vars={"name": tariff["name"], "duration": duration_text},
data={"gift_id": gift_info.gift_id, "tariff_id": int(tariff["id"])},
)
if wu.tg_id is not None:
await notify_web(
session,
tg_id=wu.tg_id,
type="gift_received",
template_vars={"name": tariff["name"], "duration": duration_text},
data={"gift_id": gift_info.gift_id, "tariff_id": int(tariff["id"])},
)
if gift_info.sender_user_id:
sender = await resolve_user_optional(session, gift_info.sender_user_id)
if sender and sender.tg_id is not None:
await notify_web(
session,
tg_id=int(sender.tg_id),
type="gift_redeemed",
title="Ваш подарок активирован",
message=f"Получатель активировал подарок — подписка на {duration_text}.",
data={"gift_id": gift_info.gift_id, "tariff_id": int(tariff["id"])},
)
except Exception as e:
logger.warning("[Gifts] Ошибка отправки уведомления о подарке: {}", e)