move minecraft proxy & use `url` key

pull/1067/head
shamoon 2 years ago
parent b36ef0234e
commit c6e76f4e31

@ -9,15 +9,16 @@ const logger = createLogger(proxyName);
export default async function minecraftProxyHandler(req, res) {
const { group, service } = req.query;
const serviceWidget = await getServiceWidget(group, service);
const url = new URL(serviceWidget.url);
try {
const pingResponse = await pingWithPromise(serviceWidget.domain, serviceWidget.port || 25565);
const pingResponse = await pingWithPromise(url.hostname, url.port || 25565);
res.status(200).send({
version: pingResponse.version.name,
online: true,
players: pingResponse.players
});
} catch (e) {
logger.warn(e)
logger.error(e);
res.status(200).send({
version: undefined,
online: false,

@ -1,4 +1,4 @@
import minecraftProxyHandler from "utils/proxy/handlers/minecraft";
import minecraftProxyHandler from "./proxy";
const widget = {
proxyHandler: minecraftProxyHandler

Loading…
Cancel
Save