Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions protocols/vintagestorymaster.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import Core from './core.js'

const USER_AGENT = 'Mozilla/5.0 (compatible; Gamedig/3.0; +https://github.com/gamedig/gamedig)'

export default class vintagestorymaster extends Core {
constructor () {
super()
this.usedTcp = true
}

async run (state) {
// Vintage Story master server returns 403 unless a valid User-Agent header is provided
const response = await this.request({
url: 'https://masterserver.vintagestory.at/api/v1/servers/list',
responseType: 'json'
responseType: 'json',
headers: {
'User-Agent': USER_AGENT
}
})

state.raw.servers = response?.data || []
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a end file new line