feat: add initial first working query

This commit is contained in:
CosminPerRam 2024-04-08 19:41:52 +03:00
parent 4e6ab05291
commit 8c237980e2
2 changed files with 12 additions and 17 deletions

View file

@ -2092,7 +2092,7 @@ export const games = {
name: 'Palworld', name: 'Palworld',
release_year: 2024, release_year: 2024,
options: { options: {
port: 8211, port: 8212,
protocol: 'palworld' protocol: 'palworld'
} }
}, },

View file

@ -1,20 +1,15 @@
import Epic from './epic.js' import Core from './core.js'
export default class palworld extends Epic { export default class palworld extends Core {
constructor () { async run (state) {
super() const url = `http://${this.options.host}:${this.options.port}/v1/api/info`
const headers = {
// OAuth2 credentials extracted from Palworld files. Authorization: `Basic ${Buffer.from(`${this.options.username}:${this.options.password}`).toString('base64')}`,
this.clientId = 'xyza78916PZ5DF0fAahu4tnrKKyFpqRE' Accept: 'application/json'
this.clientSecret = 'j0NapLEPm3R3EOrlQiM8cRLKq3Rt02ZVVwT0SkZstSg'
this.deploymentId = '0a18471f93d448e2a1f60e47e03d3413'
this.authByExternalToken = true
} }
async run (state) { const response = await this.request({ url, headers, method: 'GET' })
await super.run(state)
state.name = state.raw.attributes.NAME_s console.log(response)
state.numplayers = state.raw.attributes.PLAYERS_l
state.version = state.raw.attributes.VERSION_S
} }
} }