mirror of
https://github.com/hardillb/node-red-alexa-home-skill-web.git
synced 2025-12-11 17:39:44 +01:00
Fix a couple of bugs
Add test for extra as an object Check for none existant device Add a broken.html for nginx to serve up when node app crashes
This commit is contained in:
22
broken.html
Normal file
22
broken.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Node-RED Alexa Smart Home Skill Bridge</title>
|
||||
<style type="text/css">
|
||||
.error-body {
|
||||
margin: auto;
|
||||
width: 80%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="error-body">
|
||||
<h1>Node-RED Alexa Smart Home Skill Bridge</h1>
|
||||
<p>It looks like the skill is currently experiencing a problem at the moment. Give it a couple
|
||||
of minutes and if it's still a problem please check if there is an existing open issue on
|
||||
GitHub <a href="https://github.com/hardillb/node-red-alexa-home-skill-web/issues">here</a>,
|
||||
if not then raise one.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
17
index.js
17
index.js
@@ -584,8 +584,13 @@ mqttClient.on('message',function(topic,message){
|
||||
if (payload.success) {
|
||||
waiting.res.status(200);
|
||||
if (payload.extra) {
|
||||
//console.log("sending extra");
|
||||
waiting.res.send(payload.extra);
|
||||
if (typeof payload.extra == "object") {
|
||||
waiting.res.send(payload.extra);
|
||||
} else {
|
||||
logger.info("extra not an object: ", extra);
|
||||
logger.info(waiting.user);
|
||||
waiting.res.send({});
|
||||
}
|
||||
} else {
|
||||
//console.log("not sending extra");
|
||||
waiting.res.send({});
|
||||
@@ -710,7 +715,7 @@ app.post('/device/:dev_id',
|
||||
if (err) {
|
||||
res.status(500);
|
||||
res.send(err);
|
||||
} else {
|
||||
} else if (data) {
|
||||
data.friendlyDescription = device.friendlyDescription;
|
||||
data.actions = device.actions;
|
||||
data.applianceTypes = device.applianceTypes;
|
||||
@@ -718,6 +723,12 @@ app.post('/device/:dev_id',
|
||||
res.status(201);
|
||||
res.send(d);
|
||||
});
|
||||
} else {
|
||||
res.status(500);
|
||||
res.send("No such device");
|
||||
logger.info("No such device");
|
||||
logger.info("username: ", user);
|
||||
logger.info("device_id: ", id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<p>Follow this link to reset your password</p>
|
||||
|
||||
<a href="https://alexa-node-red.bm.hardill.me.uk/changePassword/<%= uuid %>">https://alexa-node-red.bm.hardill.me.uk/changePassword/<%= uuid %></a>
|
||||
<a href="https://alexa-node-red.bm.hardill.me.uk/changePassword/<%= uuid %>" rel="nofollow">https://alexa-node-red.bm.hardill.me.uk/changePassword/<%= uuid %></a>
|
||||
|
||||
<p>This link will only be valid for the next 24hrs and will only work once.</p>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user