Hide HTTPS Domains and IPs if not creating self-signed certificate

This commit is contained in:
JonnyWong16 2016-02-13 16:48:55 -08:00
parent e1c7a37f62
commit 635bf364ac
2 changed files with 32 additions and 15 deletions

View file

@ -344,23 +344,25 @@ scheduled_jobs = [j.id for j in plexpy.SCHED.get_jobs()]
</label> </label>
<p class="help-block">Check to have PlexPy create a self-signed SSL certificate. Uncheck if you want to use your own certificate.</p> <p class="help-block">Check to have PlexPy create a self-signed SSL certificate. Uncheck if you want to use your own certificate.</p>
</div> </div>
<div class="form-group"> <div id="https_options_self-signed">
<label for="https_domain">HTTPS Domains</label> <div class="form-group">
<div class="row"> <label for="https_domain">HTTPS Domains</label>
<div class="col-md-6"> <div class="row">
<input type="text" class="form-control http-settings" id="https_domain" name="https_domain" value="${config['https_domain']}"> <div class="col-md-6">
<input type="text" class="form-control http-settings" id="https_domain" name="https_domain" value="${config['https_domain']}">
</div>
</div> </div>
<p class="help-block">The domain names used to access PlexPy, separated by commas (,).</p>
</div> </div>
<p class="help-block">The domain names used to access PlexPy, separated by commas (,).</p> <div class="form-group">
</div> <label for="https_ip">HTTPS IPs</label>
<div class="form-group"> <div class="row">
<label for="https_ip">HTTPS IPs</label> <div class="col-md-6">
<div class="row"> <input type="text" class="form-control http-settings" id="https_ip" name="https_ip" value="${config['https_ip']}">
<div class="col-md-6"> </div>
<input type="text" class="form-control http-settings" id="https_ip" name="https_ip" value="${config['https_ip']}">
</div> </div>
<p class="help-block">The IP addresses used to access PlexPy, separated by commas (,).</p>
</div> </div>
<p class="help-block">The IP addresses used to access PlexPy, separated by commas (,).</p>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="https_cert">HTTPS Cert</label> <label for="https_cert">HTTPS Cert</label>
@ -1732,6 +1734,20 @@ $(document).ready(function() {
} }
}); });
if ($("#https_create_cert").is(":checked")) {
$("#https_options_self-signed").show();
} else {
$("#https_options_self-signed").hide();
}
$("#https_create_cert").click(function(){
if ($("#https_create_cert").is(":checked")) {
$("#https_options_self-signed").slideDown();
} else {
$("#https_options_self-signed").slideUp();
}
});
$( ".http-settings" ).change(function() { $( ".http-settings" ).change(function() {
httpChanged = true; httpChanged = true;
}); });

View file

@ -1273,8 +1273,9 @@ class WebInterface(object):
server_changed = True server_changed = True
# If we change the HTTPS setting, make sure we generate a new certificate. # If we change the HTTPS setting, make sure we generate a new certificate.
if kwargs['https_create_cert']: if 'https_create_cert' in kwargs and kwargs['https_create_cert']:
if 'https_domain' in kwargs and (kwargs['https_domain'] != plexpy.CONFIG.HTTPS_DOMAIN) or \ if 'https_create_cert' in kwargs and (kwargs['https_create_cert'] != plexpy.CONFIG.HTTPS_CREATE_CERT) or \
'https_domain' in kwargs and (kwargs['https_domain'] != plexpy.CONFIG.HTTPS_DOMAIN) or \
'https_ip' in kwargs and (kwargs['https_ip'] != plexpy.CONFIG.HTTPS_IP) or \ 'https_ip' in kwargs and (kwargs['https_ip'] != plexpy.CONFIG.HTTPS_IP) or \
'https_cert' in kwargs and (kwargs['https_cert'] != plexpy.CONFIG.HTTPS_CERT) or \ 'https_cert' in kwargs and (kwargs['https_cert'] != plexpy.CONFIG.HTTPS_CERT) or \
'https_key' in kwargs and (kwargs['https_key'] != plexpy.CONFIG.HTTPS_KEY): 'https_key' in kwargs and (kwargs['https_key'] != plexpy.CONFIG.HTTPS_KEY):