relionhq 2.0.1 → 2.0.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 (2) hide show
  1. package/dist/index.js +11 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -651,21 +651,25 @@ function openBrowser(url) {
651
651
  function waitForCallback(port, timeoutMs = 5 * 60 * 1e3) {
652
652
  return new Promise((resolve3) => {
653
653
  const timer = setTimeout(() => {
654
+ server.closeAllConnections();
654
655
  server.close();
655
656
  resolve3(null);
656
657
  }, timeoutMs);
657
658
  const server = http.createServer((req, res) => {
658
659
  const url = new URL(req.url ?? "/", `http://localhost:${port}`);
659
660
  const token = url.searchParams.get("token");
660
- res.writeHead(200, { "Content-Type": "text/html" });
661
- res.end(`<!DOCTYPE html><html><head><meta charset="utf-8">
661
+ const html = `<!DOCTYPE html><html><head><meta charset="utf-8">
662
662
  <style>body{font-family:system-ui,sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;margin:0;background:#070a12;color:#e2e8f0}
663
663
  .box{text-align:center;padding:2rem;max-width:320px}h1{font-size:1.1rem;margin-bottom:.5rem;color:#4fd1c5}p{font-size:.85rem;color:#94a3b8}</style>
664
664
  </head><body><div class="box"><h1>${token ? "\u2713 Authenticated" : "\u2717 No token received"}</h1>
665
- <p>${token ? "You can close this tab and return to your terminal." : "Something went wrong. Run relion login again."}</p></div></body></html>`);
666
- clearTimeout(timer);
667
- server.close();
668
- resolve3(token ?? null);
665
+ <p>${token ? "You can close this tab and return to your terminal." : "Something went wrong. Run relion login again."}</p></div></body></html>`;
666
+ res.writeHead(200, { "Content-Type": "text/html", "Connection": "close" });
667
+ res.end(html, () => {
668
+ clearTimeout(timer);
669
+ server.closeAllConnections();
670
+ server.close();
671
+ resolve3(token ?? null);
672
+ });
669
673
  });
670
674
  server.listen(port, "127.0.0.1");
671
675
  });
@@ -698,6 +702,7 @@ async function saveAndVerifyToken(token, apiUrl) {
698
702
  console.log(`
699
703
  ${color.green("\u2713")} ${color.bold("Authenticated")}${email ? ` as ${color.cyan(email)}` : ""}`);
700
704
  console.log(color.dim(" Token saved to ~/.relion/config.json\n"));
705
+ process.exit(0);
701
706
  }
702
707
  async function logoutCommand() {
703
708
  writeGlobalConfig({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relionhq",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Relion CLI — pre-deploy API risk detection and monitoring client.",
5
5
  "license": "MIT",
6
6
  "bin": {