]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/app.module.ts
Translated using Weblate (Galician)
[github/Chocobozzz/PeerTube.git] / client / src / app / app.module.ts
1 import 'focus-visible'
2 import { tap } from 'rxjs/operators'
3 import { environment } from 'src/environments/environment'
4 import { APP_BASE_HREF, registerLocaleData } from '@angular/common'
5 import { APP_INITIALIZER, NgModule } from '@angular/core'
6 import { BrowserModule } from '@angular/platform-browser'
7 import { ServiceWorkerModule } from '@angular/service-worker'
8 import localeOc from '@app/helpers/locales/oc'
9 import { AppRoutingModule } from './app-routing.module'
10 import { AppComponent } from './app.component'
11 import { CoreModule, PluginService, ServerService } from './core'
12 import { EmptyComponent } from './empty.component'
13 import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header'
14 import { HighlightPipe } from './header/highlight.pipe'
15 import { LanguageChooserComponent, MenuComponent, NotificationComponent } from './menu'
16 import { ConfirmComponent } from './modal/confirm.component'
17 import { CustomModalComponent } from './modal/custom-modal.component'
18 import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component'
19 import { QuickSettingsModalComponent } from './modal/quick-settings-modal.component'
20 import { AdminWelcomeModalComponent } from './modal/admin-welcome-modal.component'
21 import { AccountSetupWarningModalComponent } from './modal/account-setup-warning-modal.component'
22 import { SharedActorImageModule } from './shared/shared-actor-image/shared-actor-image.module'
23 import { SharedFormModule } from './shared/shared-forms'
24 import { SharedGlobalIconModule } from './shared/shared-icons'
25 import { SharedInstanceModule } from './shared/shared-instance'
26 import { SharedMainModule } from './shared/shared-main'
27 import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings'
28
29 registerLocaleData(localeOc, 'oc')
30
31 export 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 })
92 export class AppModule {}