Add option to start server with basic authentication enabled

This commit is contained in:
maver
2023-04-23 18:10:44 +02:00
parent 4da104211b
commit c821b1fba4
2 changed files with 7 additions and 2 deletions

View File

@ -35,6 +35,7 @@ const rimraf = require("rimraf");
const multer = require("multer");
const http = require("http");
const https = require('https');
const basicAuthMiddleware = require('./src/middleware/basicAuthMiddleware');
//const PNG = require('pngjs').PNG;
const extract = require('png-chunks-extract');
const encode = require('png-chunks-encode');
@ -194,6 +195,8 @@ const CORS = cors({
app.use(CORS);
if (listen && config.basicAuthMode) app.use(basicAuthMiddleware);
app.use(function (req, res, next) { //Security
let clientIp = req.connection.remoteAddress;
let ip = ipaddr.parse(clientIp);