|
@@ -2,29 +2,11 @@ import { config } from '../config'
|
|
|
import type { RebalanceResult } from '../engine/types'
|
|
import type { RebalanceResult } from '../engine/types'
|
|
|
|
|
|
|
|
export async function sendNotification(
|
|
export async function sendNotification(
|
|
|
- title: string,
|
|
|
|
|
- body: string,
|
|
|
|
|
- level: 'info' | 'warning' | 'error' = 'info',
|
|
|
|
|
|
|
+ _title: string,
|
|
|
|
|
+ _body: string,
|
|
|
|
|
+ _level: 'info' | 'warning' | 'error' = 'info',
|
|
|
): Promise<void> {
|
|
): Promise<void> {
|
|
|
- if (!config.notifications.enabled || !config.notifications.endpoint) return
|
|
|
|
|
-
|
|
|
|
|
- try {
|
|
|
|
|
- const { provider, endpoint } = config.notifications
|
|
|
|
|
-
|
|
|
|
|
- switch (provider) {
|
|
|
|
|
- case 'bark':
|
|
|
|
|
- await sendBark(endpoint, title, body, level)
|
|
|
|
|
- break
|
|
|
|
|
- case 'ntfy':
|
|
|
|
|
- await sendNtfy(endpoint, title, body, level)
|
|
|
|
|
- break
|
|
|
|
|
- case 'pushover':
|
|
|
|
|
- await sendPushover(endpoint, title, body, level)
|
|
|
|
|
- break
|
|
|
|
|
- }
|
|
|
|
|
- } catch (err) {
|
|
|
|
|
- console.error('[notify] Failed to send notification:', err)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // Notifications disabled
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function sendBark(
|
|
async function sendBark(
|