sheetlink 0.1.5 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/auth.js +56 -2
package/package.json
CHANGED
package/src/commands/auth.js
CHANGED
|
@@ -93,7 +93,61 @@ async function googleOAuthFlow() {
|
|
|
93
93
|
const error = url.searchParams.get('error');
|
|
94
94
|
|
|
95
95
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
96
|
-
res.end(
|
|
96
|
+
res.end(`<!DOCTYPE html>
|
|
97
|
+
<html lang="en">
|
|
98
|
+
<head>
|
|
99
|
+
<meta charset="UTF-8">
|
|
100
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
101
|
+
<title>SheetLink — Authenticated</title>
|
|
102
|
+
<style>
|
|
103
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
104
|
+
body {
|
|
105
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
106
|
+
background: #f9fafb;
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
min-height: 100vh;
|
|
111
|
+
color: #111;
|
|
112
|
+
}
|
|
113
|
+
.card {
|
|
114
|
+
background: #fff;
|
|
115
|
+
border: 1px solid #e5e7eb;
|
|
116
|
+
border-radius: 16px;
|
|
117
|
+
padding: 48px 40px;
|
|
118
|
+
text-align: center;
|
|
119
|
+
max-width: 380px;
|
|
120
|
+
width: 90%;
|
|
121
|
+
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
|
|
122
|
+
}
|
|
123
|
+
.icon {
|
|
124
|
+
width: 48px;
|
|
125
|
+
height: 48px;
|
|
126
|
+
background: #d1fae5;
|
|
127
|
+
border-radius: 50%;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
justify-content: center;
|
|
131
|
+
margin: 0 auto 20px;
|
|
132
|
+
}
|
|
133
|
+
h1 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
|
|
134
|
+
p { font-size: 14px; color: #6b7280; line-height: 1.5; }
|
|
135
|
+
</style>
|
|
136
|
+
</head>
|
|
137
|
+
<body>
|
|
138
|
+
<script>history.replaceState(null, '', '/');</script>
|
|
139
|
+
<div class="card">
|
|
140
|
+
<div class="icon">
|
|
141
|
+
<svg width="24" height="24" fill="none" stroke="#059669" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
|
|
142
|
+
<polyline points="20 6 9 17 4 12"/>
|
|
143
|
+
</svg>
|
|
144
|
+
</div>
|
|
145
|
+
<h1>You're signed in</h1>
|
|
146
|
+
<p>Authentication complete. You can close this tab and return to the terminal.</p>
|
|
147
|
+
</div>
|
|
148
|
+
</body>
|
|
149
|
+
</html>`);
|
|
150
|
+
server.closeAllConnections?.();
|
|
97
151
|
server.close();
|
|
98
152
|
|
|
99
153
|
if (error) return reject(new Error(`OAuth error: ${error}`));
|
|
@@ -119,7 +173,7 @@ async function googleOAuthFlow() {
|
|
|
119
173
|
});
|
|
120
174
|
|
|
121
175
|
server.on('error', reject);
|
|
122
|
-
setTimeout(() => { server.close(); reject(new Error('OAuth timeout (2 minutes)')); }, 120_000);
|
|
176
|
+
setTimeout(() => { server.closeAllConnections?.(); server.close(); reject(new Error('OAuth timeout (2 minutes)')); }, 120_000);
|
|
123
177
|
});
|
|
124
178
|
}
|
|
125
179
|
|