Updated nginx and connection to support local and docker runtime

This commit is contained in:
Karmaa
2025-02-09 20:29:39 -06:00
parent 98a45e9161
commit cb18a0cd87
3 changed files with 7 additions and 5 deletions

View File

@@ -19,8 +19,8 @@ http {
index index.html index.htm;
}
# Proxy WebSocket requests
location /io/ {
# Proxy IO requests
location /socket.io/ {
proxy_pass http://localhost:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;

View File

@@ -70,7 +70,11 @@ export function NewTerminal({ hostConfig }) {
// Create socket connection
const isSecure = window.location.protocol === "https:";
const wsProtocol = isSecure ? "https" : "http";
const ioUrl = `${wsProtocol}://${window.location.host}/io/`;
let ioUrl = `${wsProtocol}://${window.location.host}/socket.io/`;
if(window.location.hostname === "localhost") {
ioUrl = "http://localhost:8081";
}
const socket = io(ioUrl);

View File

@@ -14,8 +14,6 @@ io.on("connection", (socket) => {
console.log("New socket connection established");
let stream = null;
let currentCols = 80;
let currentRows = 24;
socket.on("connectToHost", (cols, rows, hostConfig) => {
if (!hostConfig || !hostConfig.ip || !hostConfig.user || !hostConfig.password || !hostConfig.port) {