fix: Add authentication to http request action buttons
All checks were successful
Mirror to Forgejo / mirror-to-codeberg (push) Successful in 3s
All checks were successful
Mirror to Forgejo / mirror-to-codeberg (push) Successful in 3s
This commit is contained in:
parent
6eb3ec0cbc
commit
d1e7a2d454
1 changed files with 6 additions and 2 deletions
|
@ -23,7 +23,7 @@ log_levels = {
|
|||
|
||||
|
||||
# Converts Nextcloud's notification buttons to ntfy.sh notification actions
|
||||
def parse_actions(actions: list) -> list:
|
||||
def parse_actions(actions: list, nextcloud_auth_header) -> list:
|
||||
parsed_actions = []
|
||||
|
||||
for action in actions:
|
||||
|
@ -41,6 +41,10 @@ def parse_actions(actions: list) -> list:
|
|||
if action_parsed["method"] == "WEB":
|
||||
del action_parsed["method"]
|
||||
action_parsed["action"] = "view"
|
||||
else:
|
||||
action_parsed["headers"] = {
|
||||
"Authorization": f"{nextcloud_auth_header}",
|
||||
}
|
||||
|
||||
parsed_actions.append(action_parsed)
|
||||
|
||||
|
@ -229,7 +233,7 @@ def main():
|
|||
message = notification["message"]
|
||||
log.debug(f"Notification message:\n{message}")
|
||||
|
||||
actions = parse_actions(notification["actions"])
|
||||
actions = parse_actions(notification["actions"], nextcloud_auth_header)
|
||||
actions.append(
|
||||
{
|
||||
"action": "http",
|
||||
|
|
Loading…
Reference in a new issue