mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 21:00:23 +01:00
navigator.oscpu and navigator.buildID are undefined in non Gecko browsers
Fixes #411
This commit is contained in:
parent
1aff68d802
commit
59ad6fc7d6
@ -58,6 +58,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function parseString(string, stack){
|
function parseString(string, stack){
|
||||||
|
if (string === "{undefined}"){
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
return string.replace(/{([a-z[\]_. -]*)}/ig, function(m, name){
|
return string.replace(/{([a-z[\]_. -]*)}/ig, function(m, name){
|
||||||
return getValue(name, stack.slice());
|
return getValue(name, stack.slice());
|
||||||
});
|
});
|
||||||
|
@ -52,7 +52,11 @@
|
|||||||
const presetProperties = presets[presetName];
|
const presetProperties = presets[presetName];
|
||||||
function checkActive(currentProperties){
|
function checkActive(currentProperties){
|
||||||
if (Object.keys(presetProperties).every(function(property){
|
if (Object.keys(presetProperties).every(function(property){
|
||||||
return currentProperties[property] === presetProperties[property];
|
let value = presetProperties[property];
|
||||||
|
if ((typeof value) === "function"){
|
||||||
|
value = value(currentProperties);
|
||||||
|
}
|
||||||
|
return value === currentProperties[property];
|
||||||
})){
|
})){
|
||||||
li.classList.add("active");
|
li.classList.add("active");
|
||||||
}
|
}
|
||||||
@ -74,7 +78,11 @@
|
|||||||
delete data[property];
|
delete data[property];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data[property] = presetProperties[property];
|
let value = presetProperties[property];
|
||||||
|
if ((typeof value) === "function"){
|
||||||
|
value = value(data);
|
||||||
|
}
|
||||||
|
data[property] = value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
settings.navigatorDetails = data;
|
settings.navigatorDetails = data;
|
||||||
@ -84,30 +92,55 @@
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const firefoxOscpu = {
|
||||||
|
Windows: "{platformDetails}",
|
||||||
|
Linux: "{platform}",
|
||||||
|
"Mac OS X": "Intel Mac OS X 10.14.3",
|
||||||
|
"": "{original value}"
|
||||||
|
};
|
||||||
|
|
||||||
const osPresets = {
|
const osPresets = {
|
||||||
Windows: {
|
Windows: {
|
||||||
|
osPreset: "Windows",
|
||||||
windowManager: "Windows",
|
windowManager: "Windows",
|
||||||
platform: "Win32",
|
platform: "Win32",
|
||||||
platformDetails: "Windows NT 10.0; Win64; x64",
|
platformDetails: "Windows NT 10.0; Win64; x64",
|
||||||
oscpu: "{platformDetails}"
|
oscpu: function(currentProperties){
|
||||||
|
if (currentProperties.browserPreset === "Firefox"){
|
||||||
|
return firefoxOscpu.Windows;
|
||||||
|
}
|
||||||
|
return "{undefined}";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Linux: {
|
Linux: {
|
||||||
|
osPreset: "Linux",
|
||||||
windowManager: "X11",
|
windowManager: "X11",
|
||||||
platform: "Linux x86_64",
|
platform: "Linux x86_64",
|
||||||
platformDetails: "X11; Linux x86_64",
|
platformDetails: "X11; Linux x86_64",
|
||||||
oscpu: "{platform}"
|
oscpu: function(currentProperties){
|
||||||
|
if (currentProperties.browserPreset === "Firefox"){
|
||||||
|
return firefoxOscpu.Linux;
|
||||||
|
}
|
||||||
|
return "{undefined}";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Mac OS X": {
|
"Mac OS X": {
|
||||||
|
osPreset: "Mac OS X",
|
||||||
windowManager: "Macintosh",
|
windowManager: "Macintosh",
|
||||||
platform: "MacIntel",
|
platform: "MacIntel",
|
||||||
platformDetails: "Macintosh; {oscpu}",
|
platformDetails: "Macintosh; Intel Mac OS X 10.14.3",
|
||||||
oscpu: "Intel Mac OS X 10.14.3"
|
oscpu: function(currentProperties){
|
||||||
|
if (currentProperties.browserPreset === "Firefox"){
|
||||||
|
return firefoxOscpu["Mac OS X"];
|
||||||
|
}
|
||||||
|
return "{undefined}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const browserPresets = {
|
const browserPresets = {
|
||||||
Edge: {
|
Edge: {
|
||||||
|
browserPreset: "Edge",
|
||||||
chromeVersion: "71.0.3578.98",
|
chromeVersion: "71.0.3578.98",
|
||||||
edgeVersion: "17.17134",
|
edgeVersion: "17.17134",
|
||||||
firefoxVersion: undefined,
|
firefoxVersion: undefined,
|
||||||
@ -116,11 +149,14 @@
|
|||||||
|
|
||||||
appVersion: "5.0 ({platformDetails}) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
appVersion: "5.0 ({platformDetails}) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
||||||
"Chrome/{chromeVersion} Safari/537.36 Edge/{edgeVersion}",
|
"Chrome/{chromeVersion} Safari/537.36 Edge/{edgeVersion}",
|
||||||
|
buildID: "{undefined}",
|
||||||
|
oscpu: "{undefined}",
|
||||||
productSub: "20030107",
|
productSub: "20030107",
|
||||||
userAgent: "Mozilla/{appVersion}",
|
userAgent: "Mozilla/{appVersion}",
|
||||||
vendor: undefined,
|
vendor: undefined,
|
||||||
},
|
},
|
||||||
Opera: {
|
Opera: {
|
||||||
|
browserPreset: "Opera",
|
||||||
chromeVersion: "71.0.3578.98",
|
chromeVersion: "71.0.3578.98",
|
||||||
edgeVersion: undefined,
|
edgeVersion: undefined,
|
||||||
firefoxVersion: undefined,
|
firefoxVersion: undefined,
|
||||||
@ -129,11 +165,14 @@
|
|||||||
|
|
||||||
appVersion: "5.0 ({platformDetails}) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
appVersion: "5.0 ({platformDetails}) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
||||||
"Chrome/{chromeVersion} Safari/537.36 OPR/{operaVersion}",
|
"Chrome/{chromeVersion} Safari/537.36 OPR/{operaVersion}",
|
||||||
|
buildID: "{undefined}",
|
||||||
|
oscpu: "{undefined}",
|
||||||
productSub: "20030107",
|
productSub: "20030107",
|
||||||
userAgent: "Mozilla/{appVersion}",
|
userAgent: "Mozilla/{appVersion}",
|
||||||
vendor: "Google Inc.",
|
vendor: "Google Inc.",
|
||||||
},
|
},
|
||||||
Chrome: {
|
Chrome: {
|
||||||
|
browserPreset: "Chrome",
|
||||||
chromeVersion: "71.0.3578.98",
|
chromeVersion: "71.0.3578.98",
|
||||||
edgeVersion: undefined,
|
edgeVersion: undefined,
|
||||||
firefoxVersion: undefined,
|
firefoxVersion: undefined,
|
||||||
@ -142,11 +181,14 @@
|
|||||||
|
|
||||||
appVersion: "5.0 ({platformDetails}) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
appVersion: "5.0 ({platformDetails}) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
||||||
"Chrome/{chromeVersion} Safari/537.36",
|
"Chrome/{chromeVersion} Safari/537.36",
|
||||||
|
buildID: "{undefined}",
|
||||||
|
oscpu: "{undefined}",
|
||||||
productSub: "20030107",
|
productSub: "20030107",
|
||||||
userAgent: "Mozilla/{appVersion}",
|
userAgent: "Mozilla/{appVersion}",
|
||||||
vendor: "Google Inc.",
|
vendor: "Google Inc.",
|
||||||
},
|
},
|
||||||
Safari: {
|
Safari: {
|
||||||
|
browserPreset: "Safari",
|
||||||
chromeVersion: undefined,
|
chromeVersion: undefined,
|
||||||
edgeVersion: undefined,
|
edgeVersion: undefined,
|
||||||
firefoxVersion: undefined,
|
firefoxVersion: undefined,
|
||||||
@ -155,11 +197,14 @@
|
|||||||
|
|
||||||
appVersion: "5.0 ({platformDetails}) AppleWebKit/605.1.15 (KHTML, like Gecko) " +
|
appVersion: "5.0 ({platformDetails}) AppleWebKit/605.1.15 (KHTML, like Gecko) " +
|
||||||
"Version/{safariVersion} Safari/605.1.15",
|
"Version/{safariVersion} Safari/605.1.15",
|
||||||
|
buildID: "{undefined}",
|
||||||
|
oscpu: "{undefined}",
|
||||||
productSub: "20030107",
|
productSub: "20030107",
|
||||||
userAgent: "Mozilla/{appVersion}",
|
userAgent: "Mozilla/{appVersion}",
|
||||||
vendor: "Apple Computer, Inc.",
|
vendor: "Apple Computer, Inc.",
|
||||||
},
|
},
|
||||||
Firefox: {
|
Firefox: {
|
||||||
|
browserPreset: "Firefox",
|
||||||
chromeVersion: undefined,
|
chromeVersion: undefined,
|
||||||
edgeVersion: undefined,
|
edgeVersion: undefined,
|
||||||
firefoxVersion: "{real Firefox version}",
|
firefoxVersion: "{real Firefox version}",
|
||||||
@ -168,6 +213,9 @@
|
|||||||
|
|
||||||
appVersion: "5.0 ({windowManager})",
|
appVersion: "5.0 ({windowManager})",
|
||||||
buildID: "20181001000000",
|
buildID: "20181001000000",
|
||||||
|
oscpu: function(currentProperties){
|
||||||
|
return firefoxOscpu[currentProperties.osPreset || ""] || "{original value}";
|
||||||
|
},
|
||||||
productSub: "20100101",
|
productSub: "20100101",
|
||||||
userAgent: "Mozilla/5.0 ({platformDetails}; rv:{firefoxVersion}) Gecko/20100101 Firefox/{firefoxVersion}",
|
userAgent: "Mozilla/5.0 ({platformDetails}; rv:{firefoxVersion}) Gecko/20100101 Firefox/{firefoxVersion}",
|
||||||
vendor: undefined,
|
vendor: undefined,
|
||||||
|
@ -9,6 +9,7 @@ Version 0.5.15:
|
|||||||
fixes:
|
fixes:
|
||||||
- background color of the textarea in the settings export was not readable in the dark theme when the value was invalid
|
- background color of the textarea in the settings export was not readable in the dark theme when the value was invalid
|
||||||
- settings sanitation: added missing APIs
|
- settings sanitation: added missing APIs
|
||||||
|
- navigator.oscpu and navigator.buildID are undefined in non Gecko browsers
|
||||||
|
|
||||||
known issues:
|
known issues:
|
||||||
- if a data URL is blocked the page action button does not appear
|
- if a data URL is blocked the page action button does not appear
|
||||||
|
Loading…
x
Reference in New Issue
Block a user