Skip to content

Commit 5e9737d

Browse files
committed
[mv3] Allow copy/paste troubleshooting info
1 parent d0c0283 commit 5e9737d

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

platform/mv3/extension/js/report.js

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,30 @@ function renderData(data, depth = 0) {
9191

9292
/******************************************************************************/
9393

94+
async function getConfigData() {
95+
const manifest = runtime.getManifest();
96+
const [
97+
rulesets,
98+
defaultMode,
99+
] = await Promise.all([
100+
dnr.getEnabledRulesets(),
101+
sendMessage({ what: 'getDefaultFilteringMode' }),
102+
]);
103+
const modes = [ 'no filtering', 'basic', 'optimal', 'complete' ];
104+
const config = {
105+
name: manifest.name,
106+
version: manifest.version,
107+
filtering: {
108+
'site': `${modes[reportedPage.mode]}`,
109+
'default': `${modes[defaultMode]}`,
110+
},
111+
rulesets,
112+
};
113+
return renderData(config);
114+
}
115+
116+
/******************************************************************************/
117+
94118
async function reportSpecificFilterIssue() {
95119
const githubURL = new URL(
96120
'https://github.com/uBlockOrigin/uAssets/issues/new?template=specific_report_from_ubol.yml'
@@ -107,22 +131,9 @@ async function reportSpecificFilterIssue() {
107131
);
108132
githubURL.searchParams.set('category', issueType);
109133

110-
const manifest = runtime.getManifest();
111-
const rulesets = await dnr.getEnabledRulesets();
112-
const defaultMode = await sendMessage({ what: 'getDefaultFilteringMode' });
113-
const modes = [ 'no filtering', 'basic', 'optimal', 'complete' ];
114-
const config = {
115-
name: manifest.name,
116-
version: manifest.version,
117-
filtering: {
118-
'site': `${modes[reportedPage.mode]}`,
119-
'default': `${modes[defaultMode]}`,
120-
},
121-
rulesets,
122-
};
123134
const configBody = [
124135
'```yaml',
125-
renderData(config),
136+
qs$('[data-i18n="supportS5H"] + pre').textContent,
126137
'```',
127138
'',
128139
].join('\n');
@@ -132,7 +143,9 @@ async function reportSpecificFilterIssue() {
132143

133144
/******************************************************************************/
134145

135-
(async ( ) => {
146+
getConfigData().then(config => {
147+
qs$('[data-i18n="supportS5H"] + pre').textContent = config;
148+
136149
dom.on('[data-url]', 'click', ev => {
137150
const elem = ev.target.closest('[data-url]');
138151
const url = dom.attr(elem, 'data-url');
@@ -154,5 +167,4 @@ async function reportSpecificFilterIssue() {
154167
ev.preventDefault();
155168
});
156169
}
157-
158-
})();
170+
});

platform/mv3/extension/report.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<section>
1818

19-
<h3 data-i18n="supportS6H"></h3>
19+
<h2 data-i18n="supportS6H"></h2>
2020
<p data-i18n="supportS3P1"></p>
2121
<div class="supportEntry">
2222
<hr>
@@ -49,6 +49,12 @@ <h3 data-i18n="supportS6H"></h3>
4949
</p>
5050
<button type="button" data-i18n="supportReportSpecificButton" class="preferred">_<span class="hover"></span></button>
5151
</div>
52+
<div style="font-size: smaller;">
53+
<hr>
54+
<details><summary data-i18n="supportS5H"></summary>
55+
<pre style="user-select: all;"></pre>
56+
</details>
57+
</div>
5258

5359
</section>
5460

0 commit comments

Comments
 (0)