Skip to content

Commit b215d02

Browse files
Adding reference change
1 parent 47166f6 commit b215d02

7 files changed

+60
-8
lines changed

features/element-hiding.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414
],
1515
"settings": {
16-
"useStrictHideStyleTag": true,
16+
"useStrictHideStyleTag2": true,
1717
"rules": [
1818
{
1919
"selector": "[id*='gpt-']",

index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ const {
1111
getBaseFeatureConfigs,
1212
} = require('./util');
1313

14+
const immutableJSONPatch = require('immutable-json-patch').immutableJSONPatch;
15+
1416
const { OVERRIDE_DIR, GENERATED_DIR, LISTS_DIR, BROWSERS_SUBDIR, CURRENT_CONFIG_VERSION, UNPROTECTED_LIST_NAME } = require('./constants');
1517

1618
const defaultConfig = {
1719
readme: 'https://github.com/duckduckgo/privacy-configuration',
1820
version: Date.now(),
19-
meta: {
21+
reference: {
2022
features: getBaseFeatureConfigs(),
2123
},
2224
unprotectedTemporary: [],
@@ -81,7 +83,7 @@ function writeConfigToDisk(platform, config) {
8183
addHashToFeatures(compatConfig);
8284

8385
compatibility.removeEolFeatures(compatConfig, i);
84-
fs.writeFileSync(`${GENERATED_DIR}/${version}/${configName}-config.json`, JSON.stringify(compatConfig));
86+
fs.writeFileSync(`${GENERATED_DIR}/${version}/${configName}-config.json`, JSON.stringify(compatConfig, null, 2));
8587
}
8688
}
8789

@@ -257,6 +259,15 @@ async function buildPlatforms() {
257259
if (isFeatureMissingState(platformConfig.features[key])) {
258260
platformConfig.features[key].state = 'disabled';
259261
}
262+
const feature = platformConfig.features[key];
263+
feature.reference = defaultConfig.reference;
264+
if ('patchFeature' in feature) {
265+
console.log(`Patching feature ${key} for ${platform}`, feature.patchFeature, JSON.stringify(platformOverride.features[key], null, 2), JSON.stringify(defaultConfig.reference.features[key], null, 2));
266+
platformConfig.features[key] = immutableJSONPatch(feature, feature.patchFeature);
267+
console.log('Patching feature', platformConfig.features[key]);
268+
}
269+
delete feature.patchFeature;
270+
delete feature.reference;
260271
}
261272

262273
// Remove appTP feature from platforms that don't use it since it's a large feature
@@ -279,6 +290,7 @@ async function buildPlatforms() {
279290

280291
addCnameEntriesToAllowlist(tds, platformConfig.features.trackerAllowlist.settings.allowlistedTrackers);
281292
platformConfig = inlineReasonArrays(platformConfig);
293+
delete platformConfig.reference;
282294
platformConfigs[platform] = platformConfig;
283295

284296
// Write config to disk

overrides/android-override.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,15 @@
621621
}
622622
},
623623
"elementHiding": {
624-
"state": "enabled"
624+
"state": "enabled",
625+
"patchFeature": [
626+
{
627+
"op": "copy",
628+
"from": "/reference/elementHiding/settings/rules",
629+
"path": "/settings"
630+
}
631+
],
632+
"settings": {}
625633
},
626634
"breakageReporting": {
627635
"state": "enabled"

overrides/extension-override.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@
5858
"state": "enabled"
5959
},
6060
"elementHiding": {
61-
"state": "enabled"
61+
"state": "enabled",
62+
"patchFeature": [
63+
{
64+
"op": "copy",
65+
"from": "/reference/elementHiding/settings/rules",
66+
"path": "/settings"
67+
}
68+
],
69+
"settings": {}
6270
},
6371
"fingerprintingCanvas": {
6472
"state": "disabled"

overrides/ios-override.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,15 @@
321321
"state": "enabled"
322322
},
323323
"elementHiding": {
324-
"state": "enabled"
324+
"state": "enabled",
325+
"patchFeature": [
326+
{
327+
"op": "copy",
328+
"from": "/reference/elementHiding/settings/rules",
329+
"path": "/settings"
330+
}
331+
],
332+
"settings": {}
325333
},
326334
"autoconsent": {
327335
"state": "enabled",

overrides/macos-override.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,15 @@
297297
"domain": "wunderground.com",
298298
"reason": "https://github.com/duckduckgo/privacy-configuration/issues/592"
299299
}
300-
]
300+
],
301+
"patchFeature": [
302+
{
303+
"op": "copy",
304+
"from": "/reference/elementHiding/settings/rules",
305+
"path": "/settings"
306+
}
307+
],
308+
"settings": {}
301309
},
302310
"gpc": {
303311
"state": "enabled"

overrides/windows-override.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,15 @@
174174
}
175175
},
176176
"elementHiding": {
177-
"state": "enabled"
177+
"state": "enabled",
178+
"patchFeature": [
179+
{
180+
"op": "copy",
181+
"from": "/reference/elementHiding/settings/rules",
182+
"path": "/settings"
183+
}
184+
],
185+
"settings": {}
178186
},
179187
"fingerprintingScreenSize": {
180188
"state": "disabled",

0 commit comments

Comments
 (0)