reelforge 0.2.1 → 0.2.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.
- package/dist/commands/auth.js +10 -1
- package/dist/index.js +4 -0
- package/package.json +1 -1
package/dist/commands/auth.js
CHANGED
|
@@ -44,10 +44,19 @@ async function browserOAuthFlow(serverUrl) {
|
|
|
44
44
|
const token = url.searchParams.get("token");
|
|
45
45
|
const errCode = url.searchParams.get("error");
|
|
46
46
|
const finish = (statusCode, title, body, outcome) => {
|
|
47
|
-
res.writeHead(statusCode, {
|
|
47
|
+
res.writeHead(statusCode, {
|
|
48
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
49
|
+
// Tell the browser to drop the socket — otherwise Node's event
|
|
50
|
+
// loop is held open by lingering keep-alive connections and the
|
|
51
|
+
// CLI hangs after a successful login.
|
|
52
|
+
Connection: "close",
|
|
53
|
+
}).end(`<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><title>ReelForge CLI</title><style>body{font-family:-apple-system,system-ui,"Segoe UI",sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;margin:0;background:#fafaf7;color:#222}div{text-align:center;max-width:24rem;padding:1.5rem}h1{font-size:1.5rem;margin:0 0 .5rem;font-weight:600}p{color:#666;font-size:.875rem;line-height:1.5}</style></head><body><div><h1>${title}</h1><p>${body}</p></div><script>setTimeout(()=>window.close?.(),2000)</script></body></html>`);
|
|
48
54
|
if (timer)
|
|
49
55
|
clearTimeout(timer);
|
|
50
56
|
server.close();
|
|
57
|
+
// Force-drop any remaining keep-alive sockets so the process can exit
|
|
58
|
+
// immediately (Node 18.2+).
|
|
59
|
+
server.closeAllConnections?.();
|
|
51
60
|
if (outcome.ok)
|
|
52
61
|
resolve(outcome.token);
|
|
53
62
|
else
|
package/dist/index.js
CHANGED
|
@@ -99,6 +99,10 @@ registerHealth(program);
|
|
|
99
99
|
async function main() {
|
|
100
100
|
try {
|
|
101
101
|
await program.parseAsync(process.argv);
|
|
102
|
+
// Explicit exit so any lingering handles (e.g. the OAuth local server's
|
|
103
|
+
// already-closed keep-alive sockets) don't keep the event loop alive
|
|
104
|
+
// after the command logically finished.
|
|
105
|
+
process.exit(0);
|
|
102
106
|
}
|
|
103
107
|
catch (err) {
|
|
104
108
|
if (err instanceof ApiCallError) {
|
package/package.json
CHANGED