Skip to content

Commit

Permalink
Fix: 03 - 2024 (#41)
Browse files Browse the repository at this point in the history
* removed the unnecessary permission (#28)

* new version

* temporary fix

* disable the warnings

* rollback

* version bump to match what's published
  • Loading branch information
sonnyt authored Mar 6, 2024
1 parent 59991c7 commit 5f30bf8
Show file tree
Hide file tree
Showing 7 changed files with 1,674 additions and 12,449 deletions.
2 changes: 1 addition & 1 deletion assets/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Ugly Email",
"short_name": "Ugly Email",
"version": "4.1.0",
"version": "4.1.1",
"description": "Get Back Your Email Privacy, Block Email Tracking.",
"author": "OneClick Lab",
"homepage_url": "http://uglyemail.com",
Expand Down
14,062 changes: 1,634 additions & 12,428 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ugly-email-extension",
"version": "4.1.0",
"version": "4.1.1",
"description": "",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -31,10 +31,13 @@
},
"homepage": "https://uglyemail.com",
"dependencies": {
"gmail-js": "^1.0.5"
"gmail-js": "^1.1.12",
"jquery": "^4.0.0-beta"
},
"devDependencies": {
"@types/chrome": "^0.0.262",
"@types/jest": "^26.0.19",
"@types/jquery": "^3.5.29",
"@typescript-eslint/eslint-plugin": "^4.9.1",
"eslint": "^7.15.0",
"eslint-config-airbnb-typescript": "^12.0.0",
Expand All @@ -46,5 +49,10 @@
"parcel-plugin-static-files-copy": "^2.5.0",
"ts-jest": "^26.4.4",
"typescript": "^4.1.3"
},
"overrides": {
"gmail-js": {
"jquery": "^4.0.0-beta"
}
}
}
12 changes: 4 additions & 8 deletions src/background.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import trackers from './services/trackers';

declare let chrome: any;

(async () => {
await trackers.init();

const filters = {
urls: ['*://*.googleusercontent.com/proxy/*'],
types: ['image'],
};

type RequestDetails = {
url: string
};

chrome.webRequest.onBeforeRequest.addListener((details: RequestDetails) => {
const pixel = trackers.match(details.url);
return { cancel: !!pixel };
}, filters, ['blocking']);
}, {
urls: ['*://*.googleusercontent.com/*'],
types: ['image'],
}, ['blocking']);

chrome.runtime.onConnect.addListener((port: any) => {
port.onMessage.addListener((data: { id: string, body: string }) => {
Expand Down
13 changes: 5 additions & 8 deletions src/loader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
declare let chrome: any;

const u = document.createElement('script');
u.src = chrome.extension.getURL('uglyemail.js');

Expand All @@ -19,11 +17,11 @@ window.addEventListener('message', ({ data }) => {

const s = document.createElement('style');
s.appendChild(document.createTextNode(`
.ade .ugly-email-track-icon {
margin-top: -6px;
height: 20px;
width: 20px;
opacity: .6;
.J-J5-Ji .ugly-email-track-icon {
height: 18px;
width: 18px;
margin-top: 4px;
margin-right: 8px;
}
.ugly-email-track-icon {
Expand All @@ -37,7 +35,6 @@ s.appendChild(document.createTextNode(`
float: left;
margin-right: 5px;
position: relative;
top: 3px;
}
`));

Expand Down
2 changes: 1 addition & 1 deletion src/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function markListItemUgly(element: HTMLSpanElement, tracker: string): void {
}

function markThreadUgly(element: HTMLHeadElement, tracker: string): void {
const parent = element.closest('.nH.V8djrc.byY')!.querySelector<HTMLDivElement>('.ade');
const parent = element.nextElementSibling;

if (parent) {
markElementUgly(parent, tracker);
Expand Down
20 changes: 19 additions & 1 deletion vendor/gmail-js.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
/**
* gmail.js
*/
import jQuery from 'jquery';

const service = require('gmail-js');

const Gmail = new service.Gmail();
/**
* Override the jQuery object
*/

jQuery.isArray = Array.isArray;

if ((window as any).trustedTypes && (window as any).trustedTypes.createPolicy) {
const htmlPrefilter = (window as any).trustedTypes.createPolicy('myEscapePolicy', {
createHTML: (string: string) => string.replace(/</g, '&lt;'),
});

jQuery.extend({ htmlPrefilter });
}

const Gmail = new service.Gmail(jQuery);

Gmail.DISABLE_OLD_GMAIL_API_DEPRECATION_WARNINGS = true;

/**
* Override the email_data_post helper
Expand Down

0 comments on commit 5f30bf8

Please sign in to comment.