From 7598704d7919de98e147bd9c687c5df673395df6 Mon Sep 17 00:00:00 2001 From: daijro Date: Mon, 30 Sep 2024 01:49:05 -0500 Subject: [PATCH] Fix swapped rect properties Fixed a logical bug in MaskConfig swapped some screen and document.body properties. - document.body.clientTop <--> document.body.clientWidth - screen.availTop <--> screen.availLeft - screen.availWidth <--> screen.availHeight --- additions/camoucfg/MaskConfig.hpp | 14 +++++++------- patches/fingerprint-injection.patch | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/additions/camoucfg/MaskConfig.hpp b/additions/camoucfg/MaskConfig.hpp index 676d6d7..2e9bed0 100644 --- a/additions/camoucfg/MaskConfig.hpp +++ b/additions/camoucfg/MaskConfig.hpp @@ -159,12 +159,12 @@ inline std::optional GetBool(const std::string& key) { } inline std::optional> GetRect( - const std::string& top, const std::string& left, const std::string& height, - const std::string& width) { + const std::string& left, const std::string& top, const std::string& width, + const std::string& height) { // Make top and left default to 0 std::array, 4> values = { - GetUint32(top).value_or(0), GetUint32(left).value_or(0), - GetUint32(height), GetUint32(width)}; + GetUint32(left).value_or(0), GetUint32(top).value_or(0), + GetUint32(width), GetUint32(height)}; // If height or width is std::nullopt, return std::nullopt if (!values[2].has_value() || !values[3].has_value()) { @@ -185,10 +185,10 @@ inline std::optional> GetRect( } inline std::optional> GetInt32Rect( - const std::string& top, const std::string& left, const std::string& height, - const std::string& width) { + const std::string& left, const std::string& top, const std::string& width, + const std::string& height) { // Calls GetRect but casts to int32_t - if (auto optValue = GetRect(top, left, height, width)) { + if (auto optValue = GetRect(left, top, width, height)) { std::array result; std::transform(optValue->begin(), optValue->end(), result.begin(), [](const auto& val) { return static_cast(val); }); diff --git a/patches/fingerprint-injection.patch b/patches/fingerprint-injection.patch index d934d9c..ae44b5d 100644 --- a/patches/fingerprint-injection.patch +++ b/patches/fingerprint-injection.patch @@ -28,7 +28,7 @@ index 807cb4ec25..3df0e0f70f 100644 + if (doc->GetBodyElement() == this) { + if (auto conf = MaskConfig::GetInt32Rect( -+ "document.body.clientTop", "document.body.clientLeft", ++ "document.body.clientLeft", "document.body.clientTop", + "document.body.clientWidth", "document.body.clientHeight")) { + if (conf.has_value()) { + auto values = conf.value(); @@ -394,8 +394,8 @@ index 4bd1e0c964..a5a95d3fdf 100644 } CSSIntRect nsScreen::GetAvailRect() { -+ auto rect = MaskConfig::GetRect("screen.availTop", "screen.availLeft", -+ "screen.availHeight", "screen.availWidth"); ++ auto rect = MaskConfig::GetRect("screen.availLeft", "screen.availTop", ++ "screen.availWidth", "screen.availHeight"); + if (rect.has_value()) { + auto values = rect.value(); + return {values[0], values[1], values[2], values[3]};