@whotracksme/reporting 7.5.0 → 7.7.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,27 @@
1
+ # v7.7.0 (Tue Aug 26 2025)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - "alive" signal: distinguish Brave from Chrome [#165](https://github.com/whotracksme/webextension-packages/pull/165) ([@philipp-classen](https://github.com/philipp-classen))
6
+
7
+ #### Authors: 1
8
+
9
+ - Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
10
+
11
+ ---
12
+
13
+ # v7.6.0 (Tue Aug 26 2025)
14
+
15
+ #### 🚀 Enhancement
16
+
17
+ - Mitigate midnight spike of anti-tracking signals [#166](https://github.com/whotracksme/webextension-packages/pull/166) ([@philipp-classen](https://github.com/philipp-classen))
18
+
19
+ #### Authors: 1
20
+
21
+ - Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
22
+
23
+ ---
24
+
1
25
  # v7.5.0 (Tue Jul 29 2025)
2
26
 
3
27
  #### 🚀 Enhancement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whotracksme/reporting",
3
- "version": "7.5.0",
3
+ "version": "7.7.0",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "scripts": {
@@ -10,7 +10,7 @@
10
10
  */
11
11
 
12
12
  import logger from './logger';
13
- import { requireParam, requireString } from './utils';
13
+ import { requireParam, requireString, lazyInitAsync } from './utils';
14
14
  import Bowser from 'bowser';
15
15
 
16
16
  /**
@@ -30,16 +30,14 @@ export default class AliveMessageGenerator {
30
30
  this.storage = requireParam(storage);
31
31
  this.storageKey = requireString(storageKey);
32
32
  this.navigatorApi = navigatorApi || globalThis.navigator;
33
- }
34
-
35
- get staticConfig() {
36
- this._staticConfig ||= this._generateBaseConfig();
37
- return this._staticConfig;
33
+ this.staticConfigProvider = lazyInitAsync(
34
+ this._generateBaseConfig.bind(this),
35
+ );
38
36
  }
39
37
 
40
38
  async generateMessage(ctry, hour) {
41
39
  const config = {
42
- ...this.staticConfig,
40
+ ...(await this.staticConfigProvider()),
43
41
  ctry,
44
42
  };
45
43
 
@@ -74,12 +72,19 @@ export default class AliveMessageGenerator {
74
72
  };
75
73
  }
76
74
 
77
- _generateBaseConfig() {
75
+ async _generateBaseConfig() {
78
76
  let browser, version, os, platform, engine;
79
77
  const { language, userAgent } = this.navigatorApi;
80
78
  if (userAgent) {
81
79
  const browserInfo = Bowser.parse(userAgent);
82
80
  browser = browserInfo.browser?.name;
81
+ if (browser === 'Chrome' && (await this._looksLikeBrave())) {
82
+ logger.debug(
83
+ 'Chrome user agent detected, but the API says it is Brave',
84
+ );
85
+ browser = 'Chrome (Brave)';
86
+ }
87
+
83
88
  os = browserInfo.os?.name;
84
89
  platform = browserInfo.platform?.type;
85
90
  engine = browserInfo.engine?.name;
@@ -143,4 +148,14 @@ export default class AliveMessageGenerator {
143
148
  _deterministicStringify(obj) {
144
149
  return JSON.stringify(Object.fromEntries(Object.entries(obj).sort()));
145
150
  }
151
+
152
+ async _looksLikeBrave() {
153
+ try {
154
+ return !!(
155
+ this.navigatorApi.brave && (await this.navigatorApi.brave.isBrave())
156
+ );
157
+ } catch (e) {
158
+ return false;
159
+ }
160
+ }
146
161
  }
@@ -26,13 +26,13 @@ export default class AttrackMessageHandler {
26
26
 
27
27
  this._configOverride = {
28
28
  'wtm.attrack.tokensv2': {
29
- readyIn: { min: 2 * SECOND, max: 4 * HOUR },
29
+ readyIn: { min: 13 * MINUTE, max: 4 * HOUR },
30
30
  },
31
31
  'wtm.attrack.keysv2': {
32
- readyIn: { min: 2 * SECOND, max: 4 * HOUR },
32
+ readyIn: { min: 19 * MINUTE, max: 4 * HOUR },
33
33
  },
34
34
  'wtm.attrack.tp_events': {
35
- readyIn: { min: 2 * SECOND, max: 30 * MINUTE },
35
+ readyIn: { min: 23 * MINUTE, max: 2 * HOUR },
36
36
  },
37
37
  };
38
38
 
@@ -47,7 +47,7 @@ export default class AttrackMessageHandler {
47
47
  },
48
48
  {
49
49
  priority: -1000,
50
- cooldownInMs: 1 * SECOND,
50
+ cooldownInMs: 2 * SECOND,
51
51
  maxJobsTotal: 500,
52
52
  ttlInMs: 14 * DAY,
53
53
  },
@@ -162,6 +162,30 @@ describe('#AliveMessageGenerator', function () {
162
162
  t: '2024010203',
163
163
  });
164
164
  });
165
+
166
+ it('should detect Brave', async function () {
167
+ // Brave uses the Chrome user agent, but extended the navigator API to detect it
168
+ navigatorApi.userAgent =
169
+ 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36';
170
+ navigatorApi.language = 'de-DE';
171
+ navigatorApi.brave = {
172
+ async isBrave() {
173
+ return true;
174
+ },
175
+ };
176
+
177
+ const message = await uut.generateMessage('de', '2025082113');
178
+ expect(message).to.eql({
179
+ browser: 'Chrome (Brave)',
180
+ version: '139', // Chrome major version (though taken from Brave 1.81.136)
181
+ os: 'Linux',
182
+ platform: 'desktop',
183
+ engine: 'Blink',
184
+ language: 'de-DE', // from window.navigator
185
+ ctry: 'de',
186
+ t: '2025082113',
187
+ });
188
+ });
165
189
  });
166
190
 
167
191
  describe('if quorum is not reached', function () {