kmz_compressor 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a10ed4adcc4059b1d999b870c6f457c7907a3e7
4
- data.tar.gz: 3386d433d119d2f9ab293913e3b1488eadbbfc13
3
+ metadata.gz: c576bf27491bbd056f5568cd90b92e515825298d
4
+ data.tar.gz: d95f6409fe18975bd648b162c8d559e8f6d2dc9f
5
5
  SHA512:
6
- metadata.gz: 205e3a574d77b626fd80812f26c67b5b773a0b8631d51cd0a6b52aeb302bebb5b5359a11ddebb52571164139b4d14b321b30a6a27928f54038709f14c1c4d04d
7
- data.tar.gz: 7c72ecb00d9fd470d893ab281acd9d345ddf7f4da490b34f5cdfb30e17fcf2932e80c764e8751fe971ec9b071033174debcf342ad98dc2e83d3718fe273753b7
6
+ metadata.gz: 4771f6df6cc335d22c6581ae08903bd527d228ccadb8acfa9cf2632be8900478e9cb35893b6740c37539b36faede4638183f7f584e0b717353803d209e808670
7
+ data.tar.gz: 00fb859290d526dd74b2c099cd639903297edfb28ff337298164bd774e4f8058c6b837be1ab5fc31fa15a3f7c0ea11579c7ac7c68dab57bb2db15b709d93b35d
@@ -1,6 +1,5 @@
1
1
  window.MapLayerManager = function(map){
2
2
  var map = map;
3
- var host = location.protocol + "//" + location.host
4
3
  var layers = []
5
4
  var loadingCount = 0 // How many layers are being loaded
6
5
  var requestTimestamps = {}
@@ -8,25 +7,25 @@ window.MapLayerManager = function(map){
8
7
  var layerLoadedEventName = 'map:layerLoaded'
9
8
 
10
9
  // Prime the KMZ cache on the server before unleashing google's many tilemills
11
- function cacheAndLoadKMLLayer(kmlPath, layerName, options) {
10
+ function cacheAndLoadKMLLayer(kmlURL, layerName, options) {
12
11
  var requestTimestamp = new Date;
13
- kmlPath = sanitizeURI(kmlPath);
12
+ kmlURL = sanitizeURI(kmlURL);
14
13
 
15
- $.ajax(host + kmlPath, {type:'head', complete:function(){
14
+ $.ajax(kmlURL, {type:'head', complete:function(){
16
15
  if (!requestTimestamps[layerName] || requestTimestamps[layerName] < requestTimestamp){
17
16
  requestTimestamps[layerName] = requestTimestamp;
18
- loadKMLLayer(cachedKMZPath(kmlPath), layerName, options)
17
+ loadKMLLayer(cachedKMZURL(kmlURL), layerName, options)
19
18
  }
20
19
  }});
21
20
  }
22
21
 
23
- function loadKMLLayer(kmlPath, layerName, options) {
22
+ function loadKMLLayer(kmlURL, layerName, options) {
24
23
  // Replace spaces with pluses so we don't have problems with some things turning them into %20s and some not
25
- kmlPath = sanitizeURI(kmlPath);
24
+ kmlURL = sanitizeURI(kmlURL);
26
25
  options = options || {}
27
26
  options.map = map;
28
27
 
29
- var kmlLayer = new google.maps.KmlLayer(host + kmlPath, options);
28
+ var kmlLayer = new google.maps.KmlLayer(kmlURL, options);
30
29
  var layer = addLayer(layerName, kmlLayer)
31
30
  loadingCount++
32
31
  $(window.document).trigger({type: layerLoadingEventName, layer:layer})
@@ -47,9 +46,10 @@ window.MapLayerManager = function(map){
47
46
  });
48
47
  }
49
48
 
50
- // Generates the url of the cached KMZ for the given kmlPath
51
- function cachedKMZPath(kmlPath){
52
- return '/kmz/' + hex_sha256(kmlPath) + '.kmz'
49
+ // Generates the url of the cached KMZ for the given kmlURL
50
+ function cachedKMZURL(kmlURL){
51
+ var url = $('<a href="' + kmlURL + '"/>')[0]
52
+ return url.protocol + '//' + url.host + '/kmz/' + hex_sha256(kmlURL) + '.kmz'
53
53
  }
54
54
 
55
55
  function centerWhenLoaded(layerNamez){
@@ -225,7 +225,7 @@ window.MapLayerManager = function(map){
225
225
  }).join('=')
226
226
  }).join('&')
227
227
 
228
- return output
228
+ return url.protocol + '//' + url.host + output
229
229
  }
230
230
 
231
231
 
@@ -9,7 +9,7 @@ module KMZCompressor
9
9
 
10
10
  # If the User is asking for a KMZ file
11
11
  if request.path_info.end_with? '.kmz'
12
- uri = request.fullpath
12
+ uri = request.url
13
13
 
14
14
  # Use a hash of the request path (before we gsub it) as the filename we will save on the HD
15
15
  cache_path = "public/kmz/#{Digest::SHA2.hexdigest(uri)}.kmz"
@@ -1,3 +1,3 @@
1
1
  module KMZCompressor
2
- VERSION = "2.0.3"
2
+ VERSION = "2.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kmz_compressor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Wallace
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-09 00:00:00.000000000 Z
12
+ date: 2014-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.2.1
99
+ rubygems_version: 2.2.2
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Rack Middleware which retrieves KML from Rails and produces KMZ for the client.