Minor bug fixes
This commit is contained in:
parent
8bd6ff6ba4
commit
11152ae8de
2 changed files with 11 additions and 5 deletions
|
@ -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:
|
||||
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
|
||||
|
|
|
@ -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.
|
||||
This plugin supports whitelisting state/territory designators, allowed senders, reaction receipt, and authenticated NTFY posting.
|
Loading…
Add table
Add a link
Reference in a new issue