remove legacy category system

This commit is contained in:
Nick Krecklow
2020-03-30 01:06:30 -05:00
parent a458038075
commit f63d9bba4b
7 changed files with 19 additions and 132 deletions

View File

@ -41,35 +41,10 @@ function handleRequest(req, res) {
} else if (requestUrl === '/publicConfig.json') {
res.setHeader('Content-Type', 'application/javascript');
var categories = config.serverCategories;
// Legacy support for people without categories configured.
if (!categories || Object.keys(categories).length === 0) {
categories = {
'default': 'All Networks'
};
}
for (var i = 0; i < servers.length; i++) {
var entry = servers[i];
if (!entry.category) {
entry.category = 'default';
logger.warn('%s has no category, defaulting!', entry.name);
} else if (!categories[entry.category]) {
logger.warn('%s has an unknown category (%s), defaulting!', entry.name, entry.category);
entry.category = 'default';
}
}
var publicConfig = {
categories: categories,
graphDuration: config.graphDuration,
servers: servers,
bootTime: util.getBootTime(),
categoriesVisible: config.categoriesVisible || false,
serverTypesVisible: config.serverTypesVisible || false,
minecraftVersions: minecraft.versions
};