feat: premium tier features — auto-backup scheduling, resource alerting, bundled workflows, one-click revert, notification manager
This commit is contained in:
@@ -218,5 +218,46 @@ module.exports = function({ notification, asyncHandler }) {
|
||||
});
|
||||
}, 'notifications-health-check'));
|
||||
|
||||
// GET /status — Get notification system status
|
||||
router.get('/status', asyncHandler(async (req, res) => {
|
||||
const notificationConfig = notification.getConfig();
|
||||
const providers = notificationConfig.providers || {};
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
enabled: notificationConfig.enabled,
|
||||
providers: {
|
||||
discord: providers.discord?.enabled && !!providers.discord?.webhookUrl,
|
||||
telegram: providers.telegram?.enabled && !!providers.telegram?.botToken && !!providers.telegram?.chatId,
|
||||
ntfy: providers.ntfy?.enabled && !!providers.ntfy?.topic,
|
||||
email: providers.email?.enabled && !!providers.email?.host && !!providers.email?.to
|
||||
},
|
||||
lastSent: notification.lastSent,
|
||||
healthCheck: notificationConfig.healthCheck?.enabled ? {
|
||||
enabled: true,
|
||||
lastCheck: notificationConfig.healthCheck.lastCheck,
|
||||
intervalMinutes: notificationConfig.healthCheck.intervalMinutes
|
||||
} : { enabled: false }
|
||||
});
|
||||
}, 'notifications-status'));
|
||||
|
||||
// POST /send — Manual test send (used by frontend "Send Test" button)
|
||||
router.post('/send', asyncHandler(async (req, res) => {
|
||||
const { event, data, type } = req.body;
|
||||
|
||||
if (!event) {
|
||||
throw new ValidationError('Event type is required');
|
||||
}
|
||||
|
||||
// Use 'test' as the event for manual sends
|
||||
const result = await notification.send(event, data || {}, type || 'info');
|
||||
|
||||
res.json({
|
||||
success: result.success,
|
||||
event,
|
||||
results: result.results
|
||||
});
|
||||
}, 'notifications-send'));
|
||||
|
||||
return router;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user