Add site-specific quirk for gitlab.gnome.org

Fixes #8509
This commit is contained in:
Florian Bruhin 2025-10-12 13:16:54 +02:00
parent 816b8aaa00
commit 467b9a7d4a
3 changed files with 17 additions and 0 deletions

View File

@ -2770,6 +2770,7 @@ Valid values:
* +ua-google+
* +ua-googledocs+
* +ua-gnome-gitlab+
* +js-whatsapp-web+
* +js-discord+
* +js-string-replaceall+

View File

@ -508,6 +508,20 @@ def _init_site_specific_quirks():
# "Safari/{webkit_version}")
firefox_ua = "Mozilla/5.0 ({os_info}; rv:136.0) Gecko/20100101 Firefox/139.0"
# Needed for gitlab.gnome.org which blocks old Chromium versions outright,
# except when QtWebEngine/... is in the UA.
#
# We could further modify the UA to just "qutebrowser" or something so we don't get
# Anubis at all, but it looks like their Anubis triggers to more than just
# Mozilla/5.0 (also AppleWebKit/... and Chromium/... possibly?), so at that point
# I'm not sure if we can strip down the UA so much without breaking
# something in GitLab as well.
not_mozilla_ua = (
"Mozilla/5.0 ({os_info}) AppleWebKit/{webkit_version} (KHTML, like Gecko) "
"{qt_key}/{qt_version} {upstream_browser_key}/{upstream_browser_version_short} "
"Safari/{webkit_version}"
)
def maybe_newer_chrome_ua(at_least_version):
"""Return a new UA if our current chrome version isn't at least at_least_version."""
current_chome_version = version.qtwebengine_versions().chromium_major
@ -528,6 +542,7 @@ def _init_site_specific_quirks():
# to keep your account secure" error.
# https://github.com/qutebrowser/qutebrowser/issues/5182
("ua-google", "https://accounts.google.com/*", firefox_ua),
("ua-gnome-gitlab", "https://gitlab.gnome.org/*", not_mozilla_ua),
]
for name, pattern, ua in user_agents:

View File

@ -658,6 +658,7 @@ content.site_specific_quirks.skip:
valid_values:
- ua-google
- ua-googledocs
- ua-gnome-gitlab
- js-whatsapp-web
- js-discord
- js-string-replaceall