1 import { Component, OnInit, ViewChild } from '@angular/core'
2 import { Notifier, ServerService } from '@app/core'
3 import { I18n } from '@ngx-translate/i18n-polyfill'
4 import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
5 import { InstanceService } from '@app/shared/instance/instance.service'
6 import { MarkdownService } from '@app/shared/renderer'
7 import { forkJoin } from 'rxjs'
8 import { first } from 'rxjs/operators'
11 selector: 'my-about-instance',
12 templateUrl: './about-instance.component.html',
13 styleUrls: [ './about-instance.component.scss' ]
15 export class AboutInstanceComponent implements OnInit {
16 @ViewChild('contactAdminModal', { static: true }) contactAdminModal: ContactAdminModalComponent
24 moderationInformation: '',
26 hardwareInformation: ''
30 maintenanceLifetime = ''
33 languages: string[] = []
34 categories: string[] = []
37 private notifier: Notifier,
38 private serverService: ServerService,
39 private instanceService: InstanceService,
40 private markdownService: MarkdownService,
45 return this.serverService.getConfig().instance.name
48 get isContactFormEnabled () {
49 return this.serverService.getConfig().email.enabled && this.serverService.getConfig().contactForm.enabled
53 return this.serverService.getConfig().instance.isNSFW
58 this.instanceService.getAbout(),
59 this.serverService.localeObservable.pipe(first()),
60 this.serverService.videoLanguagesLoaded.pipe(first()),
61 this.serverService.videoCategoriesLoaded.pipe(first())
63 async ([ about, translations ]) => {
64 this.shortDescription = about.instance.shortDescription
66 this.creationReason = about.instance.creationReason
67 this.maintenanceLifetime = about.instance.maintenanceLifetime
68 this.businessModel = about.instance.businessModel
70 this.html = await this.instanceService.buildHtml(about)
72 this.languages = this.instanceService.buildTranslatedLanguages(about, translations)
73 this.categories = this.instanceService.buildTranslatedCategories(about, translations)
76 () => this.notifier.error(this.i18n('Cannot get about information from server'))
81 return this.contactAdminModal.show()