History

feat: add headless `t3 connect` setup for SSH hosts (#3749)

Theo Browne committed 3 months ago

Commit 7a820ab1 parent 53e3c9835 files · +3017 −144Browse files

Showing the changes to apps/server/src/cloud/cliAuthHtml.ts (1 of 35 files). Show all

Unified · Split

apps/server/src/cloud/cliAuthHtml.ts+140−0
@@ -0,0 +1,140 @@
1+export function renderLoopbackAuthorizationCompleteHtml(): string {
2+ return `<!doctype html>
3+<html lang="en">
4+ <head>
5+ <meta charset="utf-8" />
6+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7+ <meta name="color-scheme" content="light dark" />
8+ <title>T3 Connect authorization complete</title>
9+ <style>
10+ :root {
11+ color-scheme: light dark;
12+ font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
13+ background: #f6f7f9;
14+ color: #17191f;
15+ }
16+ * { box-sizing: border-box; }
17+ body {
18+ min-height: 100vh;
19+ margin: 0;
20+ display: grid;
21+ place-items: center;
22+ padding: 32px 16px;
23+ background:
24+ radial-gradient(48rem 22rem at 50% -8rem, rgba(47, 119, 235, 0.15), transparent),
25+ #f6f7f9;
26+ }
27+ main {
28+ width: min(100%, 576px);
29+ overflow: hidden;
30+ border: 1px solid rgba(23, 25, 31, 0.1);
31+ border-radius: 20px;
32+ background: rgba(255, 255, 255, 0.94);
33+ box-shadow: 0 24px 64px rgba(16, 24, 40, 0.16);
34+ }
35+ .stage {
36+ position: relative;
37+ height: 96px;
38+ overflow: hidden;
39+ padding: 22px 24px;
40+ color: white;
41+ background: linear-gradient(145deg, #5ab8fa 0%, #347ff8 46%, #1939bd 100%);
42+ }
43+ .stage::before {
44+ content: "";
45+ position: absolute;
46+ inset: 0;
47+ opacity: 0.42;
48+ background-image:
49+ linear-gradient(rgba(234, 246, 255, 0.25) 1px, transparent 1px),
50+ linear-gradient(90deg, rgba(234, 246, 255, 0.25) 1px, transparent 1px),
51+ linear-gradient(rgba(234, 246, 255, 0.12) 1px, transparent 1px),
52+ linear-gradient(90deg, rgba(234, 246, 255, 0.12) 1px, transparent 1px);
53+ background-size: 32px 32px, 32px 32px, 8px 8px, 8px 8px;
54+ }
55+ .stage::after {
56+ content: "";
57+ position: absolute;
58+ inset: 0;
59+ background:
60+ radial-gradient(circle at 78% 20%, rgba(210, 255, 255, 0.36), transparent 34%),
61+ linear-gradient(to bottom, transparent 24%, rgba(8, 28, 89, 0.38));
62+ }
63+ .stage-content {
64+ position: relative;
65+ z-index: 1;
66+ }
67+ .brand {
68+ margin: 0;
69+ font-size: 10px;
70+ font-weight: 700;
71+ letter-spacing: 0.2em;
72+ text-transform: uppercase;
73+ }
74+ .brand { color: rgba(255, 255, 255, 0.82); }
75+ .content { padding: 30px 32px 34px; }
76+ .status {
77+ width: 42px;
78+ height: 42px;
79+ display: grid;
80+ place-items: center;
81+ margin-top: -52px;
82+ margin-bottom: 22px;
83+ border: 4px solid white;
84+ border-radius: 50%;
85+ background: #2065df;
86+ color: white;
87+ font-size: 22px;
88+ font-weight: 700;
89+ box-shadow: 0 8px 22px rgba(25, 72, 177, 0.3);
90+ }
91+ .eyebrow {
92+ margin: 0 0 8px;
93+ color: #2866cc;
94+ font-size: 10px;
95+ font-weight: 700;
96+ letter-spacing: 0.18em;
97+ text-transform: uppercase;
98+ }
99+ h1 { margin: 0; font-size: clamp(26px, 5vw, 34px); line-height: 1.12; letter-spacing: -0.035em; }
100+ .description { margin: 12px 0 0; color: #646975; font-size: 15px; line-height: 1.6; }
101+ .next {
102+ margin-top: 24px;
103+ padding: 14px 16px;
104+ border: 1px solid rgba(23, 25, 31, 0.1);
105+ border-radius: 12px;
106+ background: #f7f8fa;
107+ color: #454a55;
108+ font-size: 13px;
109+ }
110+ .next strong { color: #17191f; }
111+ @media (prefers-color-scheme: dark) {
112+ :root { background: #101115; color: #f1f3f7; }
113+ body { background: radial-gradient(48rem 22rem at 50% -8rem, rgba(55, 102, 210, 0.2), transparent), #101115; }
114+ main { border-color: rgba(255, 255, 255, 0.1); background: rgba(25, 27, 33, 0.96); }
115+ .status { border-color: #191b21; }
116+ .eyebrow { color: #77a8ff; }
117+ .description { color: #a8adb8; }
118+ .next { border-color: rgba(255, 255, 255, 0.1); background: #20232a; color: #b9bec8; }
119+ .next strong { color: #f1f3f7; }
120+ }
121+ </style>
122+ </head>
123+ <body>
124+ <main>
125+ <header class="stage">
126+ <div class="stage-content">
127+ <p class="brand">T3 Code</p>
128+ </div>
129+ </header>
130+ <section class="content">
131+ <div class="status" aria-hidden="true">✓</div>
132+ <p class="eyebrow">Browser authorization complete</p>
133+ <h1>You're connected</h1>
134+ <p class="description">The authorization code was delivered securely to your waiting terminal.</p>
135+ <div class="next"><strong>Next:</strong> return to the terminal to finish T3 Connect setup. You can close this window.</div>
136+ </section>
137+ </main>
138+ </body>
139+</html>`;
140+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t