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

feat(whotracksme): WhoTracks.Me report page (WIP) #2276

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
7 changes: 7 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"hybrids": "^9.1.15",
"idb": "^8.0.2",
"jwt-decode": "^4.0.0",
"plotly.js-basic-dist": "^3.0.1",
"tldts-experimental": "^6.1.82"
},
"engineStrict": true,
Expand Down
3 changes: 2 additions & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const options = {
srcDir: resolve(pwd, 'src'),
outDir: resolve(pwd, 'dist'),
assets: ['_locales', 'icons', 'static_pages'],
pages: ['logger', 'onboarding', 'whotracksme'],
};

// Generate arguments from command line
Expand Down Expand Up @@ -307,7 +308,7 @@ if (manifest.declarative_net_request?.rule_resources) {

// --- Generate entry points ---

const source = ['pages/onboarding/index.html', 'pages/logger/index.html'];
const source = options.pages.map((page) => `pages/${page}/index.html`);
const content_scripts = [];

if (manifest.action?.default_popup) {
Expand Down
34 changes: 0 additions & 34 deletions src/background/external.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import { store } from 'hybrids';

import Session from '/store/session.js';
import { MergedStats } from '/store/daily-stats.js';

if (__PLATFORM__ === 'chromium' || __PLATFORM__ === 'firefox') {
// Listen for messages from Ghostery Search extension
Expand All @@ -23,8 +22,6 @@ if (__PLATFORM__ === 'chromium' || __PLATFORM__ === 'firefox') {
'search@ghostery.com', // Firefox
];

const GHOSTERY_NEW_TAB_EXTENSION_IDS = ['newtab@ghostery.com'];

chrome.runtime.onMessageExternal.addListener(
(message, sender, sendResponse) => {
// Refresh session support for Ghostery Search extension
Expand All @@ -43,37 +40,6 @@ if (__PLATFORM__ === 'chromium' || __PLATFORM__ === 'firefox') {
}
}

// Send historical stats to Ghostery New Tab extension
if (GHOSTERY_NEW_TAB_EXTENSION_IDS.includes(sender.id)) {
switch (message?.name) {
case 'getDashboardStats': {
(async () => {
const stats = await store.resolve(MergedStats);

// Firefox does not serialize correctly objects with getters
sendResponse(JSON.parse(JSON.stringify(stats)));
})();

return true;
}
case 'getUser': {
(async () => {
const session = await store.resolve(Session);

// Firefox does not serialize correctly objects with getters
sendResponse(session.user && JSON.parse(JSON.stringify(session)));
})();

return true;
}
default:
console.error(
`[external] Unknown message type from "${sender.id}"`,
message,
);
}
}

return false;
},
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/panel/components/menu-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { openTabWithUrl } from '/utils/tabs.js';
export default {
href: '',
icon: '',
suffixIcon: 'arrow-right',
suffixIcon: 'chevron-right',
internal: false,
render: ({ href, icon, suffixIcon, internal }) => html`
<template layout="block">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/panel/components/pause.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default {
${PAUSE_TYPES.find(({ value }) => value === pauseType)
.label}
</ui-text>
<ui-icon name="arrow-down"></ui-icon>
<ui-icon name="chevron-down"></ui-icon>
`}
</div>
</button>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/panel/views/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default {
>
${!options.managed &&
html`<ui-icon
name="arrow-down"
name="chevron-down"
layout="size:1.5"
color="secondary"
></ui-icon>`}
Expand Down Expand Up @@ -210,7 +210,7 @@ export default {
>
Report a broken page
<ui-icon
name="arrow-right"
name="chevron-right"
layout="size:1.5"
></ui-icon>
</ui-text>
Expand Down
11 changes: 8 additions & 3 deletions src/pages/settings/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,17 @@ export default {
display: block;
position: absolute;
top: 0;
left: -80px;
left: -40px;
bottom: 0;
width: 80px;
box-shadow: 0px 0px 80px var(--shadow-dialog);
width: 40px;
box-shadow: 0px 0px 60px var(--shadow-dialog);
pointer-events: none;
}

main ::slotted(*) {
position: relative;
z-index: 1;
}
}
`,
};
2 changes: 1 addition & 1 deletion src/pages/settings/components/trackers-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
>
<ui-icon
id="arrow"
name="arrow-down"
name="chevron-down"
layout="size:3"
color="secondary"
></ui-icon>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/components/wtm-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
<template layout="row items:center gap:2 padding:1.5:2">
<ui-icon name="wtm-logo" color=""></ui-icon>
<ui-text type="label-m" layout="grow"><slot></slot></ui-text>
<ui-icon name="arrow-right" color="primary"></ui-icon>
<ui-icon name="chevron-right" color="primary"></ui-icon>
</template>
`.css`
:host {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/views/custom-filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
layout="row gap:0.5"
>
Learn more on supported syntax
<ui-icon name="arrow-right-s"></ui-icon>
<ui-icon name="chevron-right-s"></ui-icon>
</a>
</ui-text>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/pages/settings/views/privacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export default {
>
Regional Filters
<ui-icon
name="arrow-right"
name="chevron-right"
color="inherit"
layout="size:2"
></ui-icon
Expand Down Expand Up @@ -241,7 +241,7 @@ export default {
>
Search Engine Redirect Protection
<ui-icon
name="arrow-right"
name="chevron-right"
color="inherit"
layout="size:2"
></ui-icon
Expand Down Expand Up @@ -272,7 +272,7 @@ export default {
>
Experimental Filters
<ui-icon
name="arrow-right"
name="chevron-right"
color="inherit"
layout="size:2"
></ui-icon
Expand Down Expand Up @@ -306,7 +306,7 @@ export default {
>
Custom Filters
<ui-icon
name="arrow-right"
name="chevron-right"
color="inherit"
layout="size:2"
></ui-icon
Expand Down
18 changes: 18 additions & 0 deletions src/pages/settings/views/whotracksme.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,24 @@ export default {
</div>
</ui-toggle>
`}

<ui-line></ui-line>
<div layout="row padding:left:15">
<ui-action>
<ui-text type="headline-xs">
<a
href="${chrome.runtime.getURL(
'/pages/whotracksme/index.html',
)}"
target="_blank"
layout="row items:center gap:0.5"
>
WhoTracks.Me Raport
<ui-icon name="chevron-right" layout="size:2"></ui-icon>
</a>
</ui-text>
</ui-action>
</div>
</section>
`}
</settings-page-layout>
Expand Down
45 changes: 45 additions & 0 deletions src/pages/whotracksme/components/button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Ghostery Browser Extension
* https://www.ghostery.com/
*
* Copyright 2017-present Ghostery GmbH. All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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 { html } from 'hybrids';

export default {
active: { value: false, reflect: true },
render: () => html`
<template layout="contents">
<ui-button>
<button layout="column center gap:0"><slot></slot></button>
</ui-button>
</template>
`.css`
ui-button {
box-shadow: none;
border-radius: 0px;
height: 50px;
background: var(--background-secondary);
border-color: var(--border-primary);
}

:host(:first-child) ui-button {
border-radius: 8px 0 0 8px;
border-right: none;
}

:host(:last-child) ui-button {
border-radius: 0 8px 8px 0;
border-left: none;
}

:host([active]) ui-button {
background: var(--background-primary);
}
`,
};
Loading