X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Frenderer%2Fhtml-renderer.service.ts;h=d158519f8f973f07749b288c9f55c37e8dd7c0d8;hb=0e45e336f62a411b3c423be46d16252355c754d7;hp=3176cf6a4c21795179a9234161712a168cb8a43a;hpb=b355b394083aa4ea67a17e5c60e1d3e40f2defd9;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/core/renderer/html-renderer.service.ts b/client/src/app/core/renderer/html-renderer.service.ts index 3176cf6a4..d158519f8 100644 --- a/client/src/app/core/renderer/html-renderer.service.ts +++ b/client/src/app/core/renderer/html-renderer.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core' +import { getCustomMarkupSanitizeOptions, getDefaultSanitizeOptions } from '@shared/core-utils/renderer/html' import { LinkifierService } from './linkifier.service' -import { SANITIZE_OPTIONS } from '@shared/core-utils/renderer/html' @Injectable() export class HtmlRendererService { @@ -20,7 +20,7 @@ export class HtmlRendererService { }) } - async toSafeHtml (text: string) { + async toSafeHtml (text: string, additionalAllowedTags: string[] = []) { const [ html ] = await Promise.all([ // Convert possible markdown to html this.linkifier.linkify(text), @@ -28,7 +28,11 @@ export class HtmlRendererService { this.loadSanitizeHtml() ]) - return this.sanitizeHtml(html, SANITIZE_OPTIONS) + const options = additionalAllowedTags.length !== 0 + ? getCustomMarkupSanitizeOptions(additionalAllowedTags) + : getDefaultSanitizeOptions() + + return this.sanitizeHtml(html, options) } private async loadSanitizeHtml () {