From 77cb0e16cec7d7e1681ece690bc851053808a910 Mon Sep 17 00:00:00 2001
From: Sami Spets <savasp@utu.fi>
Date: Wed, 11 Dec 2019 12:07:20 +0200
Subject: [PATCH] Changing the configs from browser works

---
 web-service/public/js/index.js  |  1 -
 web-service/server/src/index.js | 14 ++++++--------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/web-service/public/js/index.js b/web-service/public/js/index.js
index 79da55095..293ecf1b4 100644
--- a/web-service/public/js/index.js
+++ b/web-service/public/js/index.js
@@ -158,7 +158,6 @@ connectToStream = () => {
     const converter = new VideoConverter.default(element, 20, 6);
 
     peer.bind(current_data.uri, (latency, streampckg, pckg) => {
-        console.log("CURRENTDATAS URI", current_data.uri)
         if(pckg[0] === 2){
             function decode(value){
                 converter.appendRawData(value);
diff --git a/web-service/server/src/index.js b/web-service/server/src/index.js
index 8725c3011..9640ce4e7 100644
--- a/web-service/server/src/index.js
+++ b/web-service/server/src/index.js
@@ -422,7 +422,6 @@ app.ws('/', (ws, req) => {
 
 	p.bind("find_stream", (uri) => {
 		const parsedURI = stringSplitter(uri)
-		console.log("PARSEDURI", parsedURI)
 		if (uri_to_peer.hasOwnProperty(parsedURI)) {
 			console.log("Stream found: ", uri);
 			return [Peer.uuid];
@@ -514,15 +513,14 @@ app.ws('/', (ws, req) => {
 	 * Update certain URIs values
 	 */
 	 p.bind("update_cfg", (uri, json) => {
-		const parsedURI = stringSplitter(uri);
-		console.log("PARSEDURI", parsedURI)
+		const parsedURI = stringSplitter(uri)
+		console.log("URI", uri)
+		console.log("JSON", json)
 		if(uri_to_peer[parsedURI]){
-			let peer = uri_to_peer[parsedURI].peer
-			if(peer){
-			 peer.send("update_cfg", uri, json)
-			}
+			let peer = uri_to_peer[parsedURI]
+			peer.send("update_cfg", uri, json)
 		}else{
-			console.log("Config not found", uri)
+			console.log("Failed to update the configuration uri", uri)
 			return "{}";
 		}
 	 })
-- 
GitLab