Force example frame before evaluating query and body of post for parameters
This commit is contained in:
parent
0848d5bfc0
commit
9302cf1b21
5
index.js
5
index.js
|
@ -120,8 +120,9 @@ function rDelay (req, res, next) {
|
|||
}
|
||||
|
||||
function rFrame (req, res, next) {
|
||||
intval.frame(cb=()=>{
|
||||
log.info('happened')
|
||||
log.info('/frame', { method : req.method })
|
||||
intval.frame(true, 0, () => {
|
||||
log.info('frame stopped')
|
||||
})
|
||||
res.send({})
|
||||
return next()
|
||||
|
|
|
@ -11,7 +11,7 @@ function capitalize (s) {
|
|||
class Blootstrap {
|
||||
constructor () {
|
||||
this._onData = () => {}
|
||||
try {
|
||||
ipc.config.maxRetries = 0
|
||||
ipc.connectTo('blootstrap_ble', () => {
|
||||
ipc.of.blootstrap_ble.on('connect', () => {
|
||||
log.info('connect', `Connected to the blootstrap_ble service`)
|
||||
|
@ -33,9 +33,6 @@ class Blootstrap {
|
|||
}
|
||||
})
|
||||
})
|
||||
} catch (e) {
|
||||
log.error('connectTo', { error : e })
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Binds functions to events that are triggered by BLE messages
|
||||
|
|
|
@ -13,12 +13,14 @@ const log = require('../log')('wifi')
|
|||
const exec = require('child_process').exec
|
||||
const fs = require('fs')
|
||||
|
||||
let _entry = null
|
||||
let _ssid = null
|
||||
let _cb = null
|
||||
|
||||
/** Class representing the wifi features */
|
||||
class Wifi {
|
||||
constructor () {
|
||||
this._callback = () => {}
|
||||
this._entry = null
|
||||
this._ssid = null
|
||||
|
||||
}
|
||||
/**
|
||||
* List available wifi access points
|
||||
|
@ -54,14 +56,14 @@ class Wifi {
|
|||
_readConfigCb (err, data) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
return this._callback(err)
|
||||
return _cb(err)
|
||||
}
|
||||
if (data.search(networkPattern) === -1) {
|
||||
data += `\n${this._entry}`
|
||||
data += `\n${_entry}`
|
||||
} else {
|
||||
data = data.replace(networkPattern, this._entry)
|
||||
data = data.replace(networkPattern, _entry)
|
||||
}
|
||||
this._entry = null
|
||||
_entry = null
|
||||
fs.writeFile(filePath, data, 'utf8', this._writeConfigCb)
|
||||
}
|
||||
/**
|
||||
|
@ -73,7 +75,7 @@ class Wifi {
|
|||
_writeConfigCb (err) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
return this._callback(err)
|
||||
return _cb(err)
|
||||
}
|
||||
exec(reconfigure, this._reconfigureCb)
|
||||
}
|
||||
|
@ -87,7 +89,7 @@ class Wifi {
|
|||
_reconfigureCb (err, stdout, stderr) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
return this._callback(err)
|
||||
return _cb(err)
|
||||
}
|
||||
console.log('Wifi reconfigured')
|
||||
exec(refresh, this._refreshCb)
|
||||
|
@ -102,11 +104,11 @@ class Wifi {
|
|||
_refreshCb (err, stdout, stderr) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
return this._callback(err)
|
||||
return _cb(err)
|
||||
}
|
||||
console.log('Wifi refreshed')
|
||||
//this._callback(null, { ssid : ssid, pwd : pwd.length })
|
||||
this._callback = () => {}
|
||||
_cb = () => {}
|
||||
}
|
||||
/**
|
||||
* Function which initializes the processes for adding a wifi access point authentication
|
||||
|
@ -116,9 +118,9 @@ class Wifi {
|
|||
* @param {function} callback Function invoked after process is complete, or fails
|
||||
*/
|
||||
setNetwork (ssid, pwd, callback) {
|
||||
this._entry = `network={\n\tssid="${ssid}"\n\tpsk="${pwd}"\n}\n`
|
||||
this._callback = callback
|
||||
this._ssid = ssid
|
||||
_entry = `network={\n\tssid="${ssid}"\n\tpsk="${pwd}"\n}\n`
|
||||
_cb = callback
|
||||
_ssid = ssid
|
||||
fs.readFile(filePath, 'utf8', this._readConfigCb)
|
||||
}
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue