Skip to content

Commit 56eb8bd

Browse files
committed
Remove unrelated formmatting changes
1 parent 54719a6 commit 56eb8bd

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

API/api.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const bodyParser = require("body-parser");
1515
const express = require("express");
1616

1717
module.exports = {
18-
/* getApiKey
18+
/* getApiKey
1919
* Middleware method for ExpressJS to check if an API key is provided.
2020
* Only checks for an API key if one is defined in the module's config section.
2121
*/
@@ -36,7 +36,7 @@ module.exports = {
3636
this.secureEndpoints = true;
3737
}
3838
}
39-
39+
4040
},
4141

4242

@@ -112,11 +112,11 @@ module.exports = {
112112

113113
this.expressApp.use(bodyParser.urlencoded({ extended: true }));
114114
this.expressApp.use(bodyParser.json());
115-
115+
116116
this.expressApp.use('/api/docs', express.static(path.join(__dirname, '../docs'))); // Docs without apikey
117117

118118
this.expressRouter = express.Router();
119-
119+
120120
// Route for testing the api at http://mirror:8080/api/test
121121
this.expressRouter.route(['/test','/']) // Test without apiKey
122122
.get((req, res) => {
@@ -183,7 +183,7 @@ module.exports = {
183183
console.log(req.path);
184184
self.executeQuery(this.checkDelay({ action: r }, req), res);
185185
});
186-
186+
187187
this.expressRouter.route('/classes/:value')
188188
.get((req, res) => {
189189
var classes = self.getConfig().modules.find(m => m.module === "MMM-Remote-Control").config || {};
@@ -194,7 +194,7 @@ module.exports = {
194194
res.status(400).json({ success: false, message: `Invalid value ${val} provided in request. Use /api/classes to see actual values` });
195195
}
196196
});
197-
197+
198198
this.expressRouter.route('/command/:value')
199199
.get((req, res) => {
200200
if(!this.apiKey && this.secureEndpoints) return res.status(403).json({ success: false, message: "Forbidden: API Key Not Provided in Config! Use secureEndpoints to bypass this message" });
@@ -238,7 +238,7 @@ module.exports = {
238238
res.status(400).json({ success: false, message: "Invalid URL provided in request body" });
239239
}
240240
});
241-
241+
242242
//edit config, payload is completely new config object with your changes(edits).
243243
this.expressRouter.route('/config/edit')
244244
.get((req, res) => {
@@ -326,32 +326,32 @@ module.exports = {
326326
}
327327
return query;
328328
},
329-
329+
330330
mergeData: function() {
331331
var extApiRoutes = this.externalApiRoutes;
332332
var modules = this.configData.moduleData
333333
var query = {success: true, data: []};
334-
334+
335335
modules.forEach((mod) => {
336336
if (extApiRoutes[mod.name] === undefined) {
337337
query.data.push(mod);
338338
} else {
339339
query.data.push(Object.assign({},mod, {actions: extApiRoutes[mod.name].actions}));
340340
}
341341
})
342-
342+
343343
return query;
344344
},
345345

346346
answerModuleApi: function(req, res) {
347347
if (!this.checkInititialized(res)) { return; }
348348
var dataMerged = this.mergeData().data
349-
349+
350350
if (!req.params.moduleName) {
351351
res.json({ success: true, data: dataMerged });
352352
return;
353353
}
354-
354+
355355
let modData = [];
356356
if(req.params.moduleName !== 'all') {
357357
modData = dataMerged.filter(m => {
@@ -365,26 +365,26 @@ module.exports = {
365365
} else {
366366
modData = dataMerged;
367367
}
368-
368+
369369
if (!modData.length) {
370370
res.status(400).json({ success: false, message: "Module Name or Identifier Not Found!" });
371371
return;
372-
}
373-
372+
}
373+
374374
if (!req.params.action) {
375375
res.json({ success: true, data: modData });
376376
return;
377377
}
378-
378+
379379
var action = req.params.action.toUpperCase();
380-
380+
381381
if (["SHOW", "HIDE", "FORCE", "TOGGLE", "DEFAULTS"].indexOf(action) !== -1) { // /api/modules part of the code
382-
382+
383383
if (action === "DEFAULTS") {
384384
this.answerGet({ data: "defaultConfig", module: mod.name }, res);
385385
return;
386386
}
387-
387+
388388
if (req.params.moduleName === "all") {
389389
let query = { module: "all" };
390390
if (action === "FORCE") {
@@ -396,7 +396,7 @@ module.exports = {
396396
this.executeQuery(this.checkDelay(query, req), res);
397397
return;
398398
}
399-
399+
400400
modData.forEach(mod => {
401401
let query = { module: mod.identifier };
402402
if (action === "FORCE") {
@@ -410,19 +410,19 @@ module.exports = {
410410
this.sendSocketNotification("UPDATE");
411411
return;
412412
}
413-
413+
414414
action = modData[0].actions[req.params.action]
415-
415+
416416
if (action) {
417417
if ("method" in action && action.method !== req.method) {
418418
res.status(400).json({ success: false, info: `Method ${req.method} is not allowed for ${moduleName}/${req.params.action}.` });
419419
return;
420420
}
421421
this.answerNotifyApi(req, res, action);
422422
}
423-
423+
424424
},
425-
425+
426426
answerNotifyApi: function(req, res, action) {
427427
// Build the payload to send with our notification.
428428
let n = "";

0 commit comments

Comments
 (0)