diff --git a/angular.json b/angular.json index 2b87fa8..74780b2 100644 --- a/angular.json +++ b/angular.json @@ -62,7 +62,8 @@ "maximumError": "8kB" } ], - "outputHashing": "all" + "outputHashing": "all", + "serviceWorker": "ngsw-config.json" }, "development": { "optimization": false, @@ -137,5 +138,8 @@ "@schematics/angular:resolver": { "typeSeparator": "." } + }, + "cli": { + "analytics": false } } \ No newline at end of file diff --git a/ngsw-config.json b/ngsw-config.json new file mode 100644 index 0000000..69edd28 --- /dev/null +++ b/ngsw-config.json @@ -0,0 +1,30 @@ +{ + "$schema": "./node_modules/@angular/service-worker/config/schema.json", + "index": "/index.html", + "assetGroups": [ + { + "name": "app", + "installMode": "prefetch", + "resources": { + "files": [ + "/favicon.ico", + "/index.csr.html", + "/index.html", + "/manifest.webmanifest", + "/*.css", + "/*.js" + ] + } + }, + { + "name": "assets", + "installMode": "lazy", + "updateMode": "prefetch", + "resources": { + "files": [ + "/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)" + ] + } + } + ] +} diff --git a/package-lock.json b/package-lock.json index 563b8bb..c4ba828 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "@angular/platform-browser": "^20.0.2", "@angular/platform-browser-dynamic": "^20.0.2", "@angular/router": "^20.0.2", + "@angular/service-worker": "^20.0.2", "ngx-markdown": "^20.0.0", "ngx-toastr": "^19.0.0", "prismjs": "^1.30.0", @@ -605,6 +606,25 @@ "rxjs": "^6.5.3 || ^7.4.0" } }, + "node_modules/@angular/service-worker": { + "version": "20.0.2", + "resolved": "https://registry.npmjs.org/@angular/service-worker/-/service-worker-20.0.2.tgz", + "integrity": "sha512-3Kg4wFX0WjeTH7rEQurbNgcf1e4wTIie6au5/Q3ktqfYpKVa9p6d4Zqd8vJw5VqmTXnV09ZMB3czQQz2RvfBxA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.3.0" + }, + "bin": { + "ngsw-config": "ngsw-config.js" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@angular/core": "20.0.2", + "rxjs": "^6.5.3 || ^7.4.0" + } + }, "node_modules/@antfu/install-pkg": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@antfu/install-pkg/-/install-pkg-1.1.0.tgz", diff --git a/package.json b/package.json index 94de199..66208ff 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@angular/platform-browser": "^20.0.2", "@angular/platform-browser-dynamic": "^20.0.2", "@angular/router": "^20.0.2", + "@angular/service-worker": "^20.0.2", "ngx-markdown": "^20.0.0", "ngx-toastr": "^19.0.0", "prismjs": "^1.30.0", @@ -40,4 +41,4 @@ "karma-jasmine-html-reporter": "~2.1.0", "typescript": "~5.8.3" } -} +} \ No newline at end of file diff --git a/public/icons/icon-128x128.png b/public/icons/icon-128x128.png new file mode 100644 index 0000000..5a9a2cc Binary files /dev/null and b/public/icons/icon-128x128.png differ diff --git a/public/icons/icon-144x144.png b/public/icons/icon-144x144.png new file mode 100644 index 0000000..11702cd Binary files /dev/null and b/public/icons/icon-144x144.png differ diff --git a/public/icons/icon-152x152.png b/public/icons/icon-152x152.png new file mode 100644 index 0000000..ff4e06b Binary files /dev/null and b/public/icons/icon-152x152.png differ diff --git a/public/icons/icon-192x192.png b/public/icons/icon-192x192.png new file mode 100644 index 0000000..afd36a4 Binary files /dev/null and b/public/icons/icon-192x192.png differ diff --git a/public/icons/icon-384x384.png b/public/icons/icon-384x384.png new file mode 100644 index 0000000..613ac79 Binary files /dev/null and b/public/icons/icon-384x384.png differ diff --git a/public/icons/icon-512x512.png b/public/icons/icon-512x512.png new file mode 100644 index 0000000..7574990 Binary files /dev/null and b/public/icons/icon-512x512.png differ diff --git a/public/icons/icon-72x72.png b/public/icons/icon-72x72.png new file mode 100644 index 0000000..033724e Binary files /dev/null and b/public/icons/icon-72x72.png differ diff --git a/public/icons/icon-96x96.png b/public/icons/icon-96x96.png new file mode 100644 index 0000000..3090dc2 Binary files /dev/null and b/public/icons/icon-96x96.png differ diff --git a/public/manifest.webmanifest b/public/manifest.webmanifest new file mode 100644 index 0000000..5532087 --- /dev/null +++ b/public/manifest.webmanifest @@ -0,0 +1,57 @@ +{ + "name": "Chat", + "short_name": "Chat", + "display": "standalone", + "scope": "./", + "start_url": "./", + "icons": [ + { + "src": "icons/icon-72x72.png", + "sizes": "72x72", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-96x96.png", + "sizes": "96x96", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-128x128.png", + "sizes": "128x128", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-144x144.png", + "sizes": "144x144", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-152x152.png", + "sizes": "152x152", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-192x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-384x384.png", + "sizes": "384x384", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-512x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable any" + } + ] +} diff --git a/src/app/app.config.ts b/src/app/app.config.ts index bd3f2c5..b1f57f4 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -1,4 +1,4 @@ -import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; +import { ApplicationConfig, provideZoneChangeDetection, isDevMode } from '@angular/core'; import { provideRouter, withInMemoryScrolling } from '@angular/router'; import { routes } from './app.routes'; @@ -6,6 +6,7 @@ import { provideHttpClient } from '@angular/common/http'; import { provideToastr } from 'ngx-toastr'; import { provideAnimations } from '@angular/platform-browser/animations'; import { provideMarkdown } from 'ngx-markdown'; +import { provideServiceWorker } from '@angular/service-worker'; export const appConfig: ApplicationConfig = { providers: [ @@ -21,6 +22,10 @@ export const appConfig: ApplicationConfig = { positionClass: 'toast-top-right', closeButton: true }), - provideMarkdown() + provideMarkdown(), + provideServiceWorker('ngsw-worker.js', { + enabled: !isDevMode(), + registrationStrategy: 'registerWhenStable:30000' + }) ] }; diff --git a/src/index.html b/src/index.html index 47e6b64..b158b13 100644 --- a/src/index.html +++ b/src/index.html @@ -1,15 +1,20 @@ +