Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add TrackerDB Utilities category #1892

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 3 additions & 26 deletions extension-manifest-v3/src/utils/trackerdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0
*/
import { sortCategories } from '@ghostery/ui/categories';

import * as engines from './engines.js';
import asyncSetup from './setup.js';

// TODO: remove after sunsetting Ghostery 8
// This code is a duplicate of '@ghostery/ui/categories'
// It's a walkaround to deal with WebPack problems with import.meta in @ghostery/ui when using type=module
const categoryOrder = [
'advertising',
'site_analytics',
'consent',
'essential',
'hosting',
'customer_interaction',
'audio_video_player',
'cdn',
'comments',
'email',
'extensions',
'misc',
'pornvertising',
'social_media',
'telemetry',
'unidentified',
'other',
];

export const setup = asyncSetup([engines.init(engines.TRACKERDB_ENGINE)]);

export function getUnidentifiedTracker(hostname) {
Expand Down Expand Up @@ -159,7 +138,5 @@ export async function getCategories() {

return [...categories.values()]
.filter((c) => c.trackers.length > 0)
.sort(
(a, b) => categoryOrder.indexOf(a.key) - categoryOrder.indexOf(b.key),
);
.sort(sortCategories((c) => c.key));
}
5 changes: 5 additions & 0 deletions packages/ui/src/modules/global/components/icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/ui/src/utils/categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const colors = {
site_analytics: '#5EBEDB',
consent: '#556FCD',
essential: '#FC9734',
utilities: '#FC9734',
hosting: '#8459A5',
customer_interaction: '#EF671E',
unidentified: '#79859E',
Expand All @@ -40,6 +41,7 @@ export const order = [
'site_analytics',
'consent',
'essential',
Copy link
Member

@chrmod chrmod Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we remove essential ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep it for two reasons:

  • When the extension independently gets rolled out on different platforms, there will be still TrackerDB with "essential" (because updating TrackerDB before will reintroduce the production problem from last time)
  • TrackerPreview will update independently with a delay as well (coupled to the monthly WhoTracks.me data release)

In other words, the clients needs to support utilities, but remain backward compatible to the current TrackerDB state until the changes fully propagated through the system and all platforms are running with the latest extension code.

'utilities',
'hosting',
'customer_interaction',
'audio_video_player',
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/utils/labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const categories = {
site_analytics: msg`Site Analytics | Tracker category name`,
consent: msg`Consent Management | Tracker category name - includes trackers used for cookie consent management, allowing websites different levels of tracking user activity`,
essential: msg`Essential | Tracker category name`,
utilities: msg`Utilities | Tracker category name`,
hosting: msg`Hosting | Tracker category name`,
customer_interaction: msg`Customer Interaction | Tracker category name`,
unidentified: msg`Unidentified | Tracker category name`,
Expand Down
Loading