mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-06-04 06:02:25 -04:00
The frontend and backend can now be reverse proxied together
This commit is contained in:
@@ -52,6 +52,7 @@ export default {
|
||||
}),
|
||||
replace({
|
||||
BACKEND_PORT: JSON.stringify(process.env.BACKEND_PORT),
|
||||
BACKEND_IS_PROXIED: JSON.stringify(!!process.env.BACKEND_IS_PROXIED),
|
||||
preventAssignment: true
|
||||
}),
|
||||
// we'll extract any component CSS out into
|
||||
|
||||
@@ -7,7 +7,15 @@ const message = writable('');
|
||||
let socket;
|
||||
|
||||
function initSocket() {
|
||||
socket = new WebSocket(`ws://${location.hostname}:${BACKEND_PORT}/wol/`);
|
||||
if (BACKEND_IS_PROXIED) {
|
||||
const socketUrl = new URL('/wol/', window.location.href);
|
||||
socketUrl.protocol = socketUrl.protocol.replace('http', 'ws');
|
||||
|
||||
socket = new WebSocket(socketUrl);
|
||||
}
|
||||
else {
|
||||
socket = new WebSocket(`ws://${location.hostname}:${BACKEND_PORT}/wol/`);
|
||||
}
|
||||
|
||||
// Connection opened
|
||||
socket.addEventListener('open', function () {
|
||||
|
||||
Reference in New Issue
Block a user