feat(twa): agregar .well-known/assetlinks.json para verificacion oficial Google Play Android

This commit is contained in:
unknown
2026-10-08 22:55:07 -06:00
parent bf0ddc881d
commit 98f5d1e2a7
7 changed files with 16 additions and 1 deletions
+8 -1
View File
@@ -118,13 +118,20 @@ app.get('/desktop-preview.html', (req, res) => {
res.redirect(301, '/');
});
// Android Digital Asset Links para TWA (Google Play Store)
app.get(['/.well-known/assetlinks.json', '/.well-known/assetlinks'], (req, res) => {
res.setHeader('Content-Type', 'application/json');
res.sendFile(path.join(__dirname, '../public/.well-known/assetlinks.json'));
});
// Servir archivos estáticos con compresión y caché optimizado para PWA
app.use(express.static(path.join(__dirname, '../public'), {
dotfiles: 'allow',
etag: true,
maxAge: '1d',
setHeaders: (res, filePath) => {
// Para HTML y Service Worker: siempre revalidar para garantizar actualizaciones inmediatas
if (filePath.endsWith('.html') || filePath.endsWith('sw.js') || filePath.endsWith('manifest.json')) {
if (filePath.endsWith('.html') || filePath.endsWith('sw.js') || filePath.endsWith('manifest.json') || filePath.includes('assetlinks.json')) {
res.setHeader('Cache-Control', 'no-cache, must-revalidate');
} else {
// Para CSS, JS, imágenes y fuentes: permitir caché con stale-while-revalidate para arranque instantáneo