mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-20 12:55:26 +02:00
Integrate device database.
This commit is contained in:
@@ -16,6 +16,7 @@ var wire = require('../wire')
|
||||
var wireutil = require('../wire/util')
|
||||
var wirerouter = require('../wire/router')
|
||||
var dbapi = require('../db/api')
|
||||
var datautil = require('../util/datautil')
|
||||
|
||||
var auth = require('../middleware/auth')
|
||||
var webpack = require('../middleware/webpack')
|
||||
@@ -42,6 +43,7 @@ module.exports = function(options) {
|
||||
|
||||
app.use('/static/bower_components', express.static(pathutil.resource('bower_components')))
|
||||
app.use('/static/data', express.static(pathutil.resource('data')))
|
||||
app.use('/static/devices', datautil.middleware())
|
||||
app.use('/static', express.static(pathutil.resource('app')))
|
||||
|
||||
if (!options.disableWatch) {
|
||||
@@ -137,6 +139,7 @@ module.exports = function(options) {
|
||||
.then(function(cursor) {
|
||||
return Promise.promisify(cursor.toArray, cursor)()
|
||||
.then(function(list) {
|
||||
list.forEach(datautil.applyData)
|
||||
res.json({
|
||||
success: true
|
||||
, devices: list
|
||||
@@ -157,7 +160,7 @@ module.exports = function(options) {
|
||||
if (device) {
|
||||
res.json({
|
||||
success: true
|
||||
, device: device
|
||||
, device: datautil.applyData(device)
|
||||
})
|
||||
}
|
||||
else {
|
||||
@@ -267,7 +270,7 @@ module.exports = function(options) {
|
||||
socket.emit('device.change', message)
|
||||
})
|
||||
.on(wire.DeviceIdentityMessage, function(channel, message) {
|
||||
socket.emit('device.change', message)
|
||||
socket.emit('device.change', datautil.applyData(message))
|
||||
})
|
||||
.on(wire.TransactionProgressMessage, function(channel, message) {
|
||||
socket.emit('tx.progress', channel.toString(), message)
|
||||
|
||||
Reference in New Issue
Block a user