Merge commit from fork

This commit is contained in:
ZacharyZcR
2026-07-15 14:57:40 +08:00
committed by GitHub
parent e1d1a3e53d
commit 9d336bf9df
3 changed files with 38 additions and 13 deletions
+12 -1
View File
@@ -2138,12 +2138,19 @@ app.post("/docker/ssh/keepalive", async (req, res) => {
*/
app.get("/docker/ssh/status", async (req, res) => {
const sessionId = req.query.sessionId as string;
const userId = getRequestUserId(req);
if (!sessionId) {
return res.status(400).json({ error: "Session ID is required" });
}
const isConnected = !!sshSessions[sessionId]?.isConnected;
if (!userId) {
return res.status(401).json({ error: "Authentication required" });
}
const session = sshSessions[sessionId];
const isConnected =
session?.userId === userId && session.isConnected === true;
res.json({ success: true, connected: isConnected });
});
@@ -2193,6 +2200,10 @@ app.get("/docker/validate/:sessionId", async (req, res) => {
});
}
if (session.userId !== userId) {
return res.status(403).json({ error: "Session access denied" });
}
session.lastActive = Date.now();
session.activeOperations++;