diff --git a/CHANGELOG.md b/CHANGELOG.md index 92f17af..a857544 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## To Be Released... ## 5.0.0-beta.3 * Euro Truck Simulator 2 (2012) - Added support (By @podrivo #523) +* Eco - Added support for Eco servers that require connection from a domain (By @Vito0912) ## 5.0.0-beta.2 * Fixed support for projects using `require`. diff --git a/protocols/eco.js b/protocols/eco.js index 714b86c..c3c3854 100644 --- a/protocols/eco.js +++ b/protocols/eco.js @@ -5,16 +5,17 @@ export default class eco extends Core { if (!this.options.port) this.options.port = 3001 const request = await this.request({ - url: `http://${this.options.address}:${this.options.port}/frontpage`, + url: `http://${this.options.host}:${this.options.port}/frontpage`, responseType: 'json' }) const serverInfo = request.Info state.name = serverInfo.Description - state.numplayers = serverInfo.OnlinePlayers; + state.numplayers = serverInfo.OnlinePlayers state.maxplayers = serverInfo.TotalPlayers state.password = serverInfo.HasPassword state.gamePort = serverInfo.GamePort + state.players = serverInfo.OnlinePlayersNames?.map(name => ({ name, raw: {} })) || [] state.raw = serverInfo } }