This commit is contained in:
Canis familiaris 2023-12-14 09:53:17 +00:00
parent 4c3c235297
commit 908782947a
4 changed files with 88 additions and 7 deletions

View File

@ -6,6 +6,6 @@ However, keep in mind that there may be some limitations due to your browser's r
If you can use "[Are links vulnerable to MITM attack?](../../subfiles/addon/ismm.md)" add-on, it is **recommended** to use it instead of the script for better protection and performance.
- The UserScript (use EITHER, not both)
- [Remove CF link](cf.remove.user.js); remove the link
- [Color CF link](cf.color.user.js); mark the link
- [Remove CF link](cf.remove.user.js); Remove the link
- [Color CF link](cf.color.user.js); Mark the link
- [Replace CF link](cf.replace.user.js); Mark & Replace the link to archived page

View File

@ -2,7 +2,7 @@
// @name Mark CloudFlare links
// @description Mark CloudFlare links
// @namespace deCloudflare_us_color-cf
// @author Matthew L. Tanner
// @author Matthew L. Tanner, CrimeFlare
// @match https://*/*
// @match http://*/*
// @version 1.0.0.1
@ -65,7 +65,9 @@ if (!DONT_RUN_FQDNS.includes(fqdn_self) && !/\.crimeflare\.eu\.org$/.test(fqdn_s
if (fqdns[fqdn] == undefined) {
fqdns[fqdn] = [];
}
fqdns[fqdn].push(l);
if (!/^(|(*.)\.)archive\.org$/.test(fqdn)) {
fqdns[fqdn].push(l);
}
l.setAttribute('xcf', 'q');
}
} catch (x) {}

View File

@ -2,7 +2,7 @@
// @name Remove CloudFlare links
// @description Remove CloudFlare links
// @namespace deCloudflare_us_remove-cf
// @author Matthew L. Tanner
// @author Matthew L. Tanner, CrimeFlare
// @match https://*/*
// @match http://*/*
// @version 1.0.0.1
@ -59,7 +59,9 @@ if (!DONT_RUN_FQDNS.includes(fqdn_self) && !/\.crimeflare\.eu\.org$/.test(fqdn_s
if (fqdns[fqdn] == undefined) {
fqdns[fqdn] = [];
}
fqdns[fqdn].push(l);
if (!/^(|(*.)\.)archive\.org$/.test(fqdn)) {
fqdns[fqdn].push(l);
}
l.setAttribute('xcf', 'q');
}
} catch (x) {}

View File

@ -0,0 +1,77 @@
// ==UserScript==
// @name Replace CloudFlare links
// @description Replace CloudFlare links
// @namespace deCloudflare_us_replace-cf
// @author Matthew L. Tanner, CrimeFlare
// @match https://*/*
// @match http://*/*
// @version 1.0.0.1
// @grant none
// @run-at document-end
// @license MIT
// ==/UserScript==
// this script will not run on those sites
// e.g. ['www.youtube.com','www.google.com']
let DONT_RUN_FQDNS = [];
//-----
// [Documentation] https://0xacab.org/dCF/deCloudflare/-/blob/master/tool/userscripts/README.md
// [About API] http://about-karmaapi.go.crimeflare.eu.org
const api_url = 'https://karma.crimeflare.eu.org/api/is/cloudflare/';
let fqdns = {},
fqdn_self = location.hostname;
function mark_fqdn(fl) {
try {
if (fl == '') {
return;
}
fetch(api_url, {
method: 'POST',
mode: 'cors',
body: 'ff=' + fl,
referrer: '',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(x => x.json()).then(x => {
for (let xx in x) {
if (fqdns[xx]) {
if (x[xx]) {
fqdns[xx].forEach(qs => {
qs.setAttribute('xcf', 'y');
qs.href = 'https://web.archive.org/web/' + qs.href;
});
} else {
fqdns[xx].forEach(qs => {
qs.setAttribute('xcf', 'n');
});
}
delete fqdns[xx];
}
}
}).catch(x => {});
} catch (x) {}
}
if (!DONT_RUN_FQDNS.includes(fqdn_self) && !/\.crimeflare\.eu\.org$/.test(fqdn_self)) {
try {
const style = document.createElement('style');
document.head.appendChild(style);
const styleSheet = style.sheet;
styleSheet.insertRule("a[xcf='y']{background:#f9ab1d;opacity:0.6}", 0);
} catch (x) {}
document.querySelectorAll('a[href]:not([xcf])').forEach(l => {
try {
let u = new URL(l.href);
if (u.hostname != fqdn_self && (u.protocol == 'https:' || u.protocol == 'http:')) {
let fqdn = u.hostname;
if (fqdns[fqdn] == undefined) {
fqdns[fqdn] = [];
}
if (!/^(|(*.)\.)archive\.org$/.test(fqdn)) {
fqdns[fqdn].push(l);
}
l.setAttribute('xcf', 'q');
}
} catch (x) {}
});
mark_fqdn(Object.keys(fqdns).join(','));
}