From 4dca1d43b0b1ce8f987a6cf6acc9a6bb3b9822de Mon Sep 17 00:00:00 2001 From: velvettear Date: Wed, 7 Apr 2021 12:03:07 +0200 Subject: [PATCH] remove some unnecessary method calls --- libs/server.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libs/server.js b/libs/server.js index 83852f3..e22c5b3 100644 --- a/libs/server.js +++ b/libs/server.js @@ -85,24 +85,20 @@ function handleRequests() { // POST methods app.post('*', function (request, response) { logger.logRequest(request); - if (!blinkstick.isAnimationInProgress() || blinkstick.isInfiniteAnimationInProgress()) { response.end(); - blinkstick.parseColor(parseRequest(request.body)) - .then(blinkstick.illuminate) + blinkstick.illuminate(parseRequest(request.body)) .then(logger.info) .catch(logger.error); return; - } - response.sendStatus(503); }); } // parse the request and return an object with sane defaults function parseRequest(data) { - const blinkstickConfig = { + let blinkstickConfig = { "id": Math.random(), "mode": data["mode"] || config.api.post.mode.default, - "color": data["color"] || config.api.post.color.default, + "color": blinkstick.parseColor(data["color"]), "options": { "duration": data["duration"] || config.api.post.duration.default, "pulse": {