Show supported versions for PC servers

The Minetrack daemon will send a different protocol version each time
it pings a server. If a server responds with the same protocol version,
it is assumed that the version is supported, and it is shown on the
page above the server's player count.

The list of versions to be tried is stored in config.json.
At the moment, 4 versions are checked:
- 4 (Minecraft 1.7.2)
- 5 (Minecraft 1.7.10)
- 47 (Minecraft 1.8)
- 107 (Minecraft 1.9)
This commit is contained in:
Devin Ryan
2016-03-01 21:09:38 -06:00
parent df72b98d53
commit 43c284aa8a
6 changed files with 111 additions and 23 deletions

View File

@ -145,7 +145,7 @@ a {
}
.server > .column > .rank {
width: 64px;
width: 64px;
padding-top: 3px;
}
@ -157,6 +157,18 @@ a {
margin-bottom: 2px;
}
.server > .column > .versions {
min-height: 22px;
padding-bottom: 3px;
}
.server > .column > .versions > .version {
padding: 1px 5px;
border-radius: 2px;
border: 1px solid #A09E9E;
font-size: 12px;
}
.category-header {
margin-bottom: 10px;
margin-left: 15px;
@ -246,4 +258,4 @@ h3 {
.button:hover {
background: #ecf0f1;
color: #3498db;
}
}

View File

@ -5,6 +5,15 @@ var historyPlot;
var displayedGraphData;
var hiddenGraphData = [];
var mcVersions = {
'PC': {
4: '1.7.2',
5: '1.7.10',
47: '1.8',
107: '1.9'
}
};
var isConnected = false;
var mojangServicesUpdater;
@ -13,10 +22,21 @@ var sortServersTask;
function updateServerStatus(lastEntry) {
var info = lastEntry.info;
var div = $('#status_' + safeName(info.name));
var versionDiv = $('#version_' + safeName(info.name));
if (lastEntry.versions) {
var versions = '';
for (var i = 0; i < lastEntry.versions.length; i++) {
versions += '<span class="version">' + mcVersions[lastEntry.info.type][lastEntry.versions[i]] + '</span>&nbsp;';
}
versionDiv.html(versions);
} else {
versionDiv.html('');
}
if (lastEntry.result) {
var result = lastEntry.result;
var newStatus = '<br />Players: ' + formatNumber(result.players.online);
var newStatus = 'Players: ' + formatNumber(result.players.online);
var listing = graphs[lastEntry.info.name].listing;
@ -36,7 +56,7 @@ function updateServerStatus(lastEntry) {
div.html(newStatus);
} else {
var newStatus = '<br /><span class="color-red">';
var newStatus = '<span class="color-red">';
if (findErrorMessage(lastEntry.error)) {
newStatus += findErrorMessage(lastEntry.error);
@ -328,7 +348,7 @@ $(document).ready(function() {
<div class="column" style="width: 220px;">\
<h3>' + info.name + '&nbsp;<span class="type">' + info.type + '</span></h3>\
<span class="color-gray">' + info.ip + '</span>\
<br />\
<div id="version_' + safeName(info.name) + '" class="versions"></div>\
<span id="status_' + safeName(info.name) + '">Waiting</span>\
</div>\
<div class="column" style="float: right;">\