mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-17 23:53:25 +02:00
Add browser icons. Currently requires stf-browser-db to be npm linked to work.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
var deviceData = require('stf-devices-db')
|
||||
var browserData = require('stf-browser-db')
|
||||
var express = require('express')
|
||||
|
||||
var pathutil = require('./pathutil')
|
||||
@@ -53,6 +54,18 @@ datautil.applyData = function(device) {
|
||||
return device
|
||||
}
|
||||
|
||||
datautil.applyBrowsers = function(device) {
|
||||
if (device.browser) {
|
||||
device.browser.apps.forEach(function(app) {
|
||||
var data = browserData[app.type]
|
||||
if (data) {
|
||||
app.developer = data.developer
|
||||
}
|
||||
})
|
||||
}
|
||||
return device
|
||||
}
|
||||
|
||||
datautil.applyOwner = function(device, user) {
|
||||
device.using = !!device.owner && device.owner.email === user.email
|
||||
return device
|
||||
@@ -60,12 +73,9 @@ datautil.applyOwner = function(device, user) {
|
||||
|
||||
datautil.normalize = function(device, user) {
|
||||
datautil.applyData(device)
|
||||
datautil.applyBrowsers(device)
|
||||
datautil.applyOwner(device, user)
|
||||
if (!device.present) {
|
||||
device.owner = null
|
||||
}
|
||||
}
|
||||
|
||||
datautil.middleware = function() {
|
||||
return express.static(pathutil.root('node_modules/stf-devices-db/data/small'))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user