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

feat: improve user agent detection #1038

Merged
merged 43 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9bbbb51
wat
pauldambra Feb 22, 2024
f3517c4
wat
pauldambra Feb 22, 2024
c450722
wat
pauldambra Feb 22, 2024
406deb4
Revert "wat"
pauldambra Feb 22, 2024
54a5e28
Revert "wat"
pauldambra Feb 22, 2024
a9c2a75
Revert "wat"
pauldambra Feb 22, 2024
70669d7
use the test suite
pauldambra Feb 22, 2024
1abd869
split smarttv and wearable tests out
pauldambra Feb 22, 2024
03c45f8
more
pauldambra Feb 22, 2024
c2fe338
a little bit of constants for the bundler god
pauldambra Feb 22, 2024
5d94dcf
fangling
pauldambra Feb 22, 2024
db96994
fiddling
pauldambra Feb 22, 2024
1e58470
fiddling
pauldambra Feb 22, 2024
b2f1341
some more OS detection
pauldambra Feb 22, 2024
cef594f
add more OS detection
pauldambra Feb 23, 2024
33e6abe
a brief but necessary diversion into OS matching
pauldambra Feb 23, 2024
458282b
fix
pauldambra Feb 23, 2024
aef14fd
fix
pauldambra Feb 23, 2024
bf960bc
fix a regex
pauldambra Feb 23, 2024
261c7f6
down to 18 failing
pauldambra Feb 23, 2024
7da5c33
all passing
pauldambra Feb 23, 2024
c5072d5
fix
pauldambra Feb 23, 2024
d421450
fangling
pauldambra Feb 23, 2024
e35737f
Fix
pauldambra Feb 23, 2024
bde06aa
Fix
pauldambra Feb 23, 2024
b3746dd
fix
pauldambra Feb 23, 2024
8724d2d
does that help
pauldambra Feb 23, 2024
b8cffa6
does that help
pauldambra Feb 23, 2024
1e877c1
does that help
pauldambra Feb 23, 2024
ae87965
does that help
pauldambra Feb 23, 2024
1d5ced7
split this into its own file so size impact is clearer
pauldambra Feb 23, 2024
c0025aa
Add a comment
pauldambra Feb 23, 2024
4913b1b
does that help
pauldambra Feb 23, 2024
d01e23a
does that help
pauldambra Feb 23, 2024
4eeaed4
fix vendor detection
pauldambra Feb 23, 2024
3608b5e
add source to test case files
pauldambra Feb 26, 2024
b98e42b
a little more code golf
pauldambra Feb 26, 2024
d7a60d3
more code golf
pauldambra Feb 26, 2024
7bc501f
more code golf
pauldambra Feb 26, 2024
d5da91d
more code golf
pauldambra Feb 26, 2024
2beb227
is this smaller?
pauldambra Feb 26, 2024
f108113
is this smaller?
pauldambra Feb 26, 2024
d79132e
is this smaller?
pauldambra Feb 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 0 additions & 52 deletions src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,58 +96,6 @@ describe('utils', () => {
}
})

it('osVersion', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

not deleted, just moved

const osVersions = {
// Windows Phone
'Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 635; BOOST) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537':
{ os_name: 'Windows Phone', os_version: '' },
'Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36':
{
os_name: 'Windows',
os_version: '6.3',
},
'Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) CriOS/44.0.2403.67 Mobile/12D508 Safari/600.1.4':
{
os_name: 'iOS',
os_version: '8.2.0',
},
'Mozilla/5.0 (iPad; CPU OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H143 Safari/600.1.4':
{
os_name: 'iOS',
os_version: '8.4.0',
},
'Mozilla/5.0 (Linux; Android 4.4.2; Lenovo A7600-F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.133 Safari/537.36':
{
os_name: 'Android',
os_version: '4.4.2',
},
'Mozilla/5.0 (BlackBerry; U; BlackBerry 9300; es) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.480 Mobile Safari/534.8+':
{
os_name: 'BlackBerry',
os_version: '',
},
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36':
{
os_name: 'Mac OS X',
os_version: '10.9.5',
},
'Opera/9.80 (Linux armv7l; InettvBrowser/2.2 (00014A;SonyDTV140;0001;0001) KDL40W600B; CC/MEX) Presto/2.12.407 Version/12.50':
{
os_name: 'Linux',
os_version: '',
},
'Mozilla/5.0 (X11; CrOS armv7l 6680.81.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36':
{
os_name: 'Chrome OS',
os_version: '',
},
}

for (const [userAgent, osInfo] of Object.entries(osVersions)) {
expect(_info.os(userAgent)).toEqual(osInfo)
}
})

it('properties', () => {
const properties = _info.properties()

Expand Down
Loading
Loading