diff --git a/web-service/public/js/bundle.js b/web-service/public/js/bundle.js index 4ce089f605ecef0a6bdc5bb12b1d0a9af671a8a8..3ad7e375c5a020ca7a0f1cca434de5082fd531e8 100644 --- a/web-service/public/js/bundle.js +++ b/web-service/public/js/bundle.js @@ -38,8 +38,7 @@ checkIfLoggedIn = async () => { */ getAvailableStreams = async () => { try{ - const streamsInJson = await fetch('http://localhost:8080/streams'); - console.log(streamsInJson) + const streamsInJson = await fetch(`./streams`); const streams = await streamsInJson.json(); console.log('AVAILABLE', streams) return streams; @@ -79,7 +78,7 @@ renderThumbnails = async () => { current_data.uri = thumbnails[i] console.log("URI to be added", thumbnails[i]) try{ - const someData = await fetch(`http://localhost:8080/stream/rgb?uri=${encodedURI}`) + const someData = await fetch(`./stream/rgb?uri=${encodedURI}`) console.log('SOME DATA', someData) if(!someData.ok){ throw new Error('Image not found') @@ -111,7 +110,7 @@ createCard = (url, viewers) => { createPeer = () => { - const ws = new WebSocket('ws://localhost:8080/'); + const ws = new WebSocket("ws://" + location.host + ":" + (location.port == "" ? "80" : location.port) + location.pathname); ws.binaryType = "arraybuffer"; peer = new Peer(ws) } @@ -151,6 +150,7 @@ closeStream = () => { * ************** */ + current_data.configURI = "ftl://utu.fi#reconstruction_snap8/net" configs = () => { @@ -172,7 +172,7 @@ renderConfigOptions = () => { loadConfigs = async (str) => { const configURI = encodeURIComponent(`ftl://utu.fi#reconstruction_snap8${str}`); const uri = encodeURIComponent(current_data.uri) - const rawResp = await fetch(`http://localhost:8080/stream/config?settings=${configURI}&uri=${uri}`) + const rawResp = await fetch(`./stream/config?settings=${configURI}&uri=${uri}`) const response = await rawResp.json(); const content = JSON.parse(response); container.innerHTML += `<p>${response}</p>`; @@ -185,7 +185,7 @@ loadConfigs = async (str) => { */ saveConfigs = async () => { let {uri, configURI, configData} = current_data - const rawResp = await fetch('http://localhost:8080/stream/config', { + const rawResp = await fetch('./stream/config', { method: 'POST', headers: { 'Accept': 'application/json', @@ -2025,8 +2025,8 @@ function objectToString(o) { return Object.prototype.toString.call(o); } -}).call(this,{"isBuffer":require("../../../../../../../../../../../usr/lib/node_modules/watchify/node_modules/is-buffer/index.js")}) -},{"../../../../../../../../../../../usr/lib/node_modules/watchify/node_modules/is-buffer/index.js":47}],12:[function(require,module,exports){ +}).call(this,{"isBuffer":require("../../../../../../../../../../../usr/lib/node_modules/browserify/node_modules/is-buffer/index.js")}) +},{"../../../../../../../../../../../usr/lib/node_modules/browserify/node_modules/is-buffer/index.js":47}],12:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { diff --git a/web-service/public/js/index.js b/web-service/public/js/index.js index f955feb4c84e1e53b6ab1343887b26bbf1a7d9be..2f8c10613b3f698b2cbe422b4ef6c3f8ada6ea5b 100644 --- a/web-service/public/js/index.js +++ b/web-service/public/js/index.js @@ -37,8 +37,7 @@ checkIfLoggedIn = async () => { */ getAvailableStreams = async () => { try{ - const streamsInJson = await fetch('http://localhost:8080/streams'); - console.log(streamsInJson) + const streamsInJson = await fetch(`./streams`); const streams = await streamsInJson.json(); console.log('AVAILABLE', streams) return streams; @@ -78,7 +77,7 @@ renderThumbnails = async () => { current_data.uri = thumbnails[i] console.log("URI to be added", thumbnails[i]) try{ - const someData = await fetch(`http://localhost:8080/stream/rgb?uri=${encodedURI}`) + const someData = await fetch(`./stream/rgb?uri=${encodedURI}`) console.log('SOME DATA', someData) if(!someData.ok){ throw new Error('Image not found') @@ -110,7 +109,7 @@ createCard = (url, viewers) => { createPeer = () => { - const ws = new WebSocket('ws://localhost:8080/'); + const ws = new WebSocket("ws://" + location.host + ":" + (location.port == "" ? "80" : location.port) + location.pathname); ws.binaryType = "arraybuffer"; peer = new Peer(ws) } @@ -150,6 +149,7 @@ closeStream = () => { * ************** */ + current_data.configURI = "ftl://utu.fi#reconstruction_snap8/net" configs = () => { @@ -171,7 +171,7 @@ renderConfigOptions = () => { loadConfigs = async (str) => { const configURI = encodeURIComponent(`ftl://utu.fi#reconstruction_snap8${str}`); const uri = encodeURIComponent(current_data.uri) - const rawResp = await fetch(`http://localhost:8080/stream/config?settings=${configURI}&uri=${uri}`) + const rawResp = await fetch(`./stream/config?settings=${configURI}&uri=${uri}`) const response = await rawResp.json(); const content = JSON.parse(response); container.innerHTML += `<p>${response}</p>`; @@ -184,7 +184,7 @@ loadConfigs = async (str) => { */ saveConfigs = async () => { let {uri, configURI, configData} = current_data - const rawResp = await fetch('http://localhost:8080/stream/config', { + const rawResp = await fetch('./stream/config', { method: 'POST', headers: { 'Accept': 'application/json',