mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-15 01:32:57 -07:00
Mask device token and device id from API logs
This commit is contained in:
parent
40ecf56904
commit
44f74e3590
2 changed files with 11 additions and 0 deletions
|
@ -686,6 +686,10 @@ General optional parameters:
|
||||||
def _api_run(self, *args, **kwargs):
|
def _api_run(self, *args, **kwargs):
|
||||||
""" handles the stuff from the handler """
|
""" handles the stuff from the handler """
|
||||||
|
|
||||||
|
# Make sure the device ID is not shown in the logs
|
||||||
|
if self._api_cmd == 'register_device' and kwargs.get('device_id'):
|
||||||
|
logger._BLACKLIST_WORDS.add(kwargs['device_id'])
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
logger.api_debug('Tautulli APIv2 :: API called with kwargs: %s' % kwargs)
|
logger.api_debug('Tautulli APIv2 :: API called with kwargs: %s' % kwargs)
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,11 @@ def set_temp_device_token(token=None):
|
||||||
global TEMP_DEVICE_TOKEN
|
global TEMP_DEVICE_TOKEN
|
||||||
TEMP_DEVICE_TOKEN = token
|
TEMP_DEVICE_TOKEN = token
|
||||||
|
|
||||||
|
if TEMP_DEVICE_TOKEN:
|
||||||
|
logger._BLACKLIST_WORDS.add(TEMP_DEVICE_TOKEN)
|
||||||
|
else:
|
||||||
|
logger._BLACKLIST_WORDS.discard(TEMP_DEVICE_TOKEN)
|
||||||
|
|
||||||
if TEMP_DEVICE_TOKEN is not None:
|
if TEMP_DEVICE_TOKEN is not None:
|
||||||
global INVALIDATE_TIMER
|
global INVALIDATE_TIMER
|
||||||
if INVALIDATE_TIMER:
|
if INVALIDATE_TIMER:
|
||||||
|
@ -95,6 +100,7 @@ def add_mobile_device(device_id=None, device_name=None, device_token=None, frien
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = db.upsert(table_name='mobile_devices', key_dict=keys, value_dict=values)
|
result = db.upsert(table_name='mobile_devices', key_dict=keys, value_dict=values)
|
||||||
|
blacklist_logger()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn("Tautulli MobileApp :: Failed to register mobile device in the database: %s." % e)
|
logger.warn("Tautulli MobileApp :: Failed to register mobile device in the database: %s." % e)
|
||||||
return
|
return
|
||||||
|
@ -135,6 +141,7 @@ def set_mobile_device_config(mobile_device_id=None, **kwargs):
|
||||||
try:
|
try:
|
||||||
db.upsert(table_name='mobile_devices', key_dict=keys, value_dict=values)
|
db.upsert(table_name='mobile_devices', key_dict=keys, value_dict=values)
|
||||||
logger.info("Tautulli MobileApp :: Updated mobile device agent: mobile_device_id %s." % mobile_device_id)
|
logger.info("Tautulli MobileApp :: Updated mobile device agent: mobile_device_id %s." % mobile_device_id)
|
||||||
|
blacklist_logger()
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn("Tautulli MobileApp :: Unable to update mobile device: %s." % e)
|
logger.warn("Tautulli MobileApp :: Unable to update mobile device: %s." % e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue