fix: Add authentication and ocs headers 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
73c47dcfc9
1 changed files with 7 additions and 2 deletions
|
@ -23,7 +23,7 @@ log_levels = {
|
||||||
|
|
||||||
|
|
||||||
# Converts Nextcloud's notification buttons to ntfy.sh notification actions
|
# 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 = []
|
parsed_actions = []
|
||||||
|
|
||||||
for action in actions:
|
for action in actions:
|
||||||
|
@ -41,6 +41,11 @@ def parse_actions(actions: list) -> list:
|
||||||
if action_parsed["method"] == "WEB":
|
if action_parsed["method"] == "WEB":
|
||||||
del action_parsed["method"]
|
del action_parsed["method"]
|
||||||
action_parsed["action"] = "view"
|
action_parsed["action"] = "view"
|
||||||
|
else:
|
||||||
|
action_parsed["headers"] = {
|
||||||
|
"Authorization": f"{nextcloud_auth_header}",
|
||||||
|
"OCS-APIREQUEST": "true",
|
||||||
|
}
|
||||||
|
|
||||||
parsed_actions.append(action_parsed)
|
parsed_actions.append(action_parsed)
|
||||||
|
|
||||||
|
@ -229,7 +234,7 @@ def main():
|
||||||
message = notification["message"]
|
message = notification["message"]
|
||||||
log.debug(f"Notification message:\n{message}")
|
log.debug(f"Notification message:\n{message}")
|
||||||
|
|
||||||
actions = parse_actions(notification["actions"])
|
actions = parse_actions(notification["actions"], nextcloud_auth_header)
|
||||||
actions.append(
|
actions.append(
|
||||||
{
|
{
|
||||||
"action": "http",
|
"action": "http",
|
||||||
|
|
Loading…
Reference in a new issue