make Prowl consistent with Pushbullet

This commit is contained in:
Dave C-J 2014-04-27 16:39:09 +01:00
parent 2c80c90f84
commit 3a4f870257
2 changed files with 10 additions and 1 deletions

View File

@ -32,6 +32,7 @@
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips" id="node-tip"><b>Note:</b> Using credentials from global pushkey.js file.</div>
</script>
<script type="text/x-red" data-help-name="prowl">
@ -69,6 +70,8 @@
} else {
$('#node-config-input-pushkey').val('');
}
if (data.global) $('#node-tip').show();
else $('#node-tip').hide();
});
},
oneditsave: function() {

View File

@ -75,7 +75,13 @@ RED.httpAdmin.get('/prowl/:id',function(req,res) {
var credentials = RED.nodes.getCredentials(req.params.id);
if (credentials) {
res.send(JSON.stringify({hasPassword:(credentials.pushkey&&credentials.pushkey!="")}));
} else {
}
else if (pushkeys && pushkeys.prowlkey) {
RED.nodes.addCredentials(req.params.id,{pushkey:pushkeys.prowlkey,global:true});
credentials = RED.nodes.getCredentials(req.params.id);
res.send(JSON.stringify({hasPassword:(credentials.pushkey&&credentials.pushkey!=""),global:credentials.global}));;
}
else {
res.send(JSON.stringify({}));
}
});