@whotracksme/reporting 6.2.0 β†’ 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ # v6.3.0 (Wed Jan 29 2025)
2
+
3
+ #### πŸš€ Enhancement
4
+
5
+ - URL analyzer tweak [#154](https://github.com/whotracksme/webextension-packages/pull/154) ([@philipp-classen](https://github.com/philipp-classen))
6
+
7
+ #### πŸ› Bug Fix
8
+
9
+ - Request: fix unload [#153](https://github.com/whotracksme/webextension-packages/pull/153) ([@chrmod](https://github.com/chrmod))
10
+
11
+ #### Authors: 2
12
+
13
+ - Krzysztof Modras ([@chrmod](https://github.com/chrmod))
14
+ - Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
15
+
16
+ ---
17
+
1
18
  # v6.2.0 (Sun Jan 19 2025)
2
19
 
3
20
  #### πŸš€ Enhancement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whotracksme/reporting",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "scripts": {
@@ -336,7 +336,7 @@ export function lookupBuiltinTransform(name) {
336
336
  * to disable clients that do not meet the minimum requirements of the
337
337
  * current patterns.
338
338
  */
339
- const PATTERN_DSL_VERSION = 4;
339
+ const PATTERN_DSL_VERSION = 5;
340
340
 
341
341
  /**
342
342
  * "Magic" empty rule set, which exists only if patterns were loaded, but
@@ -251,9 +251,9 @@ export default class RequestReporter {
251
251
 
252
252
  unload() {
253
253
  this.ready = false;
254
- if (this.qs_whitelist) {
255
- this.qs_whitelist.destroy();
256
- }
254
+
255
+ this.config.unload();
256
+
257
257
  if (this.cookieContext) {
258
258
  this.cookieContext.unload();
259
259
  }
@@ -72,8 +72,11 @@ const URL_PATTERNS = [
72
72
  {
73
73
  category: 'search-dd',
74
74
  regexp:
75
- /^https:[/][/]duckduckgo[.]com[/](?:html$|.*[?&]q=[^&]+.*&ia=web|[?]q=[^&]+$)/,
76
- prefix: '?q=',
75
+ /^https:[/][/](?:html[.])?duckduckgo[.]com[/].*([?&]q=[^&]+.*&ia=web|[?]q=[^&]+$)/,
76
+ prefix: 'html?q=',
77
+ doublefetchHost() {
78
+ return 'html.duckduckgo.com';
79
+ },
77
80
  },
78
81
  {
79
82
  category: 'search-gh',
@@ -130,6 +133,7 @@ export default class UrlAnalyzer {
130
133
  regexp,
131
134
  prefix,
132
135
  queryFinder = (parsedUrl) => parsedUrl.searchParams.get('q'),
136
+ doublefetchHost = (parsedUrl) => parsedUrl.host,
133
137
  } of this._urlPatterns) {
134
138
  if (regexp.test(url)) {
135
139
  // Workaround for an encoding issue (source: https://stackoverflow.com/a/24417399/783510).
@@ -144,7 +148,8 @@ export default class UrlAnalyzer {
144
148
  return { isSupported: false };
145
149
  }
146
150
  const query_ = encodeURIComponent(query).replaceAll('%20', '+');
147
- const doublefetchUrl = `https://${parsedUrl.host}/${prefix}${query_}`;
151
+ const host_ = doublefetchHost(parsedUrl);
152
+ const doublefetchUrl = `https://${host_}/${prefix}${query_}`;
148
153
  const doublefetchRequest = this.patterns.createDoublefetchRequest(
149
154
  category,
150
155
  doublefetchUrl,
@@ -227,15 +227,23 @@ describe('#UrlAnalyzer', function () {
227
227
  'search-dd': {
228
228
  'https://duckduckgo.com/?q=eiffel+tower&t=h_&ia=web': {
229
229
  query: 'eiffel tower',
230
- doublefetchUrl: 'https://duckduckgo.com/?q=eiffel+tower',
230
+ doublefetchUrl: 'https://html.duckduckgo.com/html?q=eiffel+tower',
231
231
  },
232
232
  'https://duckduckgo.com/?t=ffab&q=eiffel+tower&ia=web': {
233
233
  query: 'eiffel tower',
234
- doublefetchUrl: 'https://duckduckgo.com/?q=eiffel+tower',
234
+ doublefetchUrl: 'https://html.duckduckgo.com/html?q=eiffel+tower',
235
235
  },
236
236
  'https://duckduckgo.com/?q=eiffel+tower': {
237
237
  query: 'eiffel tower',
238
- doublefetchUrl: 'https://duckduckgo.com/?q=eiffel+tower',
238
+ doublefetchUrl: 'https://html.duckduckgo.com/html?q=eiffel+tower',
239
+ },
240
+ 'https://duckduckgo.com/html?q=eiffel+tower': {
241
+ query: 'eiffel tower',
242
+ doublefetchUrl: 'https://html.duckduckgo.com/html?q=eiffel+tower',
243
+ },
244
+ 'https://html.duckduckgo.com/html?q=eiffel+tower': {
245
+ query: 'eiffel tower',
246
+ doublefetchUrl: 'https://html.duckduckgo.com/html?q=eiffel+tower',
239
247
  },
240
248
  },
241
249
  })) {