Skip to content

Commit

Permalink
chore: limit API to only listen on localhost (#1740)
Browse files Browse the repository at this point in the history
  • Loading branch information
aronwk-aaron authored Jan 26, 2025
1 parent 306d959 commit 566791e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions dChatServer/ChatWebAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ ChatWebAPI::~ChatWebAPI() {

bool ChatWebAPI::Startup() {
// Make listen address
std::string listen_ip = Game::config->GetValue("web_server_listen_ip");
if (listen_ip == "localhost") listen_ip = "127.0.0.1";
// std::string listen_ip = Game::config->GetValue("web_server_listen_ip");
// if (listen_ip == "localhost") listen_ip = "127.0.0.1";

const std::string& listen_port = Game::config->GetValue("web_server_listen_port");
const std::string& listen_address = "http://" + listen_ip + ":" + listen_port;
// const std::string& listen_address = "http://" + listen_ip + ":" + listen_port;
const std::string& listen_address = "http://localhost:" + listen_port;
LOG("Starting web server on %s", listen_address.c_str());

// Create HTTP listener
Expand Down
3 changes: 2 additions & 1 deletion resources/chatconfig.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ max_number_of_friends=50

web_server_enabled=0

web_server_listen_ip=127.0.0.1
# Unused for now
# web_server_listen_ip=127.0.0.1
web_server_listen_port=2005

0 comments on commit 566791e

Please sign in to comment.