- ntfy_subscriptions 테이블 마이그레이션 추가 - ntfySender.js 유틸 (ntfy HTTP POST 래퍼) - sendPushToUsers() ntfy 우선 분기 (ntfy 구독자 → ntfy, 나머지 → Web Push) - ntfy subscribe/unsubscribe/status API 엔드포인트 - notification-bell.js ntfy 토글 버튼 + 앱 설정 안내 모달 - docker-compose system1-api에 NTFY 환경변수 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
20 lines
789 B
JavaScript
20 lines
789 B
JavaScript
// routes/pushSubscriptionRoutes.js
|
|
const express = require('express');
|
|
const router = express.Router();
|
|
const pushController = require('../controllers/pushSubscriptionController');
|
|
const { requireAuth } = require('../middlewares/auth');
|
|
|
|
// VAPID 공개키 (인증 불필요)
|
|
router.get('/vapid-public-key', pushController.getVapidPublicKey);
|
|
|
|
// 구독/해제 (인증 필요)
|
|
router.post('/subscribe', requireAuth, pushController.subscribe);
|
|
router.delete('/unsubscribe', requireAuth, pushController.unsubscribe);
|
|
|
|
// ntfy 구독 관리
|
|
router.post('/ntfy/subscribe', requireAuth, pushController.ntfySubscribe);
|
|
router.delete('/ntfy/unsubscribe', requireAuth, pushController.ntfyUnsubscribe);
|
|
router.get('/ntfy/status', requireAuth, pushController.ntfyStatus);
|
|
|
|
module.exports = router;
|