Update user agent completion

Fixes #4575
This commit is contained in:
Florian Bruhin 2019-02-21 17:10:15 +01:00
parent b10d84f31a
commit 81889dd7bd
3 changed files with 10 additions and 66 deletions

View File

@ -710,6 +710,7 @@ qutebrowser release
* Update changelog (remove *(unreleased)*).
* Adjust `__version_info__` in `qutebrowser/__init__.py`.
* Consider updating the completions for `content.headers.user_agent` in `configdata.yml`.
* Commit.
* Create annotated git tag (`git tag -s "v1.$x.$y" -m "Release v1.$x.$y"`).

View File

@ -478,46 +478,14 @@ content.headers.user_agent:
# 'ua_fetch.py'
# Vim-protip: Place your cursor below this comment and run
# :r!python scripts/dev/ua_fetch.py
- - "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:53.0) Gecko/20100101
Firefox/53.0"
- Firefox 53.0 Win8.1
- - "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101
Firefox/53.0"
- Firefox 53.0 Linux
- - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0"
- Firefox 53.0 MacOSX
- - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4
(KHTML, like Gecko) Version/10.1.1 Safari/603.2.4"
- Safari Generic MacOSX
- - "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30
(KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1"
- Mobile Safari 10.0 iOS
- - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/58.0.3029.110 Safari/537.36"
- Chrome Generic Win10
- - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
- Chrome Generic MacOSX
like Gecko) Chrome/71.0.3578.98 Safari/537.36"
- Chrome 71.0 Win10
- - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/58.0.3029.110 Safari/537.36"
- Chrome Generic Linux
- - "Mozilla/5.0 (compatible; Googlebot/2.1;
+http://www.google.com/bot.html"
- Google Bot
- - "Wget/1.16.1 (linux-gnu)"
- wget 1.16.1
- - "curl/7.40.0"
- curl 7.40.0
- - "Mozilla/5.0 (Linux; U; Android 7.1.2) AppleWebKit/534.30 (KHTML,
like Gecko) Version/4.0 Mobile Safari/534.30"
- Mobile Generic Android
- - "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like
Gecko"
- IE 11.0 for Desktop Win7 64-bit
Gecko) Chrome/71.0.3578.98 Safari/537.36"
- Chrome 71.0 Linux
- - ""
- Use default QtWebKit/QtWebEngine User-Agent
supports_pattern: true
desc: >-

View File

@ -75,42 +75,17 @@ def filter_list(complete_list, browsers):
return table
def add_diversity(table):
"""Insert a few additional entries for diversity into the dict.
(as returned by filter_list())
"""
table["Obscure"] = [
('Mozilla/5.0 (compatible; Googlebot/2.1; '
'+http://www.google.com/bot.html',
"Google Bot"),
('Wget/1.16.1 (linux-gnu)',
"wget 1.16.1"),
('curl/7.40.0',
"curl 7.40.0"),
('Mozilla/5.0 (Linux; U; Android 7.1.2) AppleWebKit/534.30 '
'(KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
"Mobile Generic Android"),
('Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like '
'Gecko',
"IE 11.0 for Desktop Win7 64-bit"),
]
return table
def main():
"""Generate user agent code."""
fetched = fetch()
lut = {
"Firefox": {"Win", "MacOSX", "Linux", "Android"},
"Chrome": {"Win", "MacOSX", "Linux"},
"Safari": {"MacOSX", "iOS"}
"Chrome": {"Win10", "Linux"},
}
filtered = filter_list(fetched, lut)
filtered = add_diversity(filtered)
filtered["empty"] = [('', "Use default QtWebKit/QtWebEngine User-Agent")]
tab = " "
for browser in ["Firefox", "Safari", "Chrome", "Obscure"]:
for browser in ["Chrome", "empty"]:
for it in filtered[browser]:
print('{}- - "{}"'.format(3 * tab, it[0]))
desc = it[1].replace('\xa0', ' ').replace(' ', ' ')