]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/app.module.ts
Translated using Weblate (Galician)
[github/Chocobozzz/PeerTube.git] / client / src / app / app.module.ts
CommitLineData
67ed6552 1import 'focus-visible'
fc21ef5c 2import { tap } from 'rxjs/operators'
1d22d251 3import { environment } from 'src/environments/environment'
67ed6552 4import { APP_BASE_HREF, registerLocaleData } from '@angular/common'
8e08d415 5import { APP_INITIALIZER, NgModule } from '@angular/core'
df98563e 6import { BrowserModule } from '@angular/platform-browser'
1d22d251 7import { ServiceWorkerModule } from '@angular/service-worker'
67ed6552 8import localeOc from '@app/helpers/locales/oc'
df98563e
C
9import { AppRoutingModule } from './app-routing.module'
10import { AppComponent } from './app.component'
fc21ef5c 11import { CoreModule, PluginService, ServerService } from './core'
f0b56fdd 12import { EmptyComponent } from './empty.component'
5fb2e288 13import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header'
1942f11d 14import { HighlightPipe } from './header/highlight.pipe'
1d22d251 15import { LanguageChooserComponent, MenuComponent, NotificationComponent } from './menu'
67ed6552
C
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'
8f581725
C
20import { AdminWelcomeModalComponent } from './modal/admin-welcome-modal.component'
21import { AccountSetupWarningModalComponent } from './modal/account-setup-warning-modal.component'
0f01a8ba 22import { SharedActorImageModule } from './shared/shared-actor-image/shared-actor-image.module'
67ed6552
C
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'
2a39506c
C
28
29registerLocaleData(localeOc, 'oc')
693b1aba 30
fc21ef5c
C
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 }
8e08d415
C
39}
40
ab32b0fc
C
41@NgModule({
42 bootstrap: [ AppComponent ],
67ed6552 43
ab32b0fc 44 declarations: [
b33f657c 45 AppComponent,
f0b56fdd 46 EmptyComponent,
b33f657c
C
47
48 MenuComponent,
8afc19a6 49 LanguageChooserComponent,
d3217560 50 QuickSettingsModalComponent,
51a83970 51 NotificationComponent,
43d0ea7f 52 HeaderComponent,
f409f0c3 53 SearchTypeaheadComponent,
6af662a5 54 SuggestionComponent,
1942f11d 55 HighlightPipe,
43d0ea7f 56
8f581725 57 AccountSetupWarningModalComponent,
437e8e06 58 CustomModalComponent,
8f581725 59 AdminWelcomeModalComponent,
67ed6552
C
60 InstanceConfigWarningModalComponent,
61 ConfirmComponent
ab32b0fc 62 ],
67ed6552 63
693b1aba 64 imports: [
ab32b0fc 65 BrowserModule,
1d22d251 66 ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
23bcf666 67
693b1aba 68 CoreModule,
67ed6552
C
69 SharedMainModule,
70 SharedFormModule,
71 SharedUserInterfaceSettingsModule,
72 SharedGlobalIconModule,
73 SharedInstanceModule,
746018f6 74 SharedActorImageModule,
693b1aba 75
a9614776 76 AppRoutingModule // Put it after all the module because it has the 404 route
ab32b0fc 77 ],
361dcebc 78
989e526a 79 providers: [
8cc56c7f
C
80 {
81 provide: APP_BASE_HREF,
82 useValue: '/'
8e08d415
C
83 },
84 {
85 provide: APP_INITIALIZER,
86 useFactory: loadConfigFactory,
fc21ef5c 87 deps: [ ServerService, PluginService ],
8e08d415 88 multi: true
fc21ef5c 89 }
989e526a 90 ]
ab32b0fc 91})
63c4db6d 92export class AppModule {}