@authrim/setup 0.1.12 → 0.1.16
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/cli/commands/deploy.d.ts +1 -0
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/deploy.js +23 -1
- package/dist/cli/commands/deploy.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +49 -6
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/core/deploy.d.ts +17 -0
- package/dist/core/deploy.d.ts.map +1 -1
- package/dist/core/deploy.js +44 -0
- package/dist/core/deploy.js.map +1 -1
- package/dist/core/keys.d.ts +11 -3
- package/dist/core/keys.d.ts.map +1 -1
- package/dist/core/keys.js +33 -15
- package/dist/core/keys.js.map +1 -1
- package/dist/core/wrangler.d.ts +4 -0
- package/dist/core/wrangler.d.ts.map +1 -1
- package/dist/core/wrangler.js +86 -0
- package/dist/core/wrangler.js.map +1 -1
- package/dist/web/api.d.ts.map +1 -1
- package/dist/web/api.js +49 -15
- package/dist/web/api.js.map +1 -1
- package/dist/web/ui.d.ts.map +1 -1
- package/dist/web/ui.js +137 -20
- package/dist/web/ui.js.map +1 -1
- package/package.json +1 -1
package/dist/web/ui.js
CHANGED
|
@@ -197,6 +197,66 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
197
197
|
gap: 0.5rem;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
/* Domain configuration section */
|
|
201
|
+
.domain-section {
|
|
202
|
+
background: var(--bg);
|
|
203
|
+
border: 1px solid var(--border);
|
|
204
|
+
border-radius: 8px;
|
|
205
|
+
padding: 1rem;
|
|
206
|
+
margin-bottom: 1rem;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.domain-section h4 {
|
|
210
|
+
margin: 0 0 1rem 0;
|
|
211
|
+
font-size: 0.95rem;
|
|
212
|
+
color: var(--text);
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
gap: 0.5rem;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.domain-row {
|
|
219
|
+
display: grid;
|
|
220
|
+
grid-template-columns: 90px 1fr;
|
|
221
|
+
align-items: center;
|
|
222
|
+
gap: 0.75rem;
|
|
223
|
+
margin-bottom: 0.75rem;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.domain-row:last-of-type {
|
|
227
|
+
margin-bottom: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.domain-label {
|
|
231
|
+
font-size: 0.85rem;
|
|
232
|
+
color: var(--text-muted);
|
|
233
|
+
font-weight: 500;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.domain-input-wrapper {
|
|
237
|
+
position: relative;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.domain-input-wrapper input {
|
|
241
|
+
padding-right: 180px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.domain-default {
|
|
245
|
+
position: absolute;
|
|
246
|
+
right: 10px;
|
|
247
|
+
top: 50%;
|
|
248
|
+
transform: translateY(-50%);
|
|
249
|
+
font-size: 0.7rem;
|
|
250
|
+
color: var(--text-muted);
|
|
251
|
+
background: #f1f5f9;
|
|
252
|
+
padding: 2px 6px;
|
|
253
|
+
border-radius: 4px;
|
|
254
|
+
max-width: 160px;
|
|
255
|
+
overflow: hidden;
|
|
256
|
+
text-overflow: ellipsis;
|
|
257
|
+
white-space: nowrap;
|
|
258
|
+
}
|
|
259
|
+
|
|
200
260
|
button {
|
|
201
261
|
padding: 0.75rem 1.5rem;
|
|
202
262
|
border-radius: 8px;
|
|
@@ -739,10 +799,37 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
739
799
|
<small style="color: var(--text-muted)">Lowercase letters, numbers, and hyphens only</small>
|
|
740
800
|
</div>
|
|
741
801
|
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
<
|
|
745
|
-
|
|
802
|
+
<!-- Domain Configuration -->
|
|
803
|
+
<div class="domain-section">
|
|
804
|
+
<h4>🌐 Domain Configuration</h4>
|
|
805
|
+
|
|
806
|
+
<div class="domain-row">
|
|
807
|
+
<span class="domain-label">API</span>
|
|
808
|
+
<div class="domain-input-wrapper">
|
|
809
|
+
<input type="text" id="api-domain" placeholder="auth.example.com">
|
|
810
|
+
<span class="domain-default" id="api-default">{env}-ar-router.workers.dev</span>
|
|
811
|
+
</div>
|
|
812
|
+
</div>
|
|
813
|
+
|
|
814
|
+
<div class="domain-row">
|
|
815
|
+
<span class="domain-label">Login UI</span>
|
|
816
|
+
<div class="domain-input-wrapper">
|
|
817
|
+
<input type="text" id="login-domain" placeholder="login.example.com">
|
|
818
|
+
<span class="domain-default" id="login-default">{env}-ar-ui.pages.dev</span>
|
|
819
|
+
</div>
|
|
820
|
+
</div>
|
|
821
|
+
|
|
822
|
+
<div class="domain-row">
|
|
823
|
+
<span class="domain-label">Admin UI</span>
|
|
824
|
+
<div class="domain-input-wrapper">
|
|
825
|
+
<input type="text" id="admin-domain" placeholder="admin.example.com">
|
|
826
|
+
<span class="domain-default" id="admin-default">{env}-ar-ui.pages.dev/admin</span>
|
|
827
|
+
</div>
|
|
828
|
+
</div>
|
|
829
|
+
|
|
830
|
+
<small style="color: var(--text-muted); display: block; margin-top: 0.75rem;">
|
|
831
|
+
💡 Leave empty to use default Cloudflare domains (shown on right)
|
|
832
|
+
</small>
|
|
746
833
|
</div>
|
|
747
834
|
|
|
748
835
|
<!-- Advanced options (shown in custom mode) -->
|
|
@@ -1318,7 +1405,9 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
1318
1405
|
// Use loaded config
|
|
1319
1406
|
config = {
|
|
1320
1407
|
env: loadedConfig.environment?.prefix || 'prod',
|
|
1321
|
-
|
|
1408
|
+
apiDomain: loadedConfig.urls?.api?.custom || null,
|
|
1409
|
+
loginUiDomain: loadedConfig.urls?.loginUi?.custom || null,
|
|
1410
|
+
adminUiDomain: loadedConfig.urls?.adminUi?.custom || null,
|
|
1322
1411
|
components: loadedConfig.components || {
|
|
1323
1412
|
api: true,
|
|
1324
1413
|
loginUi: true,
|
|
@@ -1331,7 +1420,11 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
1331
1420
|
|
|
1332
1421
|
// Set form values
|
|
1333
1422
|
document.getElementById('env').value = config.env;
|
|
1334
|
-
document.getElementById('domain').value = config.
|
|
1423
|
+
document.getElementById('api-domain').value = config.apiDomain || '';
|
|
1424
|
+
document.getElementById('login-domain').value = config.loginUiDomain || '';
|
|
1425
|
+
document.getElementById('admin-domain').value = config.adminUiDomain || '';
|
|
1426
|
+
// Trigger env input to update default labels
|
|
1427
|
+
document.getElementById('env').dispatchEvent(new Event('input'));
|
|
1335
1428
|
|
|
1336
1429
|
// Skip to provisioning if resources already exist
|
|
1337
1430
|
if (loadedConfig.resources) {
|
|
@@ -1344,6 +1437,14 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
1344
1437
|
});
|
|
1345
1438
|
|
|
1346
1439
|
// Configuration handlers
|
|
1440
|
+
// Update domain defaults when environment name changes
|
|
1441
|
+
document.getElementById('env').addEventListener('input', (e) => {
|
|
1442
|
+
const env = e.target.value.trim().toLowerCase().replace(/[^a-z0-9-]/g, '') || '{env}';
|
|
1443
|
+
document.getElementById('api-default').textContent = env + '-ar-router.workers.dev';
|
|
1444
|
+
document.getElementById('login-default').textContent = env + '-ar-ui.pages.dev';
|
|
1445
|
+
document.getElementById('admin-default').textContent = env + '-ar-ui.pages.dev/admin';
|
|
1446
|
+
});
|
|
1447
|
+
|
|
1347
1448
|
document.getElementById('btn-back-mode').addEventListener('click', () => {
|
|
1348
1449
|
setStep(1);
|
|
1349
1450
|
showSection('mode');
|
|
@@ -1380,11 +1481,15 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
1380
1481
|
configureBtn.disabled = false;
|
|
1381
1482
|
}
|
|
1382
1483
|
|
|
1383
|
-
const
|
|
1484
|
+
const apiDomain = document.getElementById('api-domain').value.trim();
|
|
1485
|
+
const loginDomain = document.getElementById('login-domain').value.trim();
|
|
1486
|
+
const adminDomain = document.getElementById('admin-domain').value.trim();
|
|
1384
1487
|
|
|
1385
1488
|
config = {
|
|
1386
1489
|
env,
|
|
1387
|
-
|
|
1490
|
+
apiDomain: apiDomain || null,
|
|
1491
|
+
loginUiDomain: loginDomain || null,
|
|
1492
|
+
adminUiDomain: adminDomain || null,
|
|
1388
1493
|
components: {
|
|
1389
1494
|
api: true,
|
|
1390
1495
|
loginUi: setupMode === 'quick' || document.getElementById('comp-login-ui').checked,
|
|
@@ -1398,7 +1503,7 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
1398
1503
|
// Create default config
|
|
1399
1504
|
await api('/config/default', {
|
|
1400
1505
|
method: 'POST',
|
|
1401
|
-
body: { env,
|
|
1506
|
+
body: { env, apiDomain, loginUiDomain: loginDomain, adminUiDomain: adminDomain },
|
|
1402
1507
|
});
|
|
1403
1508
|
|
|
1404
1509
|
// Update resource preview with the selected env
|
|
@@ -1454,12 +1559,21 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
1454
1559
|
}, 500);
|
|
1455
1560
|
|
|
1456
1561
|
try {
|
|
1562
|
+
// Check if keys already exist for this environment
|
|
1563
|
+
const keysCheck = await api('/keys/check/' + config.env);
|
|
1564
|
+
if (keysCheck.exists) {
|
|
1565
|
+
output.textContent += '⚠️ Warning: Keys already exist for environment "' + config.env + '"\\n';
|
|
1566
|
+
output.textContent += ' Existing keys will be overwritten.\\n';
|
|
1567
|
+
output.textContent += '\\n';
|
|
1568
|
+
scrollToBottom(log);
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1457
1571
|
// Generate keys
|
|
1458
1572
|
output.textContent += '🔐 Generating cryptographic keys...\\n';
|
|
1459
1573
|
scrollToBottom(log);
|
|
1460
1574
|
const keyResult = await api('/keys/generate', {
|
|
1461
1575
|
method: 'POST',
|
|
1462
|
-
body: { keyId: config.env + '-key-' + Date.now() },
|
|
1576
|
+
body: { keyId: config.env + '-key-' + Date.now(), env: config.env },
|
|
1463
1577
|
});
|
|
1464
1578
|
output.textContent += ' ✓ RSA key pair generated\\n';
|
|
1465
1579
|
output.textContent += ' ✓ Encryption keys generated\\n';
|
|
@@ -1467,8 +1581,8 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
1467
1581
|
output.textContent += '\\n';
|
|
1468
1582
|
scrollToBottom(log);
|
|
1469
1583
|
|
|
1470
|
-
// Show keys saved location (full path)
|
|
1471
|
-
keysPath.textContent = workingDirectory ? workingDirectory + '/.keys/' : './.keys/';
|
|
1584
|
+
// Show keys saved location (full path with environment)
|
|
1585
|
+
keysPath.textContent = workingDirectory ? workingDirectory + '/.keys/' + config.env + '/' : './.keys/' + config.env + '/';
|
|
1472
1586
|
|
|
1473
1587
|
// Provision resources
|
|
1474
1588
|
output.textContent += '☁️ Provisioning Cloudflare resources...\\n';
|
|
@@ -1609,11 +1723,10 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
1609
1723
|
function showComplete(result) {
|
|
1610
1724
|
const urlsEl = document.getElementById('urls');
|
|
1611
1725
|
const env = config.env;
|
|
1612
|
-
const domain = config.domain;
|
|
1613
1726
|
|
|
1614
|
-
const apiUrl =
|
|
1615
|
-
const loginUrl =
|
|
1616
|
-
const adminUrl =
|
|
1727
|
+
const apiUrl = config.apiDomain ? 'https://' + config.apiDomain : 'https://' + env + '-ar-router.workers.dev';
|
|
1728
|
+
const loginUrl = config.loginUiDomain ? 'https://' + config.loginUiDomain : 'https://' + env + '-ar-ui.pages.dev';
|
|
1729
|
+
const adminUrl = config.adminUiDomain ? 'https://' + config.adminUiDomain : 'https://' + env + '-ar-ui.pages.dev/admin';
|
|
1617
1730
|
|
|
1618
1731
|
// Clear and rebuild URLs section safely
|
|
1619
1732
|
urlsEl.textContent = '';
|
|
@@ -1633,7 +1746,8 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
1633
1746
|
|
|
1634
1747
|
// Resource naming functions
|
|
1635
1748
|
function getResourceNames(env) {
|
|
1636
|
-
|
|
1749
|
+
// Keys are stored in environment-specific subdirectory: .keys/{env}/
|
|
1750
|
+
const keysDir = workingDirectory ? workingDirectory + '/.keys/' + env : '.keys/' + env;
|
|
1637
1751
|
return {
|
|
1638
1752
|
d1: [
|
|
1639
1753
|
env + '-authrim-core-db',
|
|
@@ -2114,7 +2228,8 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
2114
2228
|
result.classList.remove('hidden');
|
|
2115
2229
|
|
|
2116
2230
|
if (deleteResult.success) {
|
|
2117
|
-
result.
|
|
2231
|
+
result.textContent = '';
|
|
2232
|
+
result.appendChild(createAlert('success', '✅ Environment deleted successfully!'));
|
|
2118
2233
|
|
|
2119
2234
|
// Refresh environment list after a short delay
|
|
2120
2235
|
setTimeout(() => {
|
|
@@ -2122,13 +2237,15 @@ export function getHtmlTemplate(sessionToken, manageOnly) {
|
|
|
2122
2237
|
showSection('envList');
|
|
2123
2238
|
}, 2000);
|
|
2124
2239
|
} else {
|
|
2125
|
-
result.
|
|
2240
|
+
result.textContent = '';
|
|
2241
|
+
result.appendChild(createAlert('error', '❌ Some errors occurred: ' + (deleteResult.errors || []).join(', ')));
|
|
2126
2242
|
btn.disabled = false;
|
|
2127
2243
|
}
|
|
2128
2244
|
} catch (error) {
|
|
2129
2245
|
clearInterval(pollInterval);
|
|
2130
2246
|
result.classList.remove('hidden');
|
|
2131
|
-
result.
|
|
2247
|
+
result.textContent = '';
|
|
2248
|
+
result.appendChild(createAlert('error', '❌ Error: ' + error.message));
|
|
2132
2249
|
btn.disabled = false;
|
|
2133
2250
|
}
|
|
2134
2251
|
});
|
package/dist/web/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/web/ui.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,UA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