Skip to content

Commit

Permalink
Added ability to query chrome extensions on Device
Browse files Browse the repository at this point in the history
  • Loading branch information
rmcvey committed Sep 5, 2018
1 parent d433ec4 commit d678f23
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions resolvers/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,26 @@ const Device = {
return hardwareSerial
},

async extensions (root, args, context) {
const chrome = await OSQuery.all('chrome_extensions')
const ff = await OSQuery.all('firefox_addons')
let safari = []
if (context.platform === 'darwin') {
safari = await OSQuery.all('safari_extensions')
}
return [].concat(
chrome.map(
({ name, version, identifier, path, author }) => ({ name, path, version, identifier, author, browser: 'chrome' })
),
ff.map(
({ name, version, identifier, path, creator: author }) => ({ name, path, version, identifier, author, browser: 'firefox' })
),
safari.map(
({ name, version, identifier, path, creator: author }) => ({ name, path, version, identifier, author, browser: 'safari' })
),
)
},

async applications (root, args, context) {
const os = PlatformResolvers[context.platform]
if ('applications' in os) {
Expand Down
11 changes: 11 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type Device {
hardwareSerial: String
# installed applications
applications: [Application]
# browser extensions
extensions: [Extension]
# current IP addresses
ipAddresses: [IpAddress]
# interface_details
Expand Down Expand Up @@ -88,6 +90,15 @@ type Application {
installDate: String
}

type Extension {
name: String!
path: String!
version: String!
author: String!
identifier: String!
browser: String!
}

# A DevicePolicy is a description of the desired state of a set of pre-selected device features
input DevicePolicy {
# current operation system version, use [semver](https://www.nodesource.com/blog/semver-a-primer/) strings to define requirement
Expand Down

0 comments on commit d678f23

Please sign in to comment.