mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-07-12 04:39:37 +00:00
Some auto formatting changes suggested by ide
This commit is contained in:
@ -1,13 +1,13 @@
|
|||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('node:child_process').exec;
|
||||||
const execFile = require('child_process').execFile;
|
const execFile = require('node:child_process').execFile;
|
||||||
const { Liquid } = require('liquidjs');
|
const { Liquid } = require('liquidjs');
|
||||||
const logger = require('../logger').global;
|
const logger = require('../logger').global;
|
||||||
const error = require('./error');
|
const error = require('./error');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
exec: async function(cmd, options = {}) {
|
exec: async (cmd, options = {}) => {
|
||||||
logger.debug('CMD:', cmd);
|
logger.debug('CMD:', cmd);
|
||||||
|
|
||||||
const { stdout, stderr } = await new Promise((resolve, reject) => {
|
const { stdout, stderr } = await new Promise((resolve, reject) => {
|
||||||
@ -31,11 +31,11 @@ module.exports = {
|
|||||||
* @param {Array} args
|
* @param {Array} args
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
execFile: function (cmd, args) {
|
execFile: (cmd, args) => {
|
||||||
// logger.debug('CMD: ' + cmd + ' ' + (args ? args.join(' ') : ''));
|
// logger.debug('CMD: ' + cmd + ' ' + (args ? args.join(' ') : ''));
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
execFile(cmd, args, function (err, stdout, /*stderr*/) {
|
execFile(cmd, args, (err, stdout, /*stderr*/) => {
|
||||||
if (err && typeof err === 'object') {
|
if (err && typeof err === 'object') {
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
@ -51,7 +51,7 @@ module.exports = {
|
|||||||
* @param {Array} omissions
|
* @param {Array} omissions
|
||||||
* @returns {Function}
|
* @returns {Function}
|
||||||
*/
|
*/
|
||||||
omitRow: function (omissions) {
|
omitRow: (omissions) => {
|
||||||
/**
|
/**
|
||||||
* @param {Object} row
|
* @param {Object} row
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
@ -67,7 +67,7 @@ module.exports = {
|
|||||||
* @param {Array} omissions
|
* @param {Array} omissions
|
||||||
* @returns {Function}
|
* @returns {Function}
|
||||||
*/
|
*/
|
||||||
omitRows: function (omissions) {
|
omitRows: (omissions) => {
|
||||||
/**
|
/**
|
||||||
* @param {Array} rows
|
* @param {Array} rows
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
@ -83,9 +83,9 @@ module.exports = {
|
|||||||
/**
|
/**
|
||||||
* @returns {Object} Liquid render engine
|
* @returns {Object} Liquid render engine
|
||||||
*/
|
*/
|
||||||
getRenderEngine: function () {
|
getRenderEngine: () => {
|
||||||
const renderEngine = new Liquid({
|
const renderEngine = new Liquid({
|
||||||
root: __dirname + '/../templates/'
|
root: `${__dirname}/../templates/`
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,7 @@ describe('Certificates endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Validate custom certificate', function() {
|
it('Validate custom certificate', () => {
|
||||||
cy.task('backendApiPostFiles', {
|
cy.task('backendApiPostFiles', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/nginx/certificates/validate',
|
path: '/api/nginx/certificates/validate',
|
||||||
@ -25,7 +25,7 @@ describe('Certificates endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Custom certificate lifecycle', function() {
|
it('Custom certificate lifecycle', () => {
|
||||||
// Create custom cert
|
// Create custom cert
|
||||||
cy.task('backendApiPost', {
|
cy.task('backendApiPost', {
|
||||||
token: token,
|
token: token,
|
||||||
@ -73,7 +73,7 @@ describe('Certificates endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Request Certificate - CVE-2024-46256/CVE-2024-46257', function() {
|
it('Request Certificate - CVE-2024-46256/CVE-2024-46257', () => {
|
||||||
cy.task('backendApiPost', {
|
cy.task('backendApiPost', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/nginx/certificates',
|
path: '/api/nginx/certificates',
|
||||||
|
@ -9,7 +9,7 @@ describe('Dashboard endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to get host counts', function() {
|
it('Should be able to get host counts', () => {
|
||||||
cy.task('backendApiGet', {
|
cy.task('backendApiGet', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/reports/hosts'
|
path: '/api/reports/hosts'
|
||||||
|
@ -9,7 +9,7 @@ describe('Full Certificate Provisions', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to create new http certificate', function() {
|
it('Should be able to create new http certificate', () => {
|
||||||
cy.task('backendApiPost', {
|
cy.task('backendApiPost', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/nginx/certificates',
|
path: '/api/nginx/certificates',
|
||||||
@ -32,7 +32,7 @@ describe('Full Certificate Provisions', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to create new DNS certificate with Powerdns', function() {
|
it('Should be able to create new DNS certificate with Powerdns', () => {
|
||||||
cy.task('backendApiPost', {
|
cy.task('backendApiPost', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/nginx/certificates',
|
path: '/api/nginx/certificates',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
describe('Basic API checks', () => {
|
describe('Basic API checks', () => {
|
||||||
it('Should return a valid health payload', function () {
|
it('Should return a valid health payload', () => {
|
||||||
cy.task('backendApiGet', {
|
cy.task('backendApiGet', {
|
||||||
path: '/api/',
|
path: '/api/',
|
||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
@ -10,9 +10,9 @@ describe('Basic API checks', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should return a valid schema payload', function () {
|
it('Should return a valid schema payload', () => {
|
||||||
cy.task('backendApiGet', {
|
cy.task('backendApiGet', {
|
||||||
path: '/api/schema?ts=' + Date.now(),
|
path: `/api/schema?ts=${Date.now()}`,
|
||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
expect(data.openapi).to.be.equal('3.1.0');
|
expect(data.openapi).to.be.equal('3.1.0');
|
||||||
});
|
});
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
describe('LDAP with Authentik', () => {
|
describe('LDAP with Authentik', () => {
|
||||||
let token;
|
let _token;
|
||||||
if (Cypress.env('skipStackCheck') === 'true' || Cypress.env('stack') === 'postgres') {
|
if (Cypress.env('skipStackCheck') === 'true' || Cypress.env('stack') === 'postgres') {
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.getToken().then((tok) => {
|
cy.getToken().then((tok) => {
|
||||||
token = tok;
|
_token = tok;
|
||||||
|
|
||||||
// cy.task('backendApiPut', {
|
// cy.task('backendApiPut', {
|
||||||
// token: token,
|
// token: token,
|
||||||
@ -45,7 +45,7 @@ describe('LDAP with Authentik', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('Should log in with LDAP', function() {
|
it.skip('Should log in with LDAP', () => {
|
||||||
// cy.task('backendApiPost', {
|
// cy.task('backendApiPost', {
|
||||||
// token: token,
|
// token: token,
|
||||||
// path: '/api/auth',
|
// path: '/api/auth',
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
describe('OAuth with Authentik', () => {
|
describe('OAuth with Authentik', () => {
|
||||||
let token;
|
let _token;
|
||||||
if (Cypress.env('skipStackCheck') === 'true' || Cypress.env('stack') === 'postgres') {
|
if (Cypress.env('skipStackCheck') === 'true' || Cypress.env('stack') === 'postgres') {
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.getToken().then((tok) => {
|
cy.getToken().then((tok) => {
|
||||||
token = tok;
|
_token = tok;
|
||||||
|
|
||||||
// cy.task('backendApiPut', {
|
// cy.task('backendApiPut', {
|
||||||
// token: token,
|
// token: token,
|
||||||
@ -47,7 +47,7 @@ describe('OAuth with Authentik', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('Should log in with OAuth', function() {
|
it.skip('Should log in with OAuth', () => {
|
||||||
// cy.task('backendApiGet', {
|
// cy.task('backendApiGet', {
|
||||||
// path: '/oauth/login?redirect_base=' + encodeURI(Cypress.config('baseUrl')),
|
// path: '/oauth/login?redirect_base=' + encodeURI(Cypress.config('baseUrl')),
|
||||||
// }).then((data) => {
|
// }).then((data) => {
|
||||||
|
@ -9,7 +9,7 @@ describe('Proxy Hosts endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to create a http host', function() {
|
it('Should be able to create a http host', () => {
|
||||||
cy.task('backendApiPost', {
|
cy.task('backendApiPost', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/nginx/proxy-hosts',
|
path: '/api/nginx/proxy-hosts',
|
||||||
|
@ -9,7 +9,7 @@ describe('Settings endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Get all settings', function() {
|
it('Get all settings', () => {
|
||||||
cy.task('backendApiGet', {
|
cy.task('backendApiGet', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/settings',
|
path: '/api/settings',
|
||||||
@ -19,7 +19,7 @@ describe('Settings endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Get default-site setting', function() {
|
it('Get default-site setting', () => {
|
||||||
cy.task('backendApiGet', {
|
cy.task('backendApiGet', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/settings/default-site',
|
path: '/api/settings/default-site',
|
||||||
@ -30,7 +30,7 @@ describe('Settings endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Default Site congratulations', function() {
|
it('Default Site congratulations', () => {
|
||||||
cy.task('backendApiPut', {
|
cy.task('backendApiPut', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/settings/default-site',
|
path: '/api/settings/default-site',
|
||||||
@ -46,7 +46,7 @@ describe('Settings endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Default Site 404', function() {
|
it('Default Site 404', () => {
|
||||||
cy.task('backendApiPut', {
|
cy.task('backendApiPut', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/settings/default-site',
|
path: '/api/settings/default-site',
|
||||||
@ -62,7 +62,7 @@ describe('Settings endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Default Site 444', function() {
|
it('Default Site 444', () => {
|
||||||
cy.task('backendApiPut', {
|
cy.task('backendApiPut', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/settings/default-site',
|
path: '/api/settings/default-site',
|
||||||
@ -78,7 +78,7 @@ describe('Settings endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Default Site redirect', function() {
|
it('Default Site redirect', () => {
|
||||||
cy.task('backendApiPut', {
|
cy.task('backendApiPut', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/settings/default-site',
|
path: '/api/settings/default-site',
|
||||||
@ -100,7 +100,7 @@ describe('Settings endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Default Site html', function() {
|
it('Default Site html', () => {
|
||||||
cy.task('backendApiPut', {
|
cy.task('backendApiPut', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/settings/default-site',
|
path: '/api/settings/default-site',
|
||||||
|
@ -33,7 +33,7 @@ describe('Streams', () => {
|
|||||||
cy.exec('rm -f /test/results/testssl.json');
|
cy.exec('rm -f /test/results/testssl.json');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to create TCP Stream', function() {
|
it('Should be able to create TCP Stream', () => {
|
||||||
cy.task('backendApiPost', {
|
cy.task('backendApiPost', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/nginx/streams',
|
path: '/api/nginx/streams',
|
||||||
@ -65,7 +65,7 @@ describe('Streams', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to create UDP Stream', function() {
|
it('Should be able to create UDP Stream', () => {
|
||||||
cy.task('backendApiPost', {
|
cy.task('backendApiPost', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/nginx/streams',
|
path: '/api/nginx/streams',
|
||||||
@ -92,7 +92,7 @@ describe('Streams', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to create TCP/UDP Stream', function() {
|
it('Should be able to create TCP/UDP Stream', () => {
|
||||||
cy.task('backendApiPost', {
|
cy.task('backendApiPost', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/nginx/streams',
|
path: '/api/nginx/streams',
|
||||||
@ -124,7 +124,7 @@ describe('Streams', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to create SSL TCP Stream', function() {
|
it('Should be able to create SSL TCP Stream', () => {
|
||||||
let certID = 0;
|
let certID = 0;
|
||||||
|
|
||||||
// Create custom cert
|
// Create custom cert
|
||||||
@ -184,7 +184,7 @@ describe('Streams', () => {
|
|||||||
cy.exec('/testssl/testssl.sh --quiet --add-ca="$(/bin/mkcert -CAROOT)/rootCA.pem" --jsonfile=/test/results/testssl.json website1.example.com:1503', {
|
cy.exec('/testssl/testssl.sh --quiet --add-ca="$(/bin/mkcert -CAROOT)/rootCA.pem" --jsonfile=/test/results/testssl.json website1.example.com:1503', {
|
||||||
timeout: 120000, // 2 minutes
|
timeout: 120000, // 2 minutes
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
cy.task('log', '[testssl.sh] ' + result.stdout);
|
cy.task('log', `[testssl.sh] ${result.stdout}`);
|
||||||
|
|
||||||
const allowedSeverities = ["INFO", "OK", "LOW", "MEDIUM"];
|
const allowedSeverities = ["INFO", "OK", "LOW", "MEDIUM"];
|
||||||
const ignoredIDs = [
|
const ignoredIDs = [
|
||||||
@ -210,7 +210,7 @@ describe('Streams', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to List Streams', function() {
|
it('Should be able to List Streams', () => {
|
||||||
cy.task('backendApiGet', {
|
cy.task('backendApiGet', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/nginx/streams?expand=owner,certificate',
|
path: '/api/nginx/streams?expand=owner,certificate',
|
||||||
|
@ -9,7 +9,7 @@ describe('Users endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to get yourself', function() {
|
it('Should be able to get yourself', () => {
|
||||||
cy.task('backendApiGet', {
|
cy.task('backendApiGet', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/users/me'
|
path: '/api/users/me'
|
||||||
@ -20,7 +20,7 @@ describe('Users endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to get all users', function() {
|
it('Should be able to get all users', () => {
|
||||||
cy.task('backendApiGet', {
|
cy.task('backendApiGet', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/users'
|
path: '/api/users'
|
||||||
@ -30,7 +30,7 @@ describe('Users endpoints', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to update yourself', function() {
|
it('Should be able to update yourself', () => {
|
||||||
cy.task('backendApiPut', {
|
cy.task('backendApiPut', {
|
||||||
token: token,
|
token: token,
|
||||||
path: '/api/users/me',
|
path: '/api/users/me',
|
||||||
|
Reference in New Issue
Block a user