From 11152ae8de210b69bec6fd2e50b9d1c48b6016c0 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 12 Jun 2025 00:33:34 -0700 Subject: [PATCH] Minor bug fixes --- consumerntfy.py | 14 ++++++++++---- readme.md | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/consumerntfy.py b/consumerntfy.py index 964fbcc..e54a1e5 100644 --- a/consumerntfy.py +++ b/consumerntfy.py @@ -42,6 +42,7 @@ class ConsumerNTFY(Plugin): async def report(self, evt: MessageEvent, message: str) -> None: # Split command (minus !command_name) into tokens tokens = message.split() + st_desig = tokens[0].lower() # Each command must have a state/territory designation and a message if len(tokens) < 2: return @@ -52,15 +53,20 @@ class ConsumerNTFY(Plugin): return # Check allowed senders - allowed_senders = self.config["allowed_senders." + tokens[0]] - if allowed_senders and not evt.sender in allowed_senders: - return + allowed_senders = self.config["allowed_senders"] + + print(evt.sender) + + if st_desig in self.config["allowed_senders"]: + print(f"Allowed senders for {st_desig}: {self.config['allowed_senders'].get(st_desig, [])}") + if not evt.sender in self.config['allowed_senders'].get(st_desig, []): + return # Sending notification to NTFY url = self.config["server_url"] + "/" + self.config["server_topic"] body = ' '.join(tokens[1:]) - if len(self.config["allowed_locations"]) > 1: + if len(self.config["allowed_locations"]) != 1: body = tokens[0] + ": " + body # Consider authentication diff --git a/readme.md b/readme.md index 48b4eed..4b621b7 100644 --- a/readme.md +++ b/readme.md @@ -2,4 +2,4 @@ Please see https://git.fiftyfiftyonearizona.org/webmaster/matrix-report-documentation -This plugin supports whitelisting state/territory designators, allowed senders, and authenticated NTFY posting. \ No newline at end of file +This plugin supports whitelisting state/territory designators, allowed senders, reaction receipt, and authenticated NTFY posting. \ No newline at end of file