mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 08:32:05 -08:00
Backwards compatibility with <0.3.0
Change ALL webgl keys to webGl. This keeps backwards compatibility with <0.3.0 versions of the Python library.
This commit is contained in:
parent
0ff90fc750
commit
711b5b4550
4 changed files with 45 additions and 45 deletions
28
README.md
28
README.md
|
|
@ -361,20 +361,20 @@ Camoufox supports spoofing WebGL parameters, supported extensions, context attri
|
||||||
|
|
||||||
| Property | Description | Example |
|
| Property | Description | Example |
|
||||||
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
||||||
| webgl:renderer | Spoofs the name of the unmasked WebGL renderer. | `"NVIDIA GeForce GTX 980, or similar"` |
|
| webGl:renderer | Spoofs the name of the unmasked WebGL renderer. | `"NVIDIA GeForce GTX 980, or similar"` |
|
||||||
| webgl:vendor | Spoofs the name of the unmasked WebGL vendor. | `"NVIDIA Corporation"` |
|
| webGl:vendor | Spoofs the name of the unmasked WebGL vendor. | `"NVIDIA Corporation"` |
|
||||||
| webgl:supportedExtensions | An array of supported WebGL extensions ([full list](https://registry.khronos.org/webgl/extensions/)). | `["ANGLE_instanced_arrays", "EXT_color_buffer_float", "EXT_disjoint_timer_query", ...]` |
|
| webGl:supportedExtensions | An array of supported WebGL extensions ([full list](https://registry.khronos.org/webgl/extensions/)). | `["ANGLE_instanced_arrays", "EXT_color_buffer_float", "EXT_disjoint_timer_query", ...]` |
|
||||||
| webgl2:supportedExtensions | The same as `webgl:supportedExtensions`, but for WebGL2. | `["ANGLE_instanced_arrays", "EXT_color_buffer_float", "EXT_disjoint_timer_query", ...]` |
|
| webGl2:supportedExtensions | The same as `webGl:supportedExtensions`, but for WebGL2. | `["ANGLE_instanced_arrays", "EXT_color_buffer_float", "EXT_disjoint_timer_query", ...]` |
|
||||||
| webgl:contextAttributes | A dictionary of WebGL context attributes. | `{"alpha": true, "antialias": true, "depth": true, ...}` |
|
| webGl:contextAttributes | A dictionary of WebGL context attributes. | `{"alpha": true, "antialias": true, "depth": true, ...}` |
|
||||||
| webgl2:contextAttributes | The same as `webgl:contextAttributes`, but for WebGL2. | `{"alpha": true, "antialias": true, "depth": true, ...}` |
|
| webGl2:contextAttributes | The same as `webGl:contextAttributes`, but for WebGL2. | `{"alpha": true, "antialias": true, "depth": true, ...}` |
|
||||||
| webgl:parameters | A dictionary of WebGL parameters. Keys must be GL enums, and values are the values to spoof them as. | `{"2849": 1, "2884": false, "2928": [0, 1], ...}` |
|
| webGl:parameters | A dictionary of WebGL parameters. Keys must be GL enums, and values are the values to spoof them as. | `{"2849": 1, "2884": false, "2928": [0, 1], ...}` |
|
||||||
| webgl2:parameters | The same as `webgl:parameters`, but for WebGL2. | `{"2849": 1, "2884": false, "2928": [0, 1], ...}` |
|
| webGl2:parameters | The same as `webGl:parameters`, but for WebGL2. | `{"2849": 1, "2884": false, "2928": [0, 1], ...}` |
|
||||||
| webgl:parameters:blockIfNotDefined | If set to `true`, only the parameters in `webgl:parameters` will be allowed. Can be dangerous if not used correctly. | `true`/`false` |
|
| webGl:parameters:blockIfNotDefined | If set to `true`, only the parameters in `webGl:parameters` will be allowed. Can be dangerous if not used correctly. | `true`/`false` |
|
||||||
| webgl2:parameters:blockIfNotDefined | If set to `true`, only the parameters in `webgl2:parameters` will be allowed. Can be dangerous if not used correctly. | `true`/`false` |
|
| webGl2:parameters:blockIfNotDefined | If set to `true`, only the parameters in `webGl2:parameters` will be allowed. Can be dangerous if not used correctly. | `true`/`false` |
|
||||||
| webgl:shaderPrecisionFormats | A dictionary of WebGL shader precision formats. Keys are formatted as `"<shaderType>,<precisionType>"`. | `{"35633,36336": {"rangeMin": 127, "rangeMax": 127, "precision": 23}, ...}` |
|
| webGl:shaderPrecisionFormats | A dictionary of WebGL shader precision formats. Keys are formatted as `"<shaderType>,<precisionType>"`. | `{"35633,36336": {"rangeMin": 127, "rangeMax": 127, "precision": 23}, ...}` |
|
||||||
| webgl2:shaderPrecisionFormats | The same as `webGL:shaderPrecisionFormats`, but for WebGL2. | `{"35633,36336": {"rangeMin": 127, "rangeMax": 127, "precision": 23}, ...}` |
|
| webGl2:shaderPrecisionFormats | The same as `webGL:shaderPrecisionFormats`, but for WebGL2. | `{"35633,36336": {"rangeMin": 127, "rangeMax": 127, "precision": 23}, ...}` |
|
||||||
| webgl:shaderPrecisionFormats:blockIfNotDefined | If set to `true`, only the shader percisions in `webgl:shaderPrecisionFormats` will be allowed. | `true`/`false` |
|
| webGl:shaderPrecisionFormats:blockIfNotDefined | If set to `true`, only the shader percisions in `webGl:shaderPrecisionFormats` will be allowed. | `true`/`false` |
|
||||||
| webgl2:shaderPrecisionFormats:blockIfNotDefined | If set to `true`, only the shader percisions in `webgl2:shaderPrecisionFormats` will be allowed. | `true`/`false` |
|
| webGl2:shaderPrecisionFormats:blockIfNotDefined | If set to `true`, only the shader percisions in `webGl2:shaderPrecisionFormats` will be allowed. | `true`/`false` |
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ inline std::optional<nlohmann::json> GetNested(const std::string& domain,
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline std::optional<T> GetAttribute(const std::string attrib, bool isWebGL2) {
|
inline std::optional<T> GetAttribute(const std::string attrib, bool isWebGL2) {
|
||||||
auto value = MaskConfig::GetNested(
|
auto value = MaskConfig::GetNested(
|
||||||
isWebGL2 ? "webgl2:contextAttributes" : "webgl:contextAttributes",
|
isWebGL2 ? "webGl2:contextAttributes" : "webGl:contextAttributes",
|
||||||
attrib);
|
attrib);
|
||||||
if (!value) return std::nullopt;
|
if (!value) return std::nullopt;
|
||||||
return value.value().get<T>();
|
return value.value().get<T>();
|
||||||
|
|
@ -222,7 +222,7 @@ inline std::optional<
|
||||||
std::variant<int64_t, bool, double, std::string, std::nullptr_t>>
|
std::variant<int64_t, bool, double, std::string, std::nullptr_t>>
|
||||||
GLParam(uint32_t pname, bool isWebGL2) {
|
GLParam(uint32_t pname, bool isWebGL2) {
|
||||||
auto value =
|
auto value =
|
||||||
MaskConfig::GetNested(isWebGL2 ? "webgl2:parameters" : "webgl:parameters",
|
MaskConfig::GetNested(isWebGL2 ? "webGl2:parameters" : "webGl:parameters",
|
||||||
std::to_string(pname));
|
std::to_string(pname));
|
||||||
if (!value) return std::nullopt;
|
if (!value) return std::nullopt;
|
||||||
auto data = value.value();
|
auto data = value.value();
|
||||||
|
|
@ -237,7 +237,7 @@ GLParam(uint32_t pname, bool isWebGL2) {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T MParamGL(uint32_t pname, T defaultValue, bool isWebGL2) {
|
inline T MParamGL(uint32_t pname, T defaultValue, bool isWebGL2) {
|
||||||
if (auto value = MaskConfig::GetNested(
|
if (auto value = MaskConfig::GetNested(
|
||||||
isWebGL2 ? "webgl2:parameters" : "webgl:parameters",
|
isWebGL2 ? "webGl2:parameters" : "webGl:parameters",
|
||||||
std::to_string(pname));
|
std::to_string(pname));
|
||||||
value.has_value()) {
|
value.has_value()) {
|
||||||
return value.value().get<T>();
|
return value.value().get<T>();
|
||||||
|
|
@ -250,7 +250,7 @@ inline std::vector<T> MParamGLVector(uint32_t pname,
|
||||||
std::vector<T> defaultValue,
|
std::vector<T> defaultValue,
|
||||||
bool isWebGL2) {
|
bool isWebGL2) {
|
||||||
if (auto value = MaskConfig::GetNested(
|
if (auto value = MaskConfig::GetNested(
|
||||||
isWebGL2 ? "webgl2:parameters" : "webgl:parameters",
|
isWebGL2 ? "webGl2:parameters" : "webGl:parameters",
|
||||||
std::to_string(pname));
|
std::to_string(pname));
|
||||||
value.has_value()) {
|
value.has_value()) {
|
||||||
if (value.value().is_array()) {
|
if (value.value().is_array()) {
|
||||||
|
|
@ -266,8 +266,8 @@ inline std::optional<std::array<int32_t, 3UL>> MShaderData(
|
||||||
std::string valueName =
|
std::string valueName =
|
||||||
std::to_string(shaderType) + "," + std::to_string(precisionType);
|
std::to_string(shaderType) + "," + std::to_string(precisionType);
|
||||||
if (auto value =
|
if (auto value =
|
||||||
MaskConfig::GetNested(isWebGL2 ? "webgl2:shaderPrecisionFormats"
|
MaskConfig::GetNested(isWebGL2 ? "webGl2:shaderPrecisionFormats"
|
||||||
: "webgl:shaderPrecisionFormats",
|
: "webGl:shaderPrecisionFormats",
|
||||||
valueName)) {
|
valueName)) {
|
||||||
// Convert {rangeMin: int, rangeMax: int, precision: int} to array
|
// Convert {rangeMin: int, rangeMax: int, precision: int} to array
|
||||||
auto data = value.value();
|
auto data = value.value();
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ index db60868f65..7361f0fc9c 100644
|
||||||
+ result.mStencil = MBoolVal("stencil", options.stencil);
|
+ result.mStencil = MBoolVal("stencil", options.stencil);
|
||||||
+ result.mAntialias.Construct(MBoolVal("antialias", options.antialias));
|
+ result.mAntialias.Construct(MBoolVal("antialias", options.antialias));
|
||||||
+ result.mPremultipliedAlpha = MBoolVal(
|
+ result.mPremultipliedAlpha = MBoolVal(
|
||||||
+ "webgl:contextAttributes.premultipliedAlpha", options.premultipliedAlpha);
|
+ "webGl:contextAttributes.premultipliedAlpha", options.premultipliedAlpha);
|
||||||
+ result.mPreserveDrawingBuffer =
|
+ result.mPreserveDrawingBuffer =
|
||||||
+ MBoolVal("preserveDrawingBuffer", options.preserveDrawingBuffer);
|
+ MBoolVal("preserveDrawingBuffer", options.preserveDrawingBuffer);
|
||||||
+ result.mFailIfMajorPerformanceCaveat = MBoolVal(
|
+ result.mFailIfMajorPerformanceCaveat = MBoolVal(
|
||||||
|
|
@ -161,8 +161,8 @@ index db60868f65..7361f0fc9c 100644
|
||||||
+ case dom::WEBGL_debug_renderer_info_Binding::UNMASKED_VENDOR_WEBGL:
|
+ case dom::WEBGL_debug_renderer_info_Binding::UNMASKED_VENDOR_WEBGL:
|
||||||
+ break;
|
+ break;
|
||||||
+ default:
|
+ default:
|
||||||
+ if (MaskConfig::GetBool(mIsWebGL2 ? "webgl2:parameters:blockIfNotDefined"
|
+ if (MaskConfig::GetBool(mIsWebGL2 ? "webGl2:parameters:blockIfNotDefined"
|
||||||
+ : "webgl:parameters:blockIfNotDefined")) {
|
+ : "webGl:parameters:blockIfNotDefined")) {
|
||||||
+ retval.set(JS::NullValue());
|
+ retval.set(JS::NullValue());
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
|
|
@ -272,7 +272,7 @@ index db60868f65..7361f0fc9c 100644
|
||||||
|
|
||||||
switch (pname) {
|
switch (pname) {
|
||||||
case dom::WEBGL_debug_renderer_info_Binding::UNMASKED_RENDERER_WEBGL:
|
case dom::WEBGL_debug_renderer_info_Binding::UNMASKED_RENDERER_WEBGL:
|
||||||
+ if (auto value = MaskConfig::GetString("webgl:renderer")) {
|
+ if (auto value = MaskConfig::GetString("webGl:renderer")) {
|
||||||
+ ret = Some(value.value());
|
+ ret = Some(value.value());
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
|
|
@ -283,7 +283,7 @@ index db60868f65..7361f0fc9c 100644
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case dom::WEBGL_debug_renderer_info_Binding::UNMASKED_VENDOR_WEBGL:
|
case dom::WEBGL_debug_renderer_info_Binding::UNMASKED_VENDOR_WEBGL:
|
||||||
+ if (auto value = MaskConfig::GetString("webgl:vendor")) {
|
+ if (auto value = MaskConfig::GetString("webGl:vendor")) {
|
||||||
+ ret = Some(value.value());
|
+ ret = Some(value.value());
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
|
|
@ -317,8 +317,8 @@ index db60868f65..7361f0fc9c 100644
|
||||||
+ }
|
+ }
|
||||||
+ // Check if block if not defined is on
|
+ // Check if block if not defined is on
|
||||||
+ if (MaskConfig::GetBool(
|
+ if (MaskConfig::GetBool(
|
||||||
+ mIsWebGL2 ? "webgl2:shaderPrecisionFormats:blockIfNotDefined"
|
+ mIsWebGL2 ? "webGl2:shaderPrecisionFormats:blockIfNotDefined"
|
||||||
+ : "webgl:shaderPrecisionFormats:blockIfNotDefined")) {
|
+ : "webGl:shaderPrecisionFormats:blockIfNotDefined")) {
|
||||||
+ Maybe<webgl::ShaderPrecisionFormat> ret;
|
+ Maybe<webgl::ShaderPrecisionFormat> ret;
|
||||||
+ return ret;
|
+ return ret;
|
||||||
+ }
|
+ }
|
||||||
|
|
@ -331,8 +331,8 @@ index db60868f65..7361f0fc9c 100644
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (std::vector<std::string> maskValues =
|
+ if (std::vector<std::string> maskValues =
|
||||||
+ MaskConfig::GetStringList(mIsWebGL2 ? "webgl2:supportedExtensions"
|
+ MaskConfig::GetStringList(mIsWebGL2 ? "webGl2:supportedExtensions"
|
||||||
+ : "webgl:supportedExtensions");
|
+ : "webGl:supportedExtensions");
|
||||||
+ !maskValues.empty()) {
|
+ !maskValues.empty()) {
|
||||||
+ if (std::find(maskValues.begin(), maskValues.end(),
|
+ if (std::find(maskValues.begin(), maskValues.end(),
|
||||||
+ GetExtensionName(ext)) != maskValues.end()) {
|
+ GetExtensionName(ext)) != maskValues.end()) {
|
||||||
|
|
@ -351,8 +351,8 @@ index db60868f65..7361f0fc9c 100644
|
||||||
+
|
+
|
||||||
+ // Implement separately to prevent O(n^2) timing
|
+ // Implement separately to prevent O(n^2) timing
|
||||||
+ if (std::vector<std::string> maskValues =
|
+ if (std::vector<std::string> maskValues =
|
||||||
+ MaskConfig::GetStringList(mIsWebGL2 ? "webgl2:supportedExtensions"
|
+ MaskConfig::GetStringList(mIsWebGL2 ? "webGl2:supportedExtensions"
|
||||||
+ : "webgl:supportedExtensions");
|
+ : "webGl:supportedExtensions");
|
||||||
+ !maskValues.empty()) {
|
+ !maskValues.empty()) {
|
||||||
+ for (const auto& ext : maskValues) {
|
+ for (const auto& ext : maskValues) {
|
||||||
+ retarr.AppendElement(NS_ConvertUTF8toUTF16(ext));
|
+ retarr.AppendElement(NS_ConvertUTF8toUTF16(ext));
|
||||||
|
|
|
||||||
|
|
@ -68,19 +68,19 @@
|
||||||
{ "property": "AudioContext:sampleRate", "type": "uint" },
|
{ "property": "AudioContext:sampleRate", "type": "uint" },
|
||||||
{ "property": "AudioContext:outputLatency", "type": "double" },
|
{ "property": "AudioContext:outputLatency", "type": "double" },
|
||||||
{ "property": "AudioContext:maxChannelCount", "type": "uint" },
|
{ "property": "AudioContext:maxChannelCount", "type": "uint" },
|
||||||
{ "property": "webgl:renderer", "type": "str" },
|
{ "property": "webGl:renderer", "type": "str" },
|
||||||
{ "property": "webgl:vendor", "type": "str" },
|
{ "property": "webGl:vendor", "type": "str" },
|
||||||
{ "property": "webgl:supportedExtensions", "type": "array" },
|
{ "property": "webGl:supportedExtensions", "type": "array" },
|
||||||
{ "property": "webgl2:supportedExtensions", "type": "array" },
|
{ "property": "webGl2:supportedExtensions", "type": "array" },
|
||||||
{ "property": "webgl:parameters", "type": "dict" },
|
{ "property": "webGl:parameters", "type": "dict" },
|
||||||
{ "property": "webgl:parameters:blockIfNotDefined", "type": "bool" },
|
{ "property": "webGl:parameters:blockIfNotDefined", "type": "bool" },
|
||||||
{ "property": "webgl2:parameters", "type": "dict" },
|
{ "property": "webGl2:parameters", "type": "dict" },
|
||||||
{ "property": "webgl2:parameters:blockIfNotDefined", "type": "bool" },
|
{ "property": "webGl2:parameters:blockIfNotDefined", "type": "bool" },
|
||||||
{ "property": "webgl:shaderPrecisionFormats", "type": "dict" },
|
{ "property": "webGl:shaderPrecisionFormats", "type": "dict" },
|
||||||
{ "property": "webgl:shaderPrecisionFormats:blockIfNotDefined", "type": "bool" },
|
{ "property": "webGl:shaderPrecisionFormats:blockIfNotDefined", "type": "bool" },
|
||||||
{ "property": "webgl2:shaderPrecisionFormats", "type": "dict" },
|
{ "property": "webGl2:shaderPrecisionFormats", "type": "dict" },
|
||||||
{ "property": "webgl2:shaderPrecisionFormats:blockIfNotDefined", "type": "bool" },
|
{ "property": "webGl2:shaderPrecisionFormats:blockIfNotDefined", "type": "bool" },
|
||||||
{ "property": "webgl:contextAttributes", "type": "dict" },
|
{ "property": "webGl:contextAttributes", "type": "dict" },
|
||||||
{ "property": "webgl2:contextAttributes", "type": "dict" },
|
{ "property": "webGl2:contextAttributes", "type": "dict" },
|
||||||
{ "property": "debug", "type": "bool" }
|
{ "property": "debug", "type": "bool" }
|
||||||
]
|
]
|
||||||
Loading…
Add table
Reference in a new issue