node-red-contrib-sonospollytts
Advanced tools
Comparing version 1.0.20 to 1.0.21
@@ -6,2 +6,6 @@ # Node-Red | ||
<p> | ||
<b>Version 1.0.21</b><br/> | ||
- Added handling of non standard nodered installations, having httpAdminRoot, httpNodeRoot or httpRoot altered by user. Thanks @ukmoose.<br/> | ||
</p> | ||
<p> | ||
<b>Version 1.0.20</b><br/> | ||
@@ -8,0 +12,0 @@ - Fixed an issue, where if you changed the node-red httpAdminRoot, the node won't play anything. Thanks @JorinL.<br/> |
{ | ||
"name": "node-red-contrib-sonospollytts", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"description": "Node-Red TTS with Sonos and Amazon Polly", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -558,12 +558,12 @@ module.exports = function(RED) { | ||
// Store Noder-Red complete URL | ||
if (RED.settings.httpRoot=="/") { | ||
// Standard root path, do not add the / otherwise we'll have an error because of double "//"" in the sonos url | ||
node.sNoderedURL="http://"+ config.noderedipaddress.trim() + ":" + config.noderedport.trim(); // RED.settings.uiPort | ||
// 27/10/2019 Changes made according to new httpRoot habdling, beginning from nodered 0.6.0 https://nodered.org/blog/2014/02/21/version-0-6-0-released | ||
if (RED.settings.httpAdminRoot !== "/") { | ||
// Set the httpAdminRoot as the tts endpoint root | ||
node.sNoderedURL="http://"+ config.noderedipaddress.trim() + ":" + config.noderedport.trim()+ RED.settings.httpAdminRoot; // RED.settings.uiPort | ||
}else | ||
{ | ||
// Add the httpRoot | ||
// Add the httpRoot (ignore httpNodeRoot. See above link | ||
node.sNoderedURL="http://"+ config.noderedipaddress.trim() + ":" + config.noderedport.trim() + RED.settings.httpRoot; | ||
} | ||
RED.log.info('SonosPollyTTS: Node-Red URL: ' + node.sNoderedURL); | ||
RED.log.info('SonosPollyTTS: Node-Red Endpoint will be created here: ' + node.sNoderedURL + "tts"); | ||
@@ -1035,5 +1035,5 @@ // Create sonos client | ||
}else{ | ||
sUrl = node.sNoderedURL + RED.settings.httpAdminRoot + "tts/tts.mp3?f=" + encodeURIComponent(_songuri); | ||
sUrl = node.sNoderedURL + "tts/tts.mp3?f=" + encodeURIComponent(_songuri); | ||
} | ||
RED.log.info('SonosPollyTTS: PlaySonos - _songuri: ' + _songuri + ' sUrl: '+sUrl); | ||
@@ -1074,2 +1074,3 @@ node.SonosClient.setVolume(node.sSonosVolume).then(success => { | ||
try { | ||
var url = require('url'); | ||
@@ -1076,0 +1077,0 @@ var url_parts = url.parse(req.url, true); |
357283
951