new: Support access tokens for ntfy

This commit is contained in:
Sayantan Santra 2024-11-06 21:45:19 -06:00
parent c38881922d
commit 8a3e6fa35f
Signed by: SinTan1729
GPG key ID: 0538DD402EA50898
2 changed files with 7 additions and 0 deletions

View file

@ -23,3 +23,5 @@
enabled = false
url = url
topic = topic
token = token

View file

@ -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: