mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add option to start server with basic authentication enabled
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user