cloudron 7.1.0 → 7.1.1
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/actions.js +1 -1
- package/src/helper.js +12 -4
- package/src/login-success.html +50 -0
package/package.json
CHANGED
package/src/actions.js
CHANGED
|
@@ -31,7 +31,7 @@ function requestOptions(options) {
|
|
|
31
31
|
// ensure config can return the correct section
|
|
32
32
|
config.setActive(adminFqdn);
|
|
33
33
|
|
|
34
|
-
const token = options.token || config.token();
|
|
34
|
+
const token = options.token || process.env.CLOUDRON_CLI_AUTH_TOKEN || config.token();
|
|
35
35
|
const rejectUnauthorized = !(options.allowSelfsigned || options.acceptSelfsigned || config.allowSelfsigned());
|
|
36
36
|
|
|
37
37
|
if (!adminFqdn && !token) return exit('Login with "cloudron login" first'); // a bit rough to put this here!
|
package/src/helper.js
CHANGED
|
@@ -3,6 +3,7 @@ import fs from 'fs';
|
|
|
3
3
|
import http from 'http';
|
|
4
4
|
import open from 'open';
|
|
5
5
|
import path from 'path';
|
|
6
|
+
import readline from 'readline';
|
|
6
7
|
import safe from '@cloudron/safetydance';
|
|
7
8
|
import superagent from '@cloudron/superagent';
|
|
8
9
|
import util from 'util';
|
|
@@ -128,15 +129,22 @@ async function performOidcLogin(adminFqdn, { rejectUnauthorized = true } = {}) {
|
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
const receivedCode = url.searchParams.get('code');
|
|
132
|
+
const successHtml = fs.readFileSync(path.join(import.meta.dirname, 'login-success.html'), 'utf8');
|
|
131
133
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
132
|
-
res.end(
|
|
134
|
+
res.end(successHtml);
|
|
133
135
|
server.close();
|
|
134
136
|
resolve(receivedCode);
|
|
135
137
|
});
|
|
136
138
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
// without the host ip, it will listen on :: . on mac, which has dual stack disabled, it will listen on ipv6 only
|
|
140
|
+
server.listen(1312, '127.0.0.1', () => {
|
|
141
|
+
// console.log('Login at:');
|
|
142
|
+
// console.log(authUrl.toString());
|
|
143
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
144
|
+
rl.question('Press ENTER to authenticate using the browser...', () => {
|
|
145
|
+
rl.close();
|
|
146
|
+
open(authUrl.toString());
|
|
147
|
+
});
|
|
140
148
|
});
|
|
141
149
|
|
|
142
150
|
server.on('error', (err) => {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5
|
+
<title>Login Successful</title>
|
|
6
|
+
<style>
|
|
7
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
8
|
+
body {
|
|
9
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
background: #f5f7fa;
|
|
15
|
+
color: #333;
|
|
16
|
+
}
|
|
17
|
+
.card {
|
|
18
|
+
text-align: center;
|
|
19
|
+
background: #fff;
|
|
20
|
+
border-radius: 12px;
|
|
21
|
+
padding: 48px 40px;
|
|
22
|
+
box-shadow: 0 2px 12px rgba(0,0,0,0.08);
|
|
23
|
+
max-width: 420px;
|
|
24
|
+
}
|
|
25
|
+
.icon {
|
|
26
|
+
width: 64px; height: 64px;
|
|
27
|
+
margin: 0 auto 24px;
|
|
28
|
+
background: #e8f5e9;
|
|
29
|
+
border-radius: 50%;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
}
|
|
34
|
+
.icon svg { width: 32px; height: 32px; color: #43a047; }
|
|
35
|
+
h1 { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
|
|
36
|
+
p { font-size: 15px; color: #666; line-height: 1.5; }
|
|
37
|
+
</style>
|
|
38
|
+
</head>
|
|
39
|
+
<body>
|
|
40
|
+
<div class="card">
|
|
41
|
+
<div class="icon">
|
|
42
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
43
|
+
<polyline points="20 6 9 17 4 12"/>
|
|
44
|
+
</svg>
|
|
45
|
+
</div>
|
|
46
|
+
<h1>Authentication Successful</h1>
|
|
47
|
+
<p>You can close this tab and return to your command line.</p>
|
|
48
|
+
</div>
|
|
49
|
+
</body>
|
|
50
|
+
</html>
|