[PR #238] [MERGED] feat: add notification system with Ntfy.sh and Apprise support #1603

Closed
opened 2026-04-24 18:21:22 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/238
Author: @arunavo4
Created: 3/18/2026
Status: Merged
Merged: 3/18/2026
Merged by: @arunavo4

Base: mainHead: feat/231-notifications


📝 Commits (4)

  • 2141f62 feat: add notification system with Ntfy.sh and Apprise providers (#231)
  • 09d837c fix: address review findings for notification system
  • 2c26017 fix notification gating and config validation
  • 109bb00 trim sync notification details

📊 Changes

20 files changed (+3497 additions, -20 deletions)

View changed files

docs/NOTIFICATIONS.md (+88 -0)
drizzle/0011_notification_config.sql (+1 -0)
drizzle/meta/0011_snapshot.json (+2030 -0)
📝 drizzle/meta/_journal.json (+8 -1)
📝 scripts/validate-migrations.ts (+28 -2)
📝 src/components/config/ConfigTabs.tsx (+79 -1)
src/components/config/NotificationSettings.tsx (+394 -0)
📝 src/lib/db/schema.ts (+30 -0)
📝 src/lib/gitea-enhanced.ts (+1 -1)
📝 src/lib/helpers.ts (+13 -1)
src/lib/notification-service.test.ts (+221 -0)
src/lib/notification-service.ts (+165 -0)
src/lib/providers/apprise.test.ts (+98 -0)
src/lib/providers/apprise.ts (+15 -0)
src/lib/providers/ntfy.test.ts (+95 -0)
src/lib/providers/ntfy.ts (+21 -0)
src/pages/api/config/index.test.ts (+51 -0)
📝 src/pages/api/config/index.ts (+92 -14)
src/pages/api/notifications/test.ts (+42 -0)
📝 src/types/config.ts (+25 -0)

📄 Description

Summary

Closes #231 — adds push notification support for mirror events with two providers:

  • Ntfy.sh (direct) — simple HTTP POST, works with ntfy.sh hosted or self-hosted instances
  • Apprise API (gateway) — aggregator supporting 100+ services (Slack, Discord, Telegram, Email, Pushover, etc.)

New files (10)

  • src/lib/providers/ntfy.ts / apprise.ts — Provider implementations (simple fetch calls)
  • src/lib/notification-service.ts — Main service with sendNotification, testNotification, triggerJobNotification
  • src/pages/api/notifications/test.ts — Test notification endpoint with Zod validation
  • src/components/config/NotificationSettings.tsx — Settings UI with provider selector, config forms, event toggles, test button
  • src/lib/providers/ntfy.test.ts / apprise.test.ts / src/lib/notification-service.test.ts — 23 unit tests
  • drizzle/0011_notification_config.sql — Migration adding notification_config column
  • docs/NOTIFICATIONS.md — Setup guides for both providers, event types, troubleshooting

Modified files (7)

  • src/lib/db/schema.ts — Zod schemas for ntfy, apprise, and notification config
  • src/types/config.ts — TypeScript interfaces + added notificationConfig to API request/response types
  • src/lib/helpers.ts — Fire-and-forget notification trigger on terminal job statuses
  • src/pages/api/config/index.ts — Token encryption/decryption for notification providers
  • src/components/config/ConfigTabs.tsx — 4th "Notifications" tab with auto-save
  • drizzle/meta/_journal.json — Migration journal entry
  • scripts/validate-migrations.ts — Migration validation fixture

Design decisions

  • Notifications never block the mirror flow — all errors caught and logged
  • Only the active provider's token is decrypted (prevents stale inactive provider tokens from dropping notifications)
  • notifyOnNewRepo toggle is disabled with "coming soon" label (schema ready, backend hook not yet wired)
  • Tokens encrypted at rest with same AES-256-GCM as GitHub/Gitea tokens
  • Token decryption failure clears to empty string (prevents double-encryption on save round-trip)

Test plan

  • 205 tests pass (23 new notification tests)
  • Production build succeeds
  • Migration validation passes (fixture for 0011)
  • Rebased cleanly onto main (after PRs #235, #236, #237 merges)
  • Manual: Enable ntfy, set topic, click Test → notification arrives
  • Manual: Switch to Apprise, configure, click Test → notification arrives
  • Manual: Trigger a failing mirror → error notification received

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/RayLabsHQ/gitea-mirror/pull/238 **Author:** [@arunavo4](https://github.com/arunavo4) **Created:** 3/18/2026 **Status:** ✅ Merged **Merged:** 3/18/2026 **Merged by:** [@arunavo4](https://github.com/arunavo4) **Base:** `main` ← **Head:** `feat/231-notifications` --- ### 📝 Commits (4) - [`2141f62`](https://github.com/RayLabsHQ/gitea-mirror/commit/2141f623e7bd844ae1ac8554f959bc6a5d7aaaf6) feat: add notification system with Ntfy.sh and Apprise providers (#231) - [`09d837c`](https://github.com/RayLabsHQ/gitea-mirror/commit/09d837c75393b6cbb5c9cee6d8c0b6b998e1c84b) fix: address review findings for notification system - [`2c26017`](https://github.com/RayLabsHQ/gitea-mirror/commit/2c2601744c24ad80a6a08cc3fb009e01330c5f1c) fix notification gating and config validation - [`109bb00`](https://github.com/RayLabsHQ/gitea-mirror/commit/109bb00ba296342dda6520947996f7c3f86a3af3) trim sync notification details ### 📊 Changes **20 files changed** (+3497 additions, -20 deletions) <details> <summary>View changed files</summary> ➕ `docs/NOTIFICATIONS.md` (+88 -0) ➕ `drizzle/0011_notification_config.sql` (+1 -0) ➕ `drizzle/meta/0011_snapshot.json` (+2030 -0) 📝 `drizzle/meta/_journal.json` (+8 -1) 📝 `scripts/validate-migrations.ts` (+28 -2) 📝 `src/components/config/ConfigTabs.tsx` (+79 -1) ➕ `src/components/config/NotificationSettings.tsx` (+394 -0) 📝 `src/lib/db/schema.ts` (+30 -0) 📝 `src/lib/gitea-enhanced.ts` (+1 -1) 📝 `src/lib/helpers.ts` (+13 -1) ➕ `src/lib/notification-service.test.ts` (+221 -0) ➕ `src/lib/notification-service.ts` (+165 -0) ➕ `src/lib/providers/apprise.test.ts` (+98 -0) ➕ `src/lib/providers/apprise.ts` (+15 -0) ➕ `src/lib/providers/ntfy.test.ts` (+95 -0) ➕ `src/lib/providers/ntfy.ts` (+21 -0) ➕ `src/pages/api/config/index.test.ts` (+51 -0) 📝 `src/pages/api/config/index.ts` (+92 -14) ➕ `src/pages/api/notifications/test.ts` (+42 -0) 📝 `src/types/config.ts` (+25 -0) </details> ### 📄 Description ## Summary Closes #231 — adds push notification support for mirror events with two providers: - **Ntfy.sh** (direct) — simple HTTP POST, works with ntfy.sh hosted or self-hosted instances - **Apprise API** (gateway) — aggregator supporting 100+ services (Slack, Discord, Telegram, Email, Pushover, etc.) ### New files (10) - `src/lib/providers/ntfy.ts` / `apprise.ts` — Provider implementations (simple fetch calls) - `src/lib/notification-service.ts` — Main service with `sendNotification`, `testNotification`, `triggerJobNotification` - `src/pages/api/notifications/test.ts` — Test notification endpoint with Zod validation - `src/components/config/NotificationSettings.tsx` — Settings UI with provider selector, config forms, event toggles, test button - `src/lib/providers/ntfy.test.ts` / `apprise.test.ts` / `src/lib/notification-service.test.ts` — 23 unit tests - `drizzle/0011_notification_config.sql` — Migration adding `notification_config` column - `docs/NOTIFICATIONS.md` — Setup guides for both providers, event types, troubleshooting ### Modified files (7) - `src/lib/db/schema.ts` — Zod schemas for ntfy, apprise, and notification config - `src/types/config.ts` — TypeScript interfaces + added `notificationConfig` to API request/response types - `src/lib/helpers.ts` — Fire-and-forget notification trigger on terminal job statuses - `src/pages/api/config/index.ts` — Token encryption/decryption for notification providers - `src/components/config/ConfigTabs.tsx` — 4th "Notifications" tab with auto-save - `drizzle/meta/_journal.json` — Migration journal entry - `scripts/validate-migrations.ts` — Migration validation fixture ### Design decisions - Notifications never block the mirror flow — all errors caught and logged - Only the active provider's token is decrypted (prevents stale inactive provider tokens from dropping notifications) - `notifyOnNewRepo` toggle is disabled with "coming soon" label (schema ready, backend hook not yet wired) - Tokens encrypted at rest with same AES-256-GCM as GitHub/Gitea tokens - Token decryption failure clears to empty string (prevents double-encryption on save round-trip) ## Test plan - [x] 205 tests pass (23 new notification tests) - [x] Production build succeeds - [x] Migration validation passes (fixture for 0011) - [x] Rebased cleanly onto main (after PRs #235, #236, #237 merges) - [x] Manual: Enable ntfy, set topic, click Test → notification arrives - [x] Manual: Switch to Apprise, configure, click Test → notification arrives - [x] Manual: Trigger a failing mirror → error notification received --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-24 18:21:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea-mirror#1603