]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/app.module.ts
Fix filters error in console
[github/Chocobozzz/PeerTube.git] / client / src / app / app.module.ts
... / ...
CommitLineData
1import 'focus-visible'
2import { tap } from 'rxjs/operators'
3import { environment } from 'src/environments/environment'
4import { APP_BASE_HREF, registerLocaleData } from '@angular/common'
5import { APP_INITIALIZER, NgModule } from '@angular/core'
6import { BrowserModule } from '@angular/platform-browser'
7import { ServiceWorkerModule } from '@angular/service-worker'
8import localeOc from '@app/helpers/locales/oc'
9import { AppRoutingModule } from './app-routing.module'
10import { AppComponent } from './app.component'
11import { CoreModule, PluginService, ServerService } from './core'
12import { EmptyComponent } from './empty.component'
13import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header'
14import { HighlightPipe } from './header/highlight.pipe'
15import { LanguageChooserComponent, MenuComponent, NotificationComponent } from './menu'
16import { ConfirmComponent } from './modal/confirm.component'
17import { CustomModalComponent } from './modal/custom-modal.component'
18import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component'
19import { QuickSettingsModalComponent } from './modal/quick-settings-modal.component'
20import { AdminWelcomeModalComponent } from './modal/admin-welcome-modal.component'
21import { AccountSetupWarningModalComponent } from './modal/account-setup-warning-modal.component'
22import { SharedActorImageModule } from './shared/shared-actor-image/shared-actor-image.module'
23import { SharedFormModule } from './shared/shared-forms'
24import { SharedGlobalIconModule } from './shared/shared-icons'
25import { SharedInstanceModule } from './shared/shared-instance'
26import { SharedMainModule } from './shared/shared-main'
27import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings'
28
29registerLocaleData(localeOc, 'oc')
30
31export function loadConfigFactory (server: ServerService, pluginService: PluginService) {
32 return () => {
33 const result = server.loadHTMLConfig()
34
35 if (result) return result.pipe(tap(() => pluginService.initializePlugins()))
36
37 return pluginService.initializePlugins()
38 }
39}
40
41@NgModule({
42 bootstrap: [ AppComponent ],
43
44 declarations: [
45 AppComponent,
46 EmptyComponent,
47
48 MenuComponent,
49 LanguageChooserComponent,
50 QuickSettingsModalComponent,
51 NotificationComponent,
52 HeaderComponent,
53 SearchTypeaheadComponent,
54 SuggestionComponent,
55 HighlightPipe,
56
57 AccountSetupWarningModalComponent,
58 CustomModalComponent,
59 AdminWelcomeModalComponent,
60 InstanceConfigWarningModalComponent,
61 ConfirmComponent
62 ],
63
64 imports: [
65 BrowserModule,
66 ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
67
68 CoreModule,
69 SharedMainModule,
70 SharedFormModule,
71 SharedUserInterfaceSettingsModule,
72 SharedGlobalIconModule,
73 SharedInstanceModule,
74 SharedActorImageModule,
75
76 AppRoutingModule // Put it after all the module because it has the 404 route
77 ],
78
79 providers: [
80 {
81 provide: APP_BASE_HREF,
82 useValue: '/'
83 },
84 {
85 provide: APP_INITIALIZER,
86 useFactory: loadConfigFactory,
87 deps: [ ServerService, PluginService ],
88 multi: true
89 }
90 ]
91})
92export class AppModule {}