1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

Convert fingerprint2.js scriptlet into a redirectable resource

As per internal discussion with volunteer filter list
maintainers.
This commit is contained in:
Raymond Hill 2021-09-18 10:55:22 -04:00
parent 348f5aa2aa
commit 33a18c3a1e
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 40 additions and 19 deletions

View File

@ -1554,25 +1554,6 @@
})();
// https://github.com/uBlockOrigin/uAssets/issues/2912
/// fingerprint2.js
(function() {
let browserId = '';
for ( let i = 0; i < 8; i++ ) {
browserId += (Math.random() * 0x10000 + 0x1000 | 0).toString(16).slice(-4);
}
const fp2 = function(){};
fp2.get = function(opts, cb) {
if ( !cb ) { cb = opts; }
setTimeout(( ) => { cb(browserId, []); }, 1);
};
fp2.prototype = {
get: fp2.get
};
window.Fingerprint2 = fp2;
})();
// https://github.com/NanoAdblocker/NanoFilters/issues/149
/// cookie-remover.js
(function() {

View File

@ -80,6 +80,9 @@ const redirectableResources = new Map([
[ 'empty', {
data: 'text', // Important!
} ],
[ 'fingerprint2.js', {
data: 'text',
} ],
[ 'google-analytics_analytics.js', {
alias: [
'google-analytics.com/analytics.js',

View File

@ -0,0 +1,37 @@
/*******************************************************************************
uBlock Origin - a browser extension to block requests.
Copyright (C) 2014-present Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see {http://www.gnu.org/licenses/}.
Home: https://github.com/gorhill/uBlock
*/
(function() {
'use strict';
let browserId = '';
for ( let i = 0; i < 8; i++ ) {
browserId += (Math.random() * 0x10000 + 0x1000 | 0).toString(16).slice(-4);
}
const fp2 = function(){};
fp2.get = function(opts, cb) {
if ( !cb ) { cb = opts; }
setTimeout(( ) => { cb(browserId, []); }, 1);
};
fp2.prototype = {
get: fp2.get
};
window.Fingerprint2 = fp2;
})();