Browser authorization complete
You're connected
-The authorization code was delivered securely to your waiting terminal.
-Return to your terminal to finish setting up T3 Connect. You can close this window.
diff --git a/apps/server/src/cloud/cliAuthHtml.test.ts b/apps/server/src/cloud/cliAuthHtml.test.ts index a49eaffeda7..1104927b980 100644 --- a/apps/server/src/cloud/cliAuthHtml.test.ts +++ b/apps/server/src/cloud/cliAuthHtml.test.ts @@ -1,13 +1,31 @@ import { expect, it } from "@effect/vitest"; -import { renderLoopbackAuthorizationCompleteHtml } from "./cliAuthHtml.ts"; +import { + renderLoopbackAuthorizationCompleteHtml, + resolveLoopbackAuthorizationStage, +} from "./cliAuthHtml.ts"; it("renders the branded loopback authorization completion page", () => { const html = renderLoopbackAuthorizationCompleteHtml(); - expect(html).toContain("T3 Code"); + expect(resolveLoopbackAuthorizationStage()).toBe("dev"); + expect(html).toContain("T3 Code (Dev)"); + expect(html).toContain('class="stage stage-dev"'); expect(html).not.toContain("Secure terminal handoff"); expect(html).toContain("You're connected"); - expect(html).toContain("return to the terminal"); + expect(html).toContain("Return to your terminal"); + expect(html).not.toContain('class="next"'); expect(html).toContain('name="viewport"'); + expect(html).not.toContain('class="status"'); +}); + +it("renders the matching header treatment for each release channel", () => { + const nightly = renderLoopbackAuthorizationCompleteHtml("nightly"); + const latest = renderLoopbackAuthorizationCompleteHtml("latest"); + + expect(nightly).toContain("T3 Code (Nightly)"); + expect(nightly).toContain('class="stage stage-nightly"'); + expect(latest).toContain('
T3 Code
'); + expect(latest).not.toContain("(Latest)"); + expect(latest).toContain('class="stage stage-latest"'); }); diff --git a/apps/server/src/cloud/cliAuthHtml.ts b/apps/server/src/cloud/cliAuthHtml.ts index 3c4141fba44..5a22a25993a 100644 --- a/apps/server/src/cloud/cliAuthHtml.ts +++ b/apps/server/src/cloud/cliAuthHtml.ts @@ -1,4 +1,22 @@ -export function renderLoopbackAuthorizationCompleteHtml(): string { +export type LoopbackAuthorizationStage = "dev" | "nightly" | "latest"; + +declare const __T3CODE_BUILD_CHANNEL__: "nightly" | "latest" | undefined; + +export function resolveLoopbackAuthorizationStage(): LoopbackAuthorizationStage { + return typeof __T3CODE_BUILD_CHANNEL__ === "undefined" ? "dev" : __T3CODE_BUILD_CHANNEL__; +} + +const stageBrands = { + dev: "T3 Code (Dev)", + nightly: "T3 Code (Nightly)", + latest: "T3 Code", +} as const satisfies RecordT3 Code
+${stageBrand}
Browser authorization complete
The authorization code was delivered securely to your waiting terminal.
-Return to your terminal to finish setting up T3 Connect. You can close this window.