i18n in server. Some fixes

This commit is contained in:
vjrj 2017-12-09 17:54:18 +01:00
parent 23ec2b8f55
commit a0e5dc4723
13 changed files with 543 additions and 121 deletions

View file

@ -4,22 +4,21 @@ import Perlin from 'loms.perlin';
Perlin.seed(Math.random());
Meteor.publishTransformed('userSubsToFires', function() {
Meteor.publishTransformed('userSubsToFires', function () {
// https://en.wikipedia.org/wiki/Location_obfuscation
// https://en.wikipedia.org/wiki/Decimal_degrees#Precision
// https://gis.stackexchange.com/questions/27792/what-simple-effective-techniques-for-obfuscating-points-are-available
return Subscriptions.find().serverTransform(function(doc) {
var location = doc.location;
return Subscriptions.find().serverTransform(function (doc) {
var location = doc.location;
/* doc.lat = location.lat;
* doc.lon = location.lon;*/
* doc.lon = location.lon; */
if (location) {
doc.lat = Math.round(location.lat * 10) / 10;
doc.lon = Math.round(location.lon * 10) / 10;
}
// console.log(`[${doc.lat}, ${doc.lon}]`);
var noiseBase = Perlin.perlin2(doc.lat, doc.lon)
var noise = Math.abs(noiseBase/3);
var noiseBase = Perlin.perlin2(doc.lat, doc.lon);
var noise = Math.abs(noiseBase / 3);
// console.log(`Noise ${noise}, abs: ${Math.abs(noise)}`);
doc.lat += noise;
doc.lon += noise;