Skip to content

Commit

Permalink
minecraft
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTrunk committed Nov 10, 2023
1 parent 895d451 commit 2d955ad
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/appsConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ module.exports = {
ownersApps: [], // Will retrieve only apps of owners specified here
whiteListedApps: [], // If there's app in the array, blacklisting will be ignore
blackListedApps: ['Kadena', 'Kadena2', 'PresearchNode*', 'BrokerNode*', 'Folding*'],
minecraftApps: ['mcf', '*minecraft*'],
minecraftApps: ['mcf', '*minecraft*', 'Minecraft*'],
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"cors": "^2.8.5",
"ethers": "^5.7.2",
"express": "^4.17.3",
"gamedig": "^4.1.0",
"ini": "^4.1.1",
"mocha": "^9.2.2",
"mongodb": "^4.4.1",
Expand Down
17 changes: 17 additions & 0 deletions src/services/application/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const axios = require('axios');
const config = require('config');
const https = require('https');
const ethers = require('ethers');
const gamedig = require('gamedig');
const serviceHelper = require('../serviceHelper');
const log = require('../../lib/log');

Expand Down Expand Up @@ -608,6 +609,19 @@ async function checkBitcoinNode(ip, port, name) {
return false;
}

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

async function checkApplication(app, ip) {
let isOK = true;
if (generalWebsiteApps.includes(app.name)) {
Expand All @@ -626,6 +640,9 @@ async function checkApplication(app, ip) {
isOK = await checkBlockBook(ip.split(':')[0], app.compose[0].ports[0], app.name);
} else if (app.name.startsWith('AlgorandRPC')) {
isOK = await checkAlgorand(ip.split(':')[0], app.compose[0].ports[1]);
} else if (app.name.startsWith('Minecraft') || app.name.startsWith('minecraft') || app.name === 'mcf') {
console.log('here');
isOK = await checkMinecraft(ip.split(':')[0], app.compose[0].ports[0]);
} else {
const matchIndex = ethersList.findIndex((eApp) => app.name.startsWith(eApp.name));
if (matchIndex > -1) {
Expand Down

0 comments on commit 2d955ad

Please sign in to comment.