This commit is contained in:
MCHost
2025-07-09 17:46:31 -04:00
parent f8632ade7e
commit 1ef09e5015
2 changed files with 10 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
const express = require('express');
const { promisify } = require('util');
const { exec } = require('child_process');
const dns = require('dns').promises; // Add DNS module for SRV lookup
const dns = require('dns').promises;
const rateLimit = require('express-rate-limit');
const path = require('path');
const fs = require('fs');
@@ -174,7 +174,7 @@ async function checkConnectionStatus(hostname, port) {
}
const data = JSON.parse(stdout);
if (isInfo) logger.info('Java server status check completed', { requestId, isOnline: true, resolvedHost: finalHost, resolvedPort: finalPort });
return { isOnline: true, data };
return { isOnline: true, data, srvHost: finalHost, srvPort: finalPort };
} catch (error) {
logger.error('Java server status check failed', { requestId, error: error.message });
return { isOnline: false, error: error.message };
@@ -205,7 +205,7 @@ async function checkGeyserStatus(hostname, port) {
}
const data = JSON.parse(stdout);
if (isInfo) logger.info('Bedrock server status check completed', { requestId, isOnline: true, resolvedHost: finalHost, resolvedPort: finalPort });
return { isOnline: true, data };
return { isOnline: true, data, srvHost: finalHost, srvPort: finalPort };
} catch (error) {
logger.error('Bedrock server status check failed', { requestId, error: error.message });
return { isOnline: false, error: error.message };
@@ -433,11 +433,6 @@ app.get('/widget/:edition/:host/:port', (req, res) => {
try {
validateEdition(edition);
validateHostname(host);
// Uncomment this to only allow our system servers to have widgets.
// if (host !== 'my-mc.link') {
// logger.error('Unauthorized hostname', { host });
// throw new Error('Hostname must be my-mc.link');
// }
validatePort(port);
res.setHeader('Content-Type', 'text/html');
res.send(widgetTemplate(edition, host, port));