mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 21:00:23 +01:00
Improved storage of protected API features
This commit is contained in:
parent
1430b89d55
commit
cc776b48de
@ -251,8 +251,8 @@
|
|||||||
if (
|
if (
|
||||||
funcStatus.active &&
|
funcStatus.active &&
|
||||||
(
|
(
|
||||||
!protectedAPIFeatures.hasOwnProperty(name) ||
|
!protectedAPIFeatures.hasOwnProperty(name + " @ " + changedFunction.api) ||
|
||||||
protectedAPIFeatures[name]
|
protectedAPIFeatures[name + " @ " + changedFunction.api]
|
||||||
)
|
)
|
||||||
){
|
){
|
||||||
if (funcStatus.mode === "ask"){
|
if (funcStatus.mode === "ask"){
|
||||||
@ -383,8 +383,8 @@
|
|||||||
if (
|
if (
|
||||||
functionStatus.active &&
|
functionStatus.active &&
|
||||||
(
|
(
|
||||||
!protectedAPIFeatures.hasOwnProperty(name) ||
|
!protectedAPIFeatures.hasOwnProperty(name + " @ " + changedGetter.api) ||
|
||||||
protectedAPIFeatures[name]
|
protectedAPIFeatures[name + " @ " + changedGetter.api]
|
||||||
)
|
)
|
||||||
){
|
){
|
||||||
switch (functionStatus.mode){
|
switch (functionStatus.mode){
|
||||||
|
@ -91,44 +91,45 @@
|
|||||||
defaultValue: {},
|
defaultValue: {},
|
||||||
keys: [
|
keys: [
|
||||||
{name: "Canvas-API", level: 1},
|
{name: "Canvas-API", level: 1},
|
||||||
"getContext",
|
"getContext @ canvas",
|
||||||
{message: "readout", level: 2},
|
{message: "readout", level: 2},
|
||||||
"toDataURL", "toBlob", "mozGetAsFile", "getImageData",
|
"toDataURL @ canvas", "toBlob @ canvas", "mozGetAsFile @ canvas", "getImageData @ canvas",
|
||||||
"isPointInPath", "isPointInStroke",
|
"isPointInPath @ canvas", "isPointInStroke @ canvas",
|
||||||
{message: "input", level: 2},
|
{message: "input", level: 2},
|
||||||
"fillText", "strokeText",
|
"fillText @ canvas", "strokeText @ canvas",
|
||||||
{name: "webGL", level: 2},
|
{name: "webGL", level: 2},
|
||||||
"readPixels", "getParameter",
|
"readPixels @ canvas", "getParameter @ canvas",
|
||||||
{name: "Audio-API", level: 1},
|
{name: "Audio-API", level: 1},
|
||||||
"getFloatFrequencyData", "getByteFrequencyData", "getFloatTimeDomainData", "getByteTimeDomainData",
|
"getFloatFrequencyData @ audio", "getByteFrequencyData @ audio",
|
||||||
"getChannelData", "copyFromChannel",
|
"getFloatTimeDomainData @ audio", "getByteTimeDomainData @ audio",
|
||||||
"getFrequencyResponse",
|
"getChannelData @ audio", "copyFromChannel @ audio",
|
||||||
|
"getFrequencyResponse @ audio",
|
||||||
{name: "History-API", level: 1},
|
{name: "History-API", level: 1},
|
||||||
"length",
|
"length @ history",
|
||||||
{name: "Window-API", level: 1},
|
{name: "Window-API", level: 1},
|
||||||
"opener",
|
"opener @ window",
|
||||||
"name",
|
"name @ window",
|
||||||
{name: "DOMRect-API", level: 1},
|
{name: "DOMRect-API", level: 1},
|
||||||
"getClientRects",
|
"getClientRects @ domRect",
|
||||||
"getBoundingClientRect",
|
"getBoundingClientRect @ domRect",
|
||||||
"getBounds",
|
"getBounds @ domRect",
|
||||||
"getBBox",
|
"getBBox @ domRect",
|
||||||
"getExtentOfChar",
|
"getExtentOfChar @ domRect",
|
||||||
"intersectionRect",
|
"intersectionRect @ domRect",
|
||||||
"boundingClientRect",
|
"boundingClientRect @ domRect",
|
||||||
"rootBounds",
|
"rootBounds",
|
||||||
{name: "Navigator-API", level: 1},
|
{name: "Navigator-API", level: 1},
|
||||||
"appCodeName",
|
"appCodeName @ navigator",
|
||||||
"appName",
|
"appName @ navigator",
|
||||||
"appVersion",
|
"appVersion @ navigator",
|
||||||
"buildID",
|
"buildID @ navigator",
|
||||||
"oscpu",
|
"oscpu @ navigator",
|
||||||
"platform",
|
"platform @ navigator",
|
||||||
"product",
|
"product @ navigator",
|
||||||
"productSub",
|
"productSub @ navigator",
|
||||||
"userAgent",
|
"userAgent @ navigator",
|
||||||
"vendor",
|
"vendor @ navigator",
|
||||||
"vendorSub"
|
"vendorSub @ navigator",
|
||||||
],
|
],
|
||||||
defaultKeyValue: true
|
defaultKeyValue: true
|
||||||
},
|
},
|
||||||
@ -356,7 +357,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "storageVersion",
|
name: "storageVersion",
|
||||||
defaultValue: 0.5,
|
defaultValue: 0.6,
|
||||||
fixed: true
|
fixed: true
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
else {
|
else {
|
||||||
scope = require.register("./settingsMigration", {});
|
scope = require.register("./settingsMigration", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const settingDefinitions = require("./settingDefinitions");
|
||||||
|
|
||||||
scope.validVersions = [undefined, 0.1, 0.2, 0.3, 0.4, 0.5];
|
scope.validVersions = [undefined, 0.1, 0.2, 0.3, 0.4, 0.5];
|
||||||
scope.transitions = {
|
scope.transitions = {
|
||||||
"": function(oldStorage){
|
"": function(oldStorage){
|
||||||
@ -129,7 +132,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newStorage;
|
return newStorage;
|
||||||
|
},
|
||||||
|
0.5: function(oldStorage){
|
||||||
|
var newStorage = {
|
||||||
|
storageVersion: 0.6
|
||||||
|
};
|
||||||
|
|
||||||
|
if (oldStorage.hasOwnProperty("protectedAPIFeatures")){
|
||||||
|
const protectedAPIFeatures = {};
|
||||||
|
const protectedAPIFeaturesKeys = settingDefinitions.filter(function(definition){
|
||||||
|
return definition.name === "protectedAPIFeatures";
|
||||||
|
})[0].keys.filter(function(key){
|
||||||
|
return typeof key === "string";
|
||||||
|
});
|
||||||
|
Object.keys(oldStorage.protectedAPIFeatures).forEach(function(key){
|
||||||
|
const matchingKeys = protectedAPIFeaturesKeys.filter(function(definedKey){
|
||||||
|
return definedKey.startsWith(key);
|
||||||
|
});
|
||||||
|
if (matchingKeys.length){
|
||||||
|
protectedAPIFeatures[matchingKeys[0]] = oldStorage.protectedAPIFeatures[key];
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
newStorage.protectedAPIFeatures = protectedAPIFeatures;
|
||||||
|
}
|
||||||
|
return newStorage;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
scope.check = function(storage, {settings, logging, changeValue, urlContainer}){
|
scope.check = function(storage, {settings, logging, changeValue, urlContainer}){
|
||||||
|
@ -174,7 +174,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let nameCell = document.createElement("td");
|
let nameCell = document.createElement("td");
|
||||||
nameCell.textContent = key;
|
nameCell.textContent = setting.display.replaceKeyPattern?
|
||||||
|
key.replace(setting.display.replaceKeyPattern, ""):
|
||||||
|
key;
|
||||||
row.appendChild(nameCell);
|
row.appendChild(nameCell);
|
||||||
|
|
||||||
let keyType = inputTypes[typeof setting.defaultKeyValue];
|
let keyType = inputTypes[typeof setting.defaultKeyValue];
|
||||||
|
@ -298,6 +298,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "protectedAPIFeatures",
|
"name": "protectedAPIFeatures",
|
||||||
|
"replaceKeyPattern": / @ .+$/,
|
||||||
"displayedSection": "Canvas-API",
|
"displayedSection": "Canvas-API",
|
||||||
"displayDependencies": [
|
"displayDependencies": [
|
||||||
{
|
{
|
||||||
@ -445,6 +446,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "protectedAPIFeatures",
|
"name": "protectedAPIFeatures",
|
||||||
|
"replaceKeyPattern": / @ .+$/,
|
||||||
"displayedSection": "Audio-API",
|
"displayedSection": "Audio-API",
|
||||||
"displayDependencies": [
|
"displayDependencies": [
|
||||||
{
|
{
|
||||||
@ -542,6 +544,7 @@
|
|||||||
settings: [
|
settings: [
|
||||||
{
|
{
|
||||||
"name": "protectedAPIFeatures",
|
"name": "protectedAPIFeatures",
|
||||||
|
"replaceKeyPattern": / @ .+$/,
|
||||||
"displayedSection": "History-API",
|
"displayedSection": "History-API",
|
||||||
"displayDependencies": [
|
"displayDependencies": [
|
||||||
{
|
{
|
||||||
@ -565,6 +568,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "protectedAPIFeatures",
|
"name": "protectedAPIFeatures",
|
||||||
|
"replaceKeyPattern": / @ .+$/,
|
||||||
"displayedSection": "Window-API",
|
"displayedSection": "Window-API",
|
||||||
"displayDependencies": [
|
"displayDependencies": [
|
||||||
{
|
{
|
||||||
@ -583,6 +587,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "protectedAPIFeatures",
|
"name": "protectedAPIFeatures",
|
||||||
|
"replaceKeyPattern": / @ .+$/,
|
||||||
"displayedSection": "DOMRect-API",
|
"displayedSection": "DOMRect-API",
|
||||||
"displayDependencies": [
|
"displayDependencies": [
|
||||||
{
|
{
|
||||||
@ -608,6 +613,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "protectedAPIFeatures",
|
"name": "protectedAPIFeatures",
|
||||||
|
"replaceKeyPattern": / @ .+$/,
|
||||||
"displayedSection": "Navigator-API",
|
"displayedSection": "Navigator-API",
|
||||||
"displayDependencies": [
|
"displayDependencies": [
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Version 0.5.15:
|
Version 0.5.15:
|
||||||
changes:
|
changes:
|
||||||
-
|
- improved storage of protected API features
|
||||||
|
|
||||||
new features:
|
new features:
|
||||||
-
|
-
|
||||||
|
Loading…
x
Reference in New Issue
Block a user