Skip to content

Commit

Permalink
Merge pull request #100 from RunOnFlux/palworld
Browse files Browse the repository at this point in the history
healthCheck palworld
  • Loading branch information
TheTrunk authored Jan 26, 2024
2 parents 5ebfad4 + ba60345 commit e5b5142
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"cors": "^2.8.5",
"ethers": "^5.7.2",
"express": "^4.17.3",
"gamedig": "^4.1.0",
"gamedig": "^5.0.0-beta.0",
"ini": "^4.1.1",
"mocha": "^9.2.2",
"mongodb": "^4.4.1",
Expand Down
16 changes: 16 additions & 0 deletions src/services/application/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,20 @@ async function checkMinecraft(ip, port) {
}
}

async function checkPalworld(ip, port) {
try {
const state = await gamedig.query({
type: 'palworld',
host: ip,
port,
attemptTimeout: 5000,
});
return true;
} catch (error) {
return false;
}
}

async function checkApplication(app, ip) {
let isOK = true;
if (generalWebsiteApps.includes(app.name)) {
Expand All @@ -645,6 +659,8 @@ async function checkApplication(app, ip) {
isOK = await checkAlgorand(ip.split(':')[0], app.compose[0].ports[1]);
} else if (app.name.toLowerCase().includes('minecraft') || app.name === 'mcf') {
isOK = await checkMinecraft(ip.split(':')[0], app.version >= 4 ? app.compose[0].ports[0] : app.ports[0]);
} else if (app.name.toLowerCase().includes('palworld')) {
isOK = await checkPalworld(ip.split(':')[0], app.version >= 4 ? app.compose[0].ports[0] : app.ports[0]);
} else {
const matchIndex = ethersList.findIndex((eApp) => app.name.startsWith(eApp.name));
if (matchIndex > -1) {
Expand Down

0 comments on commit e5b5142

Please sign in to comment.