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:
CosminPerRam 2026-02-03 01:18:30 +02:00 committed by GitHub
parent 1b2345fa02
commit c4adb68040
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 27 deletions

View file

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