{"id":21692523,"url":"https://github.com/alex-strizhakov/ds","last_synced_at":"2025-10-12T02:43:40.031Z","repository":{"id":57491855,"uuid":"175927787","full_name":"alex-strizhakov/ds","owner":"alex-strizhakov","description":"Device structure","archived":false,"fork":false,"pushed_at":"2023-02-04T11:48:26.000Z","size":58,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-07T06:44:07.434Z","etag":null,"topics":["device-detection","elixir","plug"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alex-strizhakov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-16T04:52:40.000Z","updated_at":"2023-02-04T11:47:00.000Z","dependencies_parsed_at":"2023-02-18T16:15:43.838Z","dependency_job_id":null,"html_url":"https://github.com/alex-strizhakov/ds","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/alex-strizhakov/ds","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-strizhakov%2Fds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-strizhakov%2Fds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-strizhakov%2Fds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-strizhakov%2Fds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alex-strizhakov","download_url":"https://codeload.github.com/alex-strizhakov/ds/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-strizhakov%2Fds/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006351,"owners_count":26084086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["device-detection","elixir","plug"],"created_at":"2024-11-25T18:16:23.110Z","updated_at":"2025-10-12T02:43:39.977Z","avatar_url":"https://github.com/alex-strizhakov.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Device Structure\n\nThis module is designed to facilitate the device structure (through `Plug.Conn.assign/3`) and easy connection to other projects.\n\n## Installation\n\nThe module can be installed by adding `ds` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ds, \"~\u003e 1.1\"}\n  ]\nend\n```\n\nRun mix task to download databases for `UAInspector`:\n\n```console\n$ mix ua_inspector.download\n```\n\n## Usage\n\nCreate new pipeline in your Router file:\n\n```elixir\ndefmodule ExampleWeb.Router do\n  use ExampleWeb.Router\n\n  pipeline :device_detectable do\n    plug DSPlug\n  end\n\n  # Add pipeline to scope\n  scope \"/\", ExampleWeb do\n    pipe_through [:browser, :device_detectable]\n    get \"/\", ExampleController, :index\n  end\nend\n```\n\nNow you can access it from your controller.\n\n```elixir\ndef ExampleController do\n  use ExampleWeb, :controller\n\n  def index(conn, _params) do\n    IO.inspect(conn.assigns[:device_info])\n    text(conn, \"OK\")\n  end\nend\n```\n\n# Example\n\n```elixir\niex(1)\u003e DS.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\")\n%DS{\n  bot_name: nil,\n  browser: \"Mobile Safari\",\n  browser_version: \"7.0\",\n  device_brand: \"Apple\",\n  device_model: \"iPad\",\n  device_type: \"tablet\",\n  is_bot?: false,\n  is_mobile?: true,\n  os: \"iOS\",\n  os_version: \"7.0.4\"\n}\n```\n## Dependencies used in library\n\n```elixir\ndefp deps do\n  [\n    {:plug_cowboy, \"~\u003e 2.1\"},\n    {:ua_inspector, \"~\u003e 1.0\"}\n  ]\nend\n```\n\n- https://github.com/elixir-plug/plug_cowboy\n- https://github.com/elixytics/ua_inspector\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-strizhakov%2Fds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falex-strizhakov%2Fds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-strizhakov%2Fds/lists"}