]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-instance/instance.service.ts
feat(about): render images in markdown (#5732)
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-instance / instance.service.ts
index ba9797bb5cd1ad4ec4422b43dda7c6733400b89e..2defffbbedbfcd9c940c2590034cbafd043ce04b 100644 (file)
@@ -3,9 +3,15 @@ import { catchError, map } from 'rxjs/operators'
 import { HttpClient } from '@angular/common/http'
 import { Injectable } from '@angular/core'
 import { MarkdownService, RestExtractor, ServerService } from '@app/core'
-import { About, peertubeTranslate } from '@shared/models'
+import { peertubeTranslate } from '@shared/core-utils/i18n'
+import { About } from '@shared/models'
 import { environment } from '../../../environments/environment'
 
+export type AboutHTML = Pick<About['instance'],
+'terms' | 'codeOfConduct' | 'moderationInformation' | 'administrator' | 'creationReason' |
+'maintenanceLifetime' | 'businessModel' | 'hardwareInformation'
+>
+
 @Injectable()
 export class InstanceService {
   private static BASE_CONFIG_URL = environment.apiUrl + '/api/v1/config'
@@ -38,17 +44,19 @@ export class InstanceService {
   }
 
   async buildHtml (about: About) {
-    const html = {
-      description: '',
+    const html: AboutHTML = {
       terms: '',
       codeOfConduct: '',
       moderationInformation: '',
       administrator: '',
+      creationReason: '',
+      maintenanceLifetime: '',
+      businessModel: '',
       hardwareInformation: ''
     }
 
     for (const key of Object.keys(html)) {
-      html[ key ] = await this.markdownService.textMarkdownToHTML(about.instance[ key ])
+      html[key] = await this.markdownService.enhancedMarkdownToHTML({ markdown: about.instance[key] })
     }
 
     return html