-
Notifications
You must be signed in to change notification settings - Fork 450
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
Add detection Sonos player and Sonos app #567
Open
ddurham2
wants to merge
5
commits into
ua-parser:master
Choose a base branch
from
ddurham2:add-sonos
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
77271ee
Added regexes to detect Sonos player and Sonos app user agents
ddurham2 f14ba7d
Merge branch 'master' of https://github.com/ua-parser/uap-core into a…
ddurham2 4e50239
diff cleanup
ddurham2 cef32e4
issue addressed
ddurham2 b34c2b1
Revert "issue addressed"
ddurham2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8688,6 +8688,30 @@ test_cases: | |
minor: '2' | ||
patch: '1' | ||
|
||
- user_agent_string: 'Linux UPnP/1.0 Sonos/76.2-47142 (ZPS22)' | ||
family: 'SonosPlayer' | ||
major: '76' | ||
minor: '2' | ||
patch: | ||
|
||
- user_agent_string: 'Linux UPnP/1.0 Sonos/26.7-48310 (ZP120)' | ||
family: 'SonosPlayer' | ||
major: '26' | ||
minor: '7' | ||
patch: | ||
|
||
- user_agent_string: 'Linux UPnP/1.0 Sonos/29.3-87071 (ICRU\_iPhone7,1); iOS/Version 8.2 (Build 12D508)' | ||
family: 'SonosApp' | ||
major: '29' | ||
minor: '3' | ||
patch: | ||
|
||
- user_agent_string: 'Linux UPnP/1.0 Sonos/76.2-48062 (ACR_:samsung:p3quew:SM-G998U1)' | ||
family: 'SonosApp' | ||
major: '76' | ||
minor: '2' | ||
patch: | ||
|
||
- user_agent_string: 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Safari/605.1.15 (Ecosia [email protected])' | ||
family: 'Ecosia iOS' | ||
major: '8' | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be only
iPhone7
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled it from here: https://docs.sonos.com/docs/soap-requests-and-responses#user-agent-header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, my question was whether we want the model to be
iPhone7
oriPhone7,1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I'm not really sure what iPhone7,1 even means.. but I'll change it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing, mind having a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, sorry for the delay.
So, I reverted the model back to expect it as "iPhone7,1" since:
A) that's the literal example on the Sonos docs site
B) the general parser is correctly parsing the model as "iPhone7,1" and it the tests fail when I muck with it in the way suggested (they now pass).
and
C) I see precedent for both versioned and unversioned model values, depending on whether the UA contained it.
For example, from test_device.yaml
user_agent_string: 'Mozilla/5.0 (iPhone; U; fr; CPU iPhone OS 4_2_1 like Mac OS X; fr) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148a Safari/6533.18.5'
parses as
model: 'iPhone'
and
user_agent_string: 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0 [FBAN/FBIOS;FBAV/7.0.0.17.1;FBBV/1325030;FBDV/iPhone6,2;FBMD/iPhone;FBSN/iPhone OS;FBSV/7.0.6;FBSS/2; FBCR/Telekom.de;FBID/phone;FBLC/de_DE;FBOP/5]'
parses as
model: 'iPhone6,2'
and many more examples.
Is that acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sgtm, @migueldemoura what do you think?