pwa update
Build and Publish Docker Image / build-and-push-image (push) Successful in 55s

This commit is contained in:
Zed
2026-07-10 15:25:35 +02:00
parent 722b98c74c
commit 9ae37f98ed
10 changed files with 58 additions and 39 deletions
-24
View File
@@ -1,24 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
+11 -3
View File
@@ -2,14 +2,22 @@
<html lang="fr" class="light"> <html lang="fr" class="light">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" href="/favicon.ico" sizes="48x48" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<meta <meta
name="viewport" name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
/> />
<meta name="theme-color" content="#ffffff" /> <meta name="theme-color" content="#0f766e" />
<meta
name="description"
content="Skori — Gestion des scores pour vos jeux de société : Skyjo, Azul, Cabo, Harmonies, Odin."
/>
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" /> <meta name="apple-mobile-web-app-status-bar-style" content="default" />
<meta name="apple-mobile-web-app-title" content="Skori" />
<title>Skori</title> <title>Skori</title>
</head> </head>
<body> <body>
+14 -6
View File
@@ -5,21 +5,29 @@ server {
index index.html; index index.html;
# Important pour les Single Page Applications (React Router) # Important pour les Single Page Applications (React Router)
# Si le fichier n'existe pas, on redirige vers index.html
location / { location / {
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }
# Mise en cache agressive pour les assets statiques # Mise en cache agressive pour les assets statiques fingerprintés
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|webp)$ { location ~* \.(?:css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|webp|ico|pdf)$ {
expires 6M; expires 6M;
access_log off; access_log off;
add_header Cache-Control "public, max-age=15552000, immutable"; add_header Cache-Control "public, max-age=15552000, immutable";
} }
# Ne pas mettre en cache le service worker pour que la PWA se mette à jour # Jamais de cache sur les fichiers pilotant les mises à jour PWA
location = /index.html {
add_header Cache-Control "no-cache, must-revalidate";
}
location = /sw.js { location = /sw.js {
expires -1; add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"; }
location = /manifest.webmanifest {
add_header Cache-Control "no-cache, must-revalidate";
types { } default_type application/manifest+json;
}
location ~* ^/workbox-.*\.js$ {
add_header Cache-Control "public, max-age=15552000, immutable";
} }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

+33 -6
View File
@@ -8,15 +8,20 @@ export default defineConfig({
react(), react(),
VitePWA({ VitePWA({
registerType: "autoUpdate", registerType: "autoUpdate",
includeAssets: ["favicon.ico", "apple-touch-icon.png", "mask-icon.svg"], includeAssets: ["favicon.ico", "apple-touch-icon.png"],
manifest: { manifest: {
name: "Skori", name: "Skori — Scores de jeux de société",
short_name: "Skori", short_name: "Skori",
description: description:
"Application Web de gestion des scores pour jeux de société", "Application Web de gestion des scores pour jeux de société",
theme_color: "#ffffff", lang: "fr",
background_color: "#ffffff", start_url: "/",
scope: "/",
display: "standalone", display: "standalone",
orientation: "portrait",
theme_color: "#0f766e",
background_color: "#ffffff",
categories: ["games", "utilities"],
icons: [ icons: [
{ {
src: "pwa-192x192.png", src: "pwa-192x192.png",
@@ -29,13 +34,35 @@ export default defineConfig({
type: "image/png", type: "image/png",
}, },
{ {
src: "pwa-512x512.png", src: "pwa-maskable-512x512.png",
sizes: "512x512", sizes: "512x512",
type: "image/png", type: "image/png",
purpose: "any maskable", purpose: "maskable",
}, },
], ],
}, },
workbox: {
// Précache le shell de l'app + les logos/bannières (légers, en webp)
globPatterns: ["**/*.{js,css,html,ico,png,svg,webp,woff2}"],
// Les PDF de règles (jusqu'à 12 Mo) ne sont PAS précachés :
// ils sont mis en cache à la demande, à la première consultation.
runtimeCaching: [
{
urlPattern: /\/games-assets\/.*\.pdf$/,
handler: "CacheFirst",
options: {
cacheName: "rules-pdf",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 90, // 90 jours
},
cacheableResponse: { statuses: [0, 200] },
},
},
],
navigateFallback: "/index.html",
cleanupOutdatedCaches: true,
},
}), }),
], ],
resolve: { resolve: {