Enable more privacy for some themes and layers

This commit is contained in:
Pieter Vander Vennet 2024-05-06 14:23:54 +02:00
parent 484adf1ee1
commit 91b836bf66
15 changed files with 59 additions and 16 deletions

View file

@ -554,4 +554,15 @@ export interface LayerConfigJson {
* group: hidden
*/
fullNodeDatabase?: boolean
/**
* question: Should a theme using this layer leak some location info when making changes?
*
* When a changeset is made, a 'distance to object'-class is written to the changeset.
* For some particular themes and layers, this might leak too much information, and we want to obfuscate this
*
* ifunset: Write 'change_within_x_m' as usual and if GPS is enabled
* iftrue: Do not write 'change_within_x_m' and do not indicate that this was done by survey
*/
enableMorePrivacy: boolean
}

View file

@ -439,4 +439,16 @@ export interface LayoutConfigJson {
* group: hidden
*/
enableNodeDatabase?: boolean
/**
* question: Should this theme leak some location info when making changes?
*
* When a changeset is made, a 'distance to object'-class is written to the changeset.
* For some particular themes and layers, this might leak too much information, and we want to obfuscate this
*
* ifunset: Write 'change_within_x_m' as usual and if GPS is enabled
* iftrue: Do not write 'change_within_x_m' and do not indicate that this was done by survey
*/
enableMorePrivacy: boolean
}

View file

@ -67,6 +67,7 @@ export default class LayerConfig extends WithContextLoader {
public readonly _needsFullNodeDatabase: boolean
public readonly popupInFloatover: boolean | string
public readonly enableMorePrivacy: boolean
constructor(json: LayerConfigJson, context?: string, official: boolean = true) {
context = context + "." + json.id
@ -149,6 +150,7 @@ export default class LayerConfig extends WithContextLoader {
this.shownByDefault = json.shownByDefault ?? true
this.doCount = json.isCounted ?? this.shownByDefault ?? true
this.forceLoad = json.forceLoad ?? false
this.enableMorePrivacy = json.enableMorePrivacy ?? false
if (json.presets === null) json.presets = undefined
if (json.presets !== undefined && json.presets?.map === undefined) {
throw "Presets should be a list of items (at " + context + ")"

View file

@ -63,6 +63,8 @@ export default class LayoutConfig implements LayoutInformation {
public readonly enableExportButton: boolean
public readonly enablePdfDownload: boolean
public readonly enableTerrain: boolean
public readonly enableMorePrivacy: boolean
public readonly customCss?: string
@ -204,6 +206,7 @@ export default class LayoutConfig implements LayoutInformation {
this.overpassTimeout = json.overpassTimeout ?? 30
this.overpassMaxZoom = json.overpassMaxZoom ?? 16
this.osmApiTileSize = json.osmApiTileSize ?? this.overpassMaxZoom + 1
this.enableMorePrivacy = json.enableMorePrivacy || json.layers.some(l => (<LayerConfigJson> l).enableMorePrivacy)
this.layersDict = new Map<string, LayerConfig>()
for (const layer of this.layers) {

View file

@ -265,6 +265,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
featurePropertiesStore: this.featureProperties,
osmConnection: this.osmConnection,
historicalUserLocations: this.geolocation.historicalUserLocations,
featureSwitches: this.featureSwitches
},
layout?.isLeftRightSensitive() ?? false
)