- Plex Token (for use with Plex Home)
+ Plex Token (for use with Plex Home)
diff --git a/headphones/__init__.py b/headphones/__init__.py
index 553a3b80..92b274a9 100644
--- a/headphones/__init__.py
+++ b/headphones/__init__.py
@@ -138,13 +138,13 @@ def initialize(config_file):
logger.initLogger(console=not QUIET, log_dir=CONFIG.LOG_DIR,
verbose=VERBOSE)
- if CONFIG.SOFT_CHROOT:
- # soft chroot defined, lets try to initialize:
- try:
- SOFT_CHROOT = SoftChroot(str(CONFIG.SOFT_CHROOT))
- except exceptions.SoftChrootError as e:
- logger.error("SoftChroot error: %s", e)
- raise e
+ try:
+ SOFT_CHROOT = SoftChroot(str(CONFIG.SOFT_CHROOT))
+ if SOFT_CHROOT.isEnabled():
+ logger.info("Soft-chroot enabled for dir: %s", str(CONFIG.SOFT_CHROOT))
+ except exceptions.SoftChrootError as e:
+ logger.error("SoftChroot error: %s", e)
+ raise e
if not CONFIG.CACHE_DIR:
# Put the cache dir in the data dir for now
diff --git a/headphones/config.py b/headphones/config.py
index 75695517..97675305 100644
--- a/headphones/config.py
+++ b/headphones/config.py
@@ -116,8 +116,8 @@ _CONFIG_DEFINITIONS = {
'HEADPHONES_INDEXER': (bool_int, 'General', False),
'HPPASS': (str, 'General', ''),
'HPUSER': (str, 'General', ''),
- 'HTTPS_CERT': (str, 'General', ''),
- 'HTTPS_KEY': (str, 'General', ''),
+ 'HTTPS_CERT': (path, 'General', ''),
+ 'HTTPS_KEY': (path, 'General', ''),
'HTTP_HOST': (str, 'General', 'localhost'),
'HTTP_PASSWORD': (str, 'General', ''),
'HTTP_PORT': (int, 'General', 8181),
diff --git a/headphones/softchroot.py b/headphones/softchroot.py
index 5117a000..80878548 100644
--- a/headphones/softchroot.py
+++ b/headphones/softchroot.py
@@ -2,6 +2,10 @@ import os
from headphones.exceptions import SoftChrootError
class SoftChroot(object):
+ """ SoftChroot provides SOFT chrooting for UI
+
+ IMPORTANT: call methods of this class just in modules, which generates data for client UI. Try to avoid unnecessary usage.
+ """
enabled = False
chroot = None
diff --git a/headphones/webserve.py b/headphones/webserve.py
index 0455cb92..d4639ad3 100644
--- a/headphones/webserve.py
+++ b/headphones/webserve.py
@@ -1367,6 +1367,13 @@ class WebInterface(object):
"idtag": checked(headphones.CONFIG.IDTAG)
}
+ for k, v in config.iteritems():
+ if isinstance(v, headphones.config.path):
+ # need to apply SoftChroot to paths:
+ nv = headphones.SOFT_CHROOT.apply(v)
+ if v != nv:
+ config[k] = headphones.config.path(nv)
+
# Need to convert EXTRAS to a dictionary we can pass to the config:
# it'll come in as a string like 2,5,6,8
@@ -1436,6 +1443,17 @@ class WebInterface(object):
kwargs[plain_config] = kwargs[use_config]
del kwargs[use_config]
+ for k, v in kwargs.iteritems():
+ # TODO : HUGE crutch. It is all because there is no way to deal with options...
+ _conf = headphones.CONFIG._define(k)
+ conftype = _conf[1]
+
+ #print '===>', conftype
+ if conftype is headphones.config.path:
+ nv = headphones.SOFT_CHROOT.revoke(v)
+ if nv != v:
+ kwargs[k] = nv
+
# Check if encoderoutputformat is set multiple times
if len(kwargs['encoderoutputformat'][-1]) > 1:
kwargs['encoderoutputformat'] = kwargs['encoderoutputformat'][-1]