Add "toOverwrite.filters" entry as managed storage property

The new entry is an array of strings, each representing a
distinct line, and all entries are used to populate the
"My filters" pane.

This offers an more straightforward way for administrators
to specify a list of custom filters to use for all
installations.
This commit is contained in:
Raymond Hill 2021-01-10 12:31:31 -05:00
parent 055f37d765
commit 649b3480e0
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 12 additions and 1 deletions

View File

@ -41,6 +41,12 @@
"title": "Settings to overwrite at launch time",
"type": "object",
"properties": {
"filters": {
"title": "A collection of filters",
"description": "The set of user filters to use at launch time -- where each entry is a distinct line.",
"type": "array",
"items": { "type": "string" }
},
"filterLists": {
"title": "A collection of list identifiers and/or list URLs",
"description": "The set of filter lists to use at launch time.",

View File

@ -1387,7 +1387,12 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
vAPI.storage.set(bin);
}
if ( typeof data.userFilters === 'string' ) {
if (
Array.isArray(toOverwrite.filters) &&
toOverwrite.filters.length !== 0
) {
this.saveUserFilters(toOverwrite.filters.join('\n'));
} else if ( typeof data.userFilters === 'string' ) {
this.saveUserFilters(data.userFilters);
}
};