fix: Updated the eco protocol to include player names and fix problems encountered when using the eco web interface behind a proxy. (#526)

* Update eco protocol to include player names and fixed problems when using eco webinterface behind a proxy

* changelog + readability

* Typo

* Typo
This commit is contained in:
Vito0912 2024-01-31 19:29:02 +01:00 committed by GitHub
parent e4d59a9f89
commit b2de68f551
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -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`.

View File

@ -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
}
}