From 64cc0e68a1c6418f41d9bfdd154b884c04e4db1e Mon Sep 17 00:00:00 2001 From: FrigaT Date: Tue, 21 Apr 2026 21:43:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=BE=D1=80=D1=8C=D0=B1=D0=B0=20=D1=81?= =?UTF-8?q?=20=D0=BA=D1=8D=D1=88=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PlaylistShared.Pwa/nginx.conf | 12 ++++++++++++ PlaylistShared.Pwa/wwwroot/manifest.webmanifest | 2 ++ .../wwwroot/service-worker.published.js | 4 ---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/PlaylistShared.Pwa/nginx.conf b/PlaylistShared.Pwa/nginx.conf index 08fabd8..b0507ec 100644 --- a/PlaylistShared.Pwa/nginx.conf +++ b/PlaylistShared.Pwa/nginx.conf @@ -5,6 +5,12 @@ events { http { include /etc/nginx/mime.types; default_type application/octet-stream; + + # Не раскрывайть версию Nginx в ответах. + server_tokens off; + + # Ограничение запросов от одного IP‑адреса, чтобы предотвратить DDoS‑атаки и злоупотребление ресурсами. + limit_req_zone $binary_remote_addr zone=one:10m rate=60r/s; # Сжатие gzip on; @@ -20,6 +26,8 @@ http { # Для Service Worker – запрещаем кэширование, чтобы он всегда был свежим location = /service-worker.js { + etag off; + add_header Last-Modified ""; add_header Cache-Control "no-cache, no-store, must-revalidate"; add_header Pragma "no-cache"; add_header Expires "0"; @@ -28,6 +36,8 @@ http { # Для файла манифеста Service Worker assets – тоже не кэшируем location = /service-worker-assets.js { + etag off; + add_header Last-Modified ""; add_header Cache-Control "no-cache, no-store, must-revalidate"; add_header Pragma "no-cache"; add_header Expires "0"; @@ -36,6 +46,8 @@ http { # Для файла index.html – тоже не кэшируем location = /index.html { + etag off; + add_header Last-Modified ""; add_header Cache-Control "no-cache, no-store, must-revalidate"; add_header Pragma "no-cache"; add_header Expires "0"; diff --git a/PlaylistShared.Pwa/wwwroot/manifest.webmanifest b/PlaylistShared.Pwa/wwwroot/manifest.webmanifest index 83baa43..afb0491 100644 --- a/PlaylistShared.Pwa/wwwroot/manifest.webmanifest +++ b/PlaylistShared.Pwa/wwwroot/manifest.webmanifest @@ -3,6 +3,8 @@ "short_name": "PlaylistShare", "id": "./", "start_url": "./", + "scope": "./", + "handle_links": "preferred", "display": "standalone", "background_color": "#1a1a27", "theme_color": "#7e6fff", diff --git a/PlaylistShared.Pwa/wwwroot/service-worker.published.js b/PlaylistShared.Pwa/wwwroot/service-worker.published.js index f540621..9c2fe50 100644 --- a/PlaylistShared.Pwa/wwwroot/service-worker.published.js +++ b/PlaylistShared.Pwa/wwwroot/service-worker.published.js @@ -17,8 +17,6 @@ const baseUrl = new URL(base, self.origin); const manifestUrlList = self.assetsManifest.assets.map(asset => new URL(asset.url, baseUrl).href); async function onInstall(event) { - console.info('Service worker: Install'); - self.skipWaiting(); // Fetch and cache all matching items from the assets manifest @@ -30,8 +28,6 @@ async function onInstall(event) { } async function onActivate(event) { - console.info('Service worker: Activate'); - await self.clients.claim(); // Delete unused caches