From ad8bc0c05b9ce0a935cb4b5cf6aad20f1212f234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Mon, 5 Aug 2019 12:24:59 +0200 Subject: [PATCH] Fixed remote issue --- server/public/assets/js/channel.js | 47 +++------------------ server/public/assets/js/hostcontroller.js | 6 +-- server/public/assets/js/remotecontroller.js | 5 +-- 3 files changed, 8 insertions(+), 50 deletions(-) diff --git a/server/public/assets/js/channel.js b/server/public/assets/js/channel.js index 81e9e8ae..73d1d327 100644 --- a/server/public/assets/js/channel.js +++ b/server/public/assets/js/channel.js @@ -3,10 +3,6 @@ var Channel = { if (window.location.hash == "#small" || inIframe()) { small_player = true; document.querySelector("footer").style.display = "none"; - //addJoinBox(); - //hideAllExtra(); - //document.querySelectorAll(".tab.col.s3")[1].remove(); - //document.querySelectorAll(".tab.col.s3")[1].remove(); } if (client) { Helper.addClass(".tabs", "hide"); @@ -25,12 +21,7 @@ var Channel = { Helper.addClass(".control-list", "client-control-list"); } else { if (!api_key.hasOwnProperty("soundcloud")) soundcloud_enabled = false; - else { - /*SC.initialize({ - client_id: api_key.soundcloud - }, function() { - });*/ - } + if (cast_ready_connect || chromecastAvailable || chromecastReady) { Helper.addClass(".volume-container", "volume-container-cast"); } @@ -295,10 +286,13 @@ var Channel = { if (!client) { if (!Helper.mobilecheck()) { + var port = window.location.port; + if (port != "") port = ":" + port; var shareCodeUrl = window.location.protocol + "//client." + window.location.hostname + + port + "/r/" + btoa(encodeURIComponent(chan.toLowerCase())); document @@ -312,18 +306,11 @@ var Channel = { "#channel-name-join", "client." + window.location.hostname + + port + "/" + encodeURIComponent(chan.toLowerCase()) ); - } /*else if(small_player) { - document.querySelector("#channel-share-modal .modal-content").innerHTML = "

To listen to this channel with more features, go to

https://zoff.me/" + encodeURIComponent(chan.toLowerCase()) + "

circle-logo-zoff"; - //M.Modal.getInstance(document.getElementById("channel-share-modal")).open(); - if(!Helper.mobilecheck()) { - setTimeout(function() { - M.Modal.getInstance(document.getElementById("channel-share-modal")).close(); - }, 10000); - } - }*/ + } } else { Helper.removeElement(".video-container"); Helper.removeElement(".offline-panel"); @@ -435,24 +422,6 @@ var Channel = { position: "top", html: "Cast Zoff to TV" }); - - /*$("#color_embed").spectrum({ - color: "#808080", - change: function(c) { - color = c.toHexString().substring(1); // #ff0000 - document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color); - }, - appendTo: "#embed", - containerClassName: 'polyfill-color z-depth-4', - show: function(color) { - }, - });*/ - - /*Helper.addClass(".sp-choose", "hide"); - Helper.addClass(".sp-cancel", "btn-flat waves-effect waves-red"); - Helper.removeClass(".sp-cancel", "sp-cancel"); - document.getElementsByClassName("sp-button-container")[0].insertAdjacentHTML("beforeend", "CHOOSE"); - */ } addListener("click", ".sp-choose-link", function(e) { @@ -708,10 +677,6 @@ var Channel = { channel: add + chan.toLowerCase() }); } else if (url_split[3] === "") { - /*if(client) { - var host = window.location.hostname.split("."); - window.location.hostname = host[host.length -1]; - }*/ Admin.display_logged_out(); if (hostMode) { Helper.removeClass("#main-row", "fullscreened"); diff --git a/server/public/assets/js/hostcontroller.js b/server/public/assets/js/hostcontroller.js index 02d5b779..b86cd179 100755 --- a/server/public/assets/js/hostcontroller.js +++ b/server/public/assets/js/hostcontroller.js @@ -13,11 +13,7 @@ var Hostcontroller = { Hostcontroller.old_id = id; } var codeURL = - window.location.protocol + - "//remote." + - window.location.hostname + - "/" + - id; + window.location.protocol + "//remote." + window.location.host + "/" + id; if (embed) { if (window.parentWindow && window.parentOrigin) { window.parentWindow.postMessage( diff --git a/server/public/assets/js/remotecontroller.js b/server/public/assets/js/remotecontroller.js index ada92ad1..676579a9 100755 --- a/server/public/assets/js/remotecontroller.js +++ b/server/public/assets/js/remotecontroller.js @@ -32,11 +32,8 @@ window.addEventListener( M.Modal.init(document.getElementById("about")); M.Modal.init(document.getElementById("contact")); M.Modal.init(document.getElementById("help")); - - if (window.location.hostname == "remote.zoff.me") add = "https://zoff.me"; - else add = "localhost"; socket = io.connect( - add, + window.location.protocol + "//" + window.location.host, connection_options ); socket.on("update_required", function() {