{"draft":null,"from":57,"to":58,"files":[{"path":"client/src/box.ts","added":14,"removed":1,"diff":"--- a/client/src/box.ts\n+++ b/client/src/box.ts\n@@ -174,6 +174,11 @@\n \t);\n }\n \n+/** The longest login waits for approval, whatever the server says. */\n+const MAX_LOGIN_WAIT_S = 30 * 60;\n+/** How often login says it's still waiting. */\n+const STILL_WAITING_MS = 60_000;\n+\n export interface LoginIo {\n \treadonly fetch?: typeof fetch;\n \treadonly sleep?: (ms: number) => Promise<void>;\n@@ -193,13 +198,21 @@\n \tconst start = await call(server, \"/login/device\", { name: boxName(), client: \"abso\" }, undefined, fetcher);\n \tconst { device_code: device, user_code: code, verification_uri_complete: link } = start.body;\n \tlet interval = Number(start.body.interval) || 5;\n-\tconst expiresIn = Number(start.body.expires_in) || 900;\n+\t// The server says when its code runs out; a server that says never still gets an end.\n+\tconst expiresIn = Math.min(Number(start.body.expires_in) || 900, MAX_LOGIN_WAIT_S);\n \tif (typeof code !== \"string\" || typeof link !== \"string\" || typeof device !== \"string\")\n \t\tthrow new UsageError(`${originOf(server)} didn't give a code to approve`);\n \tio.say(`To sign this box in, open ${link} and approve the code ${code}.`);\n+\tio.say(\"Waiting for approval. Ctrl-C stops waiting, and abso stops by itself when the code runs out.\");\n \tconst until = now() + expiresIn * 1000;\n+\tlet toldAt = now();\n \twhile (now() < until) {\n \t\tawait sleep(interval * 1000);\n+\t\t// A wait with no word looks like a hang, so say it's still waiting now and then.\n+\t\tif (now() - toldAt >= STILL_WAITING_MS) {\n+\t\t\tio.say(`Still waiting for the code ${code} to be approved.`);\n+\t\t\ttoldAt = now();\n+\t\t}\n \t\tconst a = await call(server, \"/login/token\", { device_code: device }, undefined, fetcher);\n \t\tif (a.status === 400) {\n \t\t\tif (a.body.error === \"authorization_pending\") continue;"}],"unmatched":[]}