zoho-sites-dev-cli 0.0.0-stage → 1.0.0
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/README.md +401 -2
- package/bin/zoho-sites-dev-cli.js +107 -0
- package/config/default.json +18 -0
- package/index.js +6 -0
- package/package.json +55 -4
- package/src/commands/auth.js +136 -0
- package/src/commands/create.js +175 -0
- package/src/commands/deploy.js +380 -0
- package/src/commands/generate-zip.js +49 -0
- package/src/commands/index.js +23 -0
- package/src/commands/init-tailwind.js +57 -0
- package/src/commands/init.js +448 -0
- package/src/commands/install.js +89 -0
- package/src/commands/login.js +248 -0
- package/src/commands/pull.js +41 -0
- package/src/commands/serve.js +162 -0
- package/src/compilers/css-compiler.js +230 -0
- package/src/compilers/css-ignore-loader.js +33 -0
- package/src/compilers/plugins/index.js +12 -0
- package/src/compilers/plugins/root-selector-transform-plugin.js +79 -0
- package/src/compilers/tailwind-compiler.js +102 -0
- package/src/compilers/webpack-compiler.js +512 -0
- package/src/compilers/webpack-config.js +103 -0
- package/src/config/constants.js +125 -0
- package/src/config/environments/audiences.js +19 -0
- package/src/config/environments/index.js +78 -0
- package/src/config/environments/internal.js +72 -0
- package/src/config/environments/production.js +39 -0
- package/src/locales/en.json +216 -0
- package/src/services/devServer.js +489 -0
- package/src/services/oauthService.js +672 -0
- package/src/templates/component/fields.json +6 -0
- package/src/templates/component/index.js +11 -0
- package/src/templates/component/llm.md +9 -0
- package/src/templates/component/meta.json +9 -0
- package/src/templates/component/styles.css +3 -0
- package/src/templates/oauth/complete.html +41 -0
- package/src/templates/oauth/error.html +69 -0
- package/src/templates/oauth/invalid-request.html +58 -0
- package/src/templates/oauth/loading.html +80 -0
- package/src/templates/oauth/not-found.html +33 -0
- package/src/templates/oauth/success.html +70 -0
- package/src/templates/oauth/timeout.html +56 -0
- package/src/templates/oauth/token-error.html +57 -0
- package/src/utils/configUtil.js +66 -0
- package/src/utils/httpUtil.js +351 -0
- package/src/utils/i18n.js +205 -0
- package/src/utils/loadingUtil.js +190 -0
- package/src/utils/secureConfig.js +75 -0
- package/src/utils/secureStorage.js +230 -0
- package/src/utils/templateLoader.js +89 -0
- package/src/utils/urlUtil.js +371 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>ZS CLI - Complete</title>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
text-align: center;
|
|
11
|
+
padding: 50px;
|
|
12
|
+
background: #f5f5f5;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
.container {
|
|
16
|
+
max-width: 500px;
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
background: white;
|
|
19
|
+
padding: 30px;
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
22
|
+
}
|
|
23
|
+
.info { color: #1976d2; }
|
|
24
|
+
</style>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<div class="container">
|
|
28
|
+
<h2 class="info">ZS CLI Authentication</h2>
|
|
29
|
+
<p>You can safely close this window now.</p>
|
|
30
|
+
</div>
|
|
31
|
+
<script>
|
|
32
|
+
// Auto-close
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
window.close();
|
|
35
|
+
if (!window.closed) {
|
|
36
|
+
window.location.href = 'about:blank';
|
|
37
|
+
}
|
|
38
|
+
}, 2000);
|
|
39
|
+
</script>
|
|
40
|
+
</body>
|
|
41
|
+
</html>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>ZS CLI - Authentication Failed</title>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
text-align: center;
|
|
11
|
+
padding: 50px;
|
|
12
|
+
background: #f5f5f5;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
.container {
|
|
16
|
+
max-width: 500px;
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
background: white;
|
|
19
|
+
padding: 30px;
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
22
|
+
}
|
|
23
|
+
.error { color: #d32f2f; }
|
|
24
|
+
.close-btn {
|
|
25
|
+
background: #1976d2;
|
|
26
|
+
color: white;
|
|
27
|
+
border: none;
|
|
28
|
+
padding: 10px 20px;
|
|
29
|
+
border-radius: 5px;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
margin-top: 20px;
|
|
32
|
+
}
|
|
33
|
+
.close-btn:hover { background: #1565c0; }
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div class="container">
|
|
38
|
+
<h2 class="error">❌ Authentication Failed</h2>
|
|
39
|
+
<p>There was an error during authentication:</p>
|
|
40
|
+
<p><strong>{{ERROR_MESSAGE}}</strong></p>
|
|
41
|
+
<p>Please close this window and try again.</p>
|
|
42
|
+
<button class="close-btn" onclick="closeWindow()">Close Window</button>
|
|
43
|
+
</div>
|
|
44
|
+
<script>
|
|
45
|
+
function closeWindow() {
|
|
46
|
+
// Try different methods to close the window
|
|
47
|
+
if (window.opener) {
|
|
48
|
+
window.close();
|
|
49
|
+
} else {
|
|
50
|
+
// Redirect to clean URL and try to close
|
|
51
|
+
window.history.replaceState({}, document.title, '/oauth/complete');
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
window.close();
|
|
54
|
+
// If close doesn't work, redirect to a neutral page
|
|
55
|
+
if (!window.closed) {
|
|
56
|
+
window.location.href = 'about:blank';
|
|
57
|
+
}
|
|
58
|
+
}, 1000);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Auto-redirect to clean URL after 3 seconds
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
window.history.replaceState({}, document.title, '/oauth/complete');
|
|
65
|
+
closeWindow();
|
|
66
|
+
}, 3000);
|
|
67
|
+
</script>
|
|
68
|
+
</body>
|
|
69
|
+
</html>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>ZS CLI - Invalid Request</title>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
text-align: center;
|
|
11
|
+
padding: 50px;
|
|
12
|
+
background: #f5f5f5;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
.container {
|
|
16
|
+
max-width: 500px;
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
background: white;
|
|
19
|
+
padding: 30px;
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
22
|
+
}
|
|
23
|
+
.error { color: #d32f2f; }
|
|
24
|
+
.close-btn {
|
|
25
|
+
background: #1976d2;
|
|
26
|
+
color: white;
|
|
27
|
+
border: none;
|
|
28
|
+
padding: 10px 20px;
|
|
29
|
+
border-radius: 5px;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
margin-top: 20px;
|
|
32
|
+
}
|
|
33
|
+
.close-btn:hover { background: #1565c0; }
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div class="container">
|
|
38
|
+
<h2 class="error">❌ Invalid Request</h2>
|
|
39
|
+
<p>No authorization code received. Please try again.</p>
|
|
40
|
+
<button class="close-btn" onclick="closeWindow()">Close Window</button>
|
|
41
|
+
</div>
|
|
42
|
+
<script>
|
|
43
|
+
function closeWindow() {
|
|
44
|
+
window.history.replaceState({}, document.title, '/oauth/complete');
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
window.close();
|
|
47
|
+
if (!window.closed) {
|
|
48
|
+
window.location.href = 'about:blank';
|
|
49
|
+
}
|
|
50
|
+
}, 1000);
|
|
51
|
+
}
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
window.history.replaceState({}, document.title, '/oauth/complete');
|
|
54
|
+
closeWindow();
|
|
55
|
+
}, 3000);
|
|
56
|
+
</script>
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>ZS CLI - Validating Authentication</title>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
text-align: center;
|
|
11
|
+
padding: 50px;
|
|
12
|
+
background: #f5f5f5;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
.container {
|
|
16
|
+
max-width: 500px;
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
background: white;
|
|
19
|
+
padding: 30px;
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
22
|
+
}
|
|
23
|
+
.loading { color: #1976d2; }
|
|
24
|
+
.spinner {
|
|
25
|
+
border: 4px solid #f3f3f3;
|
|
26
|
+
border-top: 4px solid #1976d2;
|
|
27
|
+
border-radius: 50%;
|
|
28
|
+
width: 40px;
|
|
29
|
+
height: 40px;
|
|
30
|
+
animation: spin 1s linear infinite;
|
|
31
|
+
margin: 20px auto;
|
|
32
|
+
}
|
|
33
|
+
@keyframes spin {
|
|
34
|
+
0% { transform: rotate(0deg); }
|
|
35
|
+
100% { transform: rotate(360deg); }
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
38
|
+
</head>
|
|
39
|
+
<body>
|
|
40
|
+
<div class="container">
|
|
41
|
+
<h2 class="loading">🔄 Validating Authentication</h2>
|
|
42
|
+
<div class="spinner"></div>
|
|
43
|
+
<p>Please wait while we validate your authentication and obtain access tokens...</p>
|
|
44
|
+
<p><em>This window will update automatically.</em></p>
|
|
45
|
+
</div>
|
|
46
|
+
<script>
|
|
47
|
+
// Poll for completion
|
|
48
|
+
let pollCount = 0;
|
|
49
|
+
const maxPolls = 30; // 30 seconds max
|
|
50
|
+
|
|
51
|
+
function checkStatus() {
|
|
52
|
+
pollCount++;
|
|
53
|
+
if (pollCount > maxPolls) {
|
|
54
|
+
window.location.href = '/oauth/timeout';
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fetch('/oauth/status')
|
|
59
|
+
.then(response => response.json())
|
|
60
|
+
.then(data => {
|
|
61
|
+
if (data.status === 'success') {
|
|
62
|
+
window.location.href = '/oauth/success';
|
|
63
|
+
} else if (data.status === 'error') {
|
|
64
|
+
window.location.href = '/oauth/error?message=' + encodeURIComponent(data.message);
|
|
65
|
+
} else {
|
|
66
|
+
// Still processing, check again
|
|
67
|
+
setTimeout(checkStatus, 1000);
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
.catch(() => {
|
|
71
|
+
// Continue polling on fetch errors
|
|
72
|
+
setTimeout(checkStatus, 1000);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Start polling after 2 seconds
|
|
77
|
+
setTimeout(checkStatus, 2000);
|
|
78
|
+
</script>
|
|
79
|
+
</body>
|
|
80
|
+
</html>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>ZS CLI - Not Found</title>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
text-align: center;
|
|
11
|
+
padding: 50px;
|
|
12
|
+
background: #f5f5f5;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
.container {
|
|
16
|
+
max-width: 500px;
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
background: white;
|
|
19
|
+
padding: 30px;
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
22
|
+
}
|
|
23
|
+
.info { color: #1976d2; }
|
|
24
|
+
</style>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<div class="container">
|
|
28
|
+
<h2 class="info">ZS CLI OAuth Server</h2>
|
|
29
|
+
<p>This is the OAuth callback server for ZS CLI.</p>
|
|
30
|
+
<p>Please use the CLI to initiate authentication.</p>
|
|
31
|
+
</div>
|
|
32
|
+
</body>
|
|
33
|
+
</html>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>ZS CLI - Authentication Successful</title>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
text-align: center;
|
|
11
|
+
padding: 50px;
|
|
12
|
+
background: #f5f5f5;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
.container {
|
|
16
|
+
max-width: 500px;
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
background: white;
|
|
19
|
+
padding: 30px;
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
22
|
+
}
|
|
23
|
+
.success { color: #2e7d32; }
|
|
24
|
+
.close-btn {
|
|
25
|
+
background: #2e7d32;
|
|
26
|
+
color: white;
|
|
27
|
+
border: none;
|
|
28
|
+
padding: 10px 20px;
|
|
29
|
+
border-radius: 5px;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
margin-top: 20px;
|
|
32
|
+
}
|
|
33
|
+
.close-btn:hover { background: #1b5e20; }
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div class="container">
|
|
38
|
+
<h2 class="success">✅ Authentication Successful!</h2>
|
|
39
|
+
<p>You have successfully authenticated with Zoho and obtained access tokens.</p>
|
|
40
|
+
<p>You can now close this window and return to your terminal.</p>
|
|
41
|
+
<button class="close-btn" onclick="closeWindow()">Close Window</button>
|
|
42
|
+
</div>
|
|
43
|
+
<script>
|
|
44
|
+
function closeWindow() {
|
|
45
|
+
// Clear URL parameters
|
|
46
|
+
window.history.replaceState({}, document.title, '/oauth/complete');
|
|
47
|
+
|
|
48
|
+
// Try multiple methods to close the window
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
// Method 1: Standard close
|
|
51
|
+
window.close();
|
|
52
|
+
|
|
53
|
+
// Method 2: If window.close() doesn't work, try opener
|
|
54
|
+
if (!window.closed && window.opener) {
|
|
55
|
+
window.opener.focus();
|
|
56
|
+
window.close();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Method 3: If still open, navigate to blank page
|
|
60
|
+
if (!window.closed) {
|
|
61
|
+
window.location.href = 'about:blank';
|
|
62
|
+
}
|
|
63
|
+
}, 1000);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Auto-close after 5 seconds
|
|
67
|
+
setTimeout(closeWindow, 5000);
|
|
68
|
+
</script>
|
|
69
|
+
</body>
|
|
70
|
+
</html>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>ZS CLI - Authentication Timeout</title>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
text-align: center;
|
|
11
|
+
padding: 50px;
|
|
12
|
+
background: #f5f5f5;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
.container {
|
|
16
|
+
max-width: 500px;
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
background: white;
|
|
19
|
+
padding: 30px;
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
22
|
+
}
|
|
23
|
+
.warning { color: #ff9800; }
|
|
24
|
+
.close-btn {
|
|
25
|
+
background: #ff9800;
|
|
26
|
+
color: white;
|
|
27
|
+
border: none;
|
|
28
|
+
padding: 10px 20px;
|
|
29
|
+
border-radius: 5px;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
margin-top: 20px;
|
|
32
|
+
}
|
|
33
|
+
.close-btn:hover { background: #f57c00; }
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div class="container">
|
|
38
|
+
<h2 class="warning">⏰ Authentication Timeout</h2>
|
|
39
|
+
<p>The authentication process is taking longer than expected.</p>
|
|
40
|
+
<p>Please close this window and check your terminal for status updates.</p>
|
|
41
|
+
<button class="close-btn" onclick="closeWindow()">Close Window</button>
|
|
42
|
+
</div>
|
|
43
|
+
<script>
|
|
44
|
+
function closeWindow() {
|
|
45
|
+
window.history.replaceState({}, document.title, '/oauth/complete');
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
window.close();
|
|
48
|
+
if (!window.closed) {
|
|
49
|
+
window.location.href = 'about:blank';
|
|
50
|
+
}
|
|
51
|
+
}, 1000);
|
|
52
|
+
}
|
|
53
|
+
setTimeout(closeWindow, 3000);
|
|
54
|
+
</script>
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>ZS CLI - Authentication Error</title>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
text-align: center;
|
|
11
|
+
padding: 50px;
|
|
12
|
+
background: #f5f5f5;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
.container {
|
|
16
|
+
max-width: 500px;
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
background: white;
|
|
19
|
+
padding: 30px;
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
22
|
+
}
|
|
23
|
+
.error { color: #d32f2f; }
|
|
24
|
+
.close-btn {
|
|
25
|
+
background: #d32f2f;
|
|
26
|
+
color: white;
|
|
27
|
+
border: none;
|
|
28
|
+
padding: 10px 20px;
|
|
29
|
+
border-radius: 5px;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
margin-top: 20px;
|
|
32
|
+
}
|
|
33
|
+
.close-btn:hover { background: #b71c1c; }
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div class="container">
|
|
38
|
+
<h2 class="error">❌ Authentication Failed</h2>
|
|
39
|
+
<p>Token validation failed:</p>
|
|
40
|
+
<p><strong>{{ERROR_MESSAGE}}</strong></p>
|
|
41
|
+
<p>Please close this window and try again in your terminal.</p>
|
|
42
|
+
<button class="close-btn" onclick="closeWindow()">Close Window</button>
|
|
43
|
+
</div>
|
|
44
|
+
<script>
|
|
45
|
+
function closeWindow() {
|
|
46
|
+
window.history.replaceState({}, document.title, '/oauth/complete');
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
window.close();
|
|
49
|
+
if (!window.closed) {
|
|
50
|
+
window.location.href = 'about:blank';
|
|
51
|
+
}
|
|
52
|
+
}, 1000);
|
|
53
|
+
}
|
|
54
|
+
setTimeout(closeWindow, 5000);
|
|
55
|
+
</script>
|
|
56
|
+
</body>
|
|
57
|
+
</html>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { CONFIG_FILE_NAME } = require('../config/constants.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Read the project configuration file and return the configuration object
|
|
7
|
+
* @returns {Object} Configuration object containing namespace, siteId, etc.
|
|
8
|
+
*/
|
|
9
|
+
function readProjectConfig() {
|
|
10
|
+
const configPath = path.join(process.cwd(), CONFIG_FILE_NAME);
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(configPath)) {
|
|
13
|
+
throw new Error(`Configuration file ${CONFIG_FILE_NAME} not found. Please run 'zs init' to initialize the project.`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const configContent = fs.readFileSync(configPath, 'utf8');
|
|
18
|
+
const config = JSON.parse(configContent);
|
|
19
|
+
|
|
20
|
+
// Support both current format (namespace = UUID) and legacy (namespaceId)
|
|
21
|
+
const namespace = config.namespace || config.namespaceId;
|
|
22
|
+
if (!namespace) {
|
|
23
|
+
throw new Error(`Namespace not found in ${CONFIG_FILE_NAME}. Please run 'zs init' to initialize the project.`);
|
|
24
|
+
}
|
|
25
|
+
if (!config.namespace) {
|
|
26
|
+
config.namespace = namespace;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return config;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (error instanceof SyntaxError) {
|
|
32
|
+
throw new Error(`Invalid JSON in ${CONFIG_FILE_NAME}. Please check the file format.`);
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get the namespace from the project configuration
|
|
40
|
+
* @returns {string} The namespace for the current project
|
|
41
|
+
*/
|
|
42
|
+
function getNamespace() {
|
|
43
|
+
const config = readProjectConfig();
|
|
44
|
+
return config.namespace;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get the site ID from the project configuration.
|
|
49
|
+
* Prefers siteId, then asoid (account asoid stored by `zs init`).
|
|
50
|
+
* @returns {string} The site ID for the current project
|
|
51
|
+
*/
|
|
52
|
+
function getSiteId() {
|
|
53
|
+
const config = readProjectConfig();
|
|
54
|
+
return config.siteId || config.asoid;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get the site builder domain from the project configuration
|
|
59
|
+
* @returns {string} The site builder domain URL
|
|
60
|
+
*/
|
|
61
|
+
function getSiteBuilderDomain() {
|
|
62
|
+
const config = readProjectConfig();
|
|
63
|
+
return config.siteBuilderDomain;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = { readProjectConfig, getNamespace, getSiteId, getSiteBuilderDomain };
|