From c9d8bf666a3bb9752d01a5b3caee4e21d836afca Mon Sep 17 00:00:00 2001 From: Galindo97 Date: Mon, 11 May 2026 08:39:16 -0500 Subject: [PATCH] fix: update docker-compose network to external and enhance avatar URL resolution logic --- backend/pytest.ini | 3 +++ docker-compose.yml | 2 +- frontend/.gitignore | 1 + frontend/package.json | 3 ++- frontend/src/lib/utils.ts | 25 +++++++++++++++---------- frontend/vite.config.ts | 1 + 6 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 backend/pytest.ini diff --git a/backend/pytest.ini b/backend/pytest.ini new file mode 100644 index 00000000..27eec68e --- /dev/null +++ b/backend/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +testpaths = tests +python_files = test_*.py diff --git a/docker-compose.yml b/docker-compose.yml index 28b35572..7b232c1b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -313,5 +313,5 @@ networks: driver: bridge hub-net: - external: false + external: true name: aduanasoft-hub_default diff --git a/frontend/.gitignore b/frontend/.gitignore index 6a5f9f9d..ce9f3eb7 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -26,6 +26,7 @@ Thumbs.db !.env.test # Vite +.vite/ vite.config.js.timestamp-* vite.config.ts.timestamp-* diff --git a/frontend/package.json b/frontend/package.json index 068aeeab..2e49b7aa 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -14,7 +14,8 @@ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "format": "prettier --write .", "lint": "prettier --check . && eslint .", - "test:unit": "vitest", + "test:unit": "vitest --project server", + "test:unit:full": "vitest", "test": "npm run test:unit -- --run && npm run test:e2e", "test:e2e": "playwright test" }, diff --git a/frontend/src/lib/utils.ts b/frontend/src/lib/utils.ts index fca43238..3e996ac5 100644 --- a/frontend/src/lib/utils.ts +++ b/frontend/src/lib/utils.ts @@ -43,18 +43,23 @@ function parseAbsoluteLikeUrl(value: string): URL | null { if (!trimmed) return null; try { - return new URL(trimmed); - } catch { - // Soporta formato host:puerto/ruta sin protocolo. - if (/^[a-z0-9.-]+:\d+\//i.test(trimmed)) { - try { - return new URL(`http://${trimmed}`); - } catch { - return null; - } + const parsed = new URL(trimmed); + if (parsed.protocol === 'http:' || parsed.protocol === 'https:') { + return parsed; } - return null; + } catch { } + + // Soporta formato host:puerto/ruta sin protocolo. + if (/^[a-z0-9.-]+:\d+\//i.test(trimmed)) { + try { + return new URL(`http://${trimmed}`); + } catch { + return null; + } + } + + return null; } function rewriteInternalHostToPublicUrl(value: string): string { diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 24c69218..6ed0afa2 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -37,6 +37,7 @@ const vitestClientProject = { }; export default defineConfig({ + cacheDir: '.vite', server: { port: 5173, // fija el puerto host: true, // escucha en 0.0.0.0