Feat: pushover notif
This commit is contained in:
@@ -1099,3 +1099,38 @@ export function mapStreamStatus(raw: string | undefined, privateStatuses: string
|
||||
// off / offline / deleted / notFound : le modèle n'est plus là du tout.
|
||||
return 'offline';
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Notifications Pushover
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Identifiants Pushover, réglage serveur unique (pas par agent) : les
|
||||
* notifications concernent l'opérateur, pas une VM en particulier.
|
||||
*
|
||||
* Complète — sans le remplacer — le mécanisme de notification déjà en place
|
||||
* (notification navigateur, `WatchTarget.notify`) : ce canal-ci atteint
|
||||
* l'opérateur même dashboard fermé, ce que le navigateur ne peut pas faire.
|
||||
*/
|
||||
export interface PushoverSettings {
|
||||
enabled: boolean;
|
||||
/** Clé utilisateur ou de groupe Pushover (`Your User Key` sur pushover.net). */
|
||||
userKey: string;
|
||||
/** Jeton de l'application créée sur pushover.net/apps/build. */
|
||||
appToken: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_PUSHOVER_SETTINGS: PushoverSettings = {
|
||||
enabled: false,
|
||||
userKey: '',
|
||||
appToken: '',
|
||||
};
|
||||
|
||||
export function normalizePushoverSettings(raw: unknown): PushoverSettings {
|
||||
const input = (raw ?? {}) as Partial<PushoverSettings>;
|
||||
return {
|
||||
enabled: input.enabled === true,
|
||||
userKey: typeof input.userKey === 'string' ? input.userKey.trim() : '',
|
||||
appToken: typeof input.appToken === 'string' ? input.appToken.trim() : '',
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user