update to add widget section

This commit is contained in:
MCHost
2025-07-03 02:51:10 -04:00
parent 827799b7cb
commit c464f3b3b5
5 changed files with 180 additions and 34 deletions

View File

@ -406,10 +406,11 @@ app.get('/widget/:edition/:host/:port', (req, res) => {
try {
validateEdition(edition);
validateHostname(host);
if (host !== 'my-mc.link') {
logger.error('Unauthorized hostname', { host });
throw new Error('Hostname must be my-mc.link');
}
// 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));