simplified unpairing
This commit is contained in:
parent
e50567ff81
commit
6ed979b1af
3 changed files with 14 additions and 44 deletions
37
.jshintrc
37
.jshintrc
|
|
@ -1,35 +1,6 @@
|
|||
{
|
||||
"white": false,
|
||||
"trailing": false,
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"esnext": 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
|
||||
}
|
||||
}
|
||||
"unused": "last-param",
|
||||
"globalstrict": true
|
||||
}
|
||||
15
lib/app.js
15
lib/app.js
|
|
@ -89,13 +89,18 @@ module.exports = function (options) {
|
|||
if (options.https) {
|
||||
authMiddleware = function(req, res, next) {
|
||||
var fingerprint = req.connection.getPeerCertificate().fingerprint;
|
||||
var e = new Error('Unauthorized');
|
||||
e.status = 401;
|
||||
|
||||
config.isAuthorized(fingerprint, function (err, device) {
|
||||
if (err) { return next(e); }
|
||||
if (!device) { return next(e); }
|
||||
req.device = device;
|
||||
if (err) {
|
||||
var serverError = new Error('Internal Server Error');
|
||||
serverError.status = 500;
|
||||
return next(serverError);
|
||||
}
|
||||
if (!device) {
|
||||
var pairError = new Error('Not Found');
|
||||
pairError.status = 404;
|
||||
return next(pairError);
|
||||
}
|
||||
next();
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,12 +18,6 @@ Error.prototype.toJSON = function () {
|
|||
};
|
||||
|
||||
var poll = function(req, res) {
|
||||
if (req.device.unpair) {
|
||||
return res.json({
|
||||
unpair: true
|
||||
});
|
||||
}
|
||||
|
||||
var rateRec = _trader.rate(req.params.currency);
|
||||
var satoshiBalanceRec = _trader.balance;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue