From 2d7b29833615401687768ac2aee721e2f040ad88 Mon Sep 17 00:00:00 2001 From: wooferguy Date: Sun, 14 May 2023 00:27:14 +1200 Subject: [PATCH] TTL Functionality Pick up msg.ttl and pass it to REST API, checking it is a positive integer first. --- social/pushover/57-pushover.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/social/pushover/57-pushover.js b/social/pushover/57-pushover.js index 98603a69..3a77bbd7 100644 --- a/social/pushover/57-pushover.js +++ b/social/pushover/57-pushover.js @@ -41,6 +41,7 @@ module.exports = function(RED) { var attachment = msg.attachment || null; var retry = msg.retry || 30; var expire = msg.expire || 600; + var ttl = msg.ttl || null; var callback = msg.callback || null; var tags = msg.tags || null; if (isNaN(pri)) {pri=0;} @@ -62,6 +63,10 @@ module.exports = function(RED) { expire = 10800; node.warn("Expire time too high, using maximum setting of 10800s (3 hours) retry duration"); } + if (!Number.isInteger(ttl) || ttl<=0) { + ttl = null; + node.warn("No valid number for TTL found, not set"); + } if (typeof msg.payload === 'undefined') { msg.payload = "(undefined msg.payload)"; } if (typeof(msg.payload) === 'object') { msg.payload = JSON.stringify(msg.payload); @@ -74,6 +79,7 @@ module.exports = function(RED) { priority: pri, retry: retry, expire: expire, + ttl: ttl, html: html }; if (dev) { pushmsg.device = dev; }