Merge pull request #659 from jc21/develop

v2.6.1
This commit is contained in:
jc21 2020-10-16 15:53:56 +10:00 committed by GitHub
commit 301499dc52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 55 additions and 54 deletions

View File

@ -1 +1 @@
2.6.0 2.6.1

View File

@ -1,7 +1,7 @@
<p align="center"> <p align="center">
<img src="https://nginxproxymanager.com/github.png"> <img src="https://nginxproxymanager.com/github.png">
<br><br> <br><br>
<img src="https://img.shields.io/badge/version-2.6.0-green.svg?style=for-the-badge"> <img src="https://img.shields.io/badge/version-2.6.1-green.svg?style=for-the-badge">
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager"> <a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge"> <img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
</a> </a>

View File

@ -37,7 +37,9 @@ server {
{% endfor %}deny all; {% endfor %}deny all;
# Access checks must... # Access checks must...
{% if access_list.satisfy %}
{{ access_list.satisfy }}; {{ access_list.satisfy }};
{% endif %}
{% endif %} {% endif %}

View File

@ -139,7 +139,11 @@ function FileUpload(path, fd) {
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
if (this.readyState === XMLHttpRequest.DONE) { if (this.readyState === XMLHttpRequest.DONE) {
if (xhr.status !== 200 && xhr.status !== 201) { if (xhr.status !== 200 && xhr.status !== 201) {
reject(new Error('Upload failed: ' + xhr.status)); try {
reject(new Error('Upload failed: ' + JSON.parse(xhr.responseText).error.message));
} catch (err) {
reject(new Error('Upload failed: ' + xhr.status));
}
} else { } else {
resolve(xhr.responseText); resolve(xhr.responseText);
} }
@ -587,7 +591,8 @@ module.exports = {
* @param {Object} data * @param {Object} data
*/ */
create: function (data) { create: function (data) {
const timeout = 180000 + (data.meta.propagation_seconds ? Number(data.meta.propagation_seconds) * 1000 : 0);
const timeout = 180000 + (data && data.meta && data.meta.propagation_seconds ? Number(data.meta.propagation_seconds) * 1000 : 0);
return fetch('post', 'nginx/certificates', data, {timeout}); return fetch('post', 'nginx/certificates', data, {timeout});
}, },

View File

@ -4,17 +4,14 @@
<button type="button" class="close cancel non-loader-content" aria-label="Close" data-dismiss="modal">&nbsp;</button> <button type="button" class="close cancel non-loader-content" aria-label="Close" data-dismiss="modal">&nbsp;</button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="alert alert-danger mb-0 rounded-0" id="le-error-info" role="alert"></div>
<div class="text-center loader-content"> <div class="text-center loader-content">
<div class="loader mx-auto my-6"></div> <div class="loader mx-auto my-6"></div>
<p><%- i18n('ssl', 'obtaining-certificate-info') %></p> <p><%- i18n('ssl', 'processing-info') %></p>
</div> </div>
<form class="non-loader-content"> <form class="non-loader-content">
<div class="row"> <div class="row">
<% if (provider === 'letsencrypt') { %> <% if (provider === 'letsencrypt') { %>
<div class="col-sm-12 col-md-12">
<div class="alert alert-danger" id="le-error-info" role="alert"></div>
</div>
<div class="col-sm-12 col-md-12"> <div class="col-sm-12 col-md-12">
<div class="form-group"> <div class="form-group">
<label class="form-label"><%- i18n('all-hosts', 'domain-names') %> <span class="form-required">*</span></label> <label class="form-label"><%- i18n('all-hosts', 'domain-names') %> <span class="form-required">*</span></label>

View File

@ -76,47 +76,44 @@ module.exports = Mn.View.extend({
return; return;
} }
let view = this;
let data = this.ui.form.serializeJSON(); let data = this.ui.form.serializeJSON();
data.provider = this.model.get('provider'); data.provider = this.model.get('provider');
let domain_err = false;
if (!data.meta.dns_challenge) {
data.domain_names.split(',').map(function (name) {
if (name.match(/\*/im)) {
domain_err = true;
}
});
}
if (domain_err) {
alert(i18n('ssl', 'no-wildcard-without-dns'));
return;
}
// Manipulate
if (typeof data.meta === 'undefined') data.meta = {};
data.meta.letsencrypt_agree = data.meta.letsencrypt_agree == 1;
data.meta.dns_challenge = data.meta.dns_challenge == 1;
if(!data.meta.dns_challenge){
data.meta.dns_provider = undefined;
data.meta.dns_provider_credentials = undefined;
data.meta.propagation_seconds = undefined;
} else {
if(data.meta.propagation_seconds === '') data.meta.propagation_seconds = undefined;
}
if (typeof data.domain_names === 'string' && data.domain_names) {
data.domain_names = data.domain_names.split(',');
}
let ssl_files = []; let ssl_files = [];
// check files are attached if (data.provider === 'letsencrypt') {
if (this.model.get('provider') === 'other' && !this.model.hasSslFiles()) { if (typeof data.meta === 'undefined') data.meta = {};
let domain_err = false;
if (!data.meta.dns_challenge) {
data.domain_names.split(',').map(function (name) {
if (name.match(/\*/im)) {
domain_err = true;
}
});
}
if (domain_err) {
alert(i18n('ssl', 'no-wildcard-without-dns'));
return;
}
// Manipulate
data.meta.letsencrypt_agree = data.meta.letsencrypt_agree == 1;
data.meta.dns_challenge = data.meta.dns_challenge == 1;
if(!data.meta.dns_challenge){
data.meta.dns_provider = undefined;
data.meta.dns_provider_credentials = undefined;
data.meta.propagation_seconds = undefined;
} else {
if(data.meta.propagation_seconds === '') data.meta.propagation_seconds = undefined;
}
if (typeof data.domain_names === 'string' && data.domain_names) {
data.domain_names = data.domain_names.split(',');
}
} else if (data.provider === 'other' && !this.model.hasSslFiles()) {
// check files are attached
if (!this.ui.other_certificate[0].files.length || !this.ui.other_certificate[0].files[0].size) { if (!this.ui.other_certificate[0].files.length || !this.ui.other_certificate[0].files[0].size) {
alert('Certificate file is not attached'); alert('Certificate file is not attached');
return; return;
@ -153,14 +150,14 @@ module.exports = Mn.View.extend({
// compile file data // compile file data
let form_data = new FormData(); let form_data = new FormData();
if (view.model.get('provider') && ssl_files.length) { if (data.provider === 'other' && ssl_files.length) {
ssl_files.map(function (file) { ssl_files.map(function (file) {
form_data.append(file.name, file.file); form_data.append(file.name, file.file);
}); });
} }
new Promise(resolve => { new Promise(resolve => {
if (view.model.get('provider') === 'other') { if (data.provider === 'other') {
resolve(App.Api.Nginx.Certificates.validate(form_data)); resolve(App.Api.Nginx.Certificates.validate(form_data));
} else { } else {
resolve(); resolve();
@ -170,13 +167,13 @@ module.exports = Mn.View.extend({
return App.Api.Nginx.Certificates.create(data); return App.Api.Nginx.Certificates.create(data);
}) })
.then(result => { .then(result => {
view.model.set(result); this.model.set(result);
// Now upload the certs if we need to // Now upload the certs if we need to
if (view.model.get('provider') === 'other') { if (data.provider === 'other') {
return App.Api.Nginx.Certificates.upload(view.model.get('id'), form_data) return App.Api.Nginx.Certificates.upload(this.model.get('id'), form_data)
.then(result => { .then(result => {
view.model.set('meta', _.assign({}, view.model.get('meta'), result)); this.model.set('meta', _.assign({}, this.model.get('meta'), result));
}); });
} }
}) })
@ -187,7 +184,7 @@ module.exports = Mn.View.extend({
}) })
.catch(err => { .catch(err => {
let more_info = ''; let more_info = '';
if(err.code === 500 && err.debug){ if (err.code === 500 && err.debug) {
try{ try{
more_info = JSON.parse(err.debug).debug.stack.join("\n"); more_info = JSON.parse(err.debug).debug.stack.join("\n");
} catch(e) {} } catch(e) {}

View File

@ -112,7 +112,7 @@
"stored-as-plaintext-info": "This data will be stored as plaintext in the database!", "stored-as-plaintext-info": "This data will be stored as plaintext in the database!",
"propagation-seconds": "Propagation Seconds", "propagation-seconds": "Propagation Seconds",
"propagation-seconds-info": "Leave empty to use the plugins default value. Number of seconds to wait for DNS propagation.", "propagation-seconds-info": "Leave empty to use the plugins default value. Number of seconds to wait for DNS propagation.",
"obtaining-certificate-info": "Obtaining certificate... This might take a few minutes." "processing-info": "Processing... This might take a few minutes."
}, },
"proxy-hosts": { "proxy-hosts": {
"title": "Proxy Hosts", "title": "Proxy Hosts",