Brave-Detection-Blocker-Chr.../block-script.js

51 lines
1.7 KiB
JavaScript
Raw Normal View History

2022-03-27 11:43:26 +00:00
let nav = function Navigator() {};
let copyNavRef = window.navigator;
nav = nav.bind(function () {
return window.navigator;
});
newNav = new nav();
2022-03-30 07:14:16 +00:00
const navClones = {
2022-03-27 11:43:26 +00:00
userAgent: window.navigator.userAgent,
appVersion: window.navigator.appVersion,
platform: window.navigator.platform,
vendor: window.navigator.vendor,
2022-03-28 15:26:32 +00:00
language: window.navigator.language,
2022-04-05 09:43:03 +00:00
oscpu: window.navigator.oscpu,
2022-03-28 17:54:45 +00:00
cookieEnabled: true,
2022-03-28 18:26:22 +00:00
appCodeName: window.navigator.appCodeName,
appName: window.navigator.appName,
product: window.navigator.product,
geolocation: window.navigator.geolocation,
onLine: window.navigator.onLine,
2022-03-28 19:47:37 +00:00
sendBeacon: window.navigator.sendBeacon.bind(window.navigator),
getBattery: window.navigator.getBattery.bind(window.navigator),
2022-03-30 07:14:16 +00:00
vibrate: window.navigator.vibrate.bind(window.navigator),
share: window.navigator.share.bind(window.navigator),
canShare: window.navigator.canShare.bind(window.navigator),
registerProtocolHandler: window.navigator.registerProtocolHandler.bind(window.navigator),
requestMediaKeySystemAccess: window.navigator.requestMediaKeySystemAccess.bind(window.navigator),
requestMIDIAccess: window.navigator.requestMIDIAccess.bind(window.navigator),
2022-04-05 09:43:03 +00:00
bluetooth: window.navigator.bluetooth.bind(window.navigator),
onLine: window.navigator.onLine,
2022-03-25 18:10:48 +00:00
};
2022-04-05 09:43:03 +00:00
const skipPropList = [...Object.keys(navClones), 'brave'];
2022-03-25 18:10:48 +00:00
for (let prop in window.navigator) {
2022-04-05 09:43:03 +00:00
if (skipPropList.includes(prop)) {
2022-03-25 18:10:48 +00:00
continue;
}
2022-03-28 19:47:37 +00:00
newNav[prop] = copyNavRef[prop];
2022-03-25 18:10:48 +00:00
}
2022-03-30 07:14:16 +00:00
for (let prop in navClones) {
navClones.hasOwnProperty(prop) &&
2022-03-25 18:10:48 +00:00
Object.defineProperty(newNav, prop, {
2022-03-30 07:14:16 +00:00
value: navClones[prop],
2022-03-25 18:10:48 +00:00
writable: true,
});
}
Object.defineProperty(window, 'navigator', {
value: newNav,
writable: true,
2022-03-27 11:43:26 +00:00
enumerable: true,
configurable: true,
2022-04-05 09:43:03 +00:00
});