From 1e1e3beca6dce6032e8eeadb0c92e2a3e5070e2e Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Sun, 15 May 2016 17:20:14 -0700 Subject: [PATCH 01/18] Check for blank username/passwords on login --- plexpy/webauth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plexpy/webauth.py b/plexpy/webauth.py index a2c6f4f5..e9cc15b0 100644 --- a/plexpy/webauth.py +++ b/plexpy/webauth.py @@ -36,7 +36,7 @@ from plexpy.plextv import PlexTV SESSION_KEY = '_cp_username' def user_login(username=None, password=None): - if not username and not password: + if not username or not password: return None # Try to login to Plex.tv to check if the user has a vaild account @@ -211,7 +211,7 @@ class AuthController(object): if not cherrypy.config.get('tools.sessions.on'): raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT) - if username is None or password is None: + if not username and not password: return self.get_loginform() (vaild_login, user_group) = check_credentials(username, password, admin_login) From 69cfbea5f3cd3c0244b6e90e61303839b24f6ee6 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Sun, 15 May 2016 17:20:28 -0700 Subject: [PATCH 02/18] Refresh Join device list when changing API key --- data/interfaces/default/notification_config.html | 2 +- plexpy/notifiers.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/data/interfaces/default/notification_config.html b/data/interfaces/default/notification_config.html index d56049b9..35f43fa6 100644 --- a/data/interfaces/default/notification_config.html +++ b/data/interfaces/default/notification_config.html @@ -217,7 +217,7 @@ } } - $('#pushbullet_apikey, #pushover_apitoken, #scripts_folder').on('change', function () { + $('#pushbullet_apikey, #pushover_apitoken, #scripts_folder, #join_apikey').on('change', function () { // Reload modal to update certain fields doAjaxCall('set_notification_config', $(this), 'tabs', true, reloadModal); return false; diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 0fa445f3..1fb1ea96 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -2633,6 +2633,8 @@ class JOIN(object): def return_config_options(self): devices = '
'.join(['%s: %s' % (v, k) for k, v in self.get_devices().iteritems() if k]) + if not devices: + devices = 'Enter your Join API key to load your device list.' config_option = [{'label': 'Join API Key', 'value': self.apikey, From 36398fe95818c025465545848c780854fe8ce1c9 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Sun, 15 May 2016 21:54:25 -0700 Subject: [PATCH 03/18] Persist current activity artwork blur across refresh --- .../default/current_activity_instance.html | 4 ++-- data/interfaces/default/index.html | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/data/interfaces/default/current_activity_instance.html b/data/interfaces/default/current_activity_instance.html index 5a51b99b..9e69faff 100644 --- a/data/interfaces/default/current_activity_instance.html +++ b/data/interfaces/default/current_activity_instance.html @@ -71,7 +71,7 @@ DOCUMENTATION :: END % else: % endif -
+
% if not data['art'].startswith('interfaces') or not data['thumb'].startswith('interfaces'): % if (data['media_type'] == 'movie' and not data['indexes']) or (data['indexes'] and not data['view_offset']):
@@ -105,7 +105,7 @@ DOCUMENTATION :: END
% endif
-
diff --git a/data/interfaces/default/index.html b/data/interfaces/default/index.html index 36d2887e..e844b9fe 100644 --- a/data/interfaces/default/index.html +++ b/data/interfaces/default/index.html @@ -150,6 +150,7 @@ bif_poster.animate({ opacity: 0 }, { duration: 1000, queue: false }); bif_poster.after($('
').fadeIn(1000, function () { bif_poster.remove() })); + blurArtwork(key); } // if transcoding, update the transcode state @@ -210,14 +211,18 @@ getCurrentActivity(); }, 15000); + function blurArtwork(session_key) { + var filterVal = $('#stream-' + session_key).is(':visible') ? 'blur(5px)' : ''; + $($('#poster-' + session_key).find('.dashboard-activity-poster-face, .dashboard-activity-cover-face')) + .css('filter', filterVal).css('webkitFilter', filterVal).css('mozFilter', filterVal).css('oFilter', filterVal).css('msFilter', filterVal); + } + // Show/Hide activity info $('#currentActivity').on('click', '.btn-activity-info', function (e) { e.preventDefault(); $($(this).attr('data-target')).toggle(); - var id = $(this).closest('.dashboard-instance').data('id'); - var filterVal = $('#stream-' + id).is(':visible') ? 'blur(5px)' : ''; - $($(this).closest('.dashboard-activity-poster').find('.dashboard-activity-poster-face, .dashboard-activity-cover-face')) - .css('filter',filterVal).css('webkitFilter',filterVal).css('mozFilter',filterVal).css('oFilter',filterVal).css('msFilter',filterVal); + var key = $(this).data('id'); + blurArtwork(key); }); // Add hover class to dashboard-instance From 9e41bf529d8a176edc88a5f0d15d394ea39fe811 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Mon, 16 May 2016 08:28:40 -0700 Subject: [PATCH 04/18] Don't return inside the loop after sending XBMC/Plex notifications --- plexpy/notifiers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 1fb1ea96..85212e33 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -786,12 +786,13 @@ class XBMC(object): raise Exception else: logger.info(u"PlexPy Notifiers :: XBMC notification sent.") - return True except Exception: - logger.warn(u"PlexPy Notifiers :: XBMC notification filed.") + logger.warn(u"PlexPy Notifiers :: XBMC notification failed.") return False + return True + def return_config_options(self): config_option = [{'label': 'XBMC Host:Port', 'value': self.hosts, @@ -870,11 +871,12 @@ class Plex(object): raise Exception else: logger.info(u"PlexPy Notifiers :: Plex Home Theater notification sent.") - return True except Exception: - logger.warn(u"PlexPy Notifiers :: Plex Home Theater notification filed.") + logger.warn(u"PlexPy Notifiers :: Plex Home Theater notification failed.") return False + + return True def return_config_options(self): config_option = [{'label': 'Plex Home Theater Host:Port', From 8b58f6b861b854f80d868bb6b9297b2e797ab6b7 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Mon, 16 May 2016 09:14:00 -0700 Subject: [PATCH 05/18] Make sure pms_identifier is cleared first when verifying server --- data/interfaces/default/settings.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index 9d1f54d2..633afeaf 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -2234,7 +2234,6 @@ $(document).ready(function() { $( ".pms-settings" ).change(function() { serverChanged = true; $("#pms_identifier").val(""); - $("#pms-verify-status").html(""); $("#server_changed").prop('checked', true); verifyServer(); }); @@ -2287,6 +2286,7 @@ $(document).ready(function() { } $('#verify_server_button').on('click', function(){ + $("#pms_identifier").val(""); verifyServer(); }); @@ -2594,4 +2594,4 @@ $(document).ready(function() { }); }); - \ No newline at end of file + From 9ecabc3fafb9a0f4aec785ae5cdd332e433fef32 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Mon, 16 May 2016 18:18:30 -0700 Subject: [PATCH 06/18] Just make sure redirects include http_root --- plexpy/webauth.py | 6 +++--- plexpy/webserve.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plexpy/webauth.py b/plexpy/webauth.py index e9cc15b0..805bec7c 100644 --- a/plexpy/webauth.py +++ b/plexpy/webauth.py @@ -119,7 +119,7 @@ def check_auth(*args, **kwargs): if not condition(): raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT) else: - raise cherrypy.HTTPRedirect("auth/logout") + raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + "auth/logout") def requireAuth(*conditions): """A decorator that appends conditions to the auth.require config @@ -204,7 +204,7 @@ class AuthController(object): @cherrypy.expose def index(self): - raise cherrypy.HTTPRedirect("login") + raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + "auth/login") @cherrypy.expose def login(self, username=None, password=None, remember_me='0', admin_login='0'): @@ -257,4 +257,4 @@ class AuthController(object): if _session and _session['user']: cherrypy.request.login = None self.on_logout(_session['user'], _session['user_group']) - raise cherrypy.HTTPRedirect("login") \ No newline at end of file + raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + "auth/login") \ No newline at end of file diff --git a/plexpy/webserve.py b/plexpy/webserve.py index cc01fac1..4b554882 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -82,9 +82,9 @@ class WebInterface(object): @requireAuth() def index(self): if plexpy.CONFIG.FIRST_RUN_COMPLETE: - raise cherrypy.HTTPRedirect("home") + raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + "home") else: - raise cherrypy.HTTPRedirect("welcome") + raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + "welcome") ##### Welcome ##### @@ -118,7 +118,7 @@ class WebInterface(object): # The setup wizard just refreshes the page on submit so we must redirect to home if config set. if plexpy.CONFIG.FIRST_RUN_COMPLETE: plexpy.initialize_scheduler() - raise cherrypy.HTTPRedirect("home") + raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + "home") else: return serve_template(templatename="welcome.html", title="Welcome", config=config) @@ -2215,7 +2215,7 @@ class WebInterface(object): log_dir=plexpy.CONFIG.LOG_DIR, verbose=plexpy.VERBOSE) logger.info(u"Verbose toggled, set to %s", plexpy.VERBOSE) logger.debug(u"If you read this message, debug logging is available") - raise cherrypy.HTTPRedirect("logs") + raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + "logs") @cherrypy.expose @requireAuth() @@ -2857,7 +2857,7 @@ class WebInterface(object): @requireAuth(member_of("admin")) def checkGithub(self): versioncheck.checkGithub() - raise cherrypy.HTTPRedirect("home") + raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + "home") @cherrypy.expose @requireAuth(member_of("admin")) From e5530182cd606fb68d1ec121cce925bfb92b927f Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 17 May 2016 20:58:28 -0700 Subject: [PATCH 07/18] Make sure we get a result when trying to group the session --- plexpy/activity_processor.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/plexpy/activity_processor.py b/plexpy/activity_processor.py index 2484cf61..1687d098 100644 --- a/plexpy/activity_processor.py +++ b/plexpy/activity_processor.py @@ -219,26 +219,30 @@ class ActivityProcessor(object): args = [session['user_id']] result = self.db.select(query=query, args=args) - - new_session = {'id': result[0]['id'], - 'rating_key': result[0]['rating_key'], - 'view_offset': result[0]['view_offset'], - 'user_id': result[0]['user_id'], - 'reference_id': result[0]['reference_id']} - if len(result) == 1: - prev_session = None - else: + new_session = prev_session = last_id = None + if len(result) > 1: + new_session = {'id': result[0]['id'], + 'rating_key': result[0]['rating_key'], + 'view_offset': result[0]['view_offset'], + 'user_id': result[0]['user_id'], + 'reference_id': result[0]['reference_id']} + prev_session = {'id': result[1]['id'], 'rating_key': result[1]['rating_key'], 'view_offset': result[1]['view_offset'], 'user_id': result[1]['user_id'], 'reference_id': result[1]['reference_id']} + else: + # Get the last insert row id + result = self.db.select(query='SELECT last_insert_rowid() AS last_id') + last_id = result[0]['last_id'] if result else None query = 'UPDATE session_history SET reference_id = ? WHERE id = ? ' # If rating_key is the same in the previous session, then set the reference_id to the previous row, else set the reference_id to the new id - if (prev_session is not None) and (prev_session['rating_key'] == new_session['rating_key'] \ - and prev_session['view_offset'] <= new_session['view_offset']): + if prev_session == new_session == None: + args = [last_id, last_id] + elif prev_session['rating_key'] == new_session['rating_key'] and prev_session['view_offset'] <= new_session['view_offset']: args = [prev_session['reference_id'], new_session['id']] else: args = [new_session['id'], new_session['id']] From 33458c1bdbd832c5d6bc7be05019ae51697b1da8 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 17 May 2016 21:10:05 -0700 Subject: [PATCH 08/18] Make sure current activity returned sessions when refreshing --- data/interfaces/default/index.html | 5 +++++ data/interfaces/default/recently_added.html | 3 +-- plexpy/webserve.py | 12 ++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/data/interfaces/default/index.html b/data/interfaces/default/index.html index e844b9fe..4100048b 100644 --- a/data/interfaces/default/index.html +++ b/data/interfaces/default/index.html @@ -107,6 +107,11 @@ $('#dashboard-checking-activity').remove(); var current_activity = $.parseJSON(xhr.responseText); + if (!(current_activity)) { + $('#currentActivity').html('
There was an error communicating with your Plex Server.
'); + return + } + var stream_count = parseInt(current_activity.stream_count); var sessions = current_activity.sessions; diff --git a/data/interfaces/default/recently_added.html b/data/interfaces/default/recently_added.html index a1f6440a..6f3a2a59 100644 --- a/data/interfaces/default/recently_added.html +++ b/data/interfaces/default/recently_added.html @@ -109,6 +109,5 @@ DOCUMENTATION :: END
% else: -

+
There was an error communicating with your Plex Server.

% endif \ No newline at end of file diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 4b554882..5edf715a 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -3618,13 +3618,13 @@ class WebInterface(object): pms_connect = pmsconnect.PmsConnect(token=plexpy.CONFIG.PMS_TOKEN) result = pms_connect.get_current_activity() - data_factory = datafactory.DataFactory() - for session in result['sessions']: - if not session['ip_address']: - ip_address = data_factory.get_session_ip(session['session_key']) - session['ip_address'] = ip_address - if result: + data_factory = datafactory.DataFactory() + for session in result['sessions']: + if not session['ip_address']: + ip_address = data_factory.get_session_ip(session['session_key']) + session['ip_address'] = ip_address + return result else: logger.warn(u"Unable to retrieve data for get_activity.") From a660a1c44b9b6c8816e361c986bf659e03702249 Mon Sep 17 00:00:00 2001 From: Hellowlol Date: Wed, 18 May 2016 20:55:20 +0200 Subject: [PATCH 09/18] fix https://github.com/drzoidberg33/plexpy/issues/705#issuecomment-219927893 Can you test and verify --- plexpy/webserve.py | 52 ++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 5edf715a..f8609767 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -1170,7 +1170,7 @@ class WebInterface(object): @requireAuth() @addtoapi() def get_user_logins(self, user_id=None, **kwargs): - """ Get the data on PlexPy user login table. + """ Get the data on PlexPy user login table. ``` Required parameters: @@ -1189,15 +1189,15 @@ class WebInterface(object): "recordsTotal": 2344, "recordsFiltered": 10, "data": - [{"browser": "Safari 7.0.3", - "friendly_name": "Jon Snow", - "host": "http://plexpy.castleblack.com", - "ip_address": "xxx.xxx.xxx.xxx", - "os": "Mac OS X", - "timestamp": 1462591869, - "user": "LordCommanderSnow", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A", - "user_group": "guest", + [{"browser": "Safari 7.0.3", + "friendly_name": "Jon Snow", + "host": "http://plexpy.castleblack.com", + "ip_address": "xxx.xxx.xxx.xxx", + "os": "Mac OS X", + "timestamp": 1462591869, + "user": "LordCommanderSnow", + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A", + "user_group": "guest", "user_id": 133788 }, {...}, @@ -1987,24 +1987,14 @@ class WebInterface(object): def getLog(self, start=0, length=100, **kwargs): start = int(start) length = int(length) - search_value = "" - search_regex = "" - order_column = 0 - order_dir = "desc" - - if 'order[0][dir]' in kwargs: - order_dir = kwargs.get('order[0][dir]', "desc") - - if 'order[0][column]' in kwargs: - order_column = kwargs.get('order[0][column]', "0") - - if 'search[value]' in kwargs: - search_value = kwargs.get('search[value]', "") - - if 'search[regex]' in kwargs: - search_regex = kwargs.get('search[regex]', "") + order_dir = kwargs.get('order[0][dir]', "desc") + order_column = kwargs.get('order[0][column]', "0") + search_value = kwargs.get('search[value]', "") + search_regex = kwargs.get('search[regex]', "") # Remove? + sortcolumn = 0 filt = [] + filtered = [] fa = filt.append with open(os.path.join(plexpy.CONFIG.LOG_DIR, logger.FILENAME)) as f: for l in f.readlines(): @@ -2017,22 +2007,24 @@ class WebInterface(object): # Add traceback message to previous msg. tl = (len(filt) - 1) n = len(l) - len(l.lstrip(' ')) - l = ' ' * (2*n) + l[n:] + l = ' ' * (2 * n) + l[n:] filt[tl][2] += '
' + l continue - filtered = [] if search_value == '': filtered = filt else: filtered = [row for row in filt for column in row if search_value.lower() in column.lower()] - sortcolumn = 0 if order_column == '1': sortcolumn = 2 elif order_column == '2': sortcolumn = 1 - filtered.sort(key=lambda x: x[sortcolumn], reverse=order_dir == "desc") + + filtered.sort(key=lambda x: x[sortcolumn]) + + if order_dir == 'desc': + filtered = filtered[::-1] rows = filtered[start:(start + length)] From 65eab801e8c0f11b00c68ea7f987fbb0deebb1da Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Wed, 18 May 2016 19:31:21 -0700 Subject: [PATCH 10/18] Format Join device ids --- data/interfaces/default/css/plexpy.css | 10 ++++++++++ plexpy/notifiers.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/data/interfaces/default/css/plexpy.css b/data/interfaces/default/css/plexpy.css index e40415e7..ffc79a39 100644 --- a/data/interfaces/default/css/plexpy.css +++ b/data/interfaces/default/css/plexpy.css @@ -2954,4 +2954,14 @@ a.no-highlight:hover { .datatable-wrap { min-width: 150px; max-width: 250px; +} +.inline-pre { + font-family: monospace; + margin: 0 2px; + padding: 2px 5px; + font-size: 13px; + color: #fff; + background-color: #555; + border: 0px solid #444; + border-radius: 3px; } \ No newline at end of file diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 85212e33..ac3b2989 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -2634,7 +2634,8 @@ class JOIN(object): return {'': ''} def return_config_options(self): - devices = '
'.join(['%s: %s' % (v, k) for k, v in self.get_devices().iteritems() if k]) + devices = '
'.join(['%s: %s' + % (v, k) for k, v in self.get_devices().iteritems() if k]) if not devices: devices = 'Enter your Join API key to load your device list.' From b70363e005858c19fef2ac2fc078c5baa3edcefb Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Wed, 18 May 2016 19:31:37 -0700 Subject: [PATCH 11/18] Fix resolution in stream data modal --- data/interfaces/default/stream_data.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/interfaces/default/stream_data.html b/data/interfaces/default/stream_data.html index b0c22db5..f48e38ea 100644 --- a/data/interfaces/default/stream_data.html +++ b/data/interfaces/default/stream_data.html @@ -59,7 +59,7 @@ DOCUMENTATION :: END
  • Container: ${data['transcode_container'] if data['transcode_container'] else data['container']}
  • % if data['media_type'] != 'track': -
  • Resolution: ${data['video_resolution'] + 'p' if data['video_resolution'] != 'sd' else data['video_resolution']}
  • +
  • Resolution: ${data['transcode_height'] if data['transcode_height'] else data['height']}p
  • % endif
@@ -101,7 +101,7 @@ DOCUMENTATION :: END
  • Container: ${data['container']}
  • % if data['media_type'] != 'track': -
  • Resolution: ${data['height']}p
  • +
  • Resolution: ${data['video_resolution'] + 'p' if data['video_resolution'] != 'sd' else data['video_resolution']}
  • % endif
  • Bitrate: ${data['bitrate']} kbps
From a3f0a78df0de62b7a945300120314be52caceda0 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Thu, 19 May 2016 20:24:22 -0700 Subject: [PATCH 12/18] Reduce cost factor for hashing passwords * Also reduce memory cost --- lib/hashing_passwords.py | 2 +- lib/pbkdf2.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hashing_passwords.py b/lib/hashing_passwords.py index 1c2c963b..1b86ec4e 100644 --- a/lib/hashing_passwords.py +++ b/lib/hashing_passwords.py @@ -32,7 +32,7 @@ HASH_FUNCTION = 'sha256' # Must be in hashlib. # Linear to the hashing time. Adjust to be high but take a reasonable # amount of time on your server. Measure with: # python -m timeit -s 'import passwords as p' 'p.make_hash("something")' -COST_FACTOR = 29000 +COST_FACTOR = 10000 def make_hash(password): diff --git a/lib/pbkdf2.py b/lib/pbkdf2.py index b7a7dd42..29455db2 100644 --- a/lib/pbkdf2.py +++ b/lib/pbkdf2.py @@ -72,7 +72,7 @@ def pbkdf2_bin(data, salt, iterations=1000, keylen=24, hashfunc=None): rv = u = _pseudorandom(salt + _pack_int(block)) for i in xrange(iterations - 1): u = _pseudorandom(''.join(map(chr, u))) - rv = starmap(xor, izip(rv, u)) + rv = list(starmap(xor, izip(rv, u))) buf.extend(rv) return ''.join(map(chr, buf))[:keylen] From f4c9dc8a5fad0714b9e5cc921fa5dbeaaa362f3c Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Thu, 19 May 2016 21:54:58 -0700 Subject: [PATCH 13/18] Make sure cherrypy doesn't add the local port twice with http_proxy enabled --- lib/cherrypy/lib/cptools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cherrypy/lib/cptools.py b/lib/cherrypy/lib/cptools.py index 9be571ba..4c8991f8 100644 --- a/lib/cherrypy/lib/cptools.py +++ b/lib/cherrypy/lib/cptools.py @@ -195,7 +195,7 @@ def proxy(base=None, local='X-Forwarded-Host', remote='X-Forwarded-For', if not base: base = request.headers.get('Host', '127.0.0.1') port = request.local.port - if port != 80: + if port != 80 and not base.endswith(':%s' % port): base += ':%s' % port if base.find("://") == -1: From 9d5052cc68919bc1c96a0af397f7daf32c609943 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Thu, 19 May 2016 21:55:11 -0700 Subject: [PATCH 14/18] Add http proxy checkbox to settings --- data/interfaces/default/settings.html | 7 +++++++ plexpy/webserve.py | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index 633afeaf..169ab3d6 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -432,6 +432,13 @@

The base URL of the web server. Used for reverse proxies.

+
+ +

Respect the X-Forwarded-Proto header. Used for reverse proxies with SSL.

+
+