Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: UserAgent is wrong on google.* if not .com #654

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

le-jeu
Copy link
Contributor

@le-jeu le-jeu commented Jul 30, 2023

Hardcode a white list for all google.* domain names
Note: this is more generic than the real exhaustive list from https://www.google.com/supported_domains

@github-actions
Copy link

github-actions bot commented Jul 30, 2023

🤖 Pull request artifacts

file commit
IITC_Mobile-test.apk 4160899
test-0.36.0.20230801.080644.zip 4160899

See build on website

@le-jeu le-jeu force-pushed the fix/google-hostnames branch 2 times, most recently from 454e361 to 44ecdc8 Compare July 30, 2023 14:53
@@ -118,6 +118,7 @@ public class IITC_Mobile extends AppCompatActivity
private String debugInputStore = "";
private Map<String, String> mAllowedHostnames = new HashMap<>();
private Set<String> mInternalHostnames = new HashSet<>();
private final Pattern mGoogleHostnamePattern = Pattern.compile("google\\.(com\\.|co\\.).\\w+$");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private final Pattern mGoogleHostnamePattern = Pattern.compile("google\\.(com\\.|co\\.).\\w+$");
private final Pattern mGoogleHostnamePattern = Pattern.compile("google\\.(com\\.|co\\.)?\\w+$");

If the match should work as mentioned in comment (for google.com?.*), The pattern should look like this, right? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixup half fixed this, (?. instead of .), it's ? now
I kept the (com\.|co\.)? for readability (instead of (com?\.)?, should I use (com?\.)? instead ?

Copy link
Contributor

@xscreach xscreach Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imho it's good like this.
I'd maybe prefer having the dot on the other side like this: ...google(\\.com|\\.co)?\\.\\w+
For me it reads a bit better, but it's really just a cosmetics 🤷

@le-jeu le-jeu force-pushed the fix/google-hostnames branch 2 times, most recently from 491fa03 to fbf2019 Compare July 30, 2023 15:09
@le-jeu le-jeu marked this pull request as ready for review August 1, 2023 08:10
@modos189 modos189 merged commit a730f6a into IITC-CE:master Aug 1, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants