Skip to content

Commit 33a18c3

Browse files
committed
Convert fingerprint2.js scriptlet into a redirectable resource
As per internal discussion with volunteer filter list maintainers.
1 parent 348f5aa commit 33a18c3

File tree

3 files changed

+40
-19
lines changed

3 files changed

+40
-19
lines changed

assets/resources/scriptlets.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,25 +1554,6 @@
15541554
})();
15551555

15561556

1557-
// https://github.com/uBlockOrigin/uAssets/issues/2912
1558-
/// fingerprint2.js
1559-
(function() {
1560-
let browserId = '';
1561-
for ( let i = 0; i < 8; i++ ) {
1562-
browserId += (Math.random() * 0x10000 + 0x1000 | 0).toString(16).slice(-4);
1563-
}
1564-
const fp2 = function(){};
1565-
fp2.get = function(opts, cb) {
1566-
if ( !cb ) { cb = opts; }
1567-
setTimeout(( ) => { cb(browserId, []); }, 1);
1568-
};
1569-
fp2.prototype = {
1570-
get: fp2.get
1571-
};
1572-
window.Fingerprint2 = fp2;
1573-
})();
1574-
1575-
15761557
// https://github.com/NanoAdblocker/NanoFilters/issues/149
15771558
/// cookie-remover.js
15781559
(function() {

src/js/redirect-engine.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ const redirectableResources = new Map([
8080
[ 'empty', {
8181
data: 'text', // Important!
8282
} ],
83+
[ 'fingerprint2.js', {
84+
data: 'text',
85+
} ],
8386
[ 'google-analytics_analytics.js', {
8487
alias: [
8588
'google-analytics.com/analytics.js',
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*******************************************************************************
2+
3+
uBlock Origin - a browser extension to block requests.
4+
Copyright (C) 2014-present Raymond Hill
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see {http://www.gnu.org/licenses/}.
18+
19+
Home: https://github.com/gorhill/uBlock
20+
*/
21+
22+
(function() {
23+
'use strict';
24+
let browserId = '';
25+
for ( let i = 0; i < 8; i++ ) {
26+
browserId += (Math.random() * 0x10000 + 0x1000 | 0).toString(16).slice(-4);
27+
}
28+
const fp2 = function(){};
29+
fp2.get = function(opts, cb) {
30+
if ( !cb ) { cb = opts; }
31+
setTimeout(( ) => { cb(browserId, []); }, 1);
32+
};
33+
fp2.prototype = {
34+
get: fp2.get
35+
};
36+
window.Fingerprint2 = fp2;
37+
})();

0 commit comments

Comments
 (0)