mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 07:22:37 -07:00
Add notifier configs to logger blacklist
This commit is contained in:
parent
864063676f
commit
1618921a57
3 changed files with 24 additions and 2 deletions
|
@ -37,6 +37,7 @@ import config
|
||||||
import database
|
import database
|
||||||
import logger
|
import logger
|
||||||
import notification_handler
|
import notification_handler
|
||||||
|
import notifiers
|
||||||
import plextv
|
import plextv
|
||||||
import pmsconnect
|
import pmsconnect
|
||||||
import versioncheck
|
import versioncheck
|
||||||
|
@ -162,6 +163,9 @@ def initialize(config_file):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(u"Could not perform upgrades: %s" % e)
|
logger.error(u"Could not perform upgrades: %s" % e)
|
||||||
|
|
||||||
|
# Add notifier configs to logger blacklist
|
||||||
|
notifiers.blacklist_logger()
|
||||||
|
|
||||||
# Check if PlexPy has a uuid
|
# Check if PlexPy has a uuid
|
||||||
if CONFIG.PMS_UUID == '' or not CONFIG.PMS_UUID:
|
if CONFIG.PMS_UUID == '' or not CONFIG.PMS_UUID:
|
||||||
my_uuid = generate_uuid()
|
my_uuid = generate_uuid()
|
||||||
|
|
|
@ -594,7 +594,7 @@ _CONFIG_DEFINITIONS = {
|
||||||
'XBMC_ON_NEWDEVICE': (int, 'XBMC', 0)
|
'XBMC_ON_NEWDEVICE': (int, 'XBMC', 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
_BLACKLIST_KEYS = ['_APITOKEN', '_TOKEN', '_KEY', '_SECRET', '_PASSWORD', '_APIKEY', '_ID']
|
_BLACKLIST_KEYS = ['_APITOKEN', '_TOKEN', '_KEY', '_SECRET', '_PASSWORD', '_APIKEY', '_ID', '_HOOK']
|
||||||
_WHITELIST_KEYS = ['HTTPS_KEY', 'UPDATE_SECTION_IDS']
|
_WHITELIST_KEYS = ['HTTPS_KEY', 'UPDATE_SECTION_IDS']
|
||||||
|
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ class Config(object):
|
||||||
subkey.upper() not in _WHITELIST_KEYS and any(bk in subkey.upper() for bk in _BLACKLIST_KEYS):
|
subkey.upper() not in _WHITELIST_KEYS and any(bk in subkey.upper() for bk in _BLACKLIST_KEYS):
|
||||||
blacklist.append(value.strip())
|
blacklist.append(value.strip())
|
||||||
|
|
||||||
logger._BLACKLIST_WORDS = blacklist
|
logger._BLACKLIST_WORDS.extend(blacklist)
|
||||||
|
|
||||||
def _define(self, name):
|
def _define(self, name):
|
||||||
key = name.upper()
|
key = name.upper()
|
||||||
|
|
|
@ -44,6 +44,7 @@ import database
|
||||||
import helpers
|
import helpers
|
||||||
import logger
|
import logger
|
||||||
import request
|
import request
|
||||||
|
from plexpy.config import _BLACKLIST_KEYS, _WHITELIST_KEYS
|
||||||
from plexpy.helpers import checked
|
from plexpy.helpers import checked
|
||||||
|
|
||||||
AGENT_IDS = {'growl': 0,
|
AGENT_IDS = {'growl': 0,
|
||||||
|
@ -503,6 +504,23 @@ def send_notification(notifier_id=None, subject='', body='', action='', **kwargs
|
||||||
logger.debug(u"PlexPy Notifiers :: Notification requested but no notifier_id received.")
|
logger.debug(u"PlexPy Notifiers :: Notification requested but no notifier_id received.")
|
||||||
|
|
||||||
|
|
||||||
|
def blacklist_logger():
|
||||||
|
monitor_db = database.MonitorDatabase()
|
||||||
|
notifiers = monitor_db.select('SELECT notifier_config FROM notifiers')
|
||||||
|
|
||||||
|
blacklist = []
|
||||||
|
blacklist_keys = [w.lstrip('_') for w in _BLACKLIST_KEYS]
|
||||||
|
|
||||||
|
for n in notifiers:
|
||||||
|
config = json.loads(n['notifier_config'] or '{}')
|
||||||
|
for key, value in config.iteritems():
|
||||||
|
if isinstance(value, basestring) and len(value.strip()) > 5 and \
|
||||||
|
key.upper() not in _WHITELIST_KEYS and any(bk in key.upper() for bk in blacklist_keys):
|
||||||
|
blacklist.append(value.strip())
|
||||||
|
|
||||||
|
logger._BLACKLIST_WORDS.extend(blacklist)
|
||||||
|
|
||||||
|
|
||||||
class PrettyMetadata(object):
|
class PrettyMetadata(object):
|
||||||
def __init__(self, parameters):
|
def __init__(self, parameters):
|
||||||
self.parameters = parameters
|
self.parameters = parameters
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue