@vectorplane/ctrl-cli 0.1.6 → 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/dist/core/server.js +88 -2
- package/package.json +2 -2
package/dist/core/server.js
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
import http from "node:http";
|
|
2
2
|
import { AuthError } from "./errors.js";
|
|
3
|
+
function renderCallbackPage() {
|
|
4
|
+
return `<!doctype html>
|
|
5
|
+
<html lang="pt-BR">
|
|
6
|
+
<head>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
<title>VectorPlane</title>
|
|
10
|
+
<style>
|
|
11
|
+
:root {
|
|
12
|
+
color-scheme: light;
|
|
13
|
+
--bg: #f5f7fb;
|
|
14
|
+
--card: #ffffff;
|
|
15
|
+
--text: #111827;
|
|
16
|
+
--muted: #5b6474;
|
|
17
|
+
--border: rgba(17, 24, 39, 0.08);
|
|
18
|
+
--accent: #0f766e;
|
|
19
|
+
--accent-soft: rgba(15, 118, 110, 0.12);
|
|
20
|
+
}
|
|
21
|
+
* { box-sizing: border-box; }
|
|
22
|
+
body {
|
|
23
|
+
margin: 0;
|
|
24
|
+
min-height: 100vh;
|
|
25
|
+
display: grid;
|
|
26
|
+
place-items: center;
|
|
27
|
+
background:
|
|
28
|
+
radial-gradient(circle at top, rgba(15, 118, 110, 0.08), transparent 32%),
|
|
29
|
+
linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
|
|
30
|
+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
31
|
+
color: var(--text);
|
|
32
|
+
padding: 24px;
|
|
33
|
+
}
|
|
34
|
+
.card {
|
|
35
|
+
width: min(480px, 100%);
|
|
36
|
+
background: var(--card);
|
|
37
|
+
border: 1px solid var(--border);
|
|
38
|
+
border-radius: 20px;
|
|
39
|
+
padding: 28px 24px;
|
|
40
|
+
box-shadow: 0 24px 80px rgba(15, 23, 42, 0.08);
|
|
41
|
+
}
|
|
42
|
+
.badge {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 8px;
|
|
46
|
+
padding: 8px 12px;
|
|
47
|
+
border-radius: 999px;
|
|
48
|
+
background: var(--accent-soft);
|
|
49
|
+
color: var(--accent);
|
|
50
|
+
font-size: 12px;
|
|
51
|
+
font-weight: 700;
|
|
52
|
+
letter-spacing: 0.04em;
|
|
53
|
+
text-transform: uppercase;
|
|
54
|
+
}
|
|
55
|
+
h1 {
|
|
56
|
+
margin: 18px 0 10px;
|
|
57
|
+
font-size: 28px;
|
|
58
|
+
line-height: 1.1;
|
|
59
|
+
}
|
|
60
|
+
p {
|
|
61
|
+
margin: 0;
|
|
62
|
+
color: var(--muted);
|
|
63
|
+
line-height: 1.65;
|
|
64
|
+
}
|
|
65
|
+
.hint {
|
|
66
|
+
margin-top: 18px;
|
|
67
|
+
padding: 14px 16px;
|
|
68
|
+
border-radius: 14px;
|
|
69
|
+
background: rgba(15, 23, 42, 0.04);
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
73
|
+
</head>
|
|
74
|
+
<body>
|
|
75
|
+
<main class="card">
|
|
76
|
+
<div class="badge">VectorPlane CLI</div>
|
|
77
|
+
<h1>Login concluído</h1>
|
|
78
|
+
<p>A autenticação já foi entregue ao terminal. Você pode fechar esta aba.</p>
|
|
79
|
+
<div class="hint">Se esta janela não fechar sozinha, volte ao terminal e continue usando o <strong>vp</strong>.</div>
|
|
80
|
+
</main>
|
|
81
|
+
<script>
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
window.close();
|
|
84
|
+
}, 250);
|
|
85
|
+
</script>
|
|
86
|
+
</body>
|
|
87
|
+
</html>`;
|
|
88
|
+
}
|
|
3
89
|
export async function createCallbackServer(host, port, callbackPath, expectedState) {
|
|
4
90
|
let resolveCallback = null;
|
|
5
91
|
let rejectCallback = null;
|
|
@@ -34,8 +120,8 @@ export async function createCallbackServer(host, port, callbackPath, expectedSta
|
|
|
34
120
|
}
|
|
35
121
|
return;
|
|
36
122
|
}
|
|
37
|
-
response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
38
|
-
response.end(
|
|
123
|
+
response.writeHead(200, { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store" });
|
|
124
|
+
response.end(renderCallbackPage());
|
|
39
125
|
if (!settled) {
|
|
40
126
|
settled = true;
|
|
41
127
|
const result = { code, state };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vectorplane/ctrl-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Official VectorPlane CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"bugs": {
|
|
29
29
|
"url": "https://gitlab.com/vector-plane/vectorplane-ctrl-cli/-/issues"
|
|
30
30
|
},
|
|
31
|
-
"homepage": "https://
|
|
31
|
+
"homepage": "https://vectorplane.ai",
|
|
32
32
|
"funding": {
|
|
33
33
|
"type": "individual",
|
|
34
34
|
"url": "https://vectorplane.ai"
|