From 60e12c6f2d93ee9b285861e71c49838d174ea0f4 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 3 Jan 2017 19:19:29 +0000 Subject: [PATCH] fix insecure protocol for websockets --- _embed/public/js/common.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/_embed/public/js/common.js b/_embed/public/js/common.js index 3c922081..1ae36b34 100644 --- a/_embed/public/js/common.js +++ b/_embed/public/js/common.js @@ -1,6 +1,7 @@ 'use strict'; var tempID = "_fm_internal_temporary_id", + ssl = (location.protocol === 'https:'), templates = {}, selectedItems = [], overlay, @@ -502,8 +503,10 @@ function searchEvent(event) { url = removeLastDirectoryPartOf(url); } + let protocol = ssl ? 'wss:' : 'ws'; + if(supported && user.AllowCommands) { - let conn = new WebSocket(`ws://${url}?command=true`); + let conn = new WebSocket(`${protocol}//${url}?command=true`); conn.onopen = function () { conn.send(value); @@ -516,7 +519,7 @@ function searchEvent(event) { conn.onclose = function (event) { search.classList.remove('ongoing'); - reloadListing(); + listing.reload(); } return; @@ -525,7 +528,7 @@ function searchEvent(event) { box.innerHTML = ''; let ul = box.querySelector('ul'), - conn = new WebSocket(`ws://${url}?search=true`); + conn = new WebSocket(`${protocol}//${url}?search=true`); conn.onopen = function () { conn.send(value);