From 91a50073da2ca2f7521e49f8b422646bfcfd753a Mon Sep 17 00:00:00 2001 From: velvettear Date: Thu, 3 Mar 2022 20:59:12 +0100 Subject: [PATCH] renamed 'blinkstick.js' to 'controller.js' --- blinky.js | 4 ++-- libs/cli.js | 4 ++-- libs/{blinkstick.js => controller.js} | 0 libs/server.js | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) rename libs/{blinkstick.js => controller.js} (100%) diff --git a/blinky.js b/blinky.js index bbf4032..7c1c634 100644 --- a/blinky.js +++ b/blinky.js @@ -2,7 +2,7 @@ const logger = require('./libs/logger.js'); const util = require('./libs/util.js'); const cli = require('./libs/cli.js'); const server = require('./libs/server.js'); -const blinkstick = require('./libs/blinkstick.js'); +const controller = require('./libs/controller.js'); const packageJSON = require('./package'); const INTERRUPTS = ['SIGINT', 'SIGTERM']; @@ -25,7 +25,7 @@ async function main() { if (await cli.handleArguments()) { exit(); } - await blinkstick.findBlinkstick(); + await controller.findBlinkstick(); logger.info(await server.start()); server.handleRequests(); } diff --git a/libs/cli.js b/libs/cli.js index c3fc389..5f9fa72 100644 --- a/libs/cli.js +++ b/libs/cli.js @@ -1,5 +1,5 @@ const logger = require('./logger.js'); -const blinkstick = require('./blinkstick.js'); +const controller = require('./controller.js'); const constants = require('./constants.js'); async function handleArguments() { @@ -9,7 +9,7 @@ async function handleArguments() { case constants.ARG_CONFIG: continue; case constants.ARG_GET_SERIALS: - logger.info('blinksticks: ' + JSON.stringify(await blinkstick.findBlinkstick(constants.ALL))); + logger.info('blinksticks: ' + JSON.stringify(await controller.findBlinkstick(constants.ALL))); handled++; break; } diff --git a/libs/blinkstick.js b/libs/controller.js similarity index 100% rename from libs/blinkstick.js rename to libs/controller.js diff --git a/libs/server.js b/libs/server.js index 40a8b1c..99c8a17 100644 --- a/libs/server.js +++ b/libs/server.js @@ -1,6 +1,6 @@ const config = require('../config.json'); const logger = require('./logger.js'); -const blinkstick = require('./blinkstick.js'); +const controller = require('./controller.js'); const parser = require('./parser.js'); const constants = require('./constants.js'); const path = require('path'); @@ -65,7 +65,7 @@ function handleRequests() { async function handleSimpleAnimation(config, response) { try { - response.end(JSON.stringify(await blinkstick.simple(config))); + response.end(JSON.stringify(await controller.simple(config))); } catch (err) { logger.error(err); response.status(500); @@ -74,12 +74,12 @@ async function handleSimpleAnimation(config, response) { } async function handleComplexAnimation(config, response) { - if (blinkstick.isInfiniteAnimation(config)) { + if (controller.isInfiniteAnimation(config)) { response.end(JSON.stringify({status: 'ok', time: 'infinite'})); response = undefined; } try { - const result = await blinkstick.complex(config); + const result = await controller.complex(config); if (response === undefined) { return; } @@ -96,7 +96,7 @@ async function handleComplexAnimation(config, response) { async function handlePowerOff(config, response) { try { - response.end(JSON.stringify(await blinkstick.powerOff(config))); + response.end(JSON.stringify(await controller.powerOff(config))); } catch (err) { response.status(500); response.end(JSON.stringify({status: 'error', error: err.message}));