Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
06272d3d2c | |||
3885c0ad6d | |||
099ec00155 | |||
92fcae9c54 | |||
22e8961c80 | |||
4d5adefa41 | |||
feaa0e51bd | |||
af83cb57d0 | |||
8b4f3507c3 | |||
bda3dba369 | |||
beb313af40 | |||
4fad9d672f | |||
0fca64929e | |||
9e476e5b24 | |||
0819a265f5 | |||
ad8eac4f07 | |||
b49de0e23e | |||
efbd024da9 | |||
e7ddcb91fc |
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Checklist**
|
||||||
|
- Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image?
|
||||||
|
- Are you sure you're not using someone else's docker image?
|
||||||
|
- If having problems with Lets Encrypt, have you made absolutely sure your site is accessible from outside of your network?
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
- A clear and concise description of what the bug is.
|
||||||
|
- What version of Nginx Proxy Manager is reported on the login page?
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Operating System**
|
||||||
|
- Please specify if using a Rpi, Mac, orchestration tool or any other setups that might affect the reproduction of this error.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here, docker version, browser version if applicable to the problem. Too much info is better than too little.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Nginx Proxy Manager
|
# Nginx Proxy Manager
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Nginx Proxy Manager
|
# Nginx Proxy Manager
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nginx-proxy-manager",
|
"name": "nginx-proxy-manager",
|
||||||
"version": "2.0.12",
|
"version": "2.0.13",
|
||||||
"description": "A beautiful interface for creating Nginx endpoints",
|
"description": "A beautiful interface for creating Nginx endpoints",
|
||||||
"main": "src/backend/index.js",
|
"main": "src/backend/index.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -28,7 +28,7 @@
|
|||||||
"numeral": "^2.0.6",
|
"numeral": "^2.0.6",
|
||||||
"sass-loader": "^7.0.3",
|
"sass-loader": "^7.0.3",
|
||||||
"style-loader": "^0.22.1",
|
"style-loader": "^0.22.1",
|
||||||
"tabler-ui": "git+https://github.com/tabler/tabler.git",
|
"tabler-ui": "git+https://github.com/tabler/tabler.git#00f78ad823311bc3ad974ac3e5b0126198f0a813",
|
||||||
"underscore": "^1.8.3",
|
"underscore": "^1.8.3",
|
||||||
"webpack": "^4.25.1",
|
"webpack": "^4.25.1",
|
||||||
"webpack-cli": "^3.1.2",
|
"webpack-cli": "^3.1.2",
|
||||||
|
@ -2,8 +2,8 @@ ssl_session_timeout 5m;
|
|||||||
ssl_session_cache shared:SSL:50m;
|
ssl_session_cache shared:SSL:50m;
|
||||||
|
|
||||||
# intermediate configuration. tweak to your needs.
|
# intermediate configuration. tweak to your needs.
|
||||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-
|
ssl_ciphers 'EECDH+AESGCM:AES256+EECDH:AES256+EDH:EDH+AESGCM:ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-
|
||||||
ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AE
|
ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AE
|
||||||
S128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
|
S128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES';
|
||||||
ssl_prefer_server_ciphers on;
|
ssl_prefer_server_ciphers on;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const bodyParser = require('body-parser');
|
const bodyParser = require('body-parser');
|
||||||
@ -48,7 +46,7 @@ app.use(function (req, res, next) {
|
|||||||
|
|
||||||
res.set({
|
res.set({
|
||||||
'Strict-Transport-Security': 'includeSubDomains; max-age=631138519; preload',
|
'Strict-Transport-Security': 'includeSubDomains; max-age=631138519; preload',
|
||||||
'X-XSS-Protection': '0',
|
'X-XSS-Protection': '1; mode=block',
|
||||||
'X-Content-Type-Options': 'nosniff',
|
'X-Content-Type-Options': 'nosniff',
|
||||||
'X-Frame-Options': x_frame_options,
|
'X-Frame-Options': x_frame_options,
|
||||||
'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate',
|
'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate',
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
|
|
||||||
if (!config.has('database')) {
|
if (!config.has('database')) {
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const logger = require('./logger').import;
|
const logger = require('./logger').import;
|
||||||
const utils = require('./lib/utils');
|
const utils = require('./lib/utils');
|
||||||
const batchflow = require('batchflow');
|
const batchflow = require('batchflow');
|
||||||
const debug_mode = process.env.NODE_ENV !== 'production';
|
const debug_mode = process.env.NODE_ENV !== 'production' || !!process.env.DEBUG;
|
||||||
|
|
||||||
const internalProxyHost = require('./internal/proxy-host');
|
const internalProxyHost = require('./internal/proxy-host');
|
||||||
const internalRedirectionHost = require('./internal/redirection-host');
|
const internalRedirectionHost = require('./internal/redirection-host');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const batchflow = require('batchflow');
|
const batchflow = require('batchflow');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const error = require('../lib/error');
|
const error = require('../lib/error');
|
||||||
const auditLogModel = require('../models/audit-log');
|
const auditLogModel = require('../models/audit-log');
|
||||||
|
|
||||||
@ -46,9 +44,9 @@ const internalAuditLog = {
|
|||||||
* @param {Access} access
|
* @param {Access} access
|
||||||
* @param {Object} data
|
* @param {Object} data
|
||||||
* @param {String} data.action
|
* @param {String} data.action
|
||||||
* @param {Integer} [data.user_id]
|
* @param {Number} [data.user_id]
|
||||||
* @param {Integer} [data.object_id]
|
* @param {Number} [data.object_id]
|
||||||
* @param {Integer} [data.object_type]
|
* @param {Number} [data.object_type]
|
||||||
* @param {Object} [data.meta]
|
* @param {Object} [data.meta]
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const logger = require('../logger').ssl;
|
const logger = require('../logger').ssl;
|
||||||
@ -9,19 +7,20 @@ const internalAuditLog = require('./audit-log');
|
|||||||
const tempWrite = require('temp-write');
|
const tempWrite = require('temp-write');
|
||||||
const utils = require('../lib/utils');
|
const utils = require('../lib/utils');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
const debug_mode = process.env.NODE_ENV !== 'production';
|
const debug_mode = process.env.NODE_ENV !== 'production' || !!process.env.DEBUG;
|
||||||
|
const le_staging = process.env.NODE_ENV !== 'production';
|
||||||
const internalNginx = require('./nginx');
|
const internalNginx = require('./nginx');
|
||||||
const internalHost = require('./host');
|
const internalHost = require('./host');
|
||||||
const certbot_command = '/usr/bin/certbot';
|
const certbot_command = '/usr/bin/certbot';
|
||||||
|
|
||||||
function omissions () {
|
function omissions() {
|
||||||
return ['is_deleted'];
|
return ['is_deleted'];
|
||||||
}
|
}
|
||||||
|
|
||||||
const internalCertificate = {
|
const internalCertificate = {
|
||||||
|
|
||||||
allowed_ssl_files: ['certificate', 'certificate_key', 'intermediate_certificate'],
|
allowed_ssl_files: ['certificate', 'certificate_key', 'intermediate_certificate'],
|
||||||
interval_timeout: 1000 * 60 * 60 * 12, // 12 hours
|
interval_timeout: 1000 * 60 * 60, // 1 hour
|
||||||
interval: null,
|
interval: null,
|
||||||
interval_processing: false,
|
interval_processing: false,
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ const internalCertificate = {
|
|||||||
internalCertificate.interval_processing = true;
|
internalCertificate.interval_processing = true;
|
||||||
logger.info('Renewing SSL certs close to expiry...');
|
logger.info('Renewing SSL certs close to expiry...');
|
||||||
|
|
||||||
return utils.exec(certbot_command + ' renew -q ' + (debug_mode ? '--staging' : ''))
|
return utils.exec(certbot_command + ' renew -q ' + (le_staging ? '--staging' : ''))
|
||||||
.then(result => {
|
.then(result => {
|
||||||
logger.info(result);
|
logger.info(result);
|
||||||
|
|
||||||
@ -205,7 +204,7 @@ const internalCertificate = {
|
|||||||
/**
|
/**
|
||||||
* @param {Access} access
|
* @param {Access} access
|
||||||
* @param {Object} data
|
* @param {Object} data
|
||||||
* @param {Integer} data.id
|
* @param {Number} data.id
|
||||||
* @param {String} [data.email]
|
* @param {String} [data.email]
|
||||||
* @param {String} [data.name]
|
* @param {String} [data.name]
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
@ -251,7 +250,7 @@ const internalCertificate = {
|
|||||||
/**
|
/**
|
||||||
* @param {Access} access
|
* @param {Access} access
|
||||||
* @param {Object} data
|
* @param {Object} data
|
||||||
* @param {Integer} data.id
|
* @param {Number} data.id
|
||||||
* @param {Array} [data.expand]
|
* @param {Array} [data.expand]
|
||||||
* @param {Array} [data.omit]
|
* @param {Array} [data.omit]
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
@ -297,7 +296,7 @@ const internalCertificate = {
|
|||||||
/**
|
/**
|
||||||
* @param {Access} access
|
* @param {Access} access
|
||||||
* @param {Object} data
|
* @param {Object} data
|
||||||
* @param {Integer} data.id
|
* @param {Number} data.id
|
||||||
* @param {String} [data.reason]
|
* @param {String} [data.reason]
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
@ -381,7 +380,7 @@ const internalCertificate = {
|
|||||||
/**
|
/**
|
||||||
* Report use
|
* Report use
|
||||||
*
|
*
|
||||||
* @param {Integer} user_id
|
* @param {Number} user_id
|
||||||
* @param {String} visibility
|
* @param {String} visibility
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
@ -522,7 +521,7 @@ const internalCertificate = {
|
|||||||
/**
|
/**
|
||||||
* @param {Access} access
|
* @param {Access} access
|
||||||
* @param {Object} data
|
* @param {Object} data
|
||||||
* @param {Integer} data.id
|
* @param {Number} data.id
|
||||||
* @param {Object} data.files
|
* @param {Object} data.files
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
@ -719,9 +718,9 @@ const internalCertificate = {
|
|||||||
|
|
||||||
let cmd = certbot_command + ' certonly --cert-name "npm-' + certificate.id + '" --agree-tos ' +
|
let cmd = certbot_command + ' certonly --cert-name "npm-' + certificate.id + '" --agree-tos ' +
|
||||||
'--email "' + certificate.meta.letsencrypt_email + '" ' +
|
'--email "' + certificate.meta.letsencrypt_email + '" ' +
|
||||||
'--preferred-challenges "http" ' +
|
'--preferred-challenges "dns,http" ' +
|
||||||
'-n -a webroot -d "' + certificate.domain_names.join(',') + '" ' +
|
'-n -a webroot -d "' + certificate.domain_names.join(',') + '" ' +
|
||||||
(debug_mode ? '--staging' : '');
|
(le_staging ? '--staging' : '');
|
||||||
|
|
||||||
if (debug_mode) {
|
if (debug_mode) {
|
||||||
logger.info('Command:', cmd);
|
logger.info('Command:', cmd);
|
||||||
@ -734,6 +733,48 @@ const internalCertificate = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Access} access
|
||||||
|
* @param {Object} data
|
||||||
|
* @param {Number} data.id
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
renew: (access, data) => {
|
||||||
|
return access.can('certificates:update', data)
|
||||||
|
.then(() => {
|
||||||
|
return internalCertificate.get(access, data);
|
||||||
|
})
|
||||||
|
.then((certificate) => {
|
||||||
|
if (certificate.provider === 'letsencrypt') {
|
||||||
|
return internalCertificate.renewLetsEncryptSsl(certificate)
|
||||||
|
.then(() => {
|
||||||
|
return internalCertificate.getCertificateInfoFromFile('/etc/letsencrypt/live/npm-' + certificate.id + '/fullchain.pem')
|
||||||
|
})
|
||||||
|
.then(cert_info => {
|
||||||
|
return certificateModel
|
||||||
|
.query()
|
||||||
|
.patchAndFetchById(certificate.id, {
|
||||||
|
expires_on: certificateModel.raw('FROM_UNIXTIME(' + cert_info.dates.to + ')')
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then((updated_certificate) => {
|
||||||
|
// Add to audit log
|
||||||
|
return internalAuditLog.add(access, {
|
||||||
|
action: 'renewed',
|
||||||
|
object_type: 'certificate',
|
||||||
|
object_id: updated_certificate.id,
|
||||||
|
meta: updated_certificate
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return updated_certificate;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new error.ValidationError('Only Let\'sEncrypt certificates can be renewed');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} certificate the certificate row
|
* @param {Object} certificate the certificate row
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
@ -741,7 +782,7 @@ const internalCertificate = {
|
|||||||
renewLetsEncryptSsl: certificate => {
|
renewLetsEncryptSsl: certificate => {
|
||||||
logger.info('Renewing Let\'sEncrypt certificates for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', '));
|
logger.info('Renewing Let\'sEncrypt certificates for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', '));
|
||||||
|
|
||||||
let cmd = certbot_command + ' renew -n --force-renewal --disable-hook-validation --cert-name "npm-' + certificate.id + '" ' + (debug_mode ? '--staging' : '');
|
let cmd = certbot_command + ' renew -n --force-renewal --disable-hook-validation --cert-name "npm-' + certificate.id + '" ' + (le_staging ? '--staging' : '');
|
||||||
|
|
||||||
if (debug_mode) {
|
if (debug_mode) {
|
||||||
logger.info('Command:', cmd);
|
logger.info('Command:', cmd);
|
||||||
@ -762,17 +803,29 @@ const internalCertificate = {
|
|||||||
revokeLetsEncryptSsl: (certificate, throw_errors) => {
|
revokeLetsEncryptSsl: (certificate, throw_errors) => {
|
||||||
logger.info('Revoking Let\'sEncrypt certificates for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', '));
|
logger.info('Revoking Let\'sEncrypt certificates for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', '));
|
||||||
|
|
||||||
let cmd = certbot_command + ' revoke --cert-path "/etc/letsencrypt/live/npm-' + certificate.id + '/fullchain.pem" ' + (debug_mode ? '--staging' : '');
|
let revoke_cmd = certbot_command + ' revoke --cert-path "/etc/letsencrypt/live/npm-' + certificate.id + '/fullchain.pem" ' + (le_staging ? '--staging' : '');
|
||||||
|
let delete_cmd = certbot_command + ' delete --cert-name "npm-' + certificate.id + '" ' + (le_staging ? '--staging' : '');
|
||||||
|
|
||||||
if (debug_mode) {
|
if (debug_mode) {
|
||||||
logger.info('Command:', cmd);
|
logger.info('Command:', revoke_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return utils.exec(cmd)
|
return utils.exec(revoke_cmd)
|
||||||
.then(result => {
|
.then((result) => {
|
||||||
logger.info(result);
|
logger.info(result);
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
|
.then(() => {
|
||||||
|
if (debug_mode) {
|
||||||
|
logger.info('Command:', delete_cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
return utils.exec(delete_cmd)
|
||||||
|
.then((result) => {
|
||||||
|
logger.info(result);
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (debug_mode) {
|
if (debug_mode) {
|
||||||
logger.error(err.message);
|
logger.error(err.message);
|
||||||
@ -796,7 +849,7 @@ const internalCertificate = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} in_use_result
|
* @param {Object} in_use_result
|
||||||
* @param {Integer} in_use_result.total_count
|
* @param {Number} in_use_result.total_count
|
||||||
* @param {Array} in_use_result.proxy_hosts
|
* @param {Array} in_use_result.proxy_hosts
|
||||||
* @param {Array} in_use_result.redirection_hosts
|
* @param {Array} in_use_result.redirection_hosts
|
||||||
* @param {Array} in_use_result.dead_hosts
|
* @param {Array} in_use_result.dead_hosts
|
||||||
@ -826,7 +879,7 @@ const internalCertificate = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} in_use_result
|
* @param {Object} in_use_result
|
||||||
* @param {Integer} in_use_result.total_count
|
* @param {Number} in_use_result.total_count
|
||||||
* @param {Array} in_use_result.proxy_hosts
|
* @param {Array} in_use_result.proxy_hosts
|
||||||
* @param {Array} in_use_result.redirection_hosts
|
* @param {Array} in_use_result.redirection_hosts
|
||||||
* @param {Array} in_use_result.dead_hosts
|
* @param {Array} in_use_result.dead_hosts
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const error = require('../lib/error');
|
const error = require('../lib/error');
|
||||||
const deadHostModel = require('../models/dead_host');
|
const deadHostModel = require('../models/dead_host');
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const _ = require('lodash');
|
|
||||||
const logger = require('../logger').ip_ranges;
|
const logger = require('../logger').ip_ranges;
|
||||||
const error = require('../lib/error');
|
const error = require('../lib/error');
|
||||||
const internalNginx = require('./nginx');
|
const internalNginx = require('./nginx');
|
||||||
|
@ -4,7 +4,7 @@ const Liquid = require('liquidjs');
|
|||||||
const logger = require('../logger').nginx;
|
const logger = require('../logger').nginx;
|
||||||
const utils = require('../lib/utils');
|
const utils = require('../lib/utils');
|
||||||
const error = require('../lib/error');
|
const error = require('../lib/error');
|
||||||
const debug_mode = process.env.NODE_ENV !== 'production';
|
const debug_mode = process.env.NODE_ENV !== 'production' || !!process.env.DEBUG;
|
||||||
|
|
||||||
const internalNginx = {
|
const internalNginx = {
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ const internalNginx = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates custom locations
|
* Generates custom locations
|
||||||
* @param {Object} host
|
* @param {Object} host
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
renderLocations: (host) => {
|
renderLocations: (host) => {
|
||||||
@ -146,7 +146,7 @@ const internalNginx = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let renderer = new Liquid();
|
let renderer = new Liquid();
|
||||||
let renderedLocations = '';
|
let renderedLocations = '';
|
||||||
|
|
||||||
const locationRendering = async () => {
|
const locationRendering = async () => {
|
||||||
@ -162,7 +162,7 @@ const internalNginx = {
|
|||||||
|
|
||||||
renderedLocations += await renderer.parseAndRender(template, locationCopy);
|
renderedLocations += await renderer.parseAndRender(template, locationCopy);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
locationRendering().then(() => resolve(renderedLocations));
|
locationRendering().then(() => resolve(renderedLocations));
|
||||||
});
|
});
|
||||||
@ -207,10 +207,18 @@ const internalNginx = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (host.locations) {
|
if (host.locations) {
|
||||||
origLocations = [].concat(host.locations);
|
origLocations = [].concat(host.locations);
|
||||||
locationsPromise = internalNginx.renderLocations(host).then((renderedLocations) => {
|
locationsPromise = internalNginx.renderLocations(host).then((renderedLocations) => {
|
||||||
host.locations = renderedLocations;
|
host.locations = renderedLocations;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Allow someone who is using / custom location path to use it, and skip the default / location
|
||||||
|
_.map(host.locations, (location) => {
|
||||||
|
if (location.path === '/') {
|
||||||
|
host.use_default_location = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
locationsPromise = Promise.resolve();
|
locationsPromise = Promise.resolve();
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ const internalProxyHost = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return access.can('proxy_hosts:create', data)
|
return access.can('proxy_hosts:create', data)
|
||||||
.then(access_data => {
|
.then(() => {
|
||||||
// Get a list of the domain names and check each of them against existing records
|
// Get a list of the domain names and check each of them against existing records
|
||||||
let domain_name_check_promises = [];
|
let domain_name_check_promises = [];
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ const internalProxyHost = {
|
|||||||
.omit(omissions())
|
.omit(omissions())
|
||||||
.insertAndFetch(data);
|
.insertAndFetch(data);
|
||||||
})
|
})
|
||||||
.then(row => {
|
.then((row) => {
|
||||||
if (create_certificate) {
|
if (create_certificate) {
|
||||||
return internalCertificate.createQuickCertificate(access, data)
|
return internalCertificate.createQuickCertificate(access, data)
|
||||||
.then(cert => {
|
.then(cert => {
|
||||||
@ -69,21 +69,21 @@ const internalProxyHost = {
|
|||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(row => {
|
.then((row) => {
|
||||||
// re-fetch with cert
|
// re-fetch with cert
|
||||||
return internalProxyHost.get(access, {
|
return internalProxyHost.get(access, {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
expand: ['certificate', 'owner', 'access_list']
|
expand: ['certificate', 'owner', 'access_list']
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(row => {
|
.then((row) => {
|
||||||
// Configure nginx
|
// Configure nginx
|
||||||
return internalNginx.configure(proxyHostModel, 'proxy_host', row)
|
return internalNginx.configure(proxyHostModel, 'proxy_host', row)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return row;
|
return row;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(row => {
|
.then((row) => {
|
||||||
// Audit log
|
// Audit log
|
||||||
data.meta = _.assign({}, data.meta || {}, row.meta);
|
data.meta = _.assign({}, data.meta || {}, row.meta);
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const error = require('../lib/error');
|
const error = require('../lib/error');
|
||||||
const redirectionHostModel = require('../models/redirection_host');
|
const redirectionHostModel = require('../models/redirection_host');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const internalProxyHost = require('./proxy-host');
|
const internalProxyHost = require('./proxy-host');
|
||||||
const internalRedirectionHost = require('./redirection-host');
|
const internalRedirectionHost = require('./redirection-host');
|
||||||
const internalDeadHost = require('./dead-host');
|
const internalDeadHost = require('./dead-host');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const error = require('../lib/error');
|
const error = require('../lib/error');
|
||||||
const streamModel = require('../models/stream');
|
const streamModel = require('../models/stream');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const error = require('../lib/error');
|
const error = require('../lib/error');
|
||||||
const userModel = require('../models/user');
|
const userModel = require('../models/user');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const error = require('../lib/error');
|
const error = require('../lib/error');
|
||||||
const userModel = require('../models/user');
|
const userModel = require('../models/user');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some Notes: This is a friggin complicated piece of code.
|
* Some Notes: This is a friggin complicated piece of code.
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const validator = require('../validator');
|
const validator = require('../validator');
|
||||||
|
|
||||||
module.exports = function (req, res, next) {
|
module.exports = function (req, res, next) {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Access = require('../access');
|
const Access = require('../access');
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
return function (req, res, next) {
|
return function (req, res, next) {
|
||||||
if (req.headers.authorization) {
|
if (req.headers.authorization) {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
let _ = require('lodash');
|
let _ = require('lodash');
|
||||||
|
|
||||||
module.exports = function (default_sort, default_offset, default_limit, max_limit) {
|
module.exports = function (default_sort, default_offset, default_limit, max_limit) {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = (req, res, next) => {
|
module.exports = (req, res, next) => {
|
||||||
if (req.params.user_id === 'me' && res.locals.access) {
|
if (req.params.user_id === 'me' && res.locals.access) {
|
||||||
req.params.user_id = res.locals.access.token.get('attrs').id;
|
req.params.user_id = res.locals.access.token.get('attrs').id;
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
const _ = require('lodash');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const migrate_name = 'identifier_for_migrate';
|
const migrate_name = 'identifier_for_migrate';
|
||||||
const logger = require('../logger').migrate;
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const error = require('../error');
|
const error = require('../error');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const parser = require('json-schema-ref-parser');
|
const parser = require('json-schema-ref-parser');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const error = require('../error');
|
const error = require('../error');
|
||||||
const definitions = require('../../schema/definitions.json');
|
const definitions = require('../../schema/definitions.json');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('./db');
|
const db = require('./db');
|
||||||
const logger = require('./logger').migrate;
|
const logger = require('./logger').migrate;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const migrate_name = 'initial-schema';
|
const migrate_name = 'initial-schema';
|
||||||
const logger = require('../logger').migrate;
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const migrate_name = 'websockets';
|
const migrate_name = 'websockets';
|
||||||
const logger = require('../logger').migrate;
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const migrate_name = 'forward_host';
|
const migrate_name = 'forward_host';
|
||||||
const logger = require('../logger').migrate;
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const migrate_name = 'http2_support';
|
const migrate_name = 'http2_support';
|
||||||
const logger = require('../logger').migrate;
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const migrate_name = 'forward_scheme';
|
const migrate_name = 'forward_scheme';
|
||||||
const logger = require('../logger').migrate;
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const migrate_name = 'disabled';
|
const migrate_name = 'disabled';
|
||||||
const logger = require('../logger').migrate;
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const migrate_name = 'custom_locations';
|
const migrate_name = 'custom_locations';
|
||||||
const logger = require('../logger').migrate;
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const migrate_name = 'hsts';
|
const migrate_name = 'hsts';
|
||||||
const logger = require('../logger').migrate;
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
const User = require('./user');
|
const User = require('./user');
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
const User = require('./user');
|
const User = require('./user');
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const bcrypt = require('bcrypt');
|
const bcrypt = require('bcrypt');
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
const User = require('./user');
|
const User = require('./user');
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
const User = require('./user');
|
const User = require('./user');
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
const User = require('./user');
|
const User = require('./user');
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
const User = require('./user');
|
const User = require('./user');
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
const User = require('./user');
|
const User = require('./user');
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
and then has abilities after that.
|
and then has abilities after that.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
const jwt = require('jsonwebtoken');
|
const jwt = require('jsonwebtoken');
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
const UserPermission = require('./user_permission');
|
const UserPermission = require('./user_permission');
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Objection Docs:
|
// Objection Docs:
|
||||||
// http://vincit.github.io/objection.js/
|
// http://vincit.github.io/objection.js/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const db = require('../db');
|
const db = require('../db');
|
||||||
const Model = require('objection').Model;
|
const Model = require('objection').Model;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const validator = require('../../lib/validator');
|
const validator = require('../../lib/validator');
|
||||||
const jwtdecode = require('../../lib/express/jwt-decode');
|
const jwtdecode = require('../../lib/express/jwt-decode');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const pjson = require('../../../../package.json');
|
const pjson = require('../../../../package.json');
|
||||||
const error = require('../../lib/error');
|
const error = require('../../lib/error');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const validator = require('../../../lib/validator');
|
const validator = require('../../../lib/validator');
|
||||||
const jwtdecode = require('../../../lib/express/jwt-decode');
|
const jwtdecode = require('../../../lib/express/jwt-decode');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const validator = require('../../../lib/validator');
|
const validator = require('../../../lib/validator');
|
||||||
const jwtdecode = require('../../../lib/express/jwt-decode');
|
const jwtdecode = require('../../../lib/express/jwt-decode');
|
||||||
@ -94,13 +92,13 @@ router
|
|||||||
certificate_id: {
|
certificate_id: {
|
||||||
$ref: 'definitions#/definitions/id'
|
$ref: 'definitions#/definitions/id'
|
||||||
},
|
},
|
||||||
expand: {
|
expand: {
|
||||||
$ref: 'definitions#/definitions/expand'
|
$ref: 'definitions#/definitions/expand'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
certificate_id: req.params.certificate_id,
|
certificate_id: req.params.certificate_id,
|
||||||
expand: (typeof req.query.expand === 'string' ? req.query.expand.split(',') : null)
|
expand: (typeof req.query.expand === 'string' ? req.query.expand.split(',') : null)
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
return internalCertificate.get(res.locals.access, {
|
return internalCertificate.get(res.locals.access, {
|
||||||
@ -181,6 +179,34 @@ router
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renew LE Certs
|
||||||
|
*
|
||||||
|
* /api/nginx/certificates/123/renew
|
||||||
|
*/
|
||||||
|
router
|
||||||
|
.route('/:certificate_id/renew')
|
||||||
|
.options((req, res) => {
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
.all(jwtdecode())
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST /api/nginx/certificates/123/renew
|
||||||
|
*
|
||||||
|
* Renew certificate
|
||||||
|
*/
|
||||||
|
.post((req, res, next) => {
|
||||||
|
internalCertificate.renew(res.locals.access, {
|
||||||
|
id: parseInt(req.params.certificate_id, 10)
|
||||||
|
})
|
||||||
|
.then(result => {
|
||||||
|
res.status(200)
|
||||||
|
.send(result);
|
||||||
|
})
|
||||||
|
.catch(next);
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate Certs before saving
|
* Validate Certs before saving
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const validator = require('../../../lib/validator');
|
const validator = require('../../../lib/validator');
|
||||||
const jwtdecode = require('../../../lib/express/jwt-decode');
|
const jwtdecode = require('../../../lib/express/jwt-decode');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const validator = require('../../../lib/validator');
|
const validator = require('../../../lib/validator');
|
||||||
const jwtdecode = require('../../../lib/express/jwt-decode');
|
const jwtdecode = require('../../../lib/express/jwt-decode');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const validator = require('../../../lib/validator');
|
const validator = require('../../../lib/validator');
|
||||||
const jwtdecode = require('../../../lib/express/jwt-decode');
|
const jwtdecode = require('../../../lib/express/jwt-decode');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const validator = require('../../../lib/validator');
|
const validator = require('../../../lib/validator');
|
||||||
const jwtdecode = require('../../../lib/express/jwt-decode');
|
const jwtdecode = require('../../../lib/express/jwt-decode');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const jwtdecode = require('../../lib/express/jwt-decode');
|
const jwtdecode = require('../../lib/express/jwt-decode');
|
||||||
const internalReport = require('../../internal/report');
|
const internalReport = require('../../internal/report');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const jwtdecode = require('../../lib/express/jwt-decode');
|
const jwtdecode = require('../../lib/express/jwt-decode');
|
||||||
const internalToken = require('../../internal/token');
|
const internalToken = require('../../internal/token');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const validator = require('../../lib/validator');
|
const validator = require('../../lib/validator');
|
||||||
const jwtdecode = require('../../lib/express/jwt-decode');
|
const jwtdecode = require('../../lib/express/jwt-decode');
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const PACKAGE = require('../../../package.json');
|
const PACKAGE = require('../../../package.json');
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
const router = express.Router({
|
const router = express.Router({
|
||||||
caseSensitive: true,
|
caseSensitive: true,
|
||||||
@ -29,15 +28,22 @@ router.get(/(.*)/, function (req, res, next) {
|
|||||||
version: PACKAGE.version
|
version: PACKAGE.version
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
fs.readFile('dist' + req.params.page, 'utf8', function (err, data) {
|
var p = path.normalize('dist' + req.params.page)
|
||||||
if (err) {
|
if (p.startsWith('dist')) { // Allow access to ressources under 'dist' directory only.
|
||||||
res.render('index', {
|
fs.readFile(p, 'utf8', function (err, data) {
|
||||||
version: PACKAGE.version
|
if (err) {
|
||||||
});
|
res.render('index', {
|
||||||
} else {
|
version: PACKAGE.version
|
||||||
res.contentType('text/html').end(data);
|
});
|
||||||
}
|
} else {
|
||||||
});
|
res.contentType('text/html').end(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
res.render('index', {
|
||||||
|
version: PACKAGE.version
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const NodeRSA = require('node-rsa');
|
const NodeRSA = require('node-rsa');
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
@ -7,7 +5,7 @@ const logger = require('./logger').setup;
|
|||||||
const userModel = require('./models/user');
|
const userModel = require('./models/user');
|
||||||
const userPermissionModel = require('./models/user_permission');
|
const userPermissionModel = require('./models/user_permission');
|
||||||
const authModel = require('./models/auth');
|
const authModel = require('./models/auth');
|
||||||
const debug_mode = process.env.NODE_ENV !== 'production';
|
const debug_mode = process.env.NODE_ENV !== 'production' || !!process.env.DEBUG;
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const $ = require('jquery');
|
const $ = require('jquery');
|
||||||
const _ = require('underscore');
|
const _ = require('underscore');
|
||||||
const Tokens = require('./tokens');
|
const Tokens = require('./tokens');
|
||||||
@ -11,8 +9,8 @@ const Tokens = require('./tokens');
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
const ApiError = function (message, debug, code) {
|
const ApiError = function (message, debug, code) {
|
||||||
let temp = Error.call(this, message);
|
let temp = Error.call(this, message);
|
||||||
temp.name = this.name = 'ApiError';
|
temp.name = this.name = 'ApiError';
|
||||||
this.stack = temp.stack;
|
this.stack = temp.stack;
|
||||||
this.message = temp.message;
|
this.message = temp.message;
|
||||||
this.debug = debug;
|
this.debug = debug;
|
||||||
@ -35,7 +33,7 @@ ApiError.prototype = Object.create(Error.prototype, {
|
|||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
function fetch (verb, path, data, options) {
|
function fetch(verb, path, data, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
@ -55,7 +53,7 @@ function fetch (verb, path, data, options) {
|
|||||||
contentType: options.contentType || 'application/json; charset=UTF-8',
|
contentType: options.contentType || 'application/json; charset=UTF-8',
|
||||||
processData: options.processData || true,
|
processData: options.processData || true,
|
||||||
crossDomain: true,
|
crossDomain: true,
|
||||||
timeout: options.timeout ? options.timeout : 15000,
|
timeout: options.timeout ? options.timeout : 30000,
|
||||||
xhrFields: {
|
xhrFields: {
|
||||||
withCredentials: true
|
withCredentials: true
|
||||||
},
|
},
|
||||||
@ -99,7 +97,7 @@ function fetch (verb, path, data, options) {
|
|||||||
* @param {Array} expand
|
* @param {Array} expand
|
||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
function makeExpansionString (expand) {
|
function makeExpansionString(expand) {
|
||||||
let items = [];
|
let items = [];
|
||||||
_.forEach(expand, function (exp) {
|
_.forEach(expand, function (exp) {
|
||||||
items.push(encodeURIComponent(exp));
|
items.push(encodeURIComponent(exp));
|
||||||
@ -114,7 +112,7 @@ function makeExpansionString (expand) {
|
|||||||
* @param {String} [query]
|
* @param {String} [query]
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
function getAllObjects (path, expand, query) {
|
function getAllObjects(path, expand, query) {
|
||||||
let params = [];
|
let params = [];
|
||||||
|
|
||||||
if (typeof expand === 'object' && expand !== null && expand.length) {
|
if (typeof expand === 'object' && expand !== null && expand.length) {
|
||||||
@ -128,20 +126,7 @@ function getAllObjects (path, expand, query) {
|
|||||||
return fetch('get', path + (params.length ? '?' + params.join('&') : ''));
|
return fetch('get', path + (params.length ? '?' + params.join('&') : ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function FileUpload(path, fd) {
|
||||||
* @param {String} path
|
|
||||||
* @param {FormData} form_data
|
|
||||||
* @returns {Promise}
|
|
||||||
*/
|
|
||||||
function upload (path, form_data) {
|
|
||||||
console.log('UPLOAD:', path, form_data);
|
|
||||||
return fetch('post', path, form_data, {
|
|
||||||
contentType: 'multipart/form-data',
|
|
||||||
processData: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function FileUpload (path, fd) {
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
let token = Tokens.getTopToken();
|
let token = Tokens.getTopToken();
|
||||||
@ -214,7 +199,7 @@ module.exports = {
|
|||||||
Users: {
|
Users: {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Integer|String} user_id
|
* @param {Number|String} user_id
|
||||||
* @param {Array} [expand]
|
* @param {Array} [expand]
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
@ -639,6 +624,14 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
validate: function (form_data) {
|
validate: function (form_data) {
|
||||||
return FileUpload('nginx/certificates/validate', form_data);
|
return FileUpload('nginx/certificates/validate', form_data);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Number} id
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
renew: function (id) {
|
||||||
|
return fetch('post', 'nginx/certificates/' + id + '/renew');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const Controller = require('../../controller');
|
const Controller = require('../../controller');
|
||||||
const template = require('./item.ejs');
|
const template = require('./item.ejs');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const ItemView = require('./item');
|
const ItemView = require('./item');
|
||||||
const template = require('./main.ejs');
|
const template = require('./main.ejs');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../main');
|
const App = require('../main');
|
||||||
const AuditLogModel = require('../../models/audit-log');
|
const AuditLogModel = require('../../models/audit-log');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const template = require('./meta.ejs');
|
const template = require('./meta.ejs');
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const UserModel = require('../models/user');
|
const UserModel = require('../models/user');
|
||||||
|
|
||||||
let cache = {
|
let cache = {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Backbone = require('backbone');
|
const Backbone = require('backbone');
|
||||||
const Cache = require('./cache');
|
const Cache = require('./cache');
|
||||||
const Tokens = require('./tokens');
|
const Tokens = require('./tokens');
|
||||||
@ -342,6 +340,19 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Certificate Renew
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
*/
|
||||||
|
showNginxCertificateRenew: function (model) {
|
||||||
|
if (Cache.User.isAdmin() || Cache.User.canManage('certificates')) {
|
||||||
|
require(['./main', './nginx/certificates/renew'], function (App, View) {
|
||||||
|
App.UI.showModalDialog(new View({model: model}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Certificate Delete Confirm
|
* Certificate Delete Confirm
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const Cache = require('../cache');
|
const Cache = require('../cache');
|
||||||
const Controller = require('../controller');
|
const Controller = require('../controller');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const template = require('./main.ejs');
|
const template = require('./main.ejs');
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const template = require('./main.ejs');
|
const template = require('./main.ejs');
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const template = require('./main.ejs');
|
const template = require('./main.ejs');
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Cache = ('./cache');
|
const Cache = ('./cache');
|
||||||
const messages = require('../i18n/messages.json');
|
const messages = require('../i18n/messages.json');
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('underscore');
|
const _ = require('underscore');
|
||||||
const Backbone = require('backbone');
|
const Backbone = require('backbone');
|
||||||
const Mn = require('../lib/marionette');
|
const Mn = require('../lib/marionette');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../main');
|
const App = require('../../main');
|
||||||
const template = require('./delete.ejs');
|
const template = require('./delete.ejs');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../main');
|
const App = require('../../main');
|
||||||
const AccessListModel = require('../../../models/access-list');
|
const AccessListModel = require('../../../models/access-list');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const template = require('./item.ejs');
|
const template = require('./item.ejs');
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../../main');
|
const App = require('../../../main');
|
||||||
const template = require('./item.ejs');
|
const template = require('./item.ejs');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../../main');
|
const App = require('../../../main');
|
||||||
const ItemView = require('./item');
|
const ItemView = require('./item');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../main');
|
const App = require('../../main');
|
||||||
const AccessListModel = require('../../../models/access-list');
|
const AccessListModel = require('../../../models/access-list');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../main');
|
const App = require('../../main');
|
||||||
const template = require('./delete.ejs');
|
const template = require('./delete.ejs');
|
||||||
@ -16,7 +14,6 @@ module.exports = Mn.View.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
|
|
||||||
'click @ui.save': function (e) {
|
'click @ui.save': function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const _ = require('underscore');
|
const _ = require('underscore');
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../main');
|
const App = require('../../main');
|
||||||
|
@ -5,16 +5,23 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<% if (provider === 'letsencrypt') { %>
|
<%
|
||||||
<% domain_names.map(function(host) {
|
if (provider === 'letsencrypt') {
|
||||||
%>
|
domain_names.map(function(host) {
|
||||||
<span class="tag"><%- host %></span>
|
if (host.indexOf('*') === -1) {
|
||||||
<%
|
%>
|
||||||
|
<span class="tag host-link hover-pink" rel="https://<%- host %>"><%- host %></span>
|
||||||
|
<%
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<span class="tag"><%- host %></span>
|
||||||
|
<%
|
||||||
|
}
|
||||||
});
|
});
|
||||||
%>
|
} else {
|
||||||
<% } else { %>
|
%><%- nice_name %><%
|
||||||
<%- nice_name %>
|
}
|
||||||
<% } %>
|
%>
|
||||||
</div>
|
</div>
|
||||||
<div class="small text-muted">
|
<div class="small text-muted">
|
||||||
<%- i18n('str', 'created-on', {date: formatDbDate(created_on, 'Do MMMM YYYY')}) %>
|
<%- i18n('str', 'created-on', {date: formatDbDate(created_on, 'Do MMMM YYYY')}) %>
|
||||||
@ -31,6 +38,10 @@
|
|||||||
<div class="item-action dropdown">
|
<div class="item-action dropdown">
|
||||||
<a href="#" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
|
<a href="#" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
<% if (provider === 'letsencrypt') { %>
|
||||||
|
<a href="#" class="renew dropdown-item"><i class="dropdown-icon fe fe-refresh-cw"></i> <%- i18n('certificates', 'force-renew') %></a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<% } %>
|
||||||
<a href="#" class="delete dropdown-item"><i class="dropdown-icon fe fe-trash-2"></i> <%- i18n('str', 'delete') %></a>
|
<a href="#" class="delete dropdown-item"><i class="dropdown-icon fe fe-trash-2"></i> <%- i18n('str', 'delete') %></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
const App = require('../../../main');
|
const App = require('../../../main');
|
||||||
@ -10,13 +8,26 @@ module.exports = Mn.View.extend({
|
|||||||
tagName: 'tr',
|
tagName: 'tr',
|
||||||
|
|
||||||
ui: {
|
ui: {
|
||||||
delete: 'a.delete'
|
host_link: '.host-link',
|
||||||
|
renew: 'a.renew',
|
||||||
|
delete: 'a.delete'
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
|
'click @ui.renew': function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
App.Controller.showNginxCertificateRenew(this.model);
|
||||||
|
},
|
||||||
|
|
||||||
'click @ui.delete': function (e) {
|
'click @ui.delete': function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
App.Controller.showNginxCertificateDeleteConfirm(this.model);
|
App.Controller.showNginxCertificateDeleteConfirm(this.model);
|
||||||
|
},
|
||||||
|
|
||||||
|
'click @ui.host_link': function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
let win = window.open($(e.currentTarget).attr('rel'), '_blank');
|
||||||
|
win.focus();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../../main');
|
const App = require('../../../main');
|
||||||
const ItemView = require('./item');
|
const ItemView = require('./item');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../main');
|
const App = require('../../main');
|
||||||
const CertificateModel = require('../../../models/certificate');
|
const CertificateModel = require('../../../models/certificate');
|
||||||
|
14
src/frontend/js/app/nginx/certificates/renew.ejs
Normal file
14
src/frontend/js/app/nginx/certificates/renew.ejs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><%- i18n('certificates', 'renew-title') %></h5>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="waiting text-center">
|
||||||
|
<%= i18n('str', 'please-wait') %>
|
||||||
|
</div>
|
||||||
|
<div class="alert alert-danger error" role="alert"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary cancel" data-dismiss="modal" disabled><%- i18n('str', 'close') %></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
31
src/frontend/js/app/nginx/certificates/renew.js
Normal file
31
src/frontend/js/app/nginx/certificates/renew.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
const Mn = require('backbone.marionette');
|
||||||
|
const App = require('../../main');
|
||||||
|
const template = require('./renew.ejs');
|
||||||
|
|
||||||
|
module.exports = Mn.View.extend({
|
||||||
|
template: template,
|
||||||
|
className: 'modal-dialog',
|
||||||
|
|
||||||
|
ui: {
|
||||||
|
waiting: '.waiting',
|
||||||
|
error: '.error',
|
||||||
|
close: 'button.cancel'
|
||||||
|
},
|
||||||
|
|
||||||
|
onRender: function () {
|
||||||
|
this.ui.error.hide();
|
||||||
|
|
||||||
|
App.Api.Nginx.Certificates.renew(this.model.get('id'))
|
||||||
|
.then((result) => {
|
||||||
|
this.model.set(result);
|
||||||
|
setTimeout(() => {
|
||||||
|
App.UI.closeModal();
|
||||||
|
}, 1000);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.ui.waiting.hide();
|
||||||
|
this.ui.error.text(err.message).show();
|
||||||
|
this.ui.close.prop('disabled', false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../main');
|
const App = require('../../main');
|
||||||
const template = require('./delete.ejs');
|
const template = require('./delete.ejs');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../main');
|
const App = require('../../main');
|
||||||
const DeadHostModel = require('../../../models/dead-host');
|
const DeadHostModel = require('../../../models/dead-host');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../../main');
|
const App = require('../../../main');
|
||||||
const template = require('./item.ejs');
|
const template = require('./item.ejs');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../../main');
|
const App = require('../../../main');
|
||||||
const ItemView = require('./item');
|
const ItemView = require('./item');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../main');
|
const App = require('../../main');
|
||||||
const DeadHostModel = require('../../../models/dead-host');
|
const DeadHostModel = require('../../../models/dead-host');
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Mn = require('backbone.marionette');
|
const Mn = require('backbone.marionette');
|
||||||
const App = require('../../main');
|
const App = require('../../main');
|
||||||
const template = require('./delete.ejs');
|
const template = require('./delete.ejs');
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user