summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rwxr-xr-xutil/buildbot/buildwin32.sh11
-rw-r--r--util/master/list.js37
-rwxr-xr-xutil/master/master.cgi5
3 files changed, 34 insertions, 19 deletions
diff --git a/util/buildbot/buildwin32.sh b/util/buildbot/buildwin32.sh
index fc42db8a7..0c0d7cf21 100755
--- a/util/buildbot/buildwin32.sh
+++ b/util/buildbot/buildwin32.sh
@@ -53,6 +53,9 @@ cd $builddir
wget http://github.com/minetest/minetest/zipball/master \
-c -O $packagedir/minetest.zip --tries=3 || (echo "Please download http://github.com/minetest/minetest/zipball/master manually and save it as $packagedir/minetest.zip"; read -s)
[ -e $packagedir/minetest.zip ] || (echo "minetest.zip not found"; exit 1)
+wget http://github.com/minetest/common/zipball/master \
+ -c -O $packagedir/common.zip --tries=3 || (echo "Please download http://github.com/minetest/common/zipball/master manually and save it as $packagedir/common.zip"; read -s)
+[ -e $packagedir/common.zip ] || (echo "common.zip not found"; exit 1)
wget http://github.com/minetest/minetest_game/zipball/master \
-c -O $packagedir/minetest_game.zip --tries=3 || (echo "Please download http://github.com/minetest/minetest_game/zipball/master manually and save it as $packagedir/minetest_game.zip"; read -s)
[ -e $packagedir/minetest_game.zip ] || (echo "minetest_game.zip not found"; exit 1)
@@ -66,6 +69,7 @@ wget http://github.com/minetest/minetest_game/zipball/master \
minetestdirname=`unzip -l $packagedir/minetest.zip | head -n 7 | tail -n 1 | sed -e 's/^[^m]*//' -e 's/\/.*$//'`
minetestdir=$builddir/$minetestdirname || exit 1
git_hash=`echo $minetestdirname | sed -e 's/minetest-minetest-//'`
+commondirname=`unzip -l $packagedir/common.zip | head -n 7 | tail -n 1 | sed -e 's/^[^m]*//' -e 's/\/.*$//'`
minetest_gamedirname=`unzip -l $packagedir/minetest_game.zip | head -n 7 | tail -n 1 | sed -e 's/^[^m]*//' -e 's/\/.*$//'`
# Extract stuff
@@ -86,6 +90,13 @@ unzip -o $packagedir/minetest.zip || exit 1
rm -rf $builddir/minetest
ln -s $minetestdir $builddir/minetest
+# Extract common
+cd $minetestdir/games || exit 1
+rm -rf common || exit 1
+unzip -o $packagedir/common.zip || exit 1
+commondir=$minetestdir/games/$commondirname || exit 1
+mv $commondir $minetestdir/games/common || exit 1
+
# Extract minetest_game
cd $minetestdir/games || exit 1
rm -rf minetest_game || exit 1
diff --git a/util/master/list.js b/util/master/list.js
index dcc30e091..990bb6ded 100644
--- a/util/master/list.js
+++ b/util/master/list.js
@@ -2,11 +2,12 @@ function e(s) {
if (typeof s === "undefined") s = '';
return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); //mc"
}
-function human_time(t) {
+
+function human_time(t, abs) {
var n = 's';
if (!t || t < 0) t = 0;
var f = 0;
- var s = parseInt((new Date().getTime() / 1000 - (t || 0)));
+ var s = parseInt(abs ? (t || 0) : (new Date().getTime() / 1000 - (t || 0)));
if (!s || s <= 0) s = 0;
if (s == 0) return 'now';
if (s >= 60) {
@@ -35,38 +36,36 @@ function human_time(t) {
}
return ((f ? parseFloat(s).toFixed(1) : parseInt(s)) + n);
}
+
function success(r) {
if (!r || !r.list) return;
- var h = '<table><tr><th>ip:port</th><th>clients, max</th><th>version</th><th>name</th><th>desc</th><th>flags</th><th>updated/started</th><th>ping</th></tr>';
+ var h = '<table class="mts_table"><tr class="mts_head"><th>ip[:port]</th><th>clients/max</th><th>version gameid</th><th>name</th><th>desc</th><th>flags</th><th>uptime</th><th>ping</th></tr>';
for (var i = 0; i < r.list.length; ++i) {
var s = r.list[i];
if (!s) continue;
- h += '<tr>';
- h += '<td>' + e(s.address) + ':' + e(s.port) + '</td>';
- h += '<td>' + e(s.clients) + (s.clients_max ? '/' + e(s.clients_max) : '') + (s.clients_top ? ', ' + s.clients_top : '') + '</td>';
- h += '<td>' + e(s.version) + '</td>';
- h += '<td>';
+ h += '<tr class="mts_row">';
+ h += '<td class="mts_address">' + e(s.address) + (s.port != 30000 ? (':' + e(s.port)) : '') + '</td>';
+ h += '<td class="mts_clients">' + e(s.clients) + (s.clients_max ? '/' + e(s.clients_max) : '') + (s.clients_top ? ', ' + s.clients_top : '') + '</td>';
+ h += '<td class="mts_version">' + e(s.version) + ' ' + e(s.gameid) + '</td>';
+ h += '<td class="mts_url">';
if (s.url) h += '<a href="' + e(s.url) + '">';
h += e(s.name || s.url);
if (s.url) h += '</a>';
h += '</td>';
- h += '<td>' + e(s.description) + '</td>';
- h += '<td>' + e(s.password ? 'Pwd ' : '') + (s.creative ? 'Cre ' : '') + (s.damage ? 'Dmg ' : '') + (s.pvp ? 'Pvp ' : '') + (s.dedicated ? 'Ded ' : '') + '</td>';
- if (!s.time || s.time < 0) s.time = 0;
+ h += '<td class="mts_description">' + e(s.description) + '</td>';
+ h += '<td class="mts_flags">' + e(s.password ? 'Pwd ' : '') + (s.creative ? 'Cre ' : '') + (s.damage ? 'Dmg ' : '') + (s.pvp ? 'Pvp ' : '') + (s.dedicated ? 'Ded ' : '') + '</td>';
if (!s.start || s.start < 0) s.start = 0;
- h += '<td>' + human_time(s.time) + (s.start ? '/' + human_time(s.start) : '') + '</td>';
- h += '<td>' + (s.ping ? parseFloat(s.ping).toFixed(3)*1000 : '') + '</td>';
+ h += '<td class="mts_time">' + (s.uptime ? human_time(s.uptime, 1) : s.start ? human_time(s.start) : '') + '</td>';
+ h += '<td class="mts_ping">' + (s.ping ? parseFloat(s.ping).toFixed(3) * 1000 : '') + '</td>';
h += '</tr>';
}
h += '</table>'
jQuery('#table').html(h);
}
+var master_root;
+
function get() {
- jQuery.ajax({
- url: 'list',
- dataType: 'json',
- success: success
- });
+ jQuery.getJSON((master_root || '') + 'list', success);
setTimeout(get, 60000);
}
-get(); \ No newline at end of file
+get();
diff --git a/util/master/master.cgi b/util/master/master.cgi
index b918876bd..0e456ed0c 100755
--- a/util/master/master.cgi
+++ b/util/master/master.cgi
@@ -18,6 +18,7 @@ nginx:
location / {
index index.html;
+ add_header Access-Control-Allow-Origin *;
}
location /announce {
fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock;
@@ -35,6 +36,10 @@ apache .htaccess:
Allow from all
</FilesMatch>
Deny from all
+ <ifModule mod_headers.c>
+ Header set Access-Control-Allow-Origin: *
+ </ifModule>
+
=cut