From cf1f24bff694f64d6dbd73a1396e79d3c5e90918 Mon Sep 17 00:00:00 2001 From: Damjan Georgievski Date: Sat, 13 Feb 2016 22:24:43 +0100 Subject: [PATCH] Allow The Lounge to be proxied behind a /path/ url contains three small changes to use relative urls instead of absolute rooted at / * favicons in index.html * badge and pop sound in lounge.js * the url for the socket.io endpoint Typical use with nginx: location /path/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass http://localhost:9000/; } those trailing / are important. --- client/index.html | 6 +++--- client/js/lounge.js | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/client/index.html b/client/index.html index 66181f34..9d434103 100644 --- a/client/index.html +++ b/client/index.html @@ -16,9 +16,9 @@ - - - + + + "> diff --git a/client/js/lounge.js b/client/js/lounge.js index 68956b9b..5be4bc22 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -1,5 +1,6 @@ $(function() { - var socket = io(); + var path = window.location.pathname + "socket.io/"; + var socket = io({path:path}); var commands = [ "/close", "/connect", @@ -38,7 +39,7 @@ $(function() { var pop; try { pop = new Audio(); - pop.src = "/audio/pop.ogg"; + pop.src = "audio/pop.ogg"; } catch (e) { pop = { play: $.noop @@ -656,7 +657,7 @@ $(function() { if (settings.badge && Notification.permission === "granted") { var notify = new Notification(msg.from + " says:", { body: msg.text.trim(), - icon: "/img/logo-64.png", + icon: "img/logo-64.png", tag: target }); notify.onclick = function() {