]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/renderer/html-renderer.service.ts
Use sass instead of deprecated node sass
[github/Chocobozzz/PeerTube.git] / client / src / app / core / renderer / html-renderer.service.ts
index 302d92ed961a7e2da2a4439947f535b888353fc6..1fe91b96bf83f1ed0c9d46477eee28a876d22da9 100644 (file)
@@ -1,5 +1,6 @@
 import { Injectable } from '@angular/core'
 import { LinkifierService } from './linkifier.service'
+import { SANITIZE_OPTIONS } from '@shared/core-utils/renderer/html'
 
 @Injectable()
 export class HtmlRendererService {
@@ -25,27 +26,7 @@ export class HtmlRendererService {
     // Convert possible markdown to html
     const html = this.linkifier.linkify(text)
 
-    return this.sanitizeHtml(html, {
-      allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ],
-      allowedSchemes: [ 'http', 'https' ],
-      allowedAttributes: {
-        'a': [ 'href', 'class', 'target', 'rel' ]
-      },
-      transformTags: {
-        a: (tagName, attribs) => {
-          let rel = 'noopener noreferrer'
-          if (attribs.rel === 'me') rel += ' me'
-
-          return {
-            tagName,
-            attribs: Object.assign(attribs, {
-              target: '_blank',
-              rel
-            })
-          }
-        }
-      }
-    })
+    return this.sanitizeHtml(html, SANITIZE_OPTIONS)
   }
 
   private async loadSanitizeHtml () {