diff --git a/app/src/terminal/socket-url.test.ts b/app/src/terminal/socket-url.test.ts index 0cdb393..d577ad0 100644 --- a/app/src/terminal/socket-url.test.ts +++ b/app/src/terminal/socket-url.test.ts @@ -84,6 +84,27 @@ describe("a session on a relay the app cannot reach", () => { } }); + it("offers the relay setting for the next session, not as a way back into this one", () => { + /* + * SHELL_ONLINE_SERVER belongs to the CLI that starts a session, not to + * this app, which reads VITE_RELAY_URL. Told to "start it" in a sentence + * whose subject was the app, people set the variable here and nothing + * changed -- and a session that has already finished cannot be reopened + * by starting anything. The advice is about the next session. + */ + const result = resolveSessionSocket( + `https://shell.online/s/${ID}`, + "http://localhost:5173", + RELAY, + ); + expect(result.ok).toBe(false); + if (!result.ok) { + expect(result.reason).not.toContain("Start it with"); + expect(result.reason).not.toContain("to open it here"); + expect(result.reason).toContain("A session started with"); + } + }); + it("explains when no relay is configured at all", () => { const result = resolveSessionSocket( `https://shell.online/s/${ID}`, diff --git a/app/src/terminal/socket-url.ts b/app/src/terminal/socket-url.ts index c31e52b..e85613f 100644 --- a/app/src/terminal/socket-url.ts +++ b/app/src/terminal/socket-url.ts @@ -76,8 +76,9 @@ export function resolveSessionSocket( return { ok: false, reason: - `This session is on ${share.origin}, but this app proxies to ${relay.origin}. ` + - `Start it with SHELL_ONLINE_SERVER=${relay.origin} to open it here.`, + `This session is on ${share.origin}, but this app reaches ${relay.origin}, ` + + `so its screen is only available where it was started. ` + + `A session started with SHELL_ONLINE_SERVER=${relay.origin} opens here.`, }; }