nixfiles/pkgs/redlib/auth-fix.patch
2024-06-23 00:47:30 -04:00

31 lines
1.2 KiB
Diff

From bd47c206a1d94c8382570b69730d72562d777454 Mon Sep 17 00:00:00 2001
From: Matthew Esposito <matt@matthew.science>
Date: Thu, 30 May 2024 18:08:45 -0400
Subject: [PATCH] fix(oauth): Make Android user-agent patching unconditional
---
src/client.rs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/client.rs b/src/client.rs
index 5b8fe8f..5ea9d1c 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -181,11 +181,12 @@ fn request(method: &'static Method, path: String, redirect: bool, quarantine: bo
)
};
- // Check if multi sub requested, or if submitted was requested. If so, replace "Android" with a tricky word.
+ // Replace "Android" with a tricky word.
// Issues: #78/#115, #116
- if path.contains('+') || path.contains("/submitted") {
- user_agent = user_agent.replace("Android", "Andr\u{200B}oid");
- }
+ // If you include the word "Android", you will get a number of different errors
+ // I guess they don't expect mobile traffic on the endpoints we use
+ // Scrawled on wall for next poor soul: Run the test suite.
+ user_agent = user_agent.replace("Android", "Andr\u{200B}oid");
// Build request to Reddit. When making a GET, request gzip compression.
// (Reddit doesn't do brotli yet.)