-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
T1hTime Estimate 1 HourTime Estimate 1 Hourenhancementhelp wantedpriority-1technicalA technical issue that requires understanding of the code, infrastructure or dependenciesA technical issue that requires understanding of the code, infrastructure or dependencies
Description
In order to provide valuable insights, we need to split our user_agent.string
into the relevant parts so that we can determine, Operating System, Device and version.
This looks promising: https://github.com/elixir-inspector/ua_inspector
(based on https://github.com/matomo-org/device-detector ...)
iex(1)> UAInspector.parse("Mozilla/5.0 (iPad; CPU OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53")
%UAInspector.Result{
client: %UAInspector.Result.Client{
engine: "WebKit",
engine_version: "537.51.11",
name: "Mobile Safari",
type: "browser",
version: "7.0"
},
device: %UAInspector.Result.Device{
brand: "Apple",
model: "iPad",
type: "tablet"
},
os: %UAInspector.Result.OS{
name: "iOS",
platform: :unknown,
version: "7.0.4"
},
user_agent: "Mozilla/5.0 (iPad; CPU OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53"
}
iex(2)> UAInspector.parse("Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Safari/537.36")
%UAInspector.Result.Bot{
category: "Search bot",
name: "Googlebot",
producer: %UAInspector.Result.BotProducer{
name: "Google Inc.",
url: "http://www.google.com"
},
url: "http://www.google.com/bot.html",
user_agent: "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Safari/537.36"
}Todo
- Borrow from: https://github.com/dwyl/auth/blob/83c286a24d47bd087ba41925a740d4030cf95e19/lib/auth/user_agent.ex
and extend theuser_agentsschema to include all the fields extracted byUAInspector.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
T1hTime Estimate 1 HourTime Estimate 1 Hourenhancementhelp wantedpriority-1technicalA technical issue that requires understanding of the code, infrastructure or dependenciesA technical issue that requires understanding of the code, infrastructure or dependencies
Type
Projects
Status
🏗 In progress