mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
Further fine-tune new Support pane
Related commit:
- a3a43c7cb4
Specifically:
- Support i18n
- Autofill issues opened through Support pane with configuration
information
- Remove from About pane items found in Support pane
This commit is contained in:
parent
2c7fcf7284
commit
730735cc5e
@ -851,6 +851,72 @@
|
||||
"message": "Markdown",
|
||||
"description": "Label for radio-button to pick export text format"
|
||||
},
|
||||
|
||||
"supportOpenButton": {
|
||||
"message": "Open",
|
||||
"description": "Text for button which open an external webpage in Support pane"
|
||||
},
|
||||
"supportS1H": {
|
||||
"message": "Documentation",
|
||||
"description": "Header of 'Documentation' section in Support pane"
|
||||
},
|
||||
"supportS1P1": {
|
||||
"message": "Read the documentation at <code>uBlock/wiki</code> to learn about all of uBlock Origin's features.",
|
||||
"description": "First paragraph of 'Documentation' section in Support pane"
|
||||
},
|
||||
"supportS2H": {
|
||||
"message": "Questions and support",
|
||||
"description": "Header of 'Questions and support' section in Support pane"
|
||||
},
|
||||
"supportS2P1": {
|
||||
"message": "Answers to questions and other kinds of help support is provided on the subreddit <code>/r/uBlockOrigin</code>.",
|
||||
"description": "First paragraph of 'Questions and support' section in Support pane"
|
||||
},
|
||||
"supportS3H": {
|
||||
"message": "Filter issues/website is broken",
|
||||
"description": "Header of 'Filter issues' section in Support pane"
|
||||
},
|
||||
"supportS3P1": {
|
||||
"message": "Report filter issues with specific websites to <span data-url=\"https://github.com/uBlockOrigin/uAssets/issues?q=is%3Aissue\"><code>uBlockOrigin/uAssets</code> issue tracker</span>. Requires a GitHub account.",
|
||||
"description": "First paragraph of 'Filter issues' section in Support pane"
|
||||
},
|
||||
"supportS3P2": {
|
||||
"message": "<b>Important:</b> Avoid using other similarly-purposed blockers along with uBlock Origin, as this may cause filter issues on specific websites.",
|
||||
"description": "Second paragraph of 'Filter issues' section in Support pane"
|
||||
},
|
||||
"supportS3P3": {
|
||||
"message": "<b>Tips:</b> Be sure your filter lists are up to date. <span data-url=\"logger-ui.html#_\">The logger</span> is the primary tool to diagnose filter-related issues.",
|
||||
"description": "Third paragraph of 'Filter issues' section in Support pane"
|
||||
},
|
||||
"supportS4H": {
|
||||
"message": "Bug report",
|
||||
"description": "Header of 'Bug report' section in Support pane"
|
||||
},
|
||||
"supportS4P1": {
|
||||
"message": "Report issues with uBlock Origin itself to <span data-url=\"https://github.com/uBlockOrigin/uBlock-issues/issues?q=is%3Aissue\"><code>uBlockOrigin/uBlock-issue</code> issue tracker</span>. Requires a GitHub account.",
|
||||
"description": "First paragraph of 'Bug report' section in Support pane"
|
||||
},
|
||||
"supportS5H": {
|
||||
"message": "Troubleshooting Information",
|
||||
"description": "Header of 'Troubleshooting Information' section in Support pane"
|
||||
},
|
||||
"supportS5P1": {
|
||||
"message": "Below is technical information that might be useful when volunteers are trying to help you solve a problem.",
|
||||
"description": "First paragraph of 'Troubleshooting Information' section in Support pane"
|
||||
},
|
||||
"supportS5P2": {
|
||||
"message": "<b>Important:</b> Potentially private or sensitive information is redacted by default. Redacted information may make it more difficult to solve a problem.",
|
||||
"description": "Second paragraph of 'Troubleshooting Information' section in Support pane"
|
||||
},
|
||||
"supportRedact": {
|
||||
"message": "Redact",
|
||||
"description": "Text for 'Redact' button"
|
||||
},
|
||||
"supportUnredact": {
|
||||
"message": "Unredact",
|
||||
"description": "Text for 'Unredact' button"
|
||||
},
|
||||
|
||||
"aboutPrivacyPolicy": {
|
||||
"message": "Privacy policy",
|
||||
"description": "Link to privacy policy on GitHub (English)"
|
||||
@ -859,18 +925,6 @@
|
||||
"message": "Changelog",
|
||||
"description": ""
|
||||
},
|
||||
"aboutWiki": {
|
||||
"message": "Wiki",
|
||||
"description": "English: project' wiki on GitHub"
|
||||
},
|
||||
"aboutSupport": {
|
||||
"message": "Support",
|
||||
"description": "A link for where to get support"
|
||||
},
|
||||
"aboutIssues": {
|
||||
"message": "Issue tracker",
|
||||
"description": "Text for a link to official issue tracker"
|
||||
},
|
||||
"aboutCode": {
|
||||
"message": "Source code (GPLv3)",
|
||||
"description": "English: Source code (GPLv3)"
|
||||
@ -1079,6 +1133,10 @@
|
||||
"message": "Copy to clipboard",
|
||||
"description": "Label for buttons used to copy something to the clipboard"
|
||||
},
|
||||
"genericSelectAll": {
|
||||
"message": "Select all",
|
||||
"description": "Label for buttons used to select all text in editor"
|
||||
},
|
||||
"toggleBlockingProfile": {
|
||||
"message": "Toggle blocking profile",
|
||||
"description": "Label for keyboard shortcut used to toggle blocking profile"
|
||||
|
@ -19,12 +19,6 @@
|
||||
</div>
|
||||
<div class="li"><a href="https://github.com/gorhill/uBlock/wiki/Privacy-policy" data-i18n="aboutPrivacyPolicy"></a></div>
|
||||
<div class="li"><a href="https://github.com/gorhill/uBlock/releases" data-i18n="aboutChangelog"></a></div>
|
||||
<div class="li"><a href="https://github.com/gorhill/uBlock/wiki" data-i18n="aboutWiki"></a></div>
|
||||
<div class="li"><a href="https://old.reddit.com/r/uBlockOrigin/" data-i18n="aboutSupport"></a></div>
|
||||
<div class="liul">
|
||||
<div class="li"><a href="logger-ui.html" data-i18n="popupTipLog"></a></div>
|
||||
</div>
|
||||
<div class="li"><a href="https://github.com/uBlockOrigin/uBlock-issues/issues" data-i18n="aboutIssues"></a></div>
|
||||
<div class="li"><a href="https://github.com/gorhill/uBlock" data-i18n="aboutCode"></a></div>
|
||||
<div class="li"><span data-i18n="aboutContributors"></span></div>
|
||||
<div class="liul">
|
||||
|
@ -21,6 +21,10 @@ button {
|
||||
margin-inline-end: 1em;
|
||||
-webkit-margin-end: 1em;
|
||||
}
|
||||
span[data-url] {
|
||||
color: var(--link-ink);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
body.redacted #redactButton {
|
||||
display: none;
|
||||
|
@ -26,13 +26,6 @@
|
||||
/******************************************************************************/
|
||||
|
||||
(async ( ) => {
|
||||
document.querySelector(
|
||||
'[href="logger-ui.html"]'
|
||||
).addEventListener(
|
||||
'click',
|
||||
self.uBlockDashboard.openOrSelectPage
|
||||
);
|
||||
|
||||
const appData = await vAPI.messaging.send('dashboard', {
|
||||
what: 'getAppData',
|
||||
});
|
||||
|
@ -1230,23 +1230,15 @@ const getSupportData = async function() {
|
||||
}
|
||||
};
|
||||
|
||||
let modifiedUserSettings = µb.getModifiedSettings(
|
||||
const modifiedUserSettings = µb.getModifiedSettings(
|
||||
µb.userSettings,
|
||||
µb.userSettingsDefault
|
||||
);
|
||||
delete modifiedUserSettings.externalLists;
|
||||
delete modifiedUserSettings.importedLists;
|
||||
if ( Object.keys(modifiedUserSettings).length === 0 ) {
|
||||
modifiedUserSettings = 'none';
|
||||
}
|
||||
|
||||
let modifiedHiddenSettings = µb.getModifiedSettings(
|
||||
const modifiedHiddenSettings = µb.getModifiedSettings(
|
||||
µb.hiddenSettings,
|
||||
µb.hiddenSettingsDefault
|
||||
);
|
||||
if ( Object.keys(modifiedHiddenSettings).length === 0 ) {
|
||||
modifiedHiddenSettings = 'none';
|
||||
}
|
||||
|
||||
let filterset = [];
|
||||
const userFilters = await µb.loadUserFilters();
|
||||
@ -1254,9 +1246,6 @@ const getSupportData = async function() {
|
||||
if ( /^($|![^#])/.test(line) ) { continue; }
|
||||
filterset.push(line);
|
||||
}
|
||||
if ( filterset.length === 0 ) {
|
||||
filterset = undefined;
|
||||
}
|
||||
|
||||
const lists = µb.availableFilterLists;
|
||||
let defaultListset = {};
|
||||
@ -1317,23 +1306,23 @@ const getSupportData = async function() {
|
||||
modifiedUserSettings,
|
||||
modifiedHiddenSettings,
|
||||
listset: {
|
||||
'default': defaultListset,
|
||||
added: addedListset,
|
||||
removed: removedListset,
|
||||
added: addedListset,
|
||||
default: defaultListset,
|
||||
},
|
||||
filterset,
|
||||
trustedset: diffArrays(
|
||||
µb.arrayFromWhitelist(µb.netWhitelist),
|
||||
µb.netWhitelistDefault
|
||||
),
|
||||
hostRuleset: diffArrays(
|
||||
sessionFirewall.toArray(),
|
||||
µb.dynamicFilteringDefault
|
||||
),
|
||||
filterset,
|
||||
switchRuleset: diffArrays(
|
||||
sessionSwitches.toArray(),
|
||||
µb.hostnameSwitchesDefault
|
||||
),
|
||||
hostRuleset: diffArrays(
|
||||
sessionFirewall.toArray(),
|
||||
µb.dynamicFilteringDefault
|
||||
),
|
||||
urlRuleset: diffArrays(
|
||||
sessionURLFiltering.toArray(),
|
||||
[]
|
||||
|
@ -27,8 +27,15 @@
|
||||
|
||||
let supportData;
|
||||
|
||||
const uselessKeys = [
|
||||
'modifiedUserSettings.popupPanelSections',
|
||||
'modifiedUserSettings.externalLists',
|
||||
'modifiedUserSettings.importedLists',
|
||||
];
|
||||
|
||||
const sensitiveValues = [
|
||||
'filterset',
|
||||
'modifiedUserSettings.popupPanelSections',
|
||||
'modifiedHiddenSettings.userResourcesLocation',
|
||||
'trustedset.added',
|
||||
'hostRuleset.added',
|
||||
@ -42,6 +49,16 @@ const sensitiveKeys = [
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
function removeKey(data, prop) {
|
||||
if ( data instanceof Object === false ) { return; }
|
||||
const pos = prop.indexOf('.');
|
||||
if ( pos !== -1 ) {
|
||||
const key = prop.slice(0, pos);
|
||||
return removeKey(data[key], prop.slice(pos + 1));
|
||||
}
|
||||
delete data[prop];
|
||||
}
|
||||
|
||||
function redactValue(data, prop) {
|
||||
if ( data instanceof Object === false ) { return; }
|
||||
const pos = prop.indexOf('.');
|
||||
@ -51,7 +68,11 @@ function redactValue(data, prop) {
|
||||
let value = data[prop];
|
||||
if ( value === undefined ) { return; }
|
||||
if ( Array.isArray(value) ) {
|
||||
if ( value.length !== 0 ) {
|
||||
value = `[array of ${value.length} redacted]`;
|
||||
} else {
|
||||
value = '[empty]';
|
||||
}
|
||||
} else {
|
||||
value = '[redacted]';
|
||||
}
|
||||
@ -76,14 +97,39 @@ function redactKeys(data, prop) {
|
||||
}
|
||||
}
|
||||
|
||||
function patchEmptiness(data, prop) {
|
||||
const entry = data[prop];
|
||||
if ( Array.isArray(entry) && entry.length === 0 ) {
|
||||
data[prop] = '[empty]';
|
||||
return;
|
||||
}
|
||||
if ( entry instanceof Object === false ) { return; }
|
||||
if ( Object.keys(entry).length === 0 ) {
|
||||
data[prop] = '[none]';
|
||||
return;
|
||||
}
|
||||
for ( const key in entry ) {
|
||||
patchEmptiness(entry, key);
|
||||
}
|
||||
}
|
||||
|
||||
function addDetailsToReportURL(id) {
|
||||
const text = cmEditor.getValue();
|
||||
const elem = uDom.nodeFromId(id);
|
||||
const url = new URL(elem.getAttribute('data-url'));
|
||||
url.searchParams.set('configuration', `<details>\n\n${text}\n</details>`);
|
||||
elem.setAttribute('data-url', url);
|
||||
}
|
||||
|
||||
function showData() {
|
||||
const shownData = JSON.parse(JSON.stringify(supportData));
|
||||
uselessKeys.forEach(prop => { removeKey(shownData, prop); });
|
||||
if ( document.body.classList.contains('redacted') ) {
|
||||
sensitiveValues.forEach(prop => { redactValue(shownData, prop); });
|
||||
sensitiveKeys.forEach(prop => { redactKeys(shownData, prop); });
|
||||
|
||||
// Redact list entries which could be hosted locally
|
||||
|
||||
}
|
||||
for ( const prop in shownData ) {
|
||||
patchEmptiness(shownData, prop);
|
||||
}
|
||||
const text = JSON.stringify(shownData, null, 2)
|
||||
.split('\n')
|
||||
@ -95,9 +141,13 @@ function showData() {
|
||||
.replace( /(?:"|"|\}|\]),?$/, '');
|
||||
})
|
||||
.filter(v => v.trim() !== '')
|
||||
.join('\n');
|
||||
cmEditor.setValue(text + '\n');
|
||||
.join('\n') + '\n';
|
||||
|
||||
cmEditor.setValue(text);
|
||||
cmEditor.clearHistory();
|
||||
|
||||
addDetailsToReportURL('filterReport');
|
||||
addDetailsToReportURL('bugReport');
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
@ -126,11 +176,12 @@ uBlockDashboard.patchCodeMirrorEditor(cmEditor);
|
||||
showData();
|
||||
|
||||
uDom('[data-url]').on('click', ev => {
|
||||
const url = ev.target.getAttribute('data-url');
|
||||
const elem = ev.target.closest('[data-url]');
|
||||
const url = elem.getAttribute('data-url');
|
||||
if ( typeof url !== 'string' || url === '' ) { return; }
|
||||
vAPI.messaging.send('default', {
|
||||
what: 'gotoURL',
|
||||
details: { url, select: true },
|
||||
details: { url, select: true, index: -1 },
|
||||
});
|
||||
ev.preventDefault();
|
||||
});
|
||||
|
@ -19,49 +19,50 @@
|
||||
<div class="body">
|
||||
<div class="supportEntry">
|
||||
<div>
|
||||
<h3>Documentation</h3>
|
||||
<p>Read the documentation to learn more about all of uBlock Origin's features.
|
||||
<h3 data-i18n="supportS1H"></h3>
|
||||
<p data-i18n="supportS1P1">
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" data-url="https://github.com/gorhill/uBlock/wiki">Open</button>
|
||||
<button type="button" data-url="https://github.com/gorhill/uBlock/wiki" data-i18n="supportOpenButton"></button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="supportEntry">
|
||||
<div>
|
||||
<h3>Questions and support</h3>
|
||||
<p>Answers to questions and other kinds of help support is provided on the subreddit /r/uBlockOrigin.
|
||||
<h3 data-i18n="supportS2H"></h3>
|
||||
<p data-i18n="supportS2P1">
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" data-url="https://old.reddit.com/r/uBlockOrigin/">Open</button>
|
||||
<button type="button" data-url="https://old.reddit.com/r/uBlockOrigin/" data-i18n="supportOpenButton"></button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="supportEntry">
|
||||
<div>
|
||||
<h3>Filter issues/website is broken</h3>
|
||||
<p>Report any issues with specific websites to uAssets issue tracker.
|
||||
<p><b>Important:</b> Avoid using other similarly-purposed blockers along with uBlock Origin, as this may cause filter issues on specific websites.
|
||||
<p><b>Tip:</b> <a href="#" data-url="logger-ui.html">The logger</a> is the primary tool to diagnose filter-related issues.
|
||||
<h3 data-i18n="supportS3H"></h3>
|
||||
<p data-i18n="supportS3P1">
|
||||
<p data-i18n="supportS3P2">
|
||||
<p data-i18n="supportS3P3">
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" data-url="https://github.com/uBlockOrigin/uAssets/issues">Open</button>
|
||||
<button id="filterReport" type="button" data-url="https://github.com/uBlockOrigin/uAssets/issues/new?template=bug_report_from_ubo.yml" data-i18n="supportOpenButton"></button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="supportEntry">
|
||||
<div>
|
||||
<h3>Bug report</h3>
|
||||
<p>File a bug report.
|
||||
<h3 data-i18n="supportS4H"></h3>
|
||||
<p data-i18n="supportS4P1">
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" data-url="https://github.com/uBlockOrigin/uBlock-issues/issues/new?template=bug_report.yml">Open</button>
|
||||
<button id="bugReport" type="button" data-url="https://github.com/uBlockOrigin/uBlock-issues/issues/new?template=bug_report_from_ubo.yml" data-i18n="supportOpenButton"></button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<h3>Troubleshooting Information</h3>
|
||||
<p>Below is technical information that might be useful when volunteers are trying to help you solve a problem. <p><b>Important:</b> You may want to redact private or sensitive information before posting to a public forum. Redacted information may make it more difficult to solve a problem. The information is redacted by default.
|
||||
<p><button id="redactButton" type="button">Redact</button><button id="unredactButton" type="button">Unredact</button><button id="selectAllButton" type="button">Select all</button>
|
||||
<h3 data-i18n="supportS5H"></h3>
|
||||
<p data-i18n="supportS5P1">
|
||||
<p data-i18n="supportS5P2">
|
||||
<p><button id="redactButton" type="button" data-i18n="supportRedact"></button><button id="unredactButton" type="button" data-i18n="supportUnredact"></button><button id="selectAllButton" type="button" data-i18n="genericSelectAll"></button>
|
||||
<div id="supportData" class="codeMirrorContainer"></div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user