-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AG-25746: simplify work with constants in mv3 example
Merge in ADGUARD-FILTERS/tsurlfilter from feature/AG-25746 to master Squashed commit of the following: commit 605c937 Author: Dmitriy Seregin <[email protected]> Date: Mon Sep 11 13:46:45 2023 +0300 AG-25746: simplify work with constants in mv3 example
- Loading branch information
Showing
5 changed files
with
13 additions
and
47 deletions.
There are no files selected for viewing
41 changes: 4 additions & 37 deletions
41
packages/examples/tswebextension-mv3/extension/src/background/loadDefaultConfig.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,13 @@ | ||
import { Configuration } from '@adguard/tswebextension/mv3'; | ||
import { type Configuration } from '@adguard/tswebextension/mv3'; | ||
import { DEFAULT_EXTENSION_CONFIG } from '../../../scripts/constants'; | ||
|
||
/** | ||
* Return default configuration with loaded filters content | ||
* @param filtersDir directory with filters in txt format | ||
* @returns configuration | ||
*/ | ||
export const loadDefaultConfig = (): Configuration => { | ||
console.debug('[LOAD DEFAULT CONFIG]: start'); | ||
console.debug('[LOAD DEFAULT CONFIG]'); | ||
|
||
const defaultConfig: Configuration = { | ||
staticFiltersIds: [1, 2, 3, 4, 9, 14], | ||
customFilters: [], | ||
allowlist: [], | ||
trustedDomains: [], | ||
userrules: [], | ||
verbose: false, | ||
filtersPath: 'filters', | ||
ruleSetsPath: 'filters/declarative', | ||
filteringLogEnabled: false, | ||
settings: { | ||
assistantUrl: '', | ||
collectStats: true, | ||
allowlistInverted: false, | ||
allowlistEnabled: false, | ||
documentBlockingPageUrl: chrome.runtime.getURL('pages/document-blocking.html'), | ||
stealthModeEnabled: true, | ||
filteringEnabled: true, | ||
stealth: { | ||
blockChromeClientData: true, | ||
hideReferrer: true, | ||
hideSearchQueries: true, | ||
sendDoNotTrack: true, | ||
blockWebRTC: true, | ||
selfDestructThirdPartyCookies: true, | ||
selfDestructThirdPartyCookiesTime: 3600, | ||
selfDestructFirstPartyCookies: true, | ||
selfDestructFirstPartyCookiesTime: 3600, | ||
}, | ||
}, | ||
}; | ||
|
||
console.debug('[LOAD DEFAULT CONFIG]: end'); | ||
|
||
return defaultConfig; | ||
return DEFAULT_EXTENSION_CONFIG; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/examples/tswebextension-mv3/scripts/build/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import path from 'path'; | ||
|
||
export const BUILD_PATH = path.join(__dirname, '../build'); | ||
|
||
export const USER_DATA_PATH = path.join(__dirname, '../tmp'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters