Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions app/src/terminal/socket-url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
5 changes: 3 additions & 2 deletions app/src/terminal/socket-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
};
}

Expand Down
Loading