diff --git a/data/interfaces/default/mobile_devices_table.html b/data/interfaces/default/mobile_devices_table.html
index ac0b3fad..240748f8 100644
--- a/data/interfaces/default/mobile_devices_table.html
+++ b/data/interfaces/default/mobile_devices_table.html
@@ -13,10 +13,10 @@ DOCUMENTATION :: END
% for device in sorted(devices_list, key=lambda k: k['device_name']):
- % if device['official'] == 1:
-
- % elif device['official'] == -1:
+ % if device['official'] == -1:
+ % elif device['official'] > 0:
+
% else:
% endif
diff --git a/plexpy/__init__.py b/plexpy/__init__.py
index fff7b492..fc60e663 100644
--- a/plexpy/__init__.py
+++ b/plexpy/__init__.py
@@ -2367,6 +2367,11 @@ def dbcheck():
def upgrade():
+ if CONFIG.UPGRADE_FLAG == 0:
+ mobile_app.revalidate_onesignal_ids()
+ CONFIG.UPGRADE_FLAG = 1
+ CONFIG.write()
+
return
diff --git a/plexpy/config.py b/plexpy/config.py
index 0fbb41c3..dad11a41 100644
--- a/plexpy/config.py
+++ b/plexpy/config.py
@@ -185,6 +185,7 @@ _CONFIG_DEFINITIONS = {
'TV_WATCHED_PERCENT': (int, 'Monitoring', 85),
'UPDATE_DB_INTERVAL': (int, 'General', 24),
'UPDATE_SHOW_CHANGELOG': (int, 'General', 1),
+ 'UPGRADE_FLAG': (int, 'Advanced', 0),
'VERBOSE_LOGS': (int, 'Advanced', 1),
'VERIFY_SSL_CERT': (bool_int, 'Advanced', 1),
'WEBSOCKET_MONITOR_PING_PONG': (int, 'Advanced', 0),
diff --git a/plexpy/mobile_app.py b/plexpy/mobile_app.py
index 0a31e0da..ba37f5f7 100644
--- a/plexpy/mobile_app.py
+++ b/plexpy/mobile_app.py
@@ -33,6 +33,7 @@ else:
_ONESIGNAL_APP_ID = '3b4b666a-d557-4b92-acdf-e2c8c4b95357'
+_ONESIGNAL_DISABLED = 'onesignal-disabled'
TEMP_DEVICE_TOKENS = {}
@@ -126,6 +127,9 @@ def get_mobile_device_config(mobile_device_id=None):
result = db.select_single('SELECT * FROM mobile_devices WHERE id = ?',
args=[mobile_device_id])
+ if result['onesignal_id'] == _ONESIGNAL_DISABLED:
+ result['onesignal_id'] = ''
+
return result
@@ -192,6 +196,8 @@ def set_last_seen(device_token=None):
def validate_onesignal_id(onesignal_id):
if onesignal_id is None:
return 0
+ elif onesignal_id == _ONESIGNAL_DISABLED:
+ return 2
headers = {'Content-Type': 'application/json'}
payload = {'app_id': _ONESIGNAL_APP_ID}
@@ -207,6 +213,11 @@ def validate_onesignal_id(onesignal_id):
return -1
+def revalidate_onesignal_ids():
+ for device in get_mobile_devices():
+ set_official(device['device_id'], device['onesignal_id'])
+
+
def blacklist_logger():
devices = get_mobile_devices()
for d in devices: