mirror of
https://gitlab.com/KevinRoebert/ClearUrls
synced 2025-12-17 22:55:36 +07:00
Compare commits
68 Commits
m3-migrati
...
poeditor
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eef2bdb753 | ||
|
|
bd64e39e02 | ||
|
|
4a90d63539 | ||
|
|
6f76f2f167 | ||
|
|
8e1cba2eb7 | ||
|
|
1360111f15 | ||
|
|
f4e5ec70de | ||
|
|
c1b2cdbda0 | ||
|
|
71484d1488 | ||
|
|
394dda1157 | ||
|
|
854460ef50 | ||
|
|
0d49080a52 | ||
|
|
08630fbb7b | ||
|
|
93630cb8db | ||
|
|
d8e0e9fe96 | ||
|
|
42117aff9c | ||
|
|
ddc1dac829 | ||
|
|
2c12ce2def | ||
|
|
1dd91ef59a | ||
|
|
7ef8faef2f | ||
|
|
acacd6e2c4 | ||
|
|
a0ec22affb | ||
|
|
4d43f5cd07 | ||
|
|
7f8c096368 | ||
|
|
ba6fc13937 | ||
|
|
2cd54fcf28 | ||
|
|
8f5404c632 | ||
|
|
b4b2fe5bfe | ||
|
|
4c0b953972 | ||
|
|
d3ddd31d02 | ||
|
|
8f547660b9 | ||
|
|
465b76dbb2 | ||
|
|
7bb4deb83a | ||
|
|
b99263f85d | ||
|
|
d81041afe4 | ||
|
|
09c4504e5e | ||
|
|
1f7a471ec3 | ||
|
|
804e08098c | ||
|
|
55581cc6b8 | ||
|
|
23279d0c70 | ||
|
|
cff3184751 | ||
|
|
3a45f0f3bd | ||
|
|
39aef0bf19 | ||
|
|
56a91be236 | ||
|
|
99439f8dc9 | ||
|
|
20dd141d3c | ||
|
|
d4c50c037a | ||
|
|
710c1ff527 | ||
|
|
c9be70d0e8 | ||
|
|
188f83b7a0 | ||
|
|
ee32041537 | ||
|
|
e016af23a9 | ||
|
|
003ed087f7 | ||
|
|
cb22c98074 | ||
|
|
f04da7c3b2 | ||
|
|
dde6a52e4b | ||
|
|
d1950a12e8 | ||
|
|
d9c2e895c9 | ||
|
|
b60f46bd34 | ||
|
|
b2547e2564 | ||
|
|
d63727b8b7 | ||
|
|
c3e3148b88 | ||
|
|
ee8916d14a | ||
|
|
7bb4e29768 | ||
|
|
f7fbbbbe88 | ||
|
|
355b724824 | ||
|
|
b53fbc5e76 | ||
|
|
e95a59e5cc |
@@ -24,26 +24,26 @@ hash rules:
|
||||
- data.minify.json
|
||||
- rules.minify.hash
|
||||
|
||||
bundle addon:
|
||||
bundle addon firefox:
|
||||
stage: build
|
||||
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:
|
||||
- master
|
||||
artifacts:
|
||||
paths:
|
||||
- ClearURLs.zip
|
||||
- ClearURLs-firefox.zip
|
||||
|
||||
#bundle addon chrome:
|
||||
#stage: build
|
||||
#script:
|
||||
#- 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/*
|
||||
#only:
|
||||
# - master
|
||||
#artifacts:
|
||||
# paths:
|
||||
# - ClearURLs-chrome.zip
|
||||
bundle addon chrome:
|
||||
stage: build
|
||||
script:
|
||||
- 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/*
|
||||
only:
|
||||
- master
|
||||
artifacts:
|
||||
paths:
|
||||
- ClearURLs-chrome.zip
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
|
||||
21
CHANGELOG.md
21
CHANGELOG.md
@@ -15,27 +15,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Require Firefox >= 55
|
||||
- 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
|
||||
|
||||
|
||||
11
README.md
11
README.md
@@ -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)
|
||||
|
||||
# <sub><img src="https://gitlab.com/ClearURLs/ClearUrls/raw/master/img/clearurls.svg" width="64px" height="64px"></sub> ClearURLs [](https://gitter.im/ClearURLs/ClearURLs)
|
||||
# <sub><img src="https://gitlab.com/KevinRoebert/ClearUrls/raw/master/img/clearurls.svg" width="64px" height="64px"></sub> ClearURLs [](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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
## 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
|
||||

|
||||
@@ -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)
|
||||
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
|
||||
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
|
||||
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).**
|
||||
|
||||
@@ -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.*
|
||||
|
||||
#### 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.
|
||||
Please push your translation into the folder `_locales/{language code}/messages.json`.
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false, request = null) {
|
||||
|
||||
let finalURL = domain;
|
||||
|
||||
if (fields.toString() !== "") finalURL += "?" + urlSearchParamsToString(fields);
|
||||
if (fields.toString() !== "") finalURL += "?" + fields.toString();
|
||||
if (fragments.toString() !== "") finalURL += "#" + fragments.toString();
|
||||
|
||||
url = finalURL.replace(new RegExp("\\?&"), "?").replace(new RegExp("#&"), "#");
|
||||
@@ -727,9 +727,3 @@ function start() {
|
||||
["blocking"]
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: Must be asked after install
|
||||
browser.permissions.request({
|
||||
permissions: ["webRequest", "webRequestBlocking", "tabs", "scripting", "webNavigation"],
|
||||
origins: ["<all_urls>"],
|
||||
});
|
||||
|
||||
@@ -48,9 +48,9 @@ function increaseBadged(quiet = false, request) {
|
||||
checkOSAndroid().then((res) => {
|
||||
if (!res) {
|
||||
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 {
|
||||
browser.action.setBadgeText({text: "", tabId: tabId}).catch(handleError);
|
||||
browser.browserAction.setBadgeText({text: "", tabId: tabId}).catch(handleError);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,29 +22,36 @@
|
||||
* 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) {
|
||||
browser.contextMenus.create({
|
||||
id: "copy-link-to-clipboard",
|
||||
title: translate("clipboard_copy_link"),
|
||||
contexts: ["link"]
|
||||
});
|
||||
|
||||
function contextMenuStart(details) {
|
||||
browser.contextMenus.create({
|
||||
id: "copy-link-to-clipboard",
|
||||
title: translate("clipboard_copy_link"),
|
||||
contexts: ["link"]
|
||||
});
|
||||
browser.contextMenus.onClicked.addListener((info, tab) => {
|
||||
if (info.menuItemId === "copy-link-to-clipboard") {
|
||||
const url = pureCleaning(info.linkUrl);
|
||||
const code = "copyToClipboard(" +
|
||||
JSON.stringify(url)+");";
|
||||
|
||||
browser.contextMenus.onClicked.addListener((info, tab) => {
|
||||
if (info.menuItemId === "copy-link-to-clipboard") {
|
||||
const url = pureCleaning(info.linkUrl);
|
||||
|
||||
browser.scripting.executeScript({
|
||||
target: {
|
||||
tabId: tab.id,
|
||||
allFrames: true
|
||||
},
|
||||
func: (text) => navigator.clipboard.writeText(text),
|
||||
args: [
|
||||
url
|
||||
]
|
||||
});
|
||||
}
|
||||
});
|
||||
browser.tabs.executeScript({
|
||||
code: "typeof copyToClipboard === 'function';",
|
||||
}).then((results) => {
|
||||
if (!results || results[0] !== true) {
|
||||
return browser.tabs.executeScript(tab.id, {
|
||||
file: "/external_js/clipboard-helper.js",
|
||||
}).catch(handleError);
|
||||
}
|
||||
}).then(() => {
|
||||
return browser.tabs.executeScript(tab.id, {
|
||||
code,
|
||||
});
|
||||
}).catch((error) => {
|
||||
console.error("Failed to copy text: " + error);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,16 +31,8 @@ function eTagFilter(requestDetails) {
|
||||
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
|
||||
requestDetails.responseHeaders[i].value = generateDummyEtag(len, quotes, w);
|
||||
requestDetails.responseHeaders[i].value = generateDummyEtag();
|
||||
|
||||
pushToLog(requestDetails.url, requestDetails.url, translate("eTag_filtering_log"));
|
||||
|
||||
@@ -50,29 +42,12 @@ function eTagFilter(requestDetails) {
|
||||
return {responseHeaders: requestDetails.responseHeaders};
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a random ETag.
|
||||
*
|
||||
* 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;
|
||||
function generateDummyEtag() {
|
||||
return Math.random().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Since Firefox 85, eTags can no longer be
|
||||
* used for tracking users over multiple sites.
|
||||
*/
|
||||
if(getBrowser() !== "Firefox") {
|
||||
browser.webRequest.onHeadersReceived.addListener(
|
||||
eTagFilter,
|
||||
{urls: ["<all_urls>"]},
|
||||
["blocking", "responseHeaders"]
|
||||
);
|
||||
}
|
||||
browser.webRequest.onHeadersReceived.addListener(
|
||||
eTagFilter,
|
||||
{urls: ["<all_urls>"]},
|
||||
["blocking", "responseHeaders"]
|
||||
);
|
||||
|
||||
@@ -17,45 +17,35 @@
|
||||
*/
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
|
||||
/*
|
||||
* This script is responsible for listen on history changes.
|
||||
* This technique is often used to inject tracking code into the location bar,
|
||||
* because all feature events will use the updated URL.
|
||||
*/
|
||||
|
||||
browser.webNavigation.onHistoryStateUpdated.addListener(historyCleaner);
|
||||
|
||||
function historyListenerStart() {
|
||||
|
||||
if(storage.historyListenerEnabled) {
|
||||
browser.webNavigation.onHistoryStateUpdated.addListener(historyCleaner);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that is triggered on history changes. Injects script into page
|
||||
* to clean links that were pushed to the history stack with the
|
||||
* history.replaceState method.
|
||||
* @param {state object} details The state object is a JavaScript object
|
||||
* which is associated with the new history entry created by replaceState()
|
||||
*/
|
||||
* Function that is triggered on history changes. Injects script into page
|
||||
* to clean links that were pushed to the history stack with the
|
||||
* history.replaceState method.
|
||||
* @param {state object} details The state object is a JavaScript object
|
||||
* which is associated with the new history entry created by replaceState()
|
||||
*/
|
||||
function historyCleaner(details) {
|
||||
if (storage.globalStatus && storage.historyListenerEnabled) {
|
||||
if(storage.globalStatus) {
|
||||
const urlBefore = details.url;
|
||||
const urlAfter = pureCleaning(details.url);
|
||||
|
||||
if (urlBefore !== urlAfter) {
|
||||
browser.scripting.executeScript({
|
||||
target: {
|
||||
tabId: details.tabId,
|
||||
frameIds: [
|
||||
details.frameId
|
||||
]
|
||||
},
|
||||
func: (url) => history.replaceState({state: null}, "", url),
|
||||
args: [
|
||||
urlAfter
|
||||
]
|
||||
}).then(() => {
|
||||
}, onError);
|
||||
if(urlBefore !== urlAfter) {
|
||||
browser.tabs.executeScript(details.tabId, {
|
||||
frameId: details.frameId,
|
||||
code: 'history.replaceState({state: "cleaned_history"},"",'+JSON.stringify(urlAfter)+');'
|
||||
}).then(() => {}, onError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,8 @@ function getData() {
|
||||
}
|
||||
}).catch(handleError);
|
||||
|
||||
loadData("historyListenerEnabled")
|
||||
loadData("contextMenuEnabled")
|
||||
.then(() => loadData("historyListenerEnabled"))
|
||||
.then(() => loadData("localHostsSkipping"))
|
||||
.then(() => loadData("referralMarketing"))
|
||||
.then(() => loadData("domainBlocking"))
|
||||
@@ -141,24 +142,11 @@ function getData() {
|
||||
.then(() => {
|
||||
changeSwitchButton("localHostsSkipping", "localHostsSkipping");
|
||||
changeSwitchButton("historyListenerEnabled", "historyListenerEnabled");
|
||||
changeSwitchButton("contextMenuEnabled", "contextMenuEnabled");
|
||||
changeSwitchButton("referralMarketing", "referralMarketing");
|
||||
changeSwitchButton("domainBlocking", "domainBlocking");
|
||||
changeSwitchButton("pingBlocking", "pingBlocking");
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -217,6 +205,7 @@ function setText() {
|
||||
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').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');
|
||||
injectText("local_hosts_skipping", "local_hosts_skipping");
|
||||
document.getElementById('export_settings_btn_text').textContent = translate('setting_html_export_button');
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
function deferSaveOnDisk(key) {
|
||||
@@ -95,20 +95,13 @@ function deferSaveOnDisk(key) {
|
||||
return;
|
||||
}
|
||||
|
||||
browser.alarms.create("deferSaveOnDisk", {
|
||||
delayInMinutes: 1
|
||||
});
|
||||
|
||||
hasPendingSaves = true;
|
||||
}
|
||||
|
||||
browser.alarms.onAlarm.addListener(function (alarmInfo) {
|
||||
if (alarmInfo.name === "deferSaveOnDisk") {
|
||||
setTimeout(function () {
|
||||
saveOnDisk(Array.from(pendingSaves));
|
||||
pendingSaves.clear();
|
||||
hasPendingSaves = false;
|
||||
}
|
||||
});
|
||||
}, 30000);
|
||||
hasPendingSaves = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start sequence for ClearURLs.
|
||||
@@ -122,6 +115,12 @@ function genesis() {
|
||||
|
||||
//Set correct icon on startup
|
||||
changeIcon();
|
||||
|
||||
// Start the context_menu
|
||||
contextMenuStart();
|
||||
|
||||
// Start history listener
|
||||
historyListenerStart();
|
||||
}, handleError);
|
||||
}
|
||||
|
||||
@@ -217,6 +216,7 @@ function initSettings() {
|
||||
storage.badged_color = "#ffa500";
|
||||
storage.hashURL = "https://rules2.clearurls.xyz/rules.minify.hash";
|
||||
storage.ruleURL = "https://rules2.clearurls.xyz/data.minify.json";
|
||||
storage.contextMenuEnabled = true;
|
||||
storage.historyListenerEnabled = true;
|
||||
storage.localHostsSkipping = true;
|
||||
storage.referralMarketing = false;
|
||||
|
||||
@@ -181,9 +181,9 @@ function changeIcon() {
|
||||
checkOSAndroid().then((res) => {
|
||||
if (!res) {
|
||||
if (storage.globalStatus) {
|
||||
browser.action.setIcon({path: "img/clearurls_128x128.png"}).catch(handleError);
|
||||
browser.browserAction.setIcon({path: "img/clearurls_128x128.png"}).catch(handleError);
|
||||
} 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;
|
||||
if (storage.badged_color.charAt(0) !== '#')
|
||||
color = '#' + storage.badged_color;
|
||||
browser.action.setBadgeBackgroundColor({
|
||||
browser.browserAction.setBadgeBackgroundColor({
|
||||
'color': color
|
||||
}).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") {
|
||||
browser.action.setBadgeTextColor({
|
||||
browser.browserAction.setBadgeTextColor({
|
||||
color: "#FFFFFF"
|
||||
}).catch(handleError);
|
||||
}
|
||||
@@ -328,30 +328,3 @@ async function sha256(message) {
|
||||
|
||||
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('&')
|
||||
}
|
||||
|
||||
@@ -24,23 +24,20 @@
|
||||
*
|
||||
* 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 __cleanURL = new URL("https://clearurls.roebert.eu").toString();
|
||||
|
||||
browser.alarms.create("watchdog", {
|
||||
periodInMinutes: 1,
|
||||
});
|
||||
|
||||
browser.alarms.onAlarm.addListener(function (alarmInfo) {
|
||||
if (alarmInfo.name === "watchdog" && isStorageAvailable() && storage.globalStatus) {
|
||||
if (new URL(pureCleaning(__dirtyURL, true)).toString() !== __cleanURL) {
|
||||
setInterval(function() {
|
||||
if(isStorageAvailable() && storage.globalStatus) {
|
||||
if(new URL(pureCleaning(__dirtyURL, true)).toString() !== __cleanURL) {
|
||||
storage.watchDogErrorCount += 1;
|
||||
console.log(translate('watchdog', storage.watchDogErrorCount));
|
||||
saveOnExit();
|
||||
if (storage.watchDogErrorCount < 3) reload();
|
||||
} else if (storage.watchDogErrorCount > 0) {
|
||||
if(storage.watchDogErrorCount < 3) reload();
|
||||
} else if(storage.watchDogErrorCount > 0){
|
||||
storage.watchDogErrorCount = 0;
|
||||
saveOnExit();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, CHECK_INTERVAL);
|
||||
|
||||
16
external_js/clipboard-helper.js
Normal file
16
external_js/clipboard-helper.js
Normal 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");
|
||||
}
|
||||
@@ -32,9 +32,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid"
|
||||
style="min-width: 200px">
|
||||
style="min-width: 200px;">
|
||||
<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">
|
||||
<span class="navbar-brand">
|
||||
<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 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="settings" target="_blank"><span class="fas fa-cog" style="font-size: 1.5em"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="globalStatus">
|
||||
@@ -91,7 +91,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<div class="progress">
|
||||
@@ -133,7 +133,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<div class="text-center">
|
||||
<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>
|
||||
<br />
|
||||
<div class="row" id="log_section">
|
||||
<div class="col-sm-4 offset-sm-4">
|
||||
<div class="col-sm-1">
|
||||
<div class="text-center">
|
||||
<a id="loggingPage" target="_blank"
|
||||
class="btn btn-default btn-sm btn-block text-wrap"></a>
|
||||
|
||||
@@ -136,6 +136,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</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>
|
||||
<label id="referral_marketing_enabled" style="font-weight: bold;"></label><br />
|
||||
<label class="switch">
|
||||
@@ -150,7 +157,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</p>
|
||||
<p id="etag_p">
|
||||
<p>
|
||||
<label id="eTag_filtering_enabled" style="font-weight: bold;"></label><br />
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="eTagFiltering">
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"manifest_version": 2,
|
||||
"name": "ClearURLs",
|
||||
"version": "1.28.0",
|
||||
"version": "1.25.0",
|
||||
"author": "Kevin Roebert",
|
||||
"description": "__MSG_extension_description__",
|
||||
"homepage_url": "https://docs.clearurls.xyz",
|
||||
"default_locale": "en",
|
||||
"content_security_policy": {
|
||||
"extension_pages": "script-src 'self'; object-src 'none'"
|
||||
},
|
||||
"browser_specific_settings": {
|
||||
"content_security_policy": "script-src 'self'; object-src 'none'",
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "{74145f27-f039-47ce-a470-a662b129930a}"
|
||||
}
|
||||
@@ -27,7 +25,8 @@
|
||||
"96": "img/clearurls_96x96.png",
|
||||
"128": "img/clearurls_128x128.png"
|
||||
},
|
||||
"action": {
|
||||
"browser_action": {
|
||||
"browser_style": true,
|
||||
"default_icon": {
|
||||
"16": "img/clearurls_16x16.png",
|
||||
"19": "img/clearurls_19x19.png",
|
||||
@@ -45,6 +44,7 @@
|
||||
"default_popup": "html/popup.html"
|
||||
},
|
||||
"permissions": [
|
||||
"<all_urls>",
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"storage",
|
||||
@@ -52,12 +52,7 @@
|
||||
"contextMenus",
|
||||
"webNavigation",
|
||||
"tabs",
|
||||
"downloads",
|
||||
"scripting",
|
||||
"alarms"
|
||||
],
|
||||
"host_permissions": [
|
||||
"<all_urls>"
|
||||
"downloads"
|
||||
],
|
||||
"background": {
|
||||
"scripts": [
|
||||
|
||||
Reference in New Issue
Block a user