aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-01-18 11:16:37 +0100
committerChocobozzz <me@florianbigard.com>2021-01-18 11:16:37 +0100
commit1d22d2514f7be14d51ed2ab78e13df5da2646546 (patch)
tree87ee5fde348f9b648efeff82461867ee2d1c0fb2 /client/src
parent83befebe52139f7533669b2e9b99ca1f807eb7ce (diff)
downloadPeerTube-1d22d2514f7be14d51ed2ab78e13df5da2646546.tar.gz
PeerTube-1d22d2514f7be14d51ed2ab78e13df5da2646546.tar.zst
PeerTube-1d22d2514f7be14d51ed2ab78e13df5da2646546.zip
Fix service worker
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/app.module.ts5
-rw-r--r--client/src/main.ts5
-rw-r--r--client/src/manifest.webmanifest8
-rw-r--r--client/src/ngsw-config.json1
4 files changed, 9 insertions, 10 deletions
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 98dec4244..f790a6848 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -1,7 +1,9 @@
1import 'focus-visible' 1import 'focus-visible'
2import { environment } from 'src/environments/environment'
2import { APP_BASE_HREF, registerLocaleData } from '@angular/common' 3import { APP_BASE_HREF, registerLocaleData } from '@angular/common'
3import { NgModule } from '@angular/core' 4import { NgModule } from '@angular/core'
4import { BrowserModule } from '@angular/platform-browser' 5import { BrowserModule } from '@angular/platform-browser'
6import { ServiceWorkerModule } from '@angular/service-worker'
5import { ServerService } from '@app/core' 7import { ServerService } from '@app/core'
6import localeOc from '@app/helpers/locales/oc' 8import localeOc from '@app/helpers/locales/oc'
7import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' 9import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core'
@@ -11,7 +13,7 @@ import { CoreModule } from './core'
11import { EmptyComponent } from './empty.component' 13import { EmptyComponent } from './empty.component'
12import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header' 14import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header'
13import { HighlightPipe } from './header/highlight.pipe' 15import { HighlightPipe } from './header/highlight.pipe'
14import { NotificationComponent, LanguageChooserComponent, MenuComponent } from './menu' 16import { LanguageChooserComponent, MenuComponent, NotificationComponent } from './menu'
15import { ConfirmComponent } from './modal/confirm.component' 17import { ConfirmComponent } from './modal/confirm.component'
16import { CustomModalComponent } from './modal/custom-modal.component' 18import { CustomModalComponent } from './modal/custom-modal.component'
17import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component' 19import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component'
@@ -49,6 +51,7 @@ registerLocaleData(localeOc, 'oc')
49 51
50 imports: [ 52 imports: [
51 BrowserModule, 53 BrowserModule,
54 ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
52 55
53 CoreModule, 56 CoreModule,
54 SharedMainModule, 57 SharedMainModule,
diff --git a/client/src/main.ts b/client/src/main.ts
index 99976a3f7..84c82203d 100644
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -11,11 +11,6 @@ if (environment.production) {
11const bootstrap = () => platformBrowserDynamic() 11const bootstrap = () => platformBrowserDynamic()
12 .bootstrapModule(AppModule) 12 .bootstrapModule(AppModule)
13 .then(bootstrapModule => { 13 .then(bootstrapModule => {
14 if ('serviceWorker' in navigator && environment.production) {
15 navigator.serviceWorker.register('/ngsw-worker.js')
16 .catch(err => console.error('Cannot register service worker.', err))
17 }
18
19 if (!environment.production) { 14 if (!environment.production) {
20 const applicationRef = bootstrapModule.injector.get(ApplicationRef) 15 const applicationRef = bootstrapModule.injector.get(ApplicationRef)
21 const componentRef = applicationRef.components[0] 16 const componentRef = applicationRef.components[0]
diff --git a/client/src/manifest.webmanifest b/client/src/manifest.webmanifest
index 851e098a8..6e62856cd 100644
--- a/client/src/manifest.webmanifest
+++ b/client/src/manifest.webmanifest
@@ -1,4 +1,7 @@
1{ 1{
2 "name": "PeerTube",
3 "short_name": "PeerTube",
4 "start_url": "/",
2 "background_color": "#fff", 5 "background_color": "#fff",
3 "theme_color": "#fff", 6 "theme_color": "#fff",
4 "description": "A federated video streaming platform using P2P", 7 "description": "A federated video streaming platform using P2P",
@@ -40,8 +43,5 @@
40 "sizes": "512x512", 43 "sizes": "512x512",
41 "type": "image/png" 44 "type": "image/png"
42 } 45 }
43 ], 46 ]
44 "name": "PeerTube",
45 "short_name": "PeerTube",
46 "start_url": "/"
47} 47}
diff --git a/client/src/ngsw-config.json b/client/src/ngsw-config.json
index d68db79d0..af7554c00 100644
--- a/client/src/ngsw-config.json
+++ b/client/src/ngsw-config.json
@@ -1,4 +1,5 @@
1{ 1{
2 "$schema": "../node_modules/@angular/service-worker/config/schema.json",
2 "index": "/index.html", 3 "index": "/index.html",
3 "assetGroups": [ 4 "assetGroups": [
4 { 5 {