1. deletes more browser-specific properties. 2. adds more domains to the exception list
This commit is contained in:
parent
90c6e1e165
commit
00efe329a4
1 changed files with 43 additions and 11 deletions
|
@ -27,7 +27,13 @@ const prefs = {
|
||||||
'color': '#777',
|
'color': '#777',
|
||||||
'cache': true,
|
'cache': true,
|
||||||
'exactMatch': false,
|
'exactMatch': false,
|
||||||
'protected': ['google.com/recaptcha', 'gstatic.com/recaptcha'],
|
'protected': [
|
||||||
|
'google.com/recaptcha',
|
||||||
|
'gstatic.com/recaptcha',
|
||||||
|
'accounts.google.com',
|
||||||
|
'accounts.youtube.com',
|
||||||
|
'gitlab.com/users/sign_in'
|
||||||
|
],
|
||||||
'parser': {}, // maps ua string to a ua object,
|
'parser': {}, // maps ua string to a ua object,
|
||||||
'log': false,
|
'log': false,
|
||||||
'json-guid': 'na'
|
'json-guid': 'na'
|
||||||
|
@ -248,9 +254,24 @@ const ua = {
|
||||||
}
|
}
|
||||||
if (isFF) {
|
if (isFF) {
|
||||||
o.oscpu = ((p.os.name || '') + ' ' + (p.os.version || '')).trim();
|
o.oscpu = ((p.os.name || '') + ' ' + (p.os.version || '')).trim();
|
||||||
|
o.userAgentData = '[delete]';
|
||||||
|
o.productSub = '20100101';
|
||||||
|
o.buildID = '20181001000000';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
o.oscpu = '[delete]';
|
o.oscpu = '[delete]';
|
||||||
|
o.buildID = '[delete]';
|
||||||
|
o.productSub = '20030107';
|
||||||
|
if (p.browser && p.browser.major) {
|
||||||
|
o.userAgentData = {
|
||||||
|
brands: [
|
||||||
|
{brand: ' Not A;Brand', version: '99'},
|
||||||
|
{brand: 'Chromium', version: p.browser.major},
|
||||||
|
{brand: 'Google Chrome', version: p.browser.major}
|
||||||
|
],
|
||||||
|
mobile: false
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o.userAgent === 'empty') {
|
if (o.userAgent === 'empty') {
|
||||||
|
@ -406,6 +427,10 @@ function match({url, tabId, cookieStoreId = DCSI}) {
|
||||||
log('match', url, tabId, cookieStoreId);
|
log('match', url, tabId, cookieStoreId);
|
||||||
const h = hostname(url);
|
const h = hostname(url);
|
||||||
|
|
||||||
|
if (prefs.protected.some(s => url.indexOf(s) !== -1)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (prefs.mode === 'blacklist') {
|
if (prefs.mode === 'blacklist') {
|
||||||
if (prefs.blacklist.length) {
|
if (prefs.blacklist.length) {
|
||||||
return prefs.blacklist.some(s => {
|
return prefs.blacklist.some(s => {
|
||||||
|
@ -501,7 +526,11 @@ const onBeforeSendHeaders = d => {
|
||||||
|
|
||||||
const str = o ? o.userAgent : '';
|
const str = o ? o.userAgent : '';
|
||||||
if (str && requestHeaders.length) {
|
if (str && requestHeaders.length) {
|
||||||
for (let i = 0, name = requestHeaders[0].name; i < requestHeaders.length; i += 1, name = (requestHeaders[i] || {}).name) {
|
for (
|
||||||
|
let i = 0, name = requestHeaders[0].name;
|
||||||
|
i < requestHeaders.length;
|
||||||
|
i += 1, name = (requestHeaders[i] || {}).name
|
||||||
|
) {
|
||||||
if (name === 'User-Agent' || name === 'user-agent') {
|
if (name === 'User-Agent' || name === 'user-agent') {
|
||||||
requestHeaders[i].value = str === 'empty' ? '' : str;
|
requestHeaders[i].value = str === 'empty' ? '' : str;
|
||||||
return {
|
return {
|
||||||
|
@ -530,16 +559,19 @@ const onCommitted = d => {
|
||||||
script.textContent = \`{
|
script.textContent = \`{
|
||||||
document.currentScript.dataset.injected = true;
|
document.currentScript.dataset.injected = true;
|
||||||
const o = JSON.parse('${JSON.stringify(o)}');
|
const o = JSON.parse('${JSON.stringify(o)}');
|
||||||
|
|
||||||
for (const key of Object.keys(o)) {
|
for (const key of Object.keys(o)) {
|
||||||
navigator.__defineGetter__(key, () => {
|
if (o[key] === '[delete]') {
|
||||||
if (o[key] === '[delete]') {
|
delete Object.getPrototypeOf(window.navigator)[key];
|
||||||
return undefined;
|
}
|
||||||
}
|
else {
|
||||||
else if (o[key] === 'empty') {
|
navigator.__defineGetter__(key, () => {
|
||||||
return '';
|
if (o[key] === 'empty') {
|
||||||
}
|
return '';
|
||||||
return o[key];
|
}
|
||||||
});
|
return o[key];
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}\`;
|
}\`;
|
||||||
document.documentElement.appendChild(script);
|
document.documentElement.appendChild(script);
|
||||||
|
|
Loading…
Reference in a new issue