mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
Fix all lib/ files with ESLint rules with 0 errors.
This commit is contained in:
parent
994977ea94
commit
434f63b3a9
69 changed files with 793 additions and 764 deletions
|
@ -25,12 +25,12 @@ var jwtutil = require('../../util/jwtutil')
|
|||
|
||||
module.exports = function(options) {
|
||||
var log = logger.createLogger('websocket')
|
||||
, server = http.createServer()
|
||||
, io = socketio.listen(server, {
|
||||
var server = http.createServer()
|
||||
var io = socketio.listen(server, {
|
||||
serveClient: false
|
||||
, transports: ['websocket']
|
||||
})
|
||||
, channelRouter = new events.EventEmitter()
|
||||
var channelRouter = new events.EventEmitter()
|
||||
|
||||
// Output
|
||||
var push = zmqutil.socket('push')
|
||||
|
@ -89,12 +89,14 @@ module.exports = function(options) {
|
|||
|
||||
io.on('connection', function(socket) {
|
||||
var req = socket.request
|
||||
, user = req.user
|
||||
, channels = []
|
||||
var user = req.user
|
||||
var channels = []
|
||||
|
||||
user.ip = socket.handshake.query.uip || req.ip
|
||||
socket.emit('socket.ip', user.ip)
|
||||
|
||||
var messageListener = wirerouter()
|
||||
|
||||
function joinChannel(channel) {
|
||||
channels.push(channel)
|
||||
channelRouter.on(channel, messageListener)
|
||||
|
@ -118,7 +120,7 @@ module.exports = function(options) {
|
|||
}
|
||||
}
|
||||
|
||||
var messageListener = wirerouter()
|
||||
messageListener
|
||||
.on(wire.DeviceLogMessage, function(channel, message) {
|
||||
socket.emit('device.log', message)
|
||||
})
|
||||
|
@ -316,7 +318,7 @@ module.exports = function(options) {
|
|||
return dbapi.loadDevice(data.serial)
|
||||
})
|
||||
.then(function(device) {
|
||||
if(device) {
|
||||
if (device) {
|
||||
io.emit('device.change', {
|
||||
important: true
|
||||
, data: {
|
||||
|
@ -346,7 +348,7 @@ module.exports = function(options) {
|
|||
})
|
||||
|
||||
var tokenId = util.format('%s-%s', uuid.v4(), uuid.v4()).replace(/-/g, '')
|
||||
, title = data.title
|
||||
var title = data.title
|
||||
|
||||
return dbapi.saveUserAccessToken(user.email, {
|
||||
title: title
|
||||
|
@ -565,7 +567,7 @@ module.exports = function(options) {
|
|||
)
|
||||
])
|
||||
})
|
||||
.on('account.check', function(channel, responseChannel, data){
|
||||
.on('account.check', function(channel, responseChannel, data) {
|
||||
joinChannel(responseChannel)
|
||||
push.send([
|
||||
channel
|
||||
|
@ -890,7 +892,7 @@ module.exports = function(options) {
|
|||
)
|
||||
])
|
||||
})
|
||||
.on('fs.list', function(channel, responseChannel, data){
|
||||
.on('fs.list', function(channel, responseChannel, data) {
|
||||
joinChannel(responseChannel)
|
||||
push.send([
|
||||
channel
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue