mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 07:07:33 +00:00
feat(protocol/hytale): add more data to raw, remove https, docs (#752)
* feat: refactor to use http only * feat: place entire player data in raw field * feat: add basic data to raw * feat: remove rejectUnauthorized usage * docs: add GAMES_LIST.md entry * docs: add note about mods usage
This commit is contained in:
parent
1b2345fa02
commit
c4adb68040
3 changed files with 12 additions and 27 deletions
|
|
@ -166,6 +166,7 @@
|
|||
| homefront | Homefront | [Valve Protocol](#valve) |
|
||||
| homeworld2 | Homeworld 2 | |
|
||||
| hurtworld | Hurtworld | [Valve Protocol](#valve) |
|
||||
| hytale | Hytale | [Notes](#hytale) |
|
||||
| i2cs | IGI 2: Covert Strike | |
|
||||
| i2s | IL-2 Sturmovik | |
|
||||
| icarus | Icarus | [Valve Protocol](#valve) |
|
||||
|
|
@ -561,3 +562,6 @@ To fetch more info via telnet (game and mods versions, date and time), at the co
|
|||
Unfortunately, only verified servers can be queried, for this you'd need a `accountId`, an `apiKey` and `serverId`
|
||||
(this optional, not providing this just returns the server list associated with the account in the raw object).
|
||||
|
||||
### <a name="Hytale"></a>Hytale
|
||||
The query is done via the [hytale-plugin-query](https://github.com/nitrado/hytale-plugin-query) mod, make sure to configure permissions.
|
||||
One can also query a server which has the [hytale-sourcequery](https://github.com/physgun-com/hytale-sourcequery) mod via `protocol-valve` but this does not have official support.
|
||||
|
|
|
|||
|
|
@ -1592,6 +1592,9 @@ export const games = {
|
|||
options: {
|
||||
port: 5523,
|
||||
protocol: 'hytale'
|
||||
},
|
||||
extra: {
|
||||
doc_notes: 'hytale'
|
||||
}
|
||||
},
|
||||
i2cs: {
|
||||
|
|
|
|||
|
|
@ -4,21 +4,9 @@ export default class hytale extends Core {
|
|||
async run (state) {
|
||||
this.usedTcp = true
|
||||
|
||||
// Hytale servers commonly use self-signed certificates for HTTPS.
|
||||
// We default rejectUnauthorized to false unless explicitly set.
|
||||
if (this.options.rejectUnauthorized === undefined) {
|
||||
this.options.rejectUnauthorized = false
|
||||
}
|
||||
const response = await this.queryEndpoint()
|
||||
|
||||
let response
|
||||
// Try HTTPS first (most common), fall back to HTTP
|
||||
try {
|
||||
response = await this.queryEndpoint('https')
|
||||
} catch (e) {
|
||||
this.logger.debug('HTTPS query failed, trying HTTP')
|
||||
this.logger.debug(e)
|
||||
response = await this.queryEndpoint('http')
|
||||
}
|
||||
state.raw.basic = response.Basic
|
||||
|
||||
if (response.Server) {
|
||||
state.name = response.Server.Name
|
||||
|
|
@ -36,10 +24,7 @@ export default class hytale extends Core {
|
|||
if (response.Players) {
|
||||
state.players = response.Players.map(player => ({
|
||||
name: player.Name,
|
||||
raw: {
|
||||
uuid: player.UUID,
|
||||
world: player.World
|
||||
}
|
||||
raw: player
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
@ -48,8 +33,8 @@ export default class hytale extends Core {
|
|||
}
|
||||
}
|
||||
|
||||
async queryEndpoint (protocol) {
|
||||
const url = `${protocol}://${this.options.host}:${this.options.port}/Nitrado/Query`
|
||||
async queryEndpoint () {
|
||||
const url = `http://${this.options.host}:${this.options.port}/Nitrado/Query`
|
||||
|
||||
const requestOptions = {
|
||||
url,
|
||||
|
|
@ -59,13 +44,6 @@ export default class hytale extends Core {
|
|||
responseType: 'json'
|
||||
}
|
||||
|
||||
if (protocol === 'https') {
|
||||
requestOptions.https = {
|
||||
minVersion: 'TLSv1.2',
|
||||
rejectUnauthorized: this.options.rejectUnauthorized
|
||||
}
|
||||
}
|
||||
|
||||
return await this.request(requestOptions)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue