From bdd2708f897f5def0fdf3bfe43ae46d6d54e1336 Mon Sep 17 00:00:00 2001 From: 10sa Date: Fri, 17 Mar 2023 19:30:28 +0900 Subject: [PATCH] Add IP listening option --- config.conf | 3 ++- server.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.conf b/config.conf index b23acee92..17c6064bd 100644 --- a/config.conf +++ b/config.conf @@ -4,7 +4,8 @@ const whitelist = ['127.0.0.1','192.168.0.*']; //Example for add several IP in w const whitelistMode = false; //Disabling enabling the ip whitelist mode. true/false const autorun = true; //Autorun in the browser. true/false const enableExtensions = true; //Enables support for TavernAI-extras project +const listen = true; // If true, Can be access from other device or PC. otherwise can be access only from hosting machine. module.exports = { - port, whitelist, whitelistMode, autorun, enableExtensions, + port, whitelist, whitelistMode, autorun, enableExtensions, listen }; diff --git a/server.js b/server.js index 399ffce4d..05035c07c 100644 --- a/server.js +++ b/server.js @@ -25,7 +25,7 @@ const whitelist = config.whitelist; const whitelistMode = config.whitelistMode; const autorun = config.autorun; const enableExtensions = config.enableExtensions; - +const listen = config.listen; var Client = require('node-rest-client').Client; var client = new Client(); @@ -1536,7 +1536,7 @@ function getAsync(url, args) { } // ** END ** -app.listen(server_port, function () { +app.listen(server_port, (listen ? '0.0.0.0' : '127.0.0.1'), function () { if (process.env.colab !== undefined) { if (process.env.colab == 2) { is_colab = true;