@lifeaitools/clauth 1.5.70 → 1.5.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/commands/serve.js +23 -0
- package/package.json +1 -1
package/cli/commands/serve.js
CHANGED
|
@@ -3793,6 +3793,29 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
3793
3793
|
return;
|
|
3794
3794
|
}
|
|
3795
3795
|
|
|
3796
|
+
// POST /terminal/recv — read last response from a terminal session
|
|
3797
|
+
if (method === "POST" && reqPath === "/terminal/recv") {
|
|
3798
|
+
let body = "";
|
|
3799
|
+
req.on("data", d => body += d);
|
|
3800
|
+
req.on("end", () => {
|
|
3801
|
+
try {
|
|
3802
|
+
const { session_id } = JSON.parse(body);
|
|
3803
|
+
if (!session_id) {
|
|
3804
|
+
res.writeHead(400, { "Content-Type": "application/json", ...CORS });
|
|
3805
|
+
return res.end(JSON.stringify({ error: "session_id required" }));
|
|
3806
|
+
}
|
|
3807
|
+
const result = recvTerminalResponse(session_id);
|
|
3808
|
+
const status = result.error ? 404 : 200;
|
|
3809
|
+
res.writeHead(status, { "Content-Type": "application/json", ...CORS });
|
|
3810
|
+
res.end(JSON.stringify(result));
|
|
3811
|
+
} catch {
|
|
3812
|
+
res.writeHead(400, { "Content-Type": "application/json", ...CORS });
|
|
3813
|
+
res.end(JSON.stringify({ error: "invalid JSON" }));
|
|
3814
|
+
}
|
|
3815
|
+
});
|
|
3816
|
+
return;
|
|
3817
|
+
}
|
|
3818
|
+
|
|
3796
3819
|
// POST /channel — receive Coolify/GitHub webhook events
|
|
3797
3820
|
if (method === "POST" && reqPath === "/channel") {
|
|
3798
3821
|
let body = "";
|