sellify-cli 0.1.0 → 0.1.1
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/bin/sellify.mjs +4 -1
- package/package.json +1 -1
package/bin/sellify.mjs
CHANGED
|
@@ -227,7 +227,8 @@ async function browserLogin(url, store, open) {
|
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
const ok = !!q.get("code");
|
|
230
|
-
|
|
230
|
+
// "connection: close" so the browser doesn't hold the listener open after this page.
|
|
231
|
+
res.writeHead(200, { "content-type": "text/html; charset=utf-8", connection: "close" }).end(
|
|
231
232
|
`<!doctype html><meta charset="utf-8"><title>Sellify CLI</title><body style="font:16px system-ui;display:grid;place-items:center;height:90vh;margin:0;background:#f5f5f5"><div style="background:#fff;padding:32px 40px;border-radius:12px;box-shadow:0 0 0 1px #0001;text-align:center"><h1 style="font-size:20px;margin:0 0 8px">${ok ? "You're logged in to Sellify CLI" : "Login cancelled"}</h1><p style="margin:0;color:#555">You can close this tab and return to your terminal.</p></div>`,
|
|
232
233
|
);
|
|
233
234
|
if (ok) finish.resolve({ code: q.get("code"), store: q.get("store") });
|
|
@@ -258,6 +259,8 @@ async function browserLogin(url, store, open) {
|
|
|
258
259
|
return { store: chosen, token: body.access_token };
|
|
259
260
|
} finally {
|
|
260
261
|
clearTimeout(timer);
|
|
262
|
+
// Browsers keep idle connections (and preconnects) open; drop them so the CLI can exit.
|
|
263
|
+
server.closeAllConnections();
|
|
261
264
|
server.close();
|
|
262
265
|
}
|
|
263
266
|
}
|