From 5dbb4e28dab7ac455db152d4c5105923563666af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josip=20Jan=C5=BEi=C4=87?= Date: Sat, 4 Mar 2017 14:43:21 +0100 Subject: [PATCH 1/2] Use ssl for pusher websocket if using https port --- src/js/services/pusher/middleware.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/services/pusher/middleware.js b/src/js/services/pusher/middleware.js index 8a66ff5f..680cd398 100755 --- a/src/js/services/pusher/middleware.js +++ b/src/js/services/pusher/middleware.js @@ -78,7 +78,7 @@ const PusherMiddleware = (function(){ connection.username = connection.username.replace(/\W/g, '') socket = new WebSocket( - 'ws://'+state.mopidy.host+':'+state.mopidy.port+'/iris/ws', + 'ws'+(state.mopidy.port === '443' ? 's' : '')+'://'+state.mopidy.host+':'+state.mopidy.port+'/iris/ws', [ connection.clientid, connection.connection_id, connection.username ] ); @@ -316,4 +316,4 @@ const PusherMiddleware = (function(){ })(); -export default PusherMiddleware \ No newline at end of file +export default PusherMiddleware From 7452c743ba4493f42cb80549710aaf9119e1606d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josip=20Jan=C5=BEi=C4=87?= Date: Mon, 27 Mar 2017 15:16:24 +0200 Subject: [PATCH 2/2] Correct check for HTTPS protocol --- src/js/services/pusher/middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/services/pusher/middleware.js b/src/js/services/pusher/middleware.js index 680cd398..a093332f 100755 --- a/src/js/services/pusher/middleware.js +++ b/src/js/services/pusher/middleware.js @@ -78,7 +78,7 @@ const PusherMiddleware = (function(){ connection.username = connection.username.replace(/\W/g, '') socket = new WebSocket( - 'ws'+(state.mopidy.port === '443' ? 's' : '')+'://'+state.mopidy.host+':'+state.mopidy.port+'/iris/ws', + 'ws'+(window.location.protocol === 'https:' ? 's' : '')+'://'+state.mopidy.host+':'+state.mopidy.port+'/iris/ws', [ connection.clientid, connection.connection_id, connection.username ] );