From b32206dd9d191cd493924634959245887b02a611 Mon Sep 17 00:00:00 2001 From: Tom60chat Date: Mon, 1 May 2023 18:21:07 +0200 Subject: [PATCH] Add subdirectory support for reverse proxy --- html/index.html | 19 ++++--- html/js/scriptin.js | 10 ++-- html/login.html | 17 +++--- mineos.conf | 1 + webui.js | 134 +++++++++++++++++++++++++++++--------------- 5 files changed, 114 insertions(+), 67 deletions(-) diff --git a/html/index.html b/html/index.html index e819e2f0..12440f97 100644 --- a/html/index.html +++ b/html/index.html @@ -5,6 +5,7 @@ + @@ -102,7 +103,7 @@ {{ 'REFRESH_SERVER_LIST' | translate }}
{{ 'REFRESH_PROFILE_LIST' | translate }}
{{ 'CHANGE_LOCALE' | translate }}
- {{ 'LOGOFF' | translate }} + {{ 'LOGOFF' | translate }} @@ -1803,14 +1804,14 @@

- - - - - - - - + + + + + + + + diff --git a/html/js/scriptin.js b/html/js/scriptin.js index 0e1d9cf8..a91d7a09 100644 --- a/html/js/scriptin.js +++ b/html/js/scriptin.js @@ -1049,6 +1049,8 @@ app.factory('ServerService', ['socket', '$filter', function(socket, $filter) { app.factory('socket', function ($rootScope) { //http://briantford.com/blog/angular-socket-io var sockets = {}; + + const urlBase = document.querySelector("head base").getAttribute("href"); var port = window.location.port || null; if (port === null) { @@ -1067,9 +1069,9 @@ app.factory('socket', function ($rootScope) { on: function (server_name, eventName, callback) { if (!(server_name in sockets)) { if (server_name == '/') - sockets[server_name] = io(connect_string, {secure: true}); + sockets[server_name] = io(connect_string, {secure: true, path: urlBase + "socket.io"}); else - sockets[server_name] = io(connect_string + server_name, {secure: true}); + sockets[server_name] = io(connect_string + server_name, {secure: true, path: urlBase + "socket.io"}); } sockets[server_name].on(eventName, function () { @@ -1082,9 +1084,9 @@ app.factory('socket', function ($rootScope) { emit: function (server_name, eventName, data, callback) { if (!(server_name in sockets)) { if (server_name == '/') - sockets[server_name] = io(connect_string, {secure: true}); + sockets[server_name] = io(connect_string, {secure: true, path: urlBase + "socket.io"}); else - sockets[server_name] = io(connect_string + server_name, {secure: true}); + sockets[server_name] = io(connect_string + server_name, {secure: true, path: urlBase + "socket.io"}); } sockets[server_name].emit(eventName, data, function () { diff --git a/html/login.html b/html/login.html index 8389090d..7cc4b5cf 100644 --- a/html/login.html +++ b/html/login.html @@ -5,6 +5,7 @@ + MineOS Web User Interface @@ -56,7 +57,7 @@

 

-