mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-03-12 04:35:40 -07:00
Update OneSignal API calls
This commit is contained in:
parent
ddb4f6131b
commit
86d775a586
@ -198,11 +198,10 @@ def validate_onesignal_id(onesignal_id):
|
||||
return 2
|
||||
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
params = {'app_id': _ONESIGNAL_APP_ID}
|
||||
|
||||
logger.info("Tautulli MobileApp :: Validating OneSignal ID")
|
||||
try:
|
||||
r = requests.get('https://onesignal.com/api/v1/players/{}'.format(onesignal_id), headers=headers, params=params)
|
||||
r = requests.get(f'https://api.onesignal.com/apps/{_ONESIGNAL_APP_ID}/subscriptions/{onesignal_id}/user/identity', headers=headers)
|
||||
status_code = r.status_code
|
||||
logger.info("Tautulli MobileApp :: OneSignal ID validation returned status code %s", status_code)
|
||||
return int(status_code == 200)
|
||||
|
@ -4044,7 +4044,7 @@ class TAUTULLIREMOTEAPP(Notifier):
|
||||
#logger.debug("Salt (base64): {}".format(base64.b64encode(salt)))
|
||||
|
||||
payload = {'app_id': mobile_app._ONESIGNAL_APP_ID,
|
||||
'include_player_ids': [device['onesignal_id']],
|
||||
'include_subscription_ids': [device['onesignal_id']],
|
||||
'contents': {'en': 'Tautulli Notification'},
|
||||
'data': {'encrypted': True,
|
||||
'version': 2,
|
||||
@ -4059,7 +4059,7 @@ class TAUTULLIREMOTEAPP(Notifier):
|
||||
"Install the library to encrypt the notifications.")
|
||||
|
||||
payload = {'app_id': mobile_app._ONESIGNAL_APP_ID,
|
||||
'include_player_ids': [device['onesignal_id']],
|
||||
'include_subscription_ids': [device['onesignal_id']],
|
||||
'contents': {'en': 'Tautulli Notification'},
|
||||
'data': {'encrypted': False,
|
||||
'plain_text': plaintext_data,
|
||||
@ -4070,7 +4070,7 @@ class TAUTULLIREMOTEAPP(Notifier):
|
||||
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
|
||||
return self.make_request('https://onesignal.com/api/v1/notifications', headers=headers, json=payload)
|
||||
return self.make_request('https://api.onesignal.com/notifications', headers=headers, json=payload)
|
||||
|
||||
def get_devices(self):
|
||||
db = database.MonitorDatabase()
|
||||
|
Loading…
x
Reference in New Issue
Block a user