simplified unpairing
This commit is contained in:
parent
e50567ff81
commit
6ed979b1af
3 changed files with 14 additions and 44 deletions
35
.jshintrc
35
.jshintrc
|
|
@ -1,35 +1,6 @@
|
||||||
{
|
{
|
||||||
"white": false,
|
"trailing": false,
|
||||||
"node": true,
|
"node": true,
|
||||||
"browser": true,
|
"unused": "last-param",
|
||||||
"esnext": true,
|
"globalstrict": true
|
||||||
"bitwise": true,
|
|
||||||
"camelcase": true,
|
|
||||||
"curly": true,
|
|
||||||
"eqeqeq": true,
|
|
||||||
"immed": true,
|
|
||||||
"indent": 2,
|
|
||||||
"latedef": true,
|
|
||||||
"newcap": true,
|
|
||||||
"noarg": true,
|
|
||||||
"quotmark": "single",
|
|
||||||
"regexp": true,
|
|
||||||
"undef": true,
|
|
||||||
"unused": true,
|
|
||||||
"strict": true,
|
|
||||||
"trailing": true,
|
|
||||||
"smarttabs": true,
|
|
||||||
"globals": {
|
|
||||||
"angular": true,
|
|
||||||
"document": true,
|
|
||||||
"nf": true,
|
|
||||||
"$":true,
|
|
||||||
"_":true,
|
|
||||||
"Highcharts": true,
|
|
||||||
"timeseries": true,
|
|
||||||
"describe": true,
|
|
||||||
"beforeEach": true,
|
|
||||||
"afterEach": true,
|
|
||||||
"it": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
15
lib/app.js
15
lib/app.js
|
|
@ -89,13 +89,18 @@ module.exports = function (options) {
|
||||||
if (options.https) {
|
if (options.https) {
|
||||||
authMiddleware = function(req, res, next) {
|
authMiddleware = function(req, res, next) {
|
||||||
var fingerprint = req.connection.getPeerCertificate().fingerprint;
|
var fingerprint = req.connection.getPeerCertificate().fingerprint;
|
||||||
var e = new Error('Unauthorized');
|
|
||||||
e.status = 401;
|
|
||||||
|
|
||||||
config.isAuthorized(fingerprint, function (err, device) {
|
config.isAuthorized(fingerprint, function (err, device) {
|
||||||
if (err) { return next(e); }
|
if (err) {
|
||||||
if (!device) { return next(e); }
|
var serverError = new Error('Internal Server Error');
|
||||||
req.device = device;
|
serverError.status = 500;
|
||||||
|
return next(serverError);
|
||||||
|
}
|
||||||
|
if (!device) {
|
||||||
|
var pairError = new Error('Not Found');
|
||||||
|
pairError.status = 404;
|
||||||
|
return next(pairError);
|
||||||
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,6 @@ Error.prototype.toJSON = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
var poll = function(req, res) {
|
var poll = function(req, res) {
|
||||||
if (req.device.unpair) {
|
|
||||||
return res.json({
|
|
||||||
unpair: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var rateRec = _trader.rate(req.params.currency);
|
var rateRec = _trader.rate(req.params.currency);
|
||||||
var satoshiBalanceRec = _trader.balance;
|
var satoshiBalanceRec = _trader.balance;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue