@flowkode/cli 1.0.3 → 1.0.4
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/commands/login.js +26 -10
- package/package.json +1 -1
package/dist/commands/login.js
CHANGED
|
@@ -55,9 +55,9 @@ export function loginCommand() {
|
|
|
55
55
|
res.writeHead(200, {
|
|
56
56
|
"Content-Type": "text/html; charset=utf-8",
|
|
57
57
|
});
|
|
58
|
-
res.end(htmlPage("Autorisation
|
|
58
|
+
res.end(htmlPage("Autorisation refusée", "Vous pouvez fermer cette page.", "#dc2626"));
|
|
59
59
|
server.close();
|
|
60
|
-
reject(new Error("Autorisation
|
|
60
|
+
reject(new Error("Autorisation refusée par l'utilisateur."));
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
if (!key) {
|
|
@@ -75,7 +75,7 @@ export function loginCommand() {
|
|
|
75
75
|
server.listen(port, "127.0.0.1");
|
|
76
76
|
setTimeout(() => {
|
|
77
77
|
server.close();
|
|
78
|
-
reject(new Error("Timeout — aucune
|
|
78
|
+
reject(new Error("Timeout — aucune réponse reçue du navigateur (5 min)."));
|
|
79
79
|
}, 5 * 60 * 1000);
|
|
80
80
|
});
|
|
81
81
|
const authorizeUrl = `${baseUrl}/cli/authorize?port=${port}&code=${code}`;
|
|
@@ -94,7 +94,7 @@ export function loginCommand() {
|
|
|
94
94
|
config.api_key = key;
|
|
95
95
|
saveConfig(config);
|
|
96
96
|
console.log();
|
|
97
|
-
printSuccess(`
|
|
97
|
+
printSuccess(`Connecté${email ? ` en tant que ${chalk.bold(email)}` : ""} !`);
|
|
98
98
|
console.log(chalk.dim(" Clé sauvegardée dans ~/.flowkode/config.json"));
|
|
99
99
|
console.log();
|
|
100
100
|
console.log(chalk.dim(" Essayez : flowkode projects list"));
|
|
@@ -118,16 +118,32 @@ export function logoutCommand() {
|
|
|
118
118
|
}
|
|
119
119
|
delete config.api_key;
|
|
120
120
|
saveConfig(config);
|
|
121
|
-
printSuccess("Déconnecté. Clé API
|
|
121
|
+
printSuccess("Déconnecté. Clé API supprimée de ~/.flowkode/config.json");
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
function htmlPage(title, message, color) {
|
|
125
|
+
const isSuccess = color === "#16a34a";
|
|
126
|
+
const icon = isSuccess
|
|
127
|
+
? `<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="${color}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4.5 12.75 6 6 9-13.5"/></svg>`
|
|
128
|
+
: `<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="${color}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`;
|
|
125
129
|
return `<!DOCTYPE html>
|
|
126
|
-
<html><head><meta charset="utf-8"><title>Flowkode CLI</title
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
<html><head><meta charset="utf-8"><title>Flowkode CLI</title>
|
|
131
|
+
<style>
|
|
132
|
+
*{margin:0;padding:0;box-sizing:border-box}
|
|
133
|
+
body{font-family:system-ui,-apple-system,sans-serif;display:flex;justify-content:center;align-items:center;min-height:100vh;background:#fafafa;padding:1rem}
|
|
134
|
+
.card{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:2rem;max-width:400px;width:100%;text-align:center;box-shadow:0 1px 3px rgba(0,0,0,.06)}
|
|
135
|
+
.icon{display:inline-flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:50%;background:${color}10;margin-bottom:1.25rem}
|
|
136
|
+
h2{font-size:1.5rem;font-weight:700;color:${color};margin-bottom:.5rem}
|
|
137
|
+
p{color:#6b7280;font-size:.9rem;line-height:1.5}
|
|
138
|
+
.logo{margin-bottom:1.5rem}
|
|
139
|
+
.logo svg{height:32px}
|
|
140
|
+
</style></head>
|
|
141
|
+
<body>
|
|
142
|
+
<div class="card">
|
|
143
|
+
<div class="logo"><svg height="32" viewBox="0 0 180 40" fill="none" xmlns="http://www.w3.org/2000/svg"><text x="0" y="30" font-family="system-ui" font-weight="700" font-size="28" fill="#0f172a">flowkode</text></svg></div>
|
|
144
|
+
<div class="icon">${icon}</div>
|
|
145
|
+
<h2>${title}</h2>
|
|
146
|
+
<p>${message}</p>
|
|
131
147
|
</div>
|
|
132
148
|
</body></html>`;
|
|
133
149
|
}
|