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:
parent
e4d59a9f89
commit
b2de68f551
|
@ -2,6 +2,7 @@
|
||||||
## To Be Released...
|
## To Be Released...
|
||||||
## 5.0.0-beta.3
|
## 5.0.0-beta.3
|
||||||
* Euro Truck Simulator 2 (2012) - Added support (By @podrivo #523)
|
* 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
|
## 5.0.0-beta.2
|
||||||
* Fixed support for projects using `require`.
|
* Fixed support for projects using `require`.
|
||||||
|
|
|
@ -5,16 +5,17 @@ export default class eco extends Core {
|
||||||
if (!this.options.port) this.options.port = 3001
|
if (!this.options.port) this.options.port = 3001
|
||||||
|
|
||||||
const request = await this.request({
|
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'
|
responseType: 'json'
|
||||||
})
|
})
|
||||||
const serverInfo = request.Info
|
const serverInfo = request.Info
|
||||||
|
|
||||||
state.name = serverInfo.Description
|
state.name = serverInfo.Description
|
||||||
state.numplayers = serverInfo.OnlinePlayers;
|
state.numplayers = serverInfo.OnlinePlayers
|
||||||
state.maxplayers = serverInfo.TotalPlayers
|
state.maxplayers = serverInfo.TotalPlayers
|
||||||
state.password = serverInfo.HasPassword
|
state.password = serverInfo.HasPassword
|
||||||
state.gamePort = serverInfo.GamePort
|
state.gamePort = serverInfo.GamePort
|
||||||
|
state.players = serverInfo.OnlinePlayersNames?.map(name => ({ name, raw: {} })) || []
|
||||||
state.raw = serverInfo
|
state.raw = serverInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue