Add checks

This commit is contained in:
Geoff Whittington
2022-08-22 00:14:48 -04:00
parent eac2ab515e
commit 30320875a2
+12
View File
@@ -155,6 +155,10 @@ class WebhookPlugin(Plugin):
logger = logging.getLogger(name="meshtastic.bridge.plugin.webhook")
def do_action(self, packet):
if type(packet) is not dict:
self.logger.warning("Packet is not dict")
return packet
if "active" in self.config and not self.config["active"]:
return packet
@@ -276,6 +280,10 @@ class DecryptFilter(Plugin):
if 'key' not in self.config:
return packet
if type(packet) is not str:
self.logger.warning(f"Packet is not string")
return packet
from jwcrypto import jwk, jwe
with open(self.config['key'], "rb") as pemfile:
@@ -296,6 +304,10 @@ class SendPlugin(Plugin):
def do_action(self, packet):
if type(packet) is not dict:
self.logger.error(f"Packet is not dict")
return packet
if self.config["device"] not in self.devices:
self.logger.error(f"Missing interface for device {self.config['device']}")
return packet