diff --git a/overviewer_core/data/web_assets/overviewer.js b/overviewer_core/data/web_assets/overviewer.js index 2ab35d0..8e3d471 100644 --- a/overviewer_core/data/web_assets/overviewer.js +++ b/overviewer_core/data/web_assets/overviewer.js @@ -1141,10 +1141,8 @@ var overviewer = { } } url = url + '.' + pathExt; - if(overviewerConfig.map.cacheMinutes > 0) { - var d = new Date(); - url += '?c=' + Math.floor(d.getTime() / - (1000 * 60 * overviewerConfig.map.cacheMinutes)); + if(typeof overviewerConfig.map.cacheTag !== 'undefined') { + url += '?c=' + overviewerConfig.map.cacheTag; } return(urlBase + url); } diff --git a/overviewer_core/data/web_assets/overviewerConfig.js b/overviewer_core/data/web_assets/overviewerConfig.js index 5f3122f..5d0ae31 100644 --- a/overviewer_core/data/web_assets/overviewerConfig.js +++ b/overviewer_core/data/web_assets/overviewerConfig.js @@ -90,14 +90,14 @@ var overviewerConfig = { */ 'center': {spawn_coords}, /** - * Set this to tell browsers how long they should cache tiles in minutes. - * Essentially if set to 0, the url for tiles will end in .png - * if not set to 0 it will amend a number derived from the current time - * to the end of the url, like .png?c=123456. This is a great method for - * preventing browsers from caching the images. 0 saves bandwidth, not 0 - * prevents caching. + * Overviewer will update cache_tag to a new value whenever the map has + * been updated. The tag will be added to the end of the tile URLs, + * like .png?c=123456. This is a great method for preventing browsers + * from loading old images from the cache when we know new versions are + * available. Use 'cacheTag': undefined to disable this behavior. + * 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 * with co-ordinates and a bunch of console output. diff --git a/overviewer_core/googlemap.py b/overviewer_core/googlemap.py index cbbce9e..2c0eb5e 100644 --- a/overviewer_core/googlemap.py +++ b/overviewer_core/googlemap.py @@ -19,7 +19,7 @@ import stat import cPickle import Image import shutil -from time import strftime, localtime +from time import strftime, time, localtime import json import util @@ -128,6 +128,8 @@ class MapGen(object): config = config.replace("{spawn_coords}", json.dumps(list(self.world.spawn))) + config = config.replace("{cache_tag}", str(int(time()))) + #config = config.replace("{bg_color}", self.bg_color) # helper function to get a label for the given rendermode