From 8a3e6fa35fee2f93b1a293223937a72ee8158024 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Wed, 6 Nov 2024 21:45:19 -0600 Subject: [PATCH] new: Support access tokens for ntfy --- example_configs/notification_config | 2 ++ src/ReVancedBuilder/Notifications.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/example_configs/notification_config b/example_configs/notification_config index 3770d4a..f96ac5a 100644 --- a/example_configs/notification_config +++ b/example_configs/notification_config @@ -23,3 +23,5 @@ enabled = false url = url topic = topic +token = token + diff --git a/src/ReVancedBuilder/Notifications.py b/src/ReVancedBuilder/Notifications.py index 28ebc8b..170ee45 100644 --- a/src/ReVancedBuilder/Notifications.py +++ b/src/ReVancedBuilder/Notifications.py @@ -55,6 +55,11 @@ def send_notif(appstate, error=False): continue headers = {'Icon': 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/40/Revanced-logo-round.svg/240px-Revanced-logo-round.svg.png', 'Title': encoded_title} + try: + token = config[entry]['token'] + headers['Authorization'] = 'Bearer' + token + except: + continue try: req.post(f"{url}/{topic}", msg, headers=headers) except Exception as e: