Further fine-tune configuration information in Support pane

This commit is contained in:
Raymond Hill 2021-11-14 08:13:43 -05:00
parent 4e81ae374f
commit 50436ced61
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 40 additions and 9 deletions

View File

@ -1302,16 +1302,18 @@ const getSupportData = async function() {
removedListset = undefined;
}
let browserFamily = (( ) => {
if ( vAPI.webextFlavor.soup.has('firefox') ) { return 'Firefox'; }
if ( vAPI.webextFlavor.soup.has('chromium') ) { return 'Chromium'; }
return 'Unknown';
})();
if ( vAPI.webextFlavor.soup.has('mobile') ) {
browserFamily += ' Mobile';
}
return {
browserFlavor: Array.from(vAPI.webextFlavor.soup).join(' '),
browserVersion: vAPI.webextFlavor.major,
extensionId: vAPI.webextFlavor.soup.has('firefox') === false
? vAPI.i18n('@@extension_id')
: undefined,
extensionName: vAPI.app.name,
extensionVersion: vAPI.app.version,
modifiedUserSettings,
modifiedHiddenSettings,
[`${vAPI.app.name}`]: `${vAPI.app.version}`,
[`${browserFamily}`]: `${vAPI.webextFlavor.major}`,
'filterset (summary)': {
network: staticNetFilteringEngine.getFilterCount(),
cosmetic: cosmeticFilteringEngine.getFilterCount(),
@ -1340,6 +1342,8 @@ const getSupportData = async function() {
sessionURLFiltering.toArray(),
[]
),
modifiedUserSettings,
modifiedHiddenSettings,
};
};

View File

@ -132,6 +132,33 @@ function showData() {
const shownData = JSON.parse(JSON.stringify(supportData));
uselessKeys.forEach(prop => { removeKey(shownData, prop); });
const redacted = document.body.classList.contains('redacted');
// If the report is for a specific site, report per-site switches which
// are triggered on the reported site.
if (
reportURL !== null &&
shownData.switchRuleset instanceof Object &&
Array.isArray(shownData.switchRuleset.added)
) {
const hostname = reportURL.hostname;
const added = [];
const triggered = [];
for ( const rule of shownData.switchRuleset.added ) {
const match = /^[^:]+:\s+(\S+)/.exec(rule);
if (
match[1] === '*' ||
hostname === match[1] ||
hostname.endsWith(`.${match[1]}`)
) {
triggered.push(rule);
} else {
added.push(rule);
}
}
if ( triggered.length !== 0 ) {
shownData.switchRuleset.triggered = triggered;
shownData.switchRuleset.added = added;
}
}
if ( redacted ) {
sensitiveValues.forEach(prop => { redactValue(shownData, prop); });
sensitiveKeys.forEach(prop => { redactKeys(shownData, prop); });