Skip to content

Commit

Permalink
Move global unprotected temporary exceptions to selected features on …
Browse files Browse the repository at this point in the history
…build (#1297)

* Move global exceptions to selected features

* Delete sneaky space

* Make requested changes

* Make further requested changes
  • Loading branch information
laghee authored Sep 11, 2023
1 parent ab39324 commit fbeaea7
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const { OVERRIDE_DIR, GENERATED_DIR, LISTS_DIR, BROWSERS_SUBDIR, CURRENT_CONFIG_
const defaultConfig = {
readme: 'https://github.com/duckduckgo/privacy-configuration',
version: Date.now(),
features: {}
features: {},
unprotectedTemporary: []
}

const platforms = require('./platforms')
Expand Down Expand Up @@ -100,11 +101,30 @@ function addExceptionsToUnprotected (exceptions) {
}

const listData = JSON.parse(fs.readFileSync(`${LISTS_DIR}/${unprotectedListName}`))
defaultConfig.unprotectedTemporary = listData.exceptions

addExceptionsToUnprotected(defaultConfig.unprotectedTemporary)
addExceptionsToUnprotected(listData.exceptions)
addExceptionsToUnprotected(defaultConfig.features.contentBlocking.exceptions)

// Exclude selected features from the global unprotected-temporary.json domain exceptions
const excludedFeaturesFromUnprotectedTempExceptions = [
'adClickAttribution',
'appTrackerProtection',
'autofill',
'duckPlayer',
'incontextSignup',
'incrementalRolloutTest',
'networkProtection',
'newTabContinueSetUp',
'voiceSearch',
'windowsPermissionUsage',
'windowsWaitlist',
'windowsDownloadLink'
]
for (const key of Object.keys(defaultConfig.features)) {
if (!(excludedFeaturesFromUnprotectedTempExceptions.includes(key))) {
defaultConfig.features[key].exceptions = defaultConfig.features[key].exceptions.concat(listData.exceptions)
}
}

// Create generated directory
mkdirIfNeeded(GENERATED_DIR)

Expand Down

0 comments on commit fbeaea7

Please sign in to comment.