diff --git a/data/interfaces/default/css/plexpy.css b/data/interfaces/default/css/plexpy.css index e07abbdb..8bec7a0d 100644 --- a/data/interfaces/default/css/plexpy.css +++ b/data/interfaces/default/css/plexpy.css @@ -103,7 +103,7 @@ div.form-control .selectize-input { overflow: hidden; text-overflow: ellipsis; } -.selectize-dropdown.form-control.selectize-pms-ip { +#selectize-pms-ip-container .selectize-dropdown.form-control.selectize-pms-ip { margin-left: 15px; } .wizard-input-section .selectize-control.form-control.selectize-pms-ip .selectize-dropdown .selectize-dropdown-content { diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index f1853936..12a7d983 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -5,7 +5,7 @@ import plexpy from plexpy import common, notifiers - from plexpy.helpers import anon_url + from plexpy.helpers import anon_url, checked available_notification_agents = sorted(notifiers.available_notification_agents(), key=lambda k: k['label']) %> @@ -650,13 +650,15 @@

Check this if your Plex Server is not on the same local network as Tautulli.

If you have secure connections enabled on your Plex Server, communicate with it securely.

@@ -1586,7 +1588,7 @@ $(document).ready(function() { if (serverChanged || authChanged || httpChanged || directoryChanged) { $('#restart-modal').modal('show'); } - $("#http_hashed_password").val($("#http_hash_password").is(":checked") ? 1 : 0) + $("#http_hashed_password").val($("#http_hash_password").is(":checked") ? 1 : 0); getConfigurationTable(); getSchedulerTable(); getNotifiersTable(); @@ -1772,6 +1774,15 @@ $(document).ready(function() { verifyServer(); }); + $('.checkbox-toggle').click(function () { + var configToggle = $(this).data('id'); + if ($(this).is(':checked')) { + $('#'+configToggle).val(1); + } else { + $('#'+configToggle).val(0); + } + }); + var $select_pms = $('#pms_ip').selectize({ createOnBlur: true, openOnFocus: true, @@ -1823,10 +1834,12 @@ $(document).ready(function() { var is_cloud = $(pms_ip_selected).data('is_cloud'); $("#pms_identifier").val(identifier !== 'undefined' ? identifier : ''); - $('#pms_port').val((port !== 'undefined' ? port : 32400)); - $('#pms_is_remote').prop('checked', (local !== 'undefined' && local === 0)); - $('#pms_ssl').prop('checked', (ssl !== 'undefined' && ssl === 1)); - $('#pms_is_cloud').val((is_cloud !== 'undefined' && is_cloud === true ? 1 : 0)); + $('#pms_port').val(port !== 'undefined' ? port : 32400); + $('#pms_is_remote_checkbox').prop('checked', (local !== 'undefined' && local === 0)); + $('#pms_is_remote').val(local !== 'undefined' && local === 0 ? 1 : 0); + $('#pms_ssl_checkbox').prop('checked', (ssl !== 'undefined' && ssl === 1)); + $('#pms_ssl').val(ssl !== 'undefined' && ssl === 1 ? 1 : 0); + $('#pms_is_cloud').val(is_cloud !== 'undefined' && is_cloud === true ? 1 : 0); $('#pms_url_manual').prop('checked', false); PMSCloudCheck(); } @@ -1858,8 +1871,10 @@ $(document).ready(function() { function PMSCloudCheck () { if ($('#pms_is_cloud').val() === "1") { $('#pms_port').val(443).prop('readonly', true); - $('#pms_is_remote').prop('checked', true).prop('disabled', true); - $('#pms_ssl').prop('checked', true).prop('disabled', true); + $('#pms_is_remote_checkbox').prop('checked', true).prop('disabled', true); + $('#pms_is_remote').val(1); + $('#pms_ssl_checkbox').prop('checked', true).prop('disabled', true); + $('#pms_ssl').val(1); $('#pms_url_manual').prop('checked', false).prop('disabled', true); $('#monitor_pms_updates').prop('checked', false).prop('disabled', true); $('#pms_update_options').hide(); @@ -1867,18 +1882,18 @@ $(document).ready(function() { $('#cloudManualConnection').show(); $('#cloudMonitorUpdates').show(); $('#cloudMonitorRemoteAccess').show(); - $('#remoteAccessCheck').hide(); } else { $('#pms_port').prop('readonly', false); - $('#pms_is_remote').prop('disabled', false); - $('#pms_ssl').prop('disabled', false); + $('#pms_is_remote_checkbox').prop('disabled', false); + $('#pms_is_remote').val($('#pms_is_remote_checkbox').is(':checked') ? 1 : 0); + $('#pms_ssl_checkbox').prop('disabled', false); + $('#pms_ssl').val($('#pms_ssl_checkbox').is(':checked') ? 1 : 0); $('#pms_url_manual').prop('disabled', false); $('#monitor_pms_updates').prop('disabled', false); $('#monitor_remote_access').prop('disabled', false); $('#cloudManualConnection').hide(); $('#cloudMonitorUpdates').hide(); $('#cloudMonitorRemoteAccess').hide(); - remoteAccessEnabledCheck(); } } PMSCloudCheck(); @@ -1887,8 +1902,8 @@ $(document).ready(function() { var pms_ip = $("#pms_ip").val(); var pms_port = $("#pms_port").val(); var pms_identifier = $("#pms_identifier").val(); - var pms_ssl = $("#pms_ssl").is(':checked') ? 1 : 0; - var pms_is_remote = $("#pms_is_remote").is(':checked') ? 1 : 0; + var pms_ssl = $("#pms_ssl").val(); + var pms_is_remote = $("#pms_is_remote").val(); if (($("#pms_ip").val() !== '') || ($("#pms_port").val() !== '')) { $("#pms_verify").html('').fadeIn('fast'); @@ -2008,8 +2023,7 @@ $(document).ready(function() { success: function(data) { if (data !== 'true') { $("#remoteAccessCheck").html("Remote access must be enabled on your Plex Server. Click here for help."); - $("#monitor_remote_access").attr("disabled", true); - $("#monitor_remote_access").attr("checked", false); + $("#monitor_remote_access").attr("checked", false).attr("disabled", true); } } }); @@ -2024,11 +2038,11 @@ $(document).ready(function() { home_sections.push(sec.value); }); $('#home_sections').val(home_sections); - }; + } var sec_cards = ${config['home_sections'] | n}; sec_cards.reverse().forEach(function (item) { - $('#hsec-' + item).prop('checked', !$(this).prop('checked')) + $('#hsec-' + item).prop('checked', !$(this).prop('checked')); $('#hsec-' + item).closest('li.card').prependTo('#sortable_home_sections'); }); @@ -2050,11 +2064,11 @@ $(document).ready(function() { home_stats_cards.push(card.value); }); $('#home_stats_cards').val(home_stats_cards); - }; + } var config_cards = ${config['home_stats_cards'] | n}; config_cards.reverse().forEach(function (item) { - $('#hscard-' + item).prop('checked', !$(this).prop('checked')) + $('#hscard-' + item).prop('checked', !$(this).prop('checked')); $('#hscard-' + item).closest('li.card').prependTo('#sortable_home_stats_cards'); }); @@ -2076,7 +2090,7 @@ $(document).ready(function() { home_library_cards.push(card.value); }); $('#home_library_cards').val(home_library_cards); - }; + } $.ajax({ url: 'get_library_sections', @@ -2115,12 +2129,10 @@ $(document).ready(function() { function allowPlexAdminCheck () { if ($("#http_basic_auth").is(":checked")) { - $("#http_plex_admin").attr("disabled", true); - $("#http_plex_admin").attr("checked", false); + $("#http_plex_admin").attr("checked", false).attr("disabled", true); $("#allowPlexCheck").html("Plex admin login cannot be enabled with basic authentication."); } else if ($('#http_username').val() == '' || $('#http_password').val() == '') { - $("#http_plex_admin").attr("disabled", true); - $("#http_plex_admin").attr("checked", false); + $("#http_plex_admin").attr("checked", false).attr("disabled", true); $("#allowPlexCheck").html("You must set an admin username and password above to allow Plex admin login."); } else { $("#http_plex_admin").attr("disabled", false); @@ -2135,12 +2147,10 @@ $(document).ready(function() { function allowGuestAccessCheck () { if ($("#http_basic_auth").is(":checked")) { - $("#allow_guest_access").attr("disabled", true); - $("#allow_guest_access").attr("checked", false); + $("#allow_guest_access").attr("checked", false).attr("disabled", true); $("#allowGuestCheck").html("Guest access cannot be enabled with basic authentication."); } else if ($('#http_username').val() == '' || $('#http_password').val() == '') { - $("#allow_guest_access").attr("disabled", true); - $("#allow_guest_access").attr("checked", false); + $("#allow_guest_access").attr("checked", false).attr("disabled", true); $("#allowGuestCheck").html("You must set an admin username and password above to allow guest access."); } else { $("#allow_guest_access").attr("disabled", false); @@ -2155,8 +2165,7 @@ $(document).ready(function() { function hashPasswordCheck () { if ($("#http_basic_auth").is(":checked")) { - $("#http_hash_password").attr("checked", false); - $("#http_hash_password").attr("disabled", true); + $("#http_hash_password").attr("checked", false).attr("disabled", true); $("#hashPasswordCheck").html("Password cannot be hashed with basic authentication."); } else { $("#http_hash_password").attr("disabled", false); diff --git a/data/interfaces/default/welcome.html b/data/interfaces/default/welcome.html index 1d37e495..0db9a867 100644 --- a/data/interfaces/default/welcome.html +++ b/data/interfaces/default/welcome.html @@ -1,6 +1,6 @@ <% import plexpy - from plexpy import common + from plexpy import common, helpers %> @@ -109,20 +109,23 @@
+ Verify @@ -286,6 +289,15 @@ $(document).ready(function() { }) }); + $('.checkbox-toggle').click(function () { + var configToggle = $(this).data('id'); + if ($(this).is(':checked')) { + $('#'+configToggle).val(1); + } else { + $('#'+configToggle).val(0); + } + }); + var $select_pms = $('#pms_ip').selectize({ createOnBlur: true, openOnFocus: true, @@ -303,6 +315,7 @@ $(document).ready(function() { '" data-identifier="' + item.clientIdentifier + '" data-ip="' + item.ip + '" data-port="' + item.port + + '" data-is_cloud="' + item.is_cloud + '" data-label="' + item.label + '">' + '' + escape(label) + '' + (caption ? '' + escape(caption) + '' : '') + @@ -316,6 +329,7 @@ $(document).ready(function() { '" data-identifier="' + item.clientIdentifier + '" data-ip="' + item.ip + '" data-port="' + item.port + + '" data-is_cloud="' + item.is_cloud + '" data-label="' + item.label + '">' + escape(label) + (caption ? '' + escape(caption) + '' : '') + @@ -331,14 +345,28 @@ $(document).ready(function() { var port = $(pms_ip_selected).data('port'); var local = $(pms_ip_selected).data('local'); var ssl = $(pms_ip_selected).data('ssl'); + var is_cloud = $(pms_ip_selected).data('is_cloud'); - $("#pms_valid").val((identifier !== 'undefined' ? 'valid' : '')); - $("#pms-verify-status").html((identifier !== 'undefined' ? ' Server found!' : '')).fadeIn('fast'); + $("#pms_valid").val(identifier !== 'undefined' ? 'valid' : ''); + $("#pms-verify-status").html(identifier !== 'undefined' ? ' Server found!' : '').fadeIn('fast'); $("#pms_identifier").val(identifier !== 'undefined' ? identifier : ''); - $('#pms_port').val((port !== 'undefined' ? port : 32400)); - $('#pms_is_remote').prop('checked', (local !== 'undefined' && local === 0)); - $('#pms_ssl').prop('checked', (ssl !== 'undefined' && ssl === 1)); + $('#pms_port').val(port !== 'undefined' ? port : 32400); + $('#pms_is_remote_checkbox').prop('checked', (local !== 'undefined' && local === 0)); + $('#pms_is_remote').val(local !== 'undefined' && local === 0 ? 1 : 0); + $('#pms_ssl_checkbox').prop('checked', (ssl !== 'undefined' && ssl === 1)); + $('#pms_ssl').val(ssl !== 'undefined' && ssl === 1 ? 1 : 0); + $('#pms_is_cloud').val(is_cloud !== 'undefined' && is_cloud === true ? 1 : 0); + + if (is_cloud === true) { + $('#pms_port').prop('readonly', true); + $('#pms_is_remote_checkbox').prop('disabled', true); + $('#pms_ssl_checkbox').prop('disabled', true); + } else { + $('#pms_port').prop('readonly', false); + $('#pms_is_remote_checkbox').prop('disabled', false); + $('#pms_ssl_checkbox').prop('disabled', false); + } } }); var select_pms = $select_pms[0].selectize; @@ -372,14 +400,19 @@ $(document).ready(function() { var pms_ip = $("#pms_ip").val().trim(); var pms_port = $("#pms_port").val().trim(); var pms_identifier = $("#pms_identifier").val(); - var pms_ssl = $("#pms_ssl").is(':checked') ? 1 : 0; - var pms_is_remote = $("#pms_is_remote").is(':checked') ? 1 : 0; + var pms_ssl = $("#pms_ssl").val(); + var pms_is_remote = $("#pms_is_remote").val(); if ((pms_ip !== '') || (pms_port !== '')) { $("#pms-verify-status").html(' Validating server...'); $('#pms-verify-status').fadeIn('fast'); $.ajax({ url: 'get_server_id', - data: { hostname: pms_ip, port: pms_port, identifier: pms_identifier, ssl: pms_ssl, remote: pms_is_remote }, + data: { + hostname: pms_ip, + port: pms_port, + identifier: pms_identifier, + ssl: pms_ssl, + remote: pms_is_remote }, cache: true, async: true, timeout: 5000, diff --git a/plexpy/webserve.py b/plexpy/webserve.py index c57d6dcd..d306cc58 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -98,10 +98,11 @@ class WebInterface(object): config = { "pms_identifier": plexpy.CONFIG.PMS_IDENTIFIER, "pms_ip": plexpy.CONFIG.PMS_IP, - "pms_is_remote": checked(plexpy.CONFIG.PMS_IS_REMOTE), "pms_port": plexpy.CONFIG.PMS_PORT, + "pms_is_remote": plexpy.CONFIG.PMS_IS_REMOTE, + "pms_ssl": plexpy.CONFIG.PMS_SSL, + "pms_is_cloud": plexpy.CONFIG.PMS_IS_CLOUD, "pms_token": plexpy.CONFIG.PMS_TOKEN, - "pms_ssl": checked(plexpy.CONFIG.PMS_SSL), "pms_uuid": plexpy.CONFIG.PMS_UUID, "logging_ignore_interval": plexpy.CONFIG.LOGGING_IGNORE_INTERVAL } @@ -2562,8 +2563,8 @@ class WebInterface(object): "pms_logs_folder": plexpy.CONFIG.PMS_LOGS_FOLDER, "pms_port": plexpy.CONFIG.PMS_PORT, "pms_token": plexpy.CONFIG.PMS_TOKEN, - "pms_ssl": checked(plexpy.CONFIG.PMS_SSL), - "pms_is_remote": checked(plexpy.CONFIG.PMS_IS_REMOTE), + "pms_ssl": plexpy.CONFIG.PMS_SSL, + "pms_is_remote": plexpy.CONFIG.PMS_IS_REMOTE, "pms_is_cloud": plexpy.CONFIG.PMS_IS_CLOUD, "pms_url_manual": checked(plexpy.CONFIG.PMS_URL_MANUAL), "pms_uuid": plexpy.CONFIG.PMS_UUID, @@ -2623,7 +2624,7 @@ class WebInterface(object): checked_configs = [ "launch_browser", "enable_https", "https_create_cert", "api_enabled", "freeze_db", "check_github", "grouping_global_history", "grouping_user_history", "grouping_charts", "group_history_tables", - "pms_ssl", "pms_is_remote", "pms_url_manual", "week_start_monday", + "pms_url_manual", "week_start_monday", "refresh_libraries_on_startup", "refresh_users_on_startup", "notify_consecutive", "notify_upload_posters", "notify_recently_added_upgrade", "notify_group_recently_added_grandparent", "notify_group_recently_added_parent",