Do not add basename to tilejson and remove sensitive properties (see #69)

This commit is contained in:
Petr Sloup 2016-12-20 13:55:36 +01:00
parent 945e568b2b
commit 2d29a21596
3 changed files with 6 additions and 9 deletions

View file

@ -41,8 +41,8 @@ module.exports = function(options, repo, params, id, styles) {
Object.assign(tileJSON, info); Object.assign(tileJSON, info);
tileJSON['tilejson'] = '2.0.0'; tileJSON['tilejson'] = '2.0.0';
tileJSON['basename'] = id; delete tileJSON['filesize'];
tileJSON['filesize'] = mbtilesFileStats['size']; delete tileJSON['mtime'];
delete tileJSON['scheme']; delete tileJSON['scheme'];
Object.assign(tileJSON, params.tilejson || {}); Object.assign(tileJSON, params.tilejson || {});

View file

@ -175,7 +175,6 @@ module.exports = function(options, repo, params, id, dataResolver) {
'tilejson': '2.0.0', 'tilejson': '2.0.0',
'name': styleJSON.name, 'name': styleJSON.name,
'attribution': '', 'attribution': '',
'basename': id,
'minzoom': 0, 'minzoom': 0,
'maxzoom': 20, 'maxzoom': 20,
'bounds': [-180, -85.0511, 180, 85.0511], 'bounds': [-180, -85.0511, 180, 85.0511],
@ -223,7 +222,6 @@ module.exports = function(options, repo, params, id, dataResolver) {
var type = source.type; var type = source.type;
Object.assign(source, info); Object.assign(source, info);
source.type = type; source.type = type;
source.basename = name;
source.tiles = [ source.tiles = [
// meta url which will be detected when requested // meta url which will be detected when requested
'mbtiles://' + name + '/{z}/{x}/{y}.' + (info.format || 'pbf') 'mbtiles://' + name + '/{z}/{x}/{y}.' + (info.format || 'pbf')

View file

@ -18,7 +18,7 @@ var testTileJSONArray = function(url) {
}); });
}; };
var testTileJSON = function(url, basename) { var testTileJSON = function(url) {
describe(url + ' is TileJSON', function() { describe(url + ' is TileJSON', function() {
it('is json', function(done) { it('is json', function(done) {
supertest(app) supertest(app)
@ -27,11 +27,10 @@ var testTileJSON = function(url, basename) {
.expect('Content-Type', /application\/json/, done); .expect('Content-Type', /application\/json/, done);
}); });
it('has valid basename and tiles', function(done) { it('has valid tiles', function(done) {
supertest(app) supertest(app)
.get(url) .get(url)
.expect(function(res) { .expect(function(res) {
res.body.basename.should.equal(basename);
res.body.tiles.length.should.be.greaterThan(0); res.body.tiles.length.should.be.greaterThan(0);
}).end(done); }).end(done);
}); });
@ -64,6 +63,6 @@ describe('Metadata', function() {
}); });
}); });
testTileJSON('/styles/test-style/rendered.json', 'test-style'); testTileJSON('/styles/test-style/rendered.json');
testTileJSON('/data/openmaptiles.json', 'openmaptiles'); testTileJSON('/data/openmaptiles.json');
}); });