mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-05 20:51:15 -07:00
Update OneSignal API calls
This commit is contained in:
parent
ddb4f6131b
commit
86d775a586
2 changed files with 4 additions and 5 deletions
|
@ -198,11 +198,10 @@ def validate_onesignal_id(onesignal_id):
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
params = {'app_id': _ONESIGNAL_APP_ID}
|
|
||||||
|
|
||||||
logger.info("Tautulli MobileApp :: Validating OneSignal ID")
|
logger.info("Tautulli MobileApp :: Validating OneSignal ID")
|
||||||
try:
|
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
|
status_code = r.status_code
|
||||||
logger.info("Tautulli MobileApp :: OneSignal ID validation returned status code %s", status_code)
|
logger.info("Tautulli MobileApp :: OneSignal ID validation returned status code %s", status_code)
|
||||||
return int(status_code == 200)
|
return int(status_code == 200)
|
||||||
|
|
|
@ -4044,7 +4044,7 @@ class TAUTULLIREMOTEAPP(Notifier):
|
||||||
#logger.debug("Salt (base64): {}".format(base64.b64encode(salt)))
|
#logger.debug("Salt (base64): {}".format(base64.b64encode(salt)))
|
||||||
|
|
||||||
payload = {'app_id': mobile_app._ONESIGNAL_APP_ID,
|
payload = {'app_id': mobile_app._ONESIGNAL_APP_ID,
|
||||||
'include_player_ids': [device['onesignal_id']],
|
'include_subscription_ids': [device['onesignal_id']],
|
||||||
'contents': {'en': 'Tautulli Notification'},
|
'contents': {'en': 'Tautulli Notification'},
|
||||||
'data': {'encrypted': True,
|
'data': {'encrypted': True,
|
||||||
'version': 2,
|
'version': 2,
|
||||||
|
@ -4059,7 +4059,7 @@ class TAUTULLIREMOTEAPP(Notifier):
|
||||||
"Install the library to encrypt the notifications.")
|
"Install the library to encrypt the notifications.")
|
||||||
|
|
||||||
payload = {'app_id': mobile_app._ONESIGNAL_APP_ID,
|
payload = {'app_id': mobile_app._ONESIGNAL_APP_ID,
|
||||||
'include_player_ids': [device['onesignal_id']],
|
'include_subscription_ids': [device['onesignal_id']],
|
||||||
'contents': {'en': 'Tautulli Notification'},
|
'contents': {'en': 'Tautulli Notification'},
|
||||||
'data': {'encrypted': False,
|
'data': {'encrypted': False,
|
||||||
'plain_text': plaintext_data,
|
'plain_text': plaintext_data,
|
||||||
|
@ -4070,7 +4070,7 @@ class TAUTULLIREMOTEAPP(Notifier):
|
||||||
|
|
||||||
headers = {'Content-Type': 'application/json'}
|
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):
|
def get_devices(self):
|
||||||
db = database.MonitorDatabase()
|
db = database.MonitorDatabase()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue