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

GH-1621: Site-Specific Whitelisting for Unknown Trackers via Anti-Tracking #416

Closed
wants to merge 23 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d17e342
Add anonymized data points to donut graph
Eden12345 Jun 4, 2019
3ec01dc
Half of original implementation complete
Eden12345 Jun 5, 2019
1f80f91
Copy icons to original branch
Eden12345 Jun 10, 2019
c2002a5
Finish rebuilding feature in original branch with cleaner code
Eden12345 Jun 10, 2019
3dcfa15
Rendering is working properly for the detailed view list, holding off…
Eden12345 Jun 12, 2019
f07a901
update npm dependencies. refactor webpack, babel, eslint
christophertino Jun 27, 2019
43e7683
apply new eslint rules and fix errors
christophertino Jun 27, 2019
ce2518c
fix formatting of if statements after lint auto-fix
christophertino Jul 1, 2019
95267e9
fix proptype errors in hub
christophertino Jul 1, 2019
e70fcd7
update codeowners and readme
christophertino Jul 1, 2019
4bad7bb
Shorten and correct the russian translations for cookies, fingerprint…
wlycdgr Jul 2, 2019
22236a6
Fix layout in Summary condensed view on Page Not Scanned pages (#404)
wlycdgr Jul 2, 2019
14973e6
bump browser core version
christophertino Jul 2, 2019
9a88931
updated donut number tooltip
tdtnguyen Jul 3, 2019
3cea1c7
fix tracker counting to include ad-block data
christophertino Jul 8, 2019
c610b08
Merge master into branch to access CliqzFeature component
Eden12345 Jul 9, 2019
82cb4bb
Get Anti-Tracking button working in category header
Eden12345 Jul 9, 2019
d57dc3d
Finish styling header
Eden12345 Jul 10, 2019
df763d6
Header styling and functionality complete, SVG buttons styled
Eden12345 Jul 11, 2019
0fdb21f
Resolve merge conflicts with Tino's changes to CliqzModuleData
Eden12345 Jul 11, 2019
6896ad7
Saving (relatively) working code)
Eden12345 Jul 17, 2019
8a88239
Complete core functionality, UI needs to be completed and refactored
Eden12345 Jul 18, 2019
45a97be
Finish styling
Eden12345 Jul 18, 2019
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Next
Add anonymized data points to donut graph
  • Loading branch information
Eden12345 committed Jun 4, 2019
commit d17e342c3395ddfb04bef813eb495025b0eab59c
@@ -56,6 +56,8 @@ class DonutGraph extends React.Component {
return '#87d7ef';
case 'social_media':
return '#388ee8';
case 'other_data_points':
return '#8459a5';
default:
return '#e8e8e8';
}
@@ -74,6 +76,7 @@ class DonutGraph extends React.Component {
componentDidMount() {
const {
categories,
antiTracking,
renderRedscale,
renderGreyscale,
isSmall,
@@ -87,7 +90,7 @@ class DonutGraph extends React.Component {
.value(d => d.value);

this.prepareDonutContainer(isSmall);
this.bakeDonut(categories, {
this.bakeDonut(categories, antiTracking, {
renderRedscale,
renderGreyscale
});
@@ -99,6 +102,7 @@ class DonutGraph extends React.Component {
componentWillReceiveProps(nextProps) {
const {
categories,
antiTracking,
renderRedscale,
renderGreyscale,
ghosteryFeatureSelect,
@@ -115,12 +119,20 @@ class DonutGraph extends React.Component {
return;
}

// componentWillReceiveProps gets called many times during page load as new trackers are found
// componentWillReceiveProps gets called many times during page load as new trackers or unsafe data points are found
// so only compare tracker totals if we don't already have to redraw anyway as a result of the cheaper checks above
const trackerTotal = categories.reduce((total, category) => total + category.num_total, 0);
const nextTrackerTotal = nextProps.categories.reduce((total, category) => total + category.num_total, 0);
if (trackerTotal !== nextTrackerTotal) {
this.nextPropsDonut(nextProps);
return;
}

if (!antiTracking && !nextProps.antiTracking) { return; }
const unsafeDataPoints = antiTracking ? antiTracking.totalUnsafeCount : 0;
const nextUnsafeDataPoints = nextProps.antiTracking ? nextProps.antiTracking.totalUnsafeCount : 0;
if (unsafeDataPoints !== nextUnsafeDataPoints) {
this.nextPropsDonut(nextProps);
}
}

@@ -142,7 +154,7 @@ class DonutGraph extends React.Component {
* Helper function that updates donut with nextProps values
*/
nextPropsDonut(nextProps) {
this.bakeDonut(nextProps.categories, {
this.bakeDonut(nextProps.categories, nextProps.antiTracking, {
renderRedscale: nextProps.renderRedscale,
renderGreyscale: nextProps.renderGreyscale,
isSmall: nextProps.isSmall,
@@ -180,7 +192,7 @@ class DonutGraph extends React.Component {
*/
bakeDonut = throttle(this._bakeDonut.bind(this), 600, { leading: true, trailing: true }) // matches panelData#updatePanelUI throttling

_bakeDonut(categories, options) {
_bakeDonut(categories, antiTracking, options) {
const {
renderRedscale,
renderGreyscale,
@@ -208,6 +220,14 @@ class DonutGraph extends React.Component {
graphData.sort((a, b) => a.value < b.value);
}

if (antiTracking && antiTracking.totalUnsafeCount) {
graphData.push({
id: 'other_data_points',
name: 'Data Points Anonymized',
value: antiTracking.totalUnsafeCount,
});
}

const trackerArc = arc()
.innerRadius(this.donutRadius - 13)
.outerRadius(this.donutRadius);
@@ -313,7 +333,7 @@ class DonutGraph extends React.Component {
* @return {JSX} JSX for rendering the donut-graph portion of the Summary View
*/
render() {
const { isSmall, totalCount } = this.props;
const { isSmall, totalCount, antiTracking } = this.props;
const componentClasses = ClassNames('sub-component', 'donut-graph', {
small: isSmall,
big: !isSmall,
@@ -327,6 +347,11 @@ class DonutGraph extends React.Component {
{cat.name}
</span>
))}
{antiTracking && !!antiTracking.totalUnsafeCount && (
<span key="other_data_points" id="other_data_points_tooltip" className="tooltip top">
Other Data Points
</span>
)}
</div>
<div className="graph-ref" ref={(node) => { this.node = node; }} />
<div className="graph-text clickable" onClick={this.clickGraphText}>
@@ -293,10 +293,12 @@ class Summary extends React.Component {
enable_anti_tracking,
enable_ad_block,
enable_smart_block,
categories,
antiTracking,
adBlock,
smartBlock,
paused_blocking,
paused_blocking_timeout,
sitePolicy,
trackerCounts,
} = this.props;
@@ -351,8 +353,8 @@ class Summary extends React.Component {
{abPause && (
<div className="pause-button-container">
<PauseButton
isPaused={this.props.paused_blocking}
isPausedTimeout={this.props.paused_blocking_timeout}
isPaused={paused_blocking}
isPausedTimeout={paused_blocking_timeout}
clickPause={this.clickPauseButton}
dropdownItems={this.pauseOptions}
isAbPause={abPause}
@@ -375,20 +377,21 @@ class Summary extends React.Component {
{!this.state.disableBlocking && !showCondensed && (
<div className="donut-graph-container">
<DonutGraph
categories={this.props.categories}
renderRedscale={this.props.sitePolicy === 1}
renderGreyscale={this.props.paused_blocking}
totalCount={this.props.trackerCounts.allowed + this.props.trackerCounts.blocked + antiTrackUnsafe + adBlockBlocked || 0}
ghosteryFeatureSelect={this.props.sitePolicy}
categories={categories}
renderRedscale={sitePolicy === 1}
renderGreyscale={paused_blocking}
totalCount={trackerCounts.allowed + trackerCounts.blocked + antiTrackUnsafe + adBlockBlocked || 0}
ghosteryFeatureSelect={sitePolicy}
isSmall={is_expert}
clickDonut={this.clickDonut}
antiTracking={antiTracking}
/>
</div>
)}
{!this.state.disableBlocking && showCondensed && (
<div className="total-tracker-count clickable" onClick={this.clickTrackersCount}>
<span className="summary-total-tracker-count g-tooltip">
{this.props.trackerCounts.allowed + this.props.trackerCounts.blocked + antiTrackUnsafe + adBlockBlocked || 0}
{trackerCounts.allowed + trackerCounts.blocked + antiTrackUnsafe + adBlockBlocked || 0}
<Tooltip
header={t('panel_tracker_total_tooltip')}
position="right"
@@ -427,17 +430,17 @@ class Summary extends React.Component {
<div className="ghostery-features-container">
<GhosteryFeatures
clickButton={this.clickSitePolicy}
sitePolicy={this.props.sitePolicy}
sitePolicy={sitePolicy}
isAbPause={abPause}
isStacked={is_expert}
isInactive={this.props.paused_blocking || this.state.disableBlocking}
isInactive={paused_blocking || this.state.disableBlocking}
isCondensed={showCondensed}
/>

{!abPause && (
<PauseButton
isPaused={this.props.paused_blocking}
isPausedTimeout={this.props.paused_blocking_timeout}
isPaused={paused_blocking}
isPausedTimeout={paused_blocking_timeout}
clickPause={this.clickPauseButton}
dropdownItems={this.pauseOptions}
isAbPause={abPause}
@@ -450,13 +453,13 @@ class Summary extends React.Component {
<div className="cliqz-features-container">
<CliqzFeatures
clickButton={this.clickCliqzFeature}
antiTrackingActive={this.props.enable_anti_tracking}
antiTracking={this.props.antiTracking}
adBlockingActive={this.props.enable_ad_block}
adBlocking={this.props.adBlock}
smartBlockingActive={this.props.enable_smart_block}
smartBlocking={this.props.smartBlock}
isInactive={this.props.paused_blocking || this.props.sitePolicy || this.state.disableBlocking || IS_CLIQZ}
antiTrackingActive={enable_anti_tracking}
antiTracking={antiTracking}
adBlockingActive={enable_ad_block}
adBlocking={adBlock}
smartBlockingActive={enable_smart_block}
smartBlocking={smartBlock}
isInactive={paused_blocking || sitePolicy || this.state.disableBlocking || IS_CLIQZ}
isSmaller={is_expert}
isCondensed={showCondensed}
/>
ProTip! Use n and p to navigate between commits in a pull request.