0

Merge remote-tracking branch 'ion1/master'

This commit is contained in:
Aaron Griffith
2011-12-30 13:22:54 -05:00
4 changed files with 13 additions and 12 deletions

View File

@@ -52,6 +52,7 @@ feature.
* Ryan Hitchman <hitchmanr@gmail.com> * Ryan Hitchman <hitchmanr@gmail.com>
* Jenny <jennytoo@gmail.com> * Jenny <jennytoo@gmail.com>
* Michael Jensen <emjay1988@gmail.com> * Michael Jensen <emjay1988@gmail.com>
* Johan Kiviniemi <devel@johan.kiviniemi.name>
* Thomas Lake <tswsl1989@sucs.org> * Thomas Lake <tswsl1989@sucs.org>
* Maciej Malecki <maciej.malecki@hotmail.com> * Maciej Malecki <maciej.malecki@hotmail.com>
* Ryan McCue <ryanmccue@cubegames.net> * Ryan McCue <ryanmccue@cubegames.net>

View File

@@ -1141,10 +1141,8 @@ var overviewer = {
} }
} }
url = url + '.' + pathExt; url = url + '.' + pathExt;
if(overviewerConfig.map.cacheMinutes > 0) { if(typeof overviewerConfig.map.cacheTag !== 'undefined') {
var d = new Date(); url += '?c=' + overviewerConfig.map.cacheTag;
url += '?c=' + Math.floor(d.getTime() /
(1000 * 60 * overviewerConfig.map.cacheMinutes));
} }
return(urlBase + url); return(urlBase + url);
} }

View File

@@ -90,14 +90,14 @@ var overviewerConfig = {
*/ */
'center': {spawn_coords}, 'center': {spawn_coords},
/** /**
* Set this to tell browsers how long they should cache tiles in minutes. * Overviewer will update cache_tag to a new value whenever the map has
* Essentially if set to 0, the url for tiles will end in .png * been updated. The tag will be added to the end of the tile URLs,
* if not set to 0 it will amend a number derived from the current time * like .png?c=123456. This is a great method for preventing browsers
* to the end of the url, like .png?c=123456. This is a great method for * from loading old images from the cache when we know new versions are
* preventing browsers from caching the images. 0 saves bandwidth, not 0 * available. Use 'cacheTag': undefined to disable this behavior.
* prevents caching. * undefined saves bandwidth, cache_tag ensures fresh image data.
*/ */
'cacheMinutes': 0, 'cacheTag': {cache_tag},
/** /**
* Set to true to turn on debug mode, which adds a grid to the map along * Set to true to turn on debug mode, which adds a grid to the map along
* with co-ordinates and a bunch of console output. * with co-ordinates and a bunch of console output.

View File

@@ -19,7 +19,7 @@ import stat
import cPickle import cPickle
import Image import Image
import shutil import shutil
from time import strftime, localtime from time import strftime, time, localtime
import json import json
import locale import locale
import codecs import codecs
@@ -130,6 +130,8 @@ class MapGen(object):
config = config.replace("{spawn_coords}", config = config.replace("{spawn_coords}",
json.dumps(list(self.world.spawn))) json.dumps(list(self.world.spawn)))
config = config.replace("{cache_tag}", str(int(time())))
#config = config.replace("{bg_color}", self.bg_color) #config = config.replace("{bg_color}", self.bg_color)
# helper function to get a label for the given rendermode # helper function to get a label for the given rendermode