68 Commits

Author SHA1 Message Date
Kevin R
eef2bdb753 Merge branch 'master' into poeditor
# Conflicts:
#	_locales/fr/messages.json
2022-07-27 00:57:26 +02:00
Kevin
bd64e39e02 Update messages.json (POEditor.com) 2022-07-26 22:36:36 +00:00
Kevin
4a90d63539 Update messages.json (POEditor.com) 2022-07-26 22:36:35 +00:00
Kevin
6f76f2f167 Update messages.json (POEditor.com) 2022-07-26 22:36:34 +00:00
Kevin
8e1cba2eb7 Update messages.json (POEditor.com) 2022-07-26 22:36:33 +00:00
Kevin
1360111f15 Update messages.json (POEditor.com) 2022-07-26 22:36:32 +00:00
Kevin
f4e5ec70de Update messages.json (POEditor.com) 2022-07-26 22:36:32 +00:00
Kevin
c1b2cdbda0 Update messages.json (POEditor.com) 2022-07-26 22:36:31 +00:00
Kevin
71484d1488 Update messages.json (POEditor.com) 2022-07-26 22:36:30 +00:00
Kevin
394dda1157 Update messages.json (POEditor.com) 2022-07-26 22:36:29 +00:00
Kevin
854460ef50 Update messages.json (POEditor.com) 2022-07-26 22:36:28 +00:00
Kevin
0d49080a52 Update messages.json (POEditor.com) 2022-07-26 22:36:27 +00:00
Kevin
08630fbb7b Update messages.json (POEditor.com) 2022-07-26 22:36:26 +00:00
Kevin
93630cb8db Update messages.json (POEditor.com) 2022-07-26 22:36:26 +00:00
Kevin
d8e0e9fe96 Update messages.json (POEditor.com) 2022-07-26 22:36:25 +00:00
Kevin
42117aff9c Update messages.json (POEditor.com) 2022-07-26 22:36:24 +00:00
Kevin
ddc1dac829 Update messages.json (POEditor.com) 2022-07-26 22:36:23 +00:00
Kevin
2c12ce2def Update messages.json (POEditor.com) 2022-07-26 22:36:22 +00:00
Kevin
1dd91ef59a Update messages.json (POEditor.com) 2022-07-26 22:36:21 +00:00
Kevin
7ef8faef2f Update messages.json (POEditor.com) 2022-07-26 22:36:20 +00:00
Kevin
acacd6e2c4 Update messages.json (POEditor.com) 2022-07-26 22:36:19 +00:00
Kevin
a0ec22affb Update messages.json (POEditor.com) 2022-07-26 22:36:19 +00:00
Kevin
4d43f5cd07 Update messages.json (POEditor.com) 2022-07-26 22:36:18 +00:00
Kevin
7f8c096368 Update messages.json (POEditor.com) 2022-07-26 22:34:37 +00:00
Kevin
ba6fc13937 Update messages.json (POEditor.com) 2022-07-26 22:34:36 +00:00
Kevin
2cd54fcf28 Update messages.json (POEditor.com) 2022-07-26 22:34:36 +00:00
Kevin
8f5404c632 Update messages.json (POEditor.com) 2022-07-26 22:34:35 +00:00
Kevin
b4b2fe5bfe Update messages.json (POEditor.com) 2022-07-26 22:34:34 +00:00
Kevin
4c0b953972 Update messages.json (POEditor.com) 2022-07-26 22:34:33 +00:00
Kevin
d3ddd31d02 Update messages.json (POEditor.com) 2022-07-26 22:34:32 +00:00
Kevin
8f547660b9 Update messages.json (POEditor.com) 2022-07-26 22:34:32 +00:00
Kevin
465b76dbb2 Update messages.json (POEditor.com) 2022-07-26 22:34:31 +00:00
Kevin
7bb4deb83a Update messages.json (POEditor.com) 2022-07-26 22:34:30 +00:00
Kevin
b99263f85d Update messages.json (POEditor.com) 2022-07-26 22:34:29 +00:00
Kevin
d81041afe4 Update messages.json (POEditor.com) 2022-07-26 22:34:28 +00:00
Kevin
09c4504e5e Update messages.json (POEditor.com) 2022-07-26 22:34:27 +00:00
Kevin
1f7a471ec3 Update messages.json (POEditor.com) 2022-07-26 22:34:26 +00:00
Kevin
804e08098c Update messages.json (POEditor.com) 2022-07-26 22:34:26 +00:00
Kevin
55581cc6b8 Update messages.json (POEditor.com) 2022-07-26 22:34:25 +00:00
Kevin
23279d0c70 Update messages.json (POEditor.com) 2022-07-26 22:34:24 +00:00
Kevin
cff3184751 Update messages.json (POEditor.com) 2022-07-26 22:34:23 +00:00
Kevin
3a45f0f3bd Update messages.json (POEditor.com) 2022-07-26 22:34:22 +00:00
Kevin
39aef0bf19 Update messages.json (POEditor.com) 2022-07-26 22:34:22 +00:00
Kevin
56a91be236 Update messages.json (POEditor.com) 2022-07-26 22:34:21 +00:00
Kevin
99439f8dc9 Update messages.json (POEditor.com) 2022-07-26 22:34:20 +00:00
Kevin R
20dd141d3c Merge branch 'master' into poeditor 2022-03-22 21:43:06 +01:00
Kevin
d4c50c037a Update messages.json (POEditor.com) 2022-03-22 20:40:54 +00:00
Kevin
710c1ff527 Update messages.json (POEditor.com) 2022-03-22 20:40:53 +00:00
Kevin
c9be70d0e8 Update messages.json (POEditor.com) 2022-03-22 20:40:52 +00:00
Kevin
188f83b7a0 Update messages.json (POEditor.com) 2022-03-22 20:40:51 +00:00
Kevin
ee32041537 Update messages.json (POEditor.com) 2022-03-22 20:40:50 +00:00
Kevin
e016af23a9 Update messages.json (POEditor.com) 2022-03-22 20:40:49 +00:00
Kevin
003ed087f7 Update messages.json (POEditor.com) 2022-03-22 20:40:49 +00:00
Kevin
cb22c98074 Update messages.json (POEditor.com) 2022-03-22 20:40:48 +00:00
Kevin
f04da7c3b2 Update messages.json (POEditor.com) 2022-03-22 20:40:47 +00:00
Kevin
dde6a52e4b Update messages.json (POEditor.com) 2022-03-22 20:40:46 +00:00
Kevin
d1950a12e8 Update messages.json (POEditor.com) 2022-03-22 20:40:45 +00:00
Kevin
d9c2e895c9 Update messages.json (POEditor.com) 2022-03-22 20:40:44 +00:00
Kevin
b60f46bd34 Update messages.json (POEditor.com) 2022-03-22 20:40:43 +00:00
Kevin
b2547e2564 Update messages.json (POEditor.com) 2022-03-22 20:40:42 +00:00
Kevin
d63727b8b7 Update messages.json (POEditor.com) 2022-03-22 20:40:41 +00:00
Kevin
c3e3148b88 Update messages.json (POEditor.com) 2022-03-22 20:40:40 +00:00
Kevin
ee8916d14a Update messages.json (POEditor.com) 2022-03-22 20:40:39 +00:00
Kevin
7bb4e29768 Update messages.json (POEditor.com) 2022-03-22 20:40:38 +00:00
Kevin
f7fbbbbe88 Update messages.json (POEditor.com) 2022-03-22 20:40:37 +00:00
Kevin
355b724824 Update messages.json (POEditor.com) 2022-03-22 20:40:36 +00:00
Kevin
b53fbc5e76 Update messages.json (POEditor.com) 2022-03-22 20:40:35 +00:00
Kevin
e95a59e5cc Update messages.json (POEditor.com) 2022-03-22 20:40:34 +00:00
16 changed files with 142 additions and 219 deletions

View File

@@ -24,26 +24,26 @@ hash rules:
- data.minify.json - data.minify.json
- rules.minify.hash - rules.minify.hash
bundle addon: bundle addon firefox:
stage: build stage: build
script: script:
- zip ClearURLs -r -FS clearurls.js browser-polyfill.js manifest.json img/* external_js/* html/* core_js/* css/* fonts/* _locales/* - zip ClearURLs-firefox -r -FS clearurls.js browser-polyfill.js manifest.json img/* external_js/* html/* core_js/* css/* fonts/* _locales/*
only: only:
- master - master
artifacts: artifacts:
paths: paths:
- ClearURLs.zip - ClearURLs-firefox.zip
#bundle addon chrome: bundle addon chrome:
#stage: build stage: build
#script: script:
#- jq 'del(.applications)' manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json - jq 'del(.applications)' manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json
#- zip ClearURLs-chrome -r -FS clearurls.js browser-polyfill.js manifest.json img/* external_js/* html/* core_js/* css/* fonts/* _locales/* - zip ClearURLs-chrome -r -FS clearurls.js browser-polyfill.js manifest.json img/* external_js/* html/* core_js/* css/* fonts/* _locales/*
#only: only:
# - master - master
#artifacts: artifacts:
# paths: paths:
# - ClearURLs-chrome.zip - ClearURLs-chrome.zip
pages: pages:
stage: deploy stage: deploy

View File

@@ -15,27 +15,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Require Firefox >= 55 - Require Firefox >= 55
- Require Chrome >= 37 - Require Chrome >= 37
## [1.27.0] - 2023-XX-XX
### Fixed
- [#276](https://github.com/ClearURLs/Addon/issues/276)
- [#196](https://github.com/ClearURLs/Addon/issues/196)
# Removed
- ETag filtering for Firefox. Since Firefox 85, ETags can no longer be used for tracking users over multiple sites.
### Compatibility note
- Require Firefox >= 55
- Require Chrome >= 37
## [1.26.0] - 2022-11-18
### Compatibility note
- Require Firefox >= 55
- Require Chrome >= 37
### Changed
- The popup window is now responsive
## [1.25.0] - 2022-07-27 ## [1.25.0] - 2022-07-27

View File

@@ -4,7 +4,7 @@
[<img src="https://blog.mozilla.org/addons/files/2020/04/get-the-addon-fx-apr-2020.svg" alt="for Firefox" height="60px">](https://addons.mozilla.org/firefox/addon/clearurls/) [<img src="https://docs.clearurls.xyz/1.22.0/assets/img/MEA-button.png" alt="for Edge" height="60px">](https://microsoftedge.microsoft.com/addons/detail/mdkdmaickkfdekbjdoojfalpbkgaddei) [<img src="https://storage.googleapis.com/chrome-gcs-uploader.appspot.com/image/WlD8wC6g8khYWPJUsQceQkhXSlv1/HRs9MPufa1J1h5glNhut.png" alt="for Chrome" height="60px">](https://chrome.google.com/webstore/detail/clearurls/lckanjgmijmafbedllaakclkaicjfmnk) [<img src="https://blog.mozilla.org/addons/files/2020/04/get-the-addon-fx-apr-2020.svg" alt="for Firefox" height="60px">](https://addons.mozilla.org/firefox/addon/clearurls/) [<img src="https://docs.clearurls.xyz/1.22.0/assets/img/MEA-button.png" alt="for Edge" height="60px">](https://microsoftedge.microsoft.com/addons/detail/mdkdmaickkfdekbjdoojfalpbkgaddei) [<img src="https://storage.googleapis.com/chrome-gcs-uploader.appspot.com/image/WlD8wC6g8khYWPJUsQceQkhXSlv1/HRs9MPufa1J1h5glNhut.png" alt="for Chrome" height="60px">](https://chrome.google.com/webstore/detail/clearurls/lckanjgmijmafbedllaakclkaicjfmnk)
# <sub><img src="https://gitlab.com/ClearURLs/ClearUrls/raw/master/img/clearurls.svg" width="64px" height="64px"></sub> ClearURLs [![Gitter](https://badges.gitter.im/ClearURLs/ClearURLs.svg)](https://gitter.im/ClearURLs/ClearURLs) # <sub><img src="https://gitlab.com/KevinRoebert/ClearUrls/raw/master/img/clearurls.svg" width="64px" height="64px"></sub> ClearURLs [![Gitter](https://badges.gitter.im/ClearURLs/ClearURLs.svg)](https://gitter.im/ClearURLs/ClearURLs)
**ClearURLs** is an add-on based on the new WebExtensions technology and is optimized for *Firefox* and *Chrome* based browsers. **ClearURLs** is an add-on based on the new WebExtensions technology and is optimized for *Firefox* and *Chrome* based browsers.
@@ -37,7 +37,7 @@ Indeed most of the above URL is tracking code. Once ClearURLs has cleaned the ad
* Prevents Yandex from rewriting the search results (to include tracking elements) * Prevents Yandex from rewriting the search results (to include tracking elements)
## Permissons ## Permissons
Reasoning for needed permissions can be found under [here](https://gitlab.com/ClearURLs/ClearUrls/issues/159). Reasoning for needed permissions can be found under [here](https://gitlab.com/KevinRoebert/ClearUrls/issues/159).
## Screenshot ## Screenshot
![Interface (version 1.14.0)](https://docs.clearurls.xyz/1.22.0/assets/img/interface.png) ![Interface (version 1.14.0)](https://docs.clearurls.xyz/1.22.0/assets/img/interface.png)
@@ -45,13 +45,14 @@ Reasoning for needed permissions can be found under [here](https://gitlab.com/Cl
## CI/CD Artifacts Download (for Firefox- and Chrome-Dev only) ## CI/CD Artifacts Download (for Firefox- and Chrome-Dev only)
Here you can download the packed files for the Firefox- and Chrome-Dev: Here you can download the packed files for the Firefox- and Chrome-Dev:
- [ClearURLs.zip](https://gitlab.com/ClearURLs/ClearUrls/-/jobs/artifacts/master/raw/ClearURLs.zip?job=bundle%20addon) - [ClearURLs-firefox.zip](https://gitlab.com/KevinRoebert/ClearUrls/-/jobs/artifacts/master/raw/ClearURLs-firefox.zip?job=bundle%20addon%20firefox)
- [ClearURLs-chrome.zip](https://gitlab.com/KevinRoebert/ClearUrls/-/jobs/artifacts/master/raw/ClearURLs-chrome.zip?job=bundle%20addon%20chrome)
## Test ## Test
If you want to test whether ClearURLs works correctly on your system, you can go to this test page: [https://test.clearurls.xyz/](https://test.clearurls.xyz/) If you want to test whether ClearURLs works correctly on your system, you can go to this test page: [https://test.clearurls.xyz/](https://test.clearurls.xyz/)
## Contribute ## Contribute
If you have any suggestions or complaints, please [create an issue.](https://gitlab.com/ClearURLs/ClearUrls/issues/new) If you have any suggestions or complaints, please [create an issue.](https://gitlab.com/KevinRoebert/ClearUrls/issues/new)
**Note: If you have any suggestions or complaints regarding the rules, please [create an issue in this repo](https://gitlab.com/anti-tracking/ClearURLs/rules/-/issues/new) or email us rules.support (at) clearurls.xyz (this mail will automatically create a new issue in this repo).** **Note: If you have any suggestions or complaints regarding the rules, please [create an issue in this repo](https://gitlab.com/anti-tracking/ClearURLs/rules/-/issues/new) or email us rules.support (at) clearurls.xyz (this mail will automatically create a new issue in this repo).**
@@ -64,7 +65,7 @@ You can choose between two options to contribute. You can create a merge request
It is not necessary to translate the description field; in the most cases it is empty.* It is not necessary to translate the description field; in the most cases it is empty.*
#### Merge request #### Merge request
If you want to create a merge request, you must open the path [`_locales/en/messages.json`](https://gitlab.com/ClearURLs/ClearUrls/-/blob/master/_locales/en/messages.json) in the ClearURLs repo If you want to create a merge request, you must open the path [`_locales/en/messages.json`](https://github.com/KevinRoebert/ClearUrls/blob/master/_locales/en/messages.json) in the ClearURLs repo
and translate the english terms into terms of your language. Once you have translated all the terms, you make a pull request of your translation. and translate the english terms into terms of your language. Once you have translated all the terms, you make a pull request of your translation.
Please push your translation into the folder `_locales/{language code}/messages.json`. Please push your translation into the folder `_locales/{language code}/messages.json`.

View File

@@ -152,7 +152,7 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false, request = null) {
let finalURL = domain; let finalURL = domain;
if (fields.toString() !== "") finalURL += "?" + urlSearchParamsToString(fields); if (fields.toString() !== "") finalURL += "?" + fields.toString();
if (fragments.toString() !== "") finalURL += "#" + fragments.toString(); if (fragments.toString() !== "") finalURL += "#" + fragments.toString();
url = finalURL.replace(new RegExp("\\?&"), "?").replace(new RegExp("#&"), "#"); url = finalURL.replace(new RegExp("\\?&"), "?").replace(new RegExp("#&"), "#");
@@ -727,9 +727,3 @@ function start() {
["blocking"] ["blocking"]
); );
} }
// TODO: Must be asked after install
browser.permissions.request({
permissions: ["webRequest", "webRequestBlocking", "tabs", "scripting", "webNavigation"],
origins: ["<all_urls>"],
});

View File

@@ -48,9 +48,9 @@ function increaseBadged(quiet = false, request) {
checkOSAndroid().then((res) => { checkOSAndroid().then((res) => {
if (!res) { if (!res) {
if (storage.badgedStatus && !quiet) { if (storage.badgedStatus && !quiet) {
browser.action.setBadgeText({text: (badges[tabId]).counter.toString(), tabId: tabId}).catch(handleError); browser.browserAction.setBadgeText({text: (badges[tabId]).counter.toString(), tabId: tabId}).catch(handleError);
} else { } else {
browser.action.setBadgeText({text: "", tabId: tabId}).catch(handleError); browser.browserAction.setBadgeText({text: "", tabId: tabId}).catch(handleError);
} }
} }
}); });

View File

@@ -22,9 +22,8 @@
* and based on: https://github.com/mdn/webextensions-examples/tree/master/context-menu-copy-link-with-types * and based on: https://github.com/mdn/webextensions-examples/tree/master/context-menu-copy-link-with-types
*/ */
browser.runtime.onInstalled.addListener(contextMenuStart); function contextMenuStart() {
if(storage.contextMenuEnabled) {
function contextMenuStart(details) {
browser.contextMenus.create({ browser.contextMenus.create({
id: "copy-link-to-clipboard", id: "copy-link-to-clipboard",
title: translate("clipboard_copy_link"), title: translate("clipboard_copy_link"),
@@ -34,17 +33,25 @@ function contextMenuStart(details) {
browser.contextMenus.onClicked.addListener((info, tab) => { browser.contextMenus.onClicked.addListener((info, tab) => {
if (info.menuItemId === "copy-link-to-clipboard") { if (info.menuItemId === "copy-link-to-clipboard") {
const url = pureCleaning(info.linkUrl); const url = pureCleaning(info.linkUrl);
const code = "copyToClipboard(" +
JSON.stringify(url)+");";
browser.scripting.executeScript({ browser.tabs.executeScript({
target: { code: "typeof copyToClipboard === 'function';",
tabId: tab.id, }).then((results) => {
allFrames: true if (!results || results[0] !== true) {
}, return browser.tabs.executeScript(tab.id, {
func: (text) => navigator.clipboard.writeText(text), file: "/external_js/clipboard-helper.js",
args: [ }).catch(handleError);
url }
] }).then(() => {
return browser.tabs.executeScript(tab.id, {
code,
});
}).catch((error) => {
console.error("Failed to copy text: " + error);
}); });
} }
}); });
}
} }

View File

@@ -31,16 +31,8 @@ function eTagFilter(requestDetails) {
continue; continue;
} }
const etag = header.value.toLowerCase();
const w = etag.startsWith('w');
const quotes = etag.endsWith('"');
let len = etag.length;
if (w) len -= 2;
if (quotes) len -= 2;
// insert dummy etag // insert dummy etag
requestDetails.responseHeaders[i].value = generateDummyEtag(len, quotes, w); requestDetails.responseHeaders[i].value = generateDummyEtag();
pushToLog(requestDetails.url, requestDetails.url, translate("eTag_filtering_log")); pushToLog(requestDetails.url, requestDetails.url, translate("eTag_filtering_log"));
@@ -50,29 +42,12 @@ function eTagFilter(requestDetails) {
return {responseHeaders: requestDetails.responseHeaders}; return {responseHeaders: requestDetails.responseHeaders};
} }
/** function generateDummyEtag() {
* Generates a random ETag. return Math.random().toString();
*
* Must be ASCII characters placed between double quotes.
* See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
*/
function generateDummyEtag(len, quotes = true, w = false) {
let rtn = randomASCII(len);
if (quotes) rtn = '"' + rtn + '"';
if (w) rtn = 'W/' + rtn;
return rtn;
} }
/** browser.webRequest.onHeadersReceived.addListener(
* Since Firefox 85, eTags can no longer be
* used for tracking users over multiple sites.
*/
if(getBrowser() !== "Firefox") {
browser.webRequest.onHeadersReceived.addListener(
eTagFilter, eTagFilter,
{urls: ["<all_urls>"]}, {urls: ["<all_urls>"]},
["blocking", "responseHeaders"] ["blocking", "responseHeaders"]
); );
}

View File

@@ -17,45 +17,35 @@
*/ */
/*jshint esversion: 6 */ /*jshint esversion: 6 */
/* /*
* This script is responsible for listen on history changes. * This script is responsible for listen on history changes.
* This technique is often used to inject tracking code into the location bar, * This technique is often used to inject tracking code into the location bar,
* because all feature events will use the updated URL. * because all feature events will use the updated URL.
*/ */
browser.webNavigation.onHistoryStateUpdated.addListener(historyCleaner);
function historyListenerStart() { function historyListenerStart() {
if(storage.historyListenerEnabled) {
browser.webNavigation.onHistoryStateUpdated.addListener(historyCleaner);
}
} }
/** /**
* Function that is triggered on history changes. Injects script into page * Function that is triggered on history changes. Injects script into page
* to clean links that were pushed to the history stack with the * to clean links that were pushed to the history stack with the
* history.replaceState method. * history.replaceState method.
* @param {state object} details The state object is a JavaScript object * @param {state object} details The state object is a JavaScript object
* which is associated with the new history entry created by replaceState() * which is associated with the new history entry created by replaceState()
*/ */
function historyCleaner(details) { function historyCleaner(details) {
if (storage.globalStatus && storage.historyListenerEnabled) { if(storage.globalStatus) {
const urlBefore = details.url; const urlBefore = details.url;
const urlAfter = pureCleaning(details.url); const urlAfter = pureCleaning(details.url);
if (urlBefore !== urlAfter) { if(urlBefore !== urlAfter) {
browser.scripting.executeScript({ browser.tabs.executeScript(details.tabId, {
target: { frameId: details.frameId,
tabId: details.tabId, code: 'history.replaceState({state: "cleaned_history"},"",'+JSON.stringify(urlAfter)+');'
frameIds: [ }).then(() => {}, onError);
details.frameId
]
},
func: (url) => history.replaceState({state: null}, "", url),
args: [
urlAfter
]
}).then(() => {
}, onError);
} }
} }
} }

View File

@@ -132,7 +132,8 @@ function getData() {
} }
}).catch(handleError); }).catch(handleError);
loadData("historyListenerEnabled") loadData("contextMenuEnabled")
.then(() => loadData("historyListenerEnabled"))
.then(() => loadData("localHostsSkipping")) .then(() => loadData("localHostsSkipping"))
.then(() => loadData("referralMarketing")) .then(() => loadData("referralMarketing"))
.then(() => loadData("domainBlocking")) .then(() => loadData("domainBlocking"))
@@ -141,24 +142,11 @@ function getData() {
.then(() => { .then(() => {
changeSwitchButton("localHostsSkipping", "localHostsSkipping"); changeSwitchButton("localHostsSkipping", "localHostsSkipping");
changeSwitchButton("historyListenerEnabled", "historyListenerEnabled"); changeSwitchButton("historyListenerEnabled", "historyListenerEnabled");
changeSwitchButton("contextMenuEnabled", "contextMenuEnabled");
changeSwitchButton("referralMarketing", "referralMarketing"); changeSwitchButton("referralMarketing", "referralMarketing");
changeSwitchButton("domainBlocking", "domainBlocking"); changeSwitchButton("domainBlocking", "domainBlocking");
changeSwitchButton("pingBlocking", "pingBlocking"); changeSwitchButton("pingBlocking", "pingBlocking");
changeSwitchButton("eTagFiltering", "eTagFiltering"); changeSwitchButton("eTagFiltering", "eTagFiltering");
})
.then(() => {
/**
* Since Firefox 85, eTags can no longer be
* used for tracking users over multiple sites.
*/
browser.runtime.sendMessage({
function: "getBrowser",
params: []
}).then(resp => {
if(resp.response === "Firefox") {
document.getElementById('etag_p').remove();
}
}, null);
}).catch(handleError); }).catch(handleError);
} }
@@ -217,6 +205,7 @@ function setText() {
document.getElementById('types_label').innerHTML = translate('setting_types_label'); document.getElementById('types_label').innerHTML = translate('setting_types_label');
document.getElementById('save_settings_btn').textContent = translate('settings_html_save_button'); document.getElementById('save_settings_btn').textContent = translate('settings_html_save_button');
document.getElementById('save_settings_btn').setAttribute('title', translate('settings_html_save_button_title')); document.getElementById('save_settings_btn').setAttribute('title', translate('settings_html_save_button_title'));
injectText("context_menu_enabled", "context_menu_enabled");
document.getElementById('history_listener_enabled').innerHTML = translate('history_listener_enabled'); document.getElementById('history_listener_enabled').innerHTML = translate('history_listener_enabled');
injectText("local_hosts_skipping", "local_hosts_skipping"); injectText("local_hosts_skipping", "local_hosts_skipping");
document.getElementById('export_settings_btn_text').textContent = translate('setting_html_export_button'); document.getElementById('export_settings_btn_text').textContent = translate('setting_html_export_button');

View File

@@ -86,7 +86,7 @@ function saveOnDisk(keys) {
} }
/** /**
* Schedule to save a key to disk in 60 seconds. * Schedule to save a key to disk in 30 seconds.
* @param {String} key * @param {String} key
*/ */
function deferSaveOnDisk(key) { function deferSaveOnDisk(key) {
@@ -95,20 +95,13 @@ function deferSaveOnDisk(key) {
return; return;
} }
browser.alarms.create("deferSaveOnDisk", { setTimeout(function () {
delayInMinutes: 1
});
hasPendingSaves = true;
}
browser.alarms.onAlarm.addListener(function (alarmInfo) {
if (alarmInfo.name === "deferSaveOnDisk") {
saveOnDisk(Array.from(pendingSaves)); saveOnDisk(Array.from(pendingSaves));
pendingSaves.clear(); pendingSaves.clear();
hasPendingSaves = false; hasPendingSaves = false;
} }, 30000);
}); hasPendingSaves = true;
}
/** /**
* Start sequence for ClearURLs. * Start sequence for ClearURLs.
@@ -122,6 +115,12 @@ function genesis() {
//Set correct icon on startup //Set correct icon on startup
changeIcon(); changeIcon();
// Start the context_menu
contextMenuStart();
// Start history listener
historyListenerStart();
}, handleError); }, handleError);
} }
@@ -217,6 +216,7 @@ function initSettings() {
storage.badged_color = "#ffa500"; storage.badged_color = "#ffa500";
storage.hashURL = "https://rules2.clearurls.xyz/rules.minify.hash"; storage.hashURL = "https://rules2.clearurls.xyz/rules.minify.hash";
storage.ruleURL = "https://rules2.clearurls.xyz/data.minify.json"; storage.ruleURL = "https://rules2.clearurls.xyz/data.minify.json";
storage.contextMenuEnabled = true;
storage.historyListenerEnabled = true; storage.historyListenerEnabled = true;
storage.localHostsSkipping = true; storage.localHostsSkipping = true;
storage.referralMarketing = false; storage.referralMarketing = false;

View File

@@ -181,9 +181,9 @@ function changeIcon() {
checkOSAndroid().then((res) => { checkOSAndroid().then((res) => {
if (!res) { if (!res) {
if (storage.globalStatus) { if (storage.globalStatus) {
browser.action.setIcon({path: "img/clearurls_128x128.png"}).catch(handleError); browser.browserAction.setIcon({path: "img/clearurls_128x128.png"}).catch(handleError);
} else { } else {
browser.action.setIcon({path: "img/clearurls_gray_128x128.png"}).catch(handleError); browser.browserAction.setIcon({path: "img/clearurls_gray_128x128.png"}).catch(handleError);
} }
} }
}); });
@@ -200,13 +200,13 @@ function setBadgedStatus() {
let color = storage.badged_color; let color = storage.badged_color;
if (storage.badged_color.charAt(0) !== '#') if (storage.badged_color.charAt(0) !== '#')
color = '#' + storage.badged_color; color = '#' + storage.badged_color;
browser.action.setBadgeBackgroundColor({ browser.browserAction.setBadgeBackgroundColor({
'color': color 'color': color
}).catch(handleError); }).catch(handleError);
// Works only in Firefox: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/action/setBadgeTextColor#Browser_compatibility // Works only in Firefox: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction/setBadgeTextColor#Browser_compatibility
if (getBrowser() === "Firefox") { if (getBrowser() === "Firefox") {
browser.action.setBadgeTextColor({ browser.browserAction.setBadgeTextColor({
color: "#FFFFFF" color: "#FFFFFF"
}).catch(handleError); }).catch(handleError);
} }
@@ -328,30 +328,3 @@ async function sha256(message) {
return hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
} }
/**
* Generates a non-secure random ASCII string of length {@code len}.
*
* @returns non-secure random ASCII
*/
function randomASCII(len) {
return [...Array(len)].map(() => (~~(Math.random() * 36)).toString(36)).join('');
}
/**
* Returns an URLSearchParams as string.
* Does handle spaces correctly.
*/
function urlSearchParamsToString(searchParams) {
const rtn = []
searchParams.forEach((value, key) => {
if (value) {
rtn.push(key + '=' + value)
} else {
rtn.push(key)
}
})
return rtn.join('&')
}

View File

@@ -24,23 +24,20 @@
* *
* This watchdog restarts the whole Add-on, when the check fails. * This watchdog restarts the whole Add-on, when the check fails.
*/ */
const CHECK_INTERVAL = 60000;
const __dirtyURL = "https://clearurls.roebert.eu?utm_source=addon"; const __dirtyURL = "https://clearurls.roebert.eu?utm_source=addon";
const __cleanURL = new URL("https://clearurls.roebert.eu").toString(); const __cleanURL = new URL("https://clearurls.roebert.eu").toString();
browser.alarms.create("watchdog", { setInterval(function() {
periodInMinutes: 1, if(isStorageAvailable() && storage.globalStatus) {
}); if(new URL(pureCleaning(__dirtyURL, true)).toString() !== __cleanURL) {
browser.alarms.onAlarm.addListener(function (alarmInfo) {
if (alarmInfo.name === "watchdog" && isStorageAvailable() && storage.globalStatus) {
if (new URL(pureCleaning(__dirtyURL, true)).toString() !== __cleanURL) {
storage.watchDogErrorCount += 1; storage.watchDogErrorCount += 1;
console.log(translate('watchdog', storage.watchDogErrorCount)); console.log(translate('watchdog', storage.watchDogErrorCount));
saveOnExit(); saveOnExit();
if (storage.watchDogErrorCount < 3) reload(); if(storage.watchDogErrorCount < 3) reload();
} else if (storage.watchDogErrorCount > 0) { } else if(storage.watchDogErrorCount > 0){
storage.watchDogErrorCount = 0; storage.watchDogErrorCount = 0;
saveOnExit(); saveOnExit();
} }
} }
}); }, CHECK_INTERVAL);

View File

@@ -0,0 +1,16 @@
/*
* Source: https://github.com/mdn/webextensions-examples/tree/master/context-menu-copy-link-with-types
*/
function copyToClipboard(text) {
function oncopy(event) {
document.removeEventListener("copy", oncopy, true);
event.stopImmediatePropagation();
event.preventDefault();
event.clipboardData.setData("text/plain", text);
}
document.addEventListener("copy", oncopy, true);
document.execCommand("copy");
}

View File

@@ -32,9 +32,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</head> </head>
<body> <body>
<div class="container-fluid" <div class="container-fluid"
style="min-width: 200px"> style="min-width: 200px;">
<div class="row"> <div class="row">
<nav class="col-sm-12 navbar-margin navbar navbar-dark bg-dark"> <nav class="col-sm-1 navbar-margin navbar navbar-dark bg-dark">
<div class="container"> <div class="container">
<span class="navbar-brand"> <span class="navbar-brand">
<span class="float-left"><img src="../img/clearurls.svg" <span class="float-left"><img src="../img/clearurls.svg"
@@ -53,14 +53,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div> </div>
<div class="row" id="references_section"> <div class="row" id="references_section">
<div class="col-sm-4 offset-sm-4 text-center"> <div class="col-sm-1 text-center">
<a id="cleaning_tools" target="_blank"><span class="fas fa-tools" style="font-size: 1.5em; margin-right: 1em;"></span></a> <a id="cleaning_tools" target="_blank"><span class="fas fa-tools" style="font-size: 1.5em; margin-right: 1em;"></span></a>
<a id="settings" target="_blank"><span class="fas fa-cog" style="font-size: 1.5em"></span></a> <a id="settings" target="_blank"><span class="fas fa-cog" style="font-size: 1.5em"></span></a>
</div> </div>
</div> </div>
<div class="row" id="config_section"> <div class="row" id="config_section">
<div class="col-sm-4 offset-sm-4"> <div class="col-sm-1">
<h5><b id="configs_head"></b></h5> <h5><b id="configs_head"></b></h5>
<label class="switch"> <label class="switch">
<input type="checkbox" id="globalStatus"> <input type="checkbox" id="globalStatus">
@@ -91,7 +91,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div> </div>
<div class="row" id="statistic_section"> <div class="row" id="statistic_section">
<div class="col-sm-4 offset-sm-4"> <div class="col-sm-1">
<h5><b id="statistics_head"></b></h5> <h5><b id="statistics_head"></b></h5>
<div class="progress"> <div class="progress">
@@ -133,7 +133,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div> </div>
<div class="row" id="status_section"> <div class="row" id="status_section">
<div class="col-sm-4 offset-sm-4"> <div class="col-sm-1">
<h5><b id="rules_status_head"></b></h5> <h5><b id="rules_status_head"></b></h5>
<div class="text-center"> <div class="text-center">
<a href="https://gitlab.com/ClearURLs/rules/-/commits/master/data.min.json" <a href="https://gitlab.com/ClearURLs/rules/-/commits/master/data.min.json"
@@ -145,7 +145,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div> </div>
<br /> <br />
<div class="row" id="log_section"> <div class="row" id="log_section">
<div class="col-sm-4 offset-sm-4"> <div class="col-sm-1">
<div class="text-center"> <div class="text-center">
<a id="loggingPage" target="_blank" <a id="loggingPage" target="_blank"
class="btn btn-default btn-sm btn-block text-wrap"></a> class="btn btn-default btn-sm btn-block text-wrap"></a>

View File

@@ -136,6 +136,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<span class="slider round"></span> <span class="slider round"></span>
</label> </label>
</p> </p>
<p>
<label id="context_menu_enabled" style="font-weight: bold;"></label><br />
<label class="switch">
<input type="checkbox" id="contextMenuEnabled">
<span class="slider round"></span>
</label>
</p>
<p> <p>
<label id="referral_marketing_enabled" style="font-weight: bold;"></label><br /> <label id="referral_marketing_enabled" style="font-weight: bold;"></label><br />
<label class="switch"> <label class="switch">
@@ -150,7 +157,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<span class="slider round"></span> <span class="slider round"></span>
</label> </label>
</p> </p>
<p id="etag_p"> <p>
<label id="eTag_filtering_enabled" style="font-weight: bold;"></label><br /> <label id="eTag_filtering_enabled" style="font-weight: bold;"></label><br />
<label class="switch"> <label class="switch">
<input type="checkbox" id="eTagFiltering"> <input type="checkbox" id="eTagFiltering">

View File

@@ -1,15 +1,13 @@
{ {
"manifest_version": 3, "manifest_version": 2,
"name": "ClearURLs", "name": "ClearURLs",
"version": "1.28.0", "version": "1.25.0",
"author": "Kevin Roebert", "author": "Kevin Roebert",
"description": "__MSG_extension_description__", "description": "__MSG_extension_description__",
"homepage_url": "https://docs.clearurls.xyz", "homepage_url": "https://docs.clearurls.xyz",
"default_locale": "en", "default_locale": "en",
"content_security_policy": { "content_security_policy": "script-src 'self'; object-src 'none'",
"extension_pages": "script-src 'self'; object-src 'none'" "applications": {
},
"browser_specific_settings": {
"gecko": { "gecko": {
"id": "{74145f27-f039-47ce-a470-a662b129930a}" "id": "{74145f27-f039-47ce-a470-a662b129930a}"
} }
@@ -27,7 +25,8 @@
"96": "img/clearurls_96x96.png", "96": "img/clearurls_96x96.png",
"128": "img/clearurls_128x128.png" "128": "img/clearurls_128x128.png"
}, },
"action": { "browser_action": {
"browser_style": true,
"default_icon": { "default_icon": {
"16": "img/clearurls_16x16.png", "16": "img/clearurls_16x16.png",
"19": "img/clearurls_19x19.png", "19": "img/clearurls_19x19.png",
@@ -45,6 +44,7 @@
"default_popup": "html/popup.html" "default_popup": "html/popup.html"
}, },
"permissions": [ "permissions": [
"<all_urls>",
"webRequest", "webRequest",
"webRequestBlocking", "webRequestBlocking",
"storage", "storage",
@@ -52,12 +52,7 @@
"contextMenus", "contextMenus",
"webNavigation", "webNavigation",
"tabs", "tabs",
"downloads", "downloads"
"scripting",
"alarms"
],
"host_permissions": [
"<all_urls>"
], ],
"background": { "background": {
"scripts": [ "scripts": [