From 203506be28f8bb9c8739a386cbc7793a9d7c430f Mon Sep 17 00:00:00 2001 From: FrigaT Date: Wed, 15 Apr 2026 20:24:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B1=D0=B5=D0=B4=D0=B8=D1=82=D1=8C=20=D0=BA=D1=8D?= =?UTF-8?q?=D1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PlaylistShared.Pwa/nginx.conf | 8 ++++++++ PlaylistShared.Pwa/wwwroot/service-worker.published.js | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/PlaylistShared.Pwa/nginx.conf b/PlaylistShared.Pwa/nginx.conf index 44e1099..08fabd8 100644 --- a/PlaylistShared.Pwa/nginx.conf +++ b/PlaylistShared.Pwa/nginx.conf @@ -33,6 +33,14 @@ http { add_header Expires "0"; try_files $uri =404; } + + # Для файла index.html – тоже не кэшируем + location = /index.html { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + add_header Pragma "no-cache"; + add_header Expires "0"; + try_files $uri =404; + } # Основной SPA fallback: все неизвестные пути отдаём через index.html location / { diff --git a/PlaylistShared.Pwa/wwwroot/service-worker.published.js b/PlaylistShared.Pwa/wwwroot/service-worker.published.js index 51a0e5c..f540621 100644 --- a/PlaylistShared.Pwa/wwwroot/service-worker.published.js +++ b/PlaylistShared.Pwa/wwwroot/service-worker.published.js @@ -19,6 +19,8 @@ const manifestUrlList = self.assetsManifest.assets.map(asset => new URL(asset.ur async function onInstall(event) { console.info('Service worker: Install'); + self.skipWaiting(); + // Fetch and cache all matching items from the assets manifest const assetsRequests = self.assetsManifest.assets .filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url))) @@ -30,6 +32,8 @@ async function onInstall(event) { async function onActivate(event) { console.info('Service worker: Activate'); + await self.clients.claim(); + // Delete unused caches const cacheKeys = await caches.keys(); await Promise.all(cacheKeys