WIP
This commit is contained in:
parent
a49fac6cc8
commit
bb1e952e39
5 changed files with 4 additions and 5 deletions
|
|
@ -17,7 +17,6 @@ if (!httpOnly) {
|
||||||
options.https = {
|
options.https = {
|
||||||
key: fs.readFileSync(options.certKeyPath),
|
key: fs.readFileSync(options.certKeyPath),
|
||||||
cert: fs.readFileSync(options.certPath),
|
cert: fs.readFileSync(options.certPath),
|
||||||
requestCert: true
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Please configure your certificate.')
|
console.log('Please configure your certificate.')
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ module.exports = function (options) {
|
||||||
var authMiddleware
|
var authMiddleware
|
||||||
|
|
||||||
if (options.https) {
|
if (options.https) {
|
||||||
var serverOptions = {
|
const serverOptions = {
|
||||||
key: options.https.key,
|
key: options.https.key,
|
||||||
cert: options.https.cert,
|
cert: options.https.cert,
|
||||||
requestCert: true
|
requestCert: true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const pgp = require('pg-promise')()
|
const pgp = require('pg-promise')()
|
||||||
const psqlUrl = require('../lib/options').postgresql
|
const psqlUrl = require('../lib/options').postgresql
|
||||||
|
|
||||||
module.exports = {db: pgp(psqlUrl)}
|
module.exports = pgp(psqlUrl)
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,8 @@ exports.cartridgeCounts = function cartridgeCounts (deviceId) {
|
||||||
return db.oneOrNone(sql, [deviceId, true])
|
return db.oneOrNone(sql, [deviceId, true])
|
||||||
.then(row => {
|
.then(row => {
|
||||||
const counts = row ? [row.count1, row.count2] : [0, 0]
|
const counts = row ? [row.count1, row.count2] : [0, 0]
|
||||||
return {id: row.id, counts: counts}
|
const id = row ? row.id : 0
|
||||||
|
return {id, counts}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ function buildBalances (deviceId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function poll (req, res) {
|
function poll (req, res) {
|
||||||
console.log('DEBUG1')
|
|
||||||
const deviceId = getDeviceId(req)
|
const deviceId = getDeviceId(req)
|
||||||
const deviceTime = getDeviceTime(req)
|
const deviceTime = getDeviceTime(req)
|
||||||
const pid = req.query.pid
|
const pid = req.query.pid
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue