From 5881688813fe338b70b056f69333d91d7b043214 Mon Sep 17 00:00:00 2001 From: charleswrayjr Date: Mon, 8 Sep 2025 13:51:03 -0500 Subject: [PATCH] Fixing closures on app.js file. --- app.js | 1 + src/controllers/vpn.controller.js | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index a79f230..2e0e761 100755 --- a/app.js +++ b/app.js @@ -35,6 +35,7 @@ global.phsdb = phsdb; global.fs = fs; global.sshConfig = sshConfig; global.docker = docker; +global.createError = createError; // noinspection JSCheckFunctionSignatures app.use( bodyParser.json( { diff --git a/src/controllers/vpn.controller.js b/src/controllers/vpn.controller.js index a0f95c1..6faa0d6 100644 --- a/src/controllers/vpn.controller.js +++ b/src/controllers/vpn.controller.js @@ -1,5 +1,4 @@ const { Client } = require( 'ssh2' ); -const createError = require('http-errors'); /** * @@ -10,10 +9,6 @@ const parseVpnStatus = ( output ) => { // Split once and reuse const lines = output.split( '\n' ).map( line => line.trim() ).filter( Boolean ); - const lValues = [ 'lines:', lines ].join( ' ' ); - logger.debug( lValues ); - logger.warn( lValues ); - logger.error( lValues ); // Find indices using a single pass let sIndex = -1, mIndex = -1, eIndex = -1; lines.forEach( ( line, i ) => { @@ -131,6 +126,8 @@ module.exports = { } ).connect( sshConfig ); }, getClients:async ( req, res, next ) => { + const error = new Error( 'Not implemented yet' ); + next( error ); const conn = new Client(); conn.on( 'ready', () => { const command = `cat /var/log/openvpn/openvpn-status.log`; -- 2.43.0