create-kontrolia-auth 2.4.0 → 2.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../src/steps/deployment.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA8JpD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAoJ3F"}
1
+ {"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../src/steps/deployment.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAiLpD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAsJ3F"}
@@ -2,6 +2,26 @@ import * as p from "@clack/prompts";
2
2
  import { readEnvFile, updateEnvValue, writeEnvFile } from "../utils/files.js";
3
3
  import { registerOAuthClient } from "../utils/oauth-client.js";
4
4
  import { createVercelProject, detectCurrentBranch, detectGitHubRepo, triggerVercelDeployment } from "../utils/vercel-api.js";
5
+ /**
6
+ * Catches a `http://` URL for a real domain before it gets baked into env
7
+ * vars — this exact typo shipped once already and broke CORS silently: the
8
+ * browser sends `Origin: https://panel.example.com`, the server only
9
+ * allow-lists the `http://` variant from this value, and every fetch()
10
+ * from admin-panel to auth-server fails with an unhelpful "Failed to
11
+ * fetch" that gives no hint the mismatch is just one character. `http://`
12
+ * is still fine for localhost/127.0.0.1 since nothing serves plain HTTP
13
+ * during local dev.
14
+ */
15
+ function validateDeployUrl(value) {
16
+ if (!value.trim())
17
+ return "Requerido";
18
+ if (/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?\/?$/i.test(value.trim()))
19
+ return undefined;
20
+ if (!/^https:\/\//i.test(value.trim())) {
21
+ return 'Usa https:// para un dominio real (http:// solo vale para localhost) — si no, el navegador bloquea las llamadas entre auth-server y admin-panel por CORS.';
22
+ }
23
+ return undefined;
24
+ }
5
25
  const NEXT_STEPS = {
6
26
  docker: "Ya está: los servicios auth-server y admin-panel viven en el mismo docker/docker-compose.yml. Corre `docker compose -f docker/docker-compose.yml up -d` para tenerlos arriba.",
7
27
  vercel: "Lo más confiable con un monorepo pnpm es conectar el repo desde el dashboard (no desplegar carpetas sueltas por CLI):\n" +
@@ -156,6 +176,7 @@ export async function askDeploymentStep(repoRoot, db) {
156
176
  placeholder: "http://localhost:3000",
157
177
  defaultValue: "http://localhost:3000",
158
178
  initialValue: prevAuthServerUrl,
179
+ validate: validateDeployUrl,
159
180
  });
160
181
  if (p.isCancel(authServerUrl)) {
161
182
  p.cancel("Instalación cancelada.");
@@ -166,6 +187,7 @@ export async function askDeploymentStep(repoRoot, db) {
166
187
  placeholder: "http://localhost:3001",
167
188
  defaultValue: "http://localhost:3001",
168
189
  initialValue: prevAdminPanelUrl,
190
+ validate: validateDeployUrl,
169
191
  });
170
192
  if (p.isCancel(adminPanelUrl)) {
171
193
  p.cancel("Instalación cancelada.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kontrolia-auth",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "license": "MIT",
5
5
  "description": "Turnkey installer for KontrolIA Auth. `npx create-kontrolia-auth mi-app` checks requirements, downloads the repo, installs deps, and runs a wizard: (1) connect to an existing Supabase project or create a new self-hosted one via Docker; (2) where to deploy auth-server/admin-panel (Docker, Vercel, Railway, Render, Coolify). Also exposes `update`, `migrate` and `doctor` subcommands.",
6
6
  "keywords": [