diff --git a/GAMES_LIST.md b/GAMES_LIST.md index eb97803..3cc2928 100644 --- a/GAMES_LIST.md +++ b/GAMES_LIST.md @@ -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). +### 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. diff --git a/lib/games.js b/lib/games.js index ebc99b7..bb126ed 100644 --- a/lib/games.js +++ b/lib/games.js @@ -1592,6 +1592,9 @@ export const games = { options: { port: 5523, protocol: 'hytale' + }, + extra: { + doc_notes: 'hytale' } }, i2cs: { diff --git a/protocols/hytale.js b/protocols/hytale.js index 9c669f1..bd7aa1e 100644 --- a/protocols/hytale.js +++ b/protocols/hytale.js @@ -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) } }