mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 21:03:47 +00:00
fix: host connections failing with "Authentication failed"
This commit is contained in:
@@ -257,6 +257,12 @@ wss.on("connection", async (ws: WebSocket, req) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
const urlObj = new URL(req.url || "", "http://localhost");
|
||||||
|
const qp = urlObj.searchParams.get("token");
|
||||||
|
if (qp) token = qp;
|
||||||
|
}
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
ws.close(1008, "Authentication required");
|
ws.close(1008, "Authentication required");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -432,6 +432,12 @@ wss.on("connection", async (ws: WebSocket, req) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
const urlObj = new URL(req.url || "", "http://localhost");
|
||||||
|
const qp = urlObj.searchParams.get("token");
|
||||||
|
if (qp) token = qp;
|
||||||
|
}
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
ws.close(1008, "Authentication required");
|
ws.close(1008, "Authentication required");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -866,6 +866,10 @@ const TerminalInner = forwardRef<TerminalHandle, SSHTerminalProps>(
|
|||||||
.replace(/^https?:\/\//, "")
|
.replace(/^https?:\/\//, "")
|
||||||
.replace(/\/$/, "");
|
.replace(/\/$/, "");
|
||||||
baseWsUrl = `${wsProtocol}${wsHost}/ssh/websocket/`;
|
baseWsUrl = `${wsProtocol}${wsHost}/ssh/websocket/`;
|
||||||
|
const storedJwt = localStorage.getItem("jwt");
|
||||||
|
if (storedJwt) {
|
||||||
|
baseWsUrl += `?token=${encodeURIComponent(storedJwt)}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
baseWsUrl = `${getBasePath()}/ssh/websocket/`;
|
baseWsUrl = `${getBasePath()}/ssh/websocket/`;
|
||||||
|
|||||||
Reference in New Issue
Block a user