iframer-cli 2.1.1 → 2.1.2

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.
Files changed (3) hide show
  1. package/cli.js +19 -4
  2. package/mcp-server.cjs +2 -1
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -519,19 +519,34 @@ async function main() {
519
519
  case "proxy": {
520
520
  const action = args[0];
521
521
  if (!action || !["start", "stop", "status"].includes(action)) {
522
- console.log(" Usage: iframer proxy <start|stop|status>");
522
+ console.log(" Usage: iframer proxy <start|stop|status> [proxy-url]");
523
+ console.log(" Note: 'start' requires a proxy URL (e.g. socks5://host:port).");
524
+ console.log(" To use your home IP automatically, use the iframer MCP tool instead.");
523
525
  break;
524
526
  }
525
527
  if (action === "status") {
526
528
  const res = await fetch(`${getServer()}/proxy`);
527
529
  const data = await res.json();
528
530
  console.log(JSON.stringify(data, null, 2));
529
- } else {
530
- const server = action === "start" ? args[1] || null : null;
531
+ } else if (action === "stop") {
532
+ const res = await fetch(`${getServer()}/proxy`, {
533
+ method: "POST",
534
+ headers: { "Content-Type": "application/json" },
535
+ body: JSON.stringify({ server: null }),
536
+ });
537
+ const data = await res.json();
538
+ console.log(JSON.stringify(data, null, 2));
539
+ } else if (action === "start") {
540
+ const proxyUrl = args[1];
541
+ if (!proxyUrl) {
542
+ console.error(" Error: 'proxy start' requires a proxy URL, e.g.: iframer proxy start socks5://host:port");
543
+ console.error(" To route through your home IP automatically, use the iframer MCP tool.");
544
+ process.exit(1);
545
+ }
531
546
  const res = await fetch(`${getServer()}/proxy`, {
532
547
  method: "POST",
533
548
  headers: { "Content-Type": "application/json" },
534
- body: JSON.stringify({ server }),
549
+ body: JSON.stringify({ server: proxyUrl }),
535
550
  });
536
551
  const data = await res.json();
537
552
  console.log(JSON.stringify(data, null, 2));
package/mcp-server.cjs CHANGED
@@ -28541,9 +28541,10 @@ async function startTunnel(apiBaseUrl, authToken) {
28541
28541
  } catch {}
28542
28542
  };
28543
28543
  ws.onerror = (err) => fail(`WebSocket error: ${err?.message ?? "unknown"}`);
28544
- ws.onclose = () => {
28544
+ ws.onclose = (event) => {
28545
28545
  sockets.forEach((s) => s.destroy());
28546
28546
  sockets.clear();
28547
+ fail(`Tunnel closed by server (code=${event?.code ?? "?"}, reason=${event?.reason ?? "unknown"})`);
28547
28548
  };
28548
28549
  setTimeout(() => fail("Tunnel setup timed out (10s)"), 1e4);
28549
28550
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iframer-cli",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "CLI for iframer — browser access for AI agents",
5
5
  "bin": {
6
6
  "iframer": "./cli.js"