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'
29 registerLocaleData(localeOc, 'oc')
31 export function loadConfigFactory (server: ServerService, pluginService: PluginService) {
33 const result = server.loadHTMLConfig()
35 if (result) return result.pipe(tap(() => pluginService.initializePlugins()))
37 return pluginService.initializePlugins()
42 bootstrap: [ AppComponent ],
49 LanguageChooserComponent,
50 QuickSettingsModalComponent,
51 NotificationComponent,
53 SearchTypeaheadComponent,
57 AccountSetupWarningModalComponent,
59 AdminWelcomeModalComponent,
60 InstanceConfigWarningModalComponent,
66 ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
71 SharedUserInterfaceSettingsModule,
72 SharedGlobalIconModule,
74 SharedActorImageModule,
76 AppRoutingModule // Put it after all the module because it has the 404 route
81 provide: APP_BASE_HREF,
85 provide: APP_INITIALIZER,
86 useFactory: loadConfigFactory,
87 deps: [ ServerService, PluginService ],
92 export class AppModule {}