mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 13:23:24 -07:00
Encrypt notification with device token instead of api key
This commit is contained in:
parent
a939d1bfd8
commit
997e2cdfd8
1 changed files with 6 additions and 5 deletions
|
@ -700,12 +700,14 @@ class ANDROIDAPP(Notifier):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check mobile device is still registered
|
# Check mobile device is still registered
|
||||||
if not mobile_app.get_mobile_devices(device_id=self.config['device_id']):
|
device = mobile_app.get_mobile_devices(device_id=self.config['device_id'])
|
||||||
|
if not device:
|
||||||
logger.warn(u"PlexPy Notifiers :: Unable to send Android app notification: device not registered.")
|
logger.warn(u"PlexPy Notifiers :: Unable to send Android app notification: device not registered.")
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
device = device[0]
|
||||||
|
|
||||||
plaintext_data = {'notification_id': notification_id,
|
plaintext_data = {'subject': subject.encode("utf-8"),
|
||||||
'subject': subject.encode("utf-8"),
|
|
||||||
'body': body.encode("utf-8"),
|
'body': body.encode("utf-8"),
|
||||||
'priority': self.config['priority']}
|
'priority': self.config['priority']}
|
||||||
|
|
||||||
|
@ -714,7 +716,7 @@ class ANDROIDAPP(Notifier):
|
||||||
if CRYPTODOME:
|
if CRYPTODOME:
|
||||||
# Key generation
|
# Key generation
|
||||||
salt = get_random_bytes(16)
|
salt = get_random_bytes(16)
|
||||||
passphrase = plexpy.CONFIG.API_KEY
|
passphrase = device['device_token']
|
||||||
key_length = 32 # AES256
|
key_length = 32 # AES256
|
||||||
iterations = 1000
|
iterations = 1000
|
||||||
key = PBKDF2(passphrase, salt, dkLen=key_length, count=iterations,
|
key = PBKDF2(passphrase, salt, dkLen=key_length, count=iterations,
|
||||||
|
@ -1041,7 +1043,6 @@ class DISCORD(Notifier):
|
||||||
attachment = {'title': title
|
attachment = {'title': title
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if self.config['color']:
|
if self.config['color']:
|
||||||
hex_match = re.match(r'^#([0-9a-fA-F]{3}){1,2}$', self.config['color'])
|
hex_match = re.match(r'^#([0-9a-fA-F]{3}){1,2}$', self.config['color'])
|
||||||
if hex_match:
|
if hex_match:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue