@dutodev/cli 0.4.3 → 0.4.4

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/README.md CHANGED
@@ -106,7 +106,7 @@ Com os túneis no ar, o terminal mostra cada túnel (URL, destino local, requisi
106
106
  | `tab`, `↑↓` | Alterna entre túneis e requisições e move a seleção |
107
107
  | `q` ou Ctrl+C | Fecha os túneis e sai |
108
108
 
109
- Se o túnel está no ar mas nada responde na porta local, quem abrir o endereço no navegador vê uma página do Duto que tenta de novo a cada 3 segundos e volta sozinha quando o serviço sobe. Clientes que não são navegador (`curl`, APIs) recebem um 502 com uma mensagem em texto.
109
+ Se o túnel está no ar mas nada responde na porta local, quem abrir o endereço no navegador vê uma página do Duto que tenta de novo a cada 3 segundos e volta sozinha quando o serviço sobe. Clientes que não são navegador (`curl`, APIs) recebem a mesma resposta em texto. Em ambos os casos o status é `503` com `Retry-After: 3`.
110
110
 
111
111
  Fora de um terminal interativo (pipe, CI) ou com `--no-ui`, a CLI imprime um log simples. No Windows a tela cheia vem desligada; use `--ui` para tentar.
112
112
 
package/dist/index.js CHANGED
@@ -553,10 +553,10 @@ async function startProxy(o) {
553
553
  const html = wantsHtml(req.headers.accept);
554
554
  const msg = html ? unavailablePage({ tunnel: route.tunnel, port: route.port, retry: req.method === "GET" }) : `Nada escutando em localhost:${route.port}. Suba o servidor e tente de novo.`;
555
555
  if (!res.headersSent) {
556
- res.writeHead(502, { "content-type": html ? "text/html; charset=utf-8" : "text/plain; charset=utf-8", "cache-control": "no-store" });
556
+ res.writeHead(503, { "content-type": html ? "text/html; charset=utf-8" : "text/plain; charset=utf-8", "cache-control": "no-store", "retry-after": "3" });
557
557
  res.end(req.method === "HEAD" ? void 0 : msg);
558
558
  } else res.destroy();
559
- o.store.update(id, { status: 502, durationMs: Date.now() - started, bytes: res.headersSent ? 0 : Buffer.byteLength(msg), error: err.message || err.code || err.name, reqBody: reqCap.text() });
559
+ o.store.update(id, { status: 503, durationMs: Date.now() - started, bytes: res.headersSent ? 0 : Buffer.byteLength(msg), error: err.message || err.code || err.name, reqBody: reqCap.text() });
560
560
  });
561
561
  req.on("data", (c) => reqCap.push(c));
562
562
  req.pipe(upstream);
@@ -605,7 +605,7 @@ async function startProxy(o) {
605
605
  client.pipe(target);
606
606
  });
607
607
  const fail3 = (err) => {
608
- o.store.update(id, { status: 502, durationMs: Date.now() - started, error: err.message });
608
+ o.store.update(id, { status: 503, durationMs: Date.now() - started, error: err.message });
609
609
  client.destroy();
610
610
  };
611
611
  target.on("error", fail3);
@@ -957,9 +957,9 @@ async function runSession(specs, source, flags) {
957
957
  const session = new Session({ api, deviceId: config.deviceId, deviceName: hostname(), cloudflaredPath, source });
958
958
  if (wantsUi(flags)) {
959
959
  const { runFullscreen } = await import("./fullscreen-5437X7MP.js");
960
- process.exit(await runFullscreen(session, specs, "0.4.3"));
960
+ process.exit(await runFullscreen(session, specs, "0.4.4"));
961
961
  }
962
- console.log(`${mark()} ${paint("muted", `${"0.4.3"} \xB7 ${source} \xB7 Ctrl+C para encerrar`)}`);
962
+ console.log(`${mark()} ${paint("muted", `${"0.4.4"} \xB7 ${source} \xB7 Ctrl+C para encerrar`)}`);
963
963
  const stopLog = runPlain(session, (l) => console.log(l));
964
964
  const stopped = new Promise((resolve) => {
965
965
  const onSignal = () => {
@@ -1046,7 +1046,7 @@ cli.help(
1046
1046
  body: s.body.replace(/^\s*For more info, run any command with the `--help` flag:/m, " Mais detalhes de um comando: duto <comando> --help").replace("Display this message", "Mostra esta ajuda").replace("Display version number", "Mostra a vers\xE3o")
1047
1047
  }))
1048
1048
  );
1049
- cli.version("0.4.3");
1049
+ cli.version("0.4.4");
1050
1050
  try {
1051
1051
  cli.parse(process.argv, { run: false });
1052
1052
  await cli.runMatchedCommand();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dutodev/cli",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Exponha uma porta local em https://<nome>-<usuário>.duto.dev com um comando.",
5
5
  "license": "MIT",
6
6
  "type": "module",