mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-25 18:17:37 +01:00
Added ability to set each url individually.
This commit is contained in:
parent
f0cdd5614b
commit
d1a8c40248
@ -1,9 +1,33 @@
|
||||
var config = {
|
||||
// For internal server or proxying webserver.
|
||||
url: {
|
||||
configuration: 'up/configuration',
|
||||
update: 'up/world/{world}/{timestamp}',
|
||||
sendmessage: 'up/sendmessage'
|
||||
},
|
||||
|
||||
// For proxying webserver through php.
|
||||
//url: {
|
||||
// configuration: 'up.php?path=configuration',
|
||||
// update: 'up.php?path=world/{world}/?{timestamp}',
|
||||
// sendmessage: 'up.php?path=sendmessage'
|
||||
//},
|
||||
|
||||
// For proxying webserver through aspx.
|
||||
//url: {
|
||||
// configuration: 'up.aspx?path=configuration',
|
||||
// update: 'up.aspx?path=world/{world}/?{timestamp}',
|
||||
// sendmessage: 'up.aspx?path=sendmessage'
|
||||
//},
|
||||
|
||||
// For standalone (jsonfile) webserver.
|
||||
//url: {
|
||||
// configuration: 'standalone/dynmap_config.json',
|
||||
// update: 'standalone/dynmap_{world}.json',
|
||||
// sendmessage: 'standalone/sendmessage.php'
|
||||
//},
|
||||
|
||||
tileUrl: 'tiles/',
|
||||
updateUrl: 'up/', // For Apache and lighttpd
|
||||
// updateUrl: 'up.php?path=', // For Apache and lighttpd without ability to natively proxy
|
||||
// updateUrl: 'up.aspx?path=', // For IIS
|
||||
// configurationUrl: 'standalone/dynmap_config.json', // For some standalone setups.
|
||||
tileWidth: 128,
|
||||
tileHeight: 128
|
||||
tileWidth: 128,
|
||||
tileHeight: 128
|
||||
};
|
@ -78,7 +78,7 @@ function Location(world, x, y, z) {
|
||||
function DynMap(options) {
|
||||
var me = this;
|
||||
me.options = options;
|
||||
$.getJSON(me.options.configurationUrl || (me.options.updateUrl + 'configuration'), function(configuration) {
|
||||
$.getJSON(me.options.url.configuration, function(configuration) {
|
||||
me.configure(configuration);
|
||||
me.initialize();
|
||||
}, function(status, statusMessage) {
|
||||
@ -92,6 +92,13 @@ DynMap.prototype = {
|
||||
players: {},
|
||||
lasttimestamp: '0',
|
||||
followingPlayer: '',
|
||||
formatUrl: function(name, options) {
|
||||
var url = this.options.url[name];
|
||||
$.each(options, function(n,v) {
|
||||
url = url.replace("{" + n + "}", v);
|
||||
});
|
||||
return url;
|
||||
},
|
||||
configure: function(configuration) {
|
||||
var me = this;
|
||||
$.extend(me.options, configuration);
|
||||
@ -352,7 +359,7 @@ DynMap.prototype = {
|
||||
var me = this;
|
||||
|
||||
$(me).trigger('worldupdating');
|
||||
$.getJSON(me.options.updateUrl + "world/" + me.world.name + "/" + me.lasttimestamp, function(update) {
|
||||
$.getJSON(me.formatUrl('update', { world: me.world.name, timestamp: me.lasttimestamp }), function(update) {
|
||||
if (!update) {
|
||||
setTimeout(function() { me.update(); }, me.options.updaterate);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user