From f0bb17193dc332bb4b8d7bddedba6aca15e4b0ff Mon Sep 17 00:00:00 2001 From: bordun Date: Tue, 5 May 2020 12:11:11 +0200 Subject: [PATCH] server: lint --- src/server/auth.js | 21 ++++++++++----------- src/server/ipc/server.js | 4 ++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/server/auth.js b/src/server/auth.js index a017edb5..56d6efc1 100644 --- a/src/server/auth.js +++ b/src/server/auth.js @@ -4,18 +4,17 @@ var settings = require('./settings'), if (settings.read('authentication')) { var [name, pwd] = settings.read('authentication').split(':'), - httpAuth = require("http-auth") + httpAuth = require('http-auth') - - auth = httpAuth.basic( - { - realm: "Open Stage Control" - }, - (username, password, callback) => { - // Custom authentication method. - callback(username === name && password === pwd); - } - ) + auth = httpAuth.basic( + { + realm: 'Open Stage Control' + }, + (username, password, callback) => { + // Custom authentication method. + callback(username === name && password === pwd) + } + ) } diff --git a/src/server/ipc/server.js b/src/server/ipc/server.js index 53c8619e..9be982df 100644 --- a/src/server/ipc/server.js +++ b/src/server/ipc/server.js @@ -17,8 +17,8 @@ class Ipc extends EventEmitter { this.server.on('connection', (socket, req)=>{ if (settings.read('authentication')) { - if (!req.headers.authorization) return; - if (req.headers.authorization.search('Basic ') !== 0) return; + if (!req.headers.authorization) return + if (req.headers.authorization.search('Basic ') !== 0) return var auth = new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString() if (settings.read('authentication') !== auth) { console.log(`(WARNING) Client connexion refused for ${req.connection.remoteAddress} (authentication failed)`)