Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 137 additions & 81 deletions frontend/app.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions frontend/imagenes.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ test('NBA mantiene los logos en la lista y en el encabezado',()=>{
for(const code of ['BOS','BKN'])assert.equal(html.split(`src="/web/imagenes/nba/${manifest.nba[code].f}"`).length-1,2);
});

test('un retrato WebP de tenis se usa para la misma persona en la lista y el encabezado',()=>{
const html=sportView('tenis','Jakub Menšík','Adrian Mannarino',{
nba:{},tenis:{'jakub mensik':{f:'jakub-mensik.webp',a:'Autor',l:'CC BY'}}
});
assert.equal(html.split('src="/web/imagenes/tenis/jakub-mensik.webp"').length-1,2);
assert.ok(html.includes('CC BY'));
});

test('sin foto o con un nombre de archivo inválido usa iniciales y no solicita rutas arbitrarias',()=>{
const html=sportView('tenis','Jugador desconocido','Otro jugador',{nba:{},tenis:{'otro jugador':{f:'../privado.png'}}});
assert.ok(!html.includes('<img'));
Expand Down
7 changes: 4 additions & 3 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link rel="stylesheet" href="./styles.css?v=9cebbf1d0f3e" />
<link rel="stylesheet" href="./membership.css?v=m1" />
<link rel="stylesheet" href="./future.css?v=20261017c" />
<link rel="stylesheet" href="./window.css?v=destacado-segura-20261105" />
<link rel="stylesheet" href="./window.css?v=pronosticos-ventana-20261117" />
<link rel="stylesheet" href="./sport-images.css?v=imagenes-20261028" />
<link rel="stylesheet" href="./conversion.css?v=checkout-20261116" />
<link rel="modulepreload" href="./public-data.js?v=54fa60ae0082" />
Expand All @@ -19,7 +19,8 @@
<link rel="modulepreload" href="./rutas.js?v=generica-20261113" />
<link rel="modulepreload" href="./real-views.js?v=cupos-20261116" />
<link rel="modulepreload" href="./sports-data.js?v=cupos-20261116" />
<link rel="modulepreload" href="./sports-window.js?v=cupos-20261116" />
<link rel="modulepreload" href="./sports-window.js?v=pronosticos-ventana-20261117" />
<link rel="modulepreload" href="./window-i18n.js?v=20261117" />
<link rel="modulepreload" href="./sport-images.js?v=imagenes-20261028b" />
<link rel="modulepreload" href="./cuenta-api.js?v=b298f1c04385" />
<link rel="modulepreload" href="./conversion-views.js?v=parley-historial-7-dias-20261116" />
Expand All @@ -28,7 +29,7 @@
<link rel="modulepreload" href="./google-auth.js?v=w2b3c4d5e6f7" />
<link rel="modulepreload" href="./meta-pixel.js?v=preferencias-20261108" />
<link rel="modulepreload" href="./whop-checkout.js?v=pasarela-20261116" />
<script type="module" src="./app.js?v=agenda-finalizados-20261117"></script>
<script type="module" src="./app.js?v=pronosticos-ventana-20261117"></script>
</head>
<body>
<a class="skip-link" href="#main-content">Saltar al contenido</a>
Expand Down
3 changes: 2 additions & 1 deletion frontend/real-publication.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ test('match identity is encoded and source strings are escaped',async()=>{
test('production boot has no simulated catalog and maps all old data views to real sources',()=>{
const app=readFileSync(new URL('./app.js',import.meta.url),'utf8');
for(const name of ['Puerto Norte','Estrella Azul','function seeded','function buildFixture','qf-101','DEMO + DATOS PÚBLICOS']) assert.ok(!app.includes(name));
for(const route of ['inicio: realViews.home','mercados: windowView','picks: realViews.picks','historial: realViews.history']) assert.ok(app.includes(route));
for(const route of ['inicio: realViews.home','mercados: windowView','picks: predictionsView','historial: realViews.history']) assert.ok(app.includes(route));
assert.match(app, /function predictionsView\(\)[\s\S]*?\$\{windowView\(\)\}/);
assert.ok(app.includes('applyCybercoreTheme(app)'));
});
9 changes: 9 additions & 0 deletions frontend/rutas.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { ROUTE_PATH, INFO_PATHS, urlFor, routeFromLocation, cleanUrl, historyEntry, deporteDeUrl, isDeportePage, deporteBoot } from './rutas.js';
import { windowSelection, windowText } from './window-i18n.js';

const FRONTEND_DIR = path.dirname(fileURLToPath(import.meta.url));

Expand All @@ -16,6 +17,14 @@ const canonical = route => ALIAS[route] || route;
const at = (pathname, hash = '', search = '') => ({ pathname, hash, search });
const route = loc => routeFromLocation(loc, valid, canonical);

test('Pronósticos traduce las etiquetas y selecciones conocidas sin cambiar equipos, jugadores ni líneas', () => {
assert.equal(windowText('DOBLE OPORTUNIDAD', 'en'), 'Double chance');
assert.equal(windowText('Estadísticas', 'pt'), 'Estatísticas');
assert.equal(windowSelection('Albacete o Celta de Vigo II (sin empate)', 'en'), 'Albacete or Celta de Vigo II (no draw)');
assert.equal(windowSelection('Más de 2.5 goles', 'pt'), 'Mais de 2,5 gols');
assert.equal(windowSelection('Jakub Menšík +4.5', 'en'), 'Jakub Menšík +4.5');
});

test('cada sección pública tiene una URL limpia, con barra final y única', () => {
const paths = Object.values(ROUTE_PATH);
assert.equal(new Set(paths).size, paths.length);
Expand Down
8 changes: 6 additions & 2 deletions frontend/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const files = new Map([
['/real-views.js', ['real-views.js', 'text/javascript; charset=utf-8']],
['/sports-data.js', ['sports-data.js', 'text/javascript; charset=utf-8']],
['/sports-window.js', ['sports-window.js', 'text/javascript; charset=utf-8']],
['/window-i18n.js', ['window-i18n.js', 'text/javascript; charset=utf-8']],
['/conversion-views.js', ['conversion-views.js', 'text/javascript; charset=utf-8']],
['/conversion.css', ['conversion.css', 'text/css; charset=utf-8']],
['/historial-views.js', ['historial-views.js', 'text/javascript; charset=utf-8']],
['/sport-images.js', ['sport-images.js', 'text/javascript; charset=utf-8']],
['/sport-images.css', ['sport-images.css', 'text/css; charset=utf-8']],
['/ergonomic-views.js', ['ergonomic-views.js', 'text/javascript; charset=utf-8']],
Expand All @@ -35,7 +39,7 @@ const host = process.env.HOST || '127.0.0.1';

createServer(async (request, response) => {
const pathname = new URL(request.url || '/', 'http://localhost').pathname;
const file = files.get(SECCIONES.has(pathname) ? '/' : pathname);
const file = files.get(SECCIONES.has(pathname) || ['/en/predictions/', '/pt/previsoes/'].includes(pathname) ? '/' : pathname);
if (!file) {
response.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
response.end('No encontrado');
Expand All @@ -44,7 +48,7 @@ createServer(async (request, response) => {
try {
let body = await readFile(join(root, file[0]));
// Desde una ruta anidada, './styles.css' pediría '/historial/styles.css': como hace el servidor real, rutas absolutas.
if (file[0] === 'index.html') body = body.toString('utf8').replace(/(href|src)="\.\//g, '$1="/');
if (file[0] === 'index.html') body = body.toString('utf8').replace(/\b(href|src)="\.\//g, '$1="/');
response.writeHead(200, {
'Content-Type': file[1],
'Cache-Control': 'no-store',
Expand Down
Loading
Loading