Skip to content

feat: web notification#166

Open
CedrikNikita wants to merge 1 commit into
developfrom
feature/web-notifications
Open

feat: web notification#166
CedrikNikita wants to merge 1 commit into
developfrom
feature/web-notifications

Conversation

@CedrikNikita

@CedrikNikita CedrikNikita commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Note

High Risk
Touches authentication (feed sessions), new persistence and delivery paths, and proxy trust settings that affect rate limiting and IP spoofing if misconfigured; large surface area with many edge cases around dedup, retention, and multi-channel fan-out.

Overview
Adds a full web notification stack on top of the existing Expo mobile pipeline: persisted per-address feed rows, REST + bearer sessions minted from æternity signatures, a /notifications Socket.IO namespace for live notification / unread-count, and a Web Push (VAPID) channel with Bull-backed sends and subscription management.

Database & delivery: New notifications and web_push_subscriptions tables (TypeORM migration WebNotificationFeed1718900000020, manual SQL doc updated). DatabaseChannel writes feed rows, dedups per channel, and emits live updates; WebPushChannel enqueues per-endpoint jobs. Invitation-claimed and post-comment types now route through expo, database, and web-push with toDatabase(); incoming transfers stay Expo-only (no feed rows for every SpendTx). Social listeners drop the mobile hasDevices gate so web-only users still get feed/push.

Auth & ops: Feed challenge/session flow reuses device nonces with a distinct signed message; FeedSessionGuard binds bearer tokens to :address. Hourly retention cron caps rows per address and prunes old read items. Config/env covers session TTL, socket caps, handshake rate limits per IP, VAPID keys, and opt-in NOTIF_DEBUG smoke tooling.

Proxy fix: TRUST_PROXY is parsed in shared trust-proxy / client-ip helpers, applied in main.ts for Express and in the notifications gateway so per-IP rate limits and socket handshake caps use real client IPs behind nginx/ELB/Cloudflare—not the proxy peer.

Reviewed by Cursor Bugbot for commit 4bd500d. Bugbot is set up for automated code reviews on this repo. Configure here.

@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from ef16119 to d970013 Compare July 14, 2026 09:44
@CedrikNikita
CedrikNikita force-pushed the develop branch 2 times, most recently from 2718729 to bb7e283 Compare July 15, 2026 05:27
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from d970013 to 0396f5a Compare July 16, 2026 08:25
@CedrikNikita
CedrikNikita marked this pull request as ready for review July 16, 2026 08:25
Comment thread src/notifications/notifications.gateway.ts
Comment thread src/notifications/services/notification-spam.debug.ts
Comment thread src/notifications/channels/web-push.channel.ts Outdated
Comment thread docs/examples/notification-feed-client.ts Outdated
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from 0396f5a to 26d120b Compare July 16, 2026 09:03
Comment thread docs/examples/notification-feed-client.ts Outdated
Comment thread src/notifications/services/feed-session.service.ts
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from 26d120b to 2f88566 Compare July 16, 2026 09:53
Comment thread src/migrations/1718900000010-WebNotificationFeed.ts Outdated
Comment thread docs/examples/notification-feed-client.ts Outdated
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from 2f88566 to 908a38a Compare July 16, 2026 18:55
Comment thread docs/examples/notification-feed-client.ts Outdated
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from 908a38a to 6e29e1b Compare July 16, 2026 19:04
Comment thread src/notifications/web-push/web-push.client.ts Outdated
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from 6e29e1b to 472602a Compare July 16, 2026 19:43
Comment thread src/notifications/channels/database.channel.ts Outdated
Comment thread src/notifications/queues/send-web-push.queue.ts
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from 472602a to db82306 Compare July 17, 2026 10:29
Comment thread src/notifications/services/notification-feed.service.ts
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from db82306 to b7e48cf Compare July 17, 2026 11:40
Comment thread docs/examples/notification-feed-client.ts Outdated
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from b7e48cf to 3b982fa Compare July 17, 2026 11:50
Comment thread src/notifications/services/notification-feed.service.ts Outdated
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from 3b982fa to ef2c09f Compare July 17, 2026 12:08
Comment thread src/notifications/services/notification-feed.service.ts Outdated
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from ef2c09f to ad5735e Compare July 18, 2026 11:39
Comment thread src/notifications/notifications.gateway.ts
Comment thread src/notifications/services/web-push-subscription.service.ts
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from ad5735e to 2dc998d Compare July 18, 2026 12:13
@CedrikNikita
CedrikNikita force-pushed the feature/web-notifications branch from 2dc998d to 4bd500d Compare July 18, 2026 12:20

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4bd500d. Configure here.

import { NotificationsGateway } from './notifications.gateway';
import { FeedSessionGuard } from './guards/feed-session.guard';
// ⚠️ TEMPORARY DEBUG — remove this import + its provider entry below.
import { NotificationSpamDebugService } from './services/notification-spam.debug';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary debug spam left in

Medium Severity

NotificationSpamDebugService and the gateway/send-web-push [TEMP] / [TEMP-PUSH] traces are marked temporary to remove, yet they ship in this feature. When NOTIF_DEBUG=true, the interval emits live socket events and real VAPID pushes every 10s while logging at error level.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4bd500d. Configure here.

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