]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+about/about-instance/about-instance.component.ts
Merge branch 'develop' into pr/1285
[github/Chocobozzz/PeerTube.git] / client / src / app / +about / about-instance / about-instance.component.ts
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
8 @Component({
9 selector: 'my-about-instance',
10 templateUrl: './about-instance.component.html',
11 styleUrls: [ './about-instance.component.scss' ]
12 })
13 export class AboutInstanceComponent implements OnInit {
14 @ViewChild('contactAdminModal') contactAdminModal: ContactAdminModalComponent
15
16 shortDescription = ''
17 descriptionHTML = ''
18 termsHTML = ''
19
20 constructor (
21 private notifier: Notifier,
22 private serverService: ServerService,
23 private instanceService: InstanceService,
24 private markdownService: MarkdownService,
25 private i18n: I18n
26 ) {}
27
28 get instanceName () {
29 return this.serverService.getConfig().instance.name
30 }
31
32 get userVideoQuota () {
33 return this.serverService.getConfig().user.videoQuota
34 }
35
36 get isSignupAllowed () {
37 return this.serverService.getConfig().signup.allowed
38 }
39
40 get isContactFormEnabled () {
41 return this.serverService.getConfig().email.enabled && this.serverService.getConfig().contactForm.enabled
42 }
43
44 ngOnInit () {
45 this.instanceService.getAbout()
46 .subscribe(
47 res => {
48 this.shortDescription = res.instance.shortDescription
49 this.descriptionHTML = this.markdownService.textMarkdownToHTML(res.instance.description)
50 this.termsHTML = this.markdownService.textMarkdownToHTML(res.instance.terms)
51 },
52
53 () => this.notifier.error(this.i18n('Cannot get about information from server'))
54 )
55 }
56
57 openContactModal () {
58 return this.contactAdminModal.show()
59 }
60
61 }