diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-16 16:12:10 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-04-16 16:13:28 +0200 |
commit | 891bc2ffadd5dedae316fcc80856ff859e6f8336 (patch) | |
tree | 3fb13974f119a87d6fa45b4bcb8114ac34e00afa | |
parent | 5600def4c87d3e6b7724489c9c4415778ea014d3 (diff) | |
download | PeerTube-891bc2ffadd5dedae316fcc80856ff859e6f8336.tar.gz PeerTube-891bc2ffadd5dedae316fcc80856ff859e6f8336.tar.zst PeerTube-891bc2ffadd5dedae316fcc80856ff859e6f8336.zip |
Support rel="me" links in markdown
3 files changed, 8 insertions, 4 deletions
diff --git a/client/src/app/+admin/config/shared/batch-domains-validators.service.ts b/client/src/app/+admin/config/shared/batch-domains-validators.service.ts index 154ef3a23..46fa6514d 100644 --- a/client/src/app/+admin/config/shared/batch-domains-validators.service.ts +++ b/client/src/app/+admin/config/shared/batch-domains-validators.service.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { I18n } from '@ngx-translate/i18n-polyfill' | 1 | import { I18n } from '@ngx-translate/i18n-polyfill' |
2 | import { Validators, ValidatorFn } from '@angular/forms' | 2 | import { Validators, ValidatorFn } from '@angular/forms' |
3 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { BuildFormValidator, validateHost } from '@app/shared' | 4 | import { BuildFormValidator, validateHost } from '@app/shared/forms/form-validators' |
5 | 5 | ||
6 | @Injectable() | 6 | @Injectable() |
7 | export class BatchDomainsValidatorsService { | 7 | export class BatchDomainsValidatorsService { |
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts index b4ed56cbe..039fd6ff1 100644 --- a/client/src/app/core/plugins/plugin.service.ts +++ b/client/src/app/core/plugins/plugin.service.ts | |||
@@ -12,7 +12,8 @@ import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plu | |||
12 | import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' | 12 | import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' |
13 | import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model' | 13 | import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model' |
14 | import { HttpClient } from '@angular/common/http' | 14 | import { HttpClient } from '@angular/common/http' |
15 | import { AuthService, Notifier } from '@app/core' | 15 | import { AuthService } from '@app/core/auth' |
16 | import { Notifier } from '@app/core/notification' | ||
16 | import { RestExtractor } from '@app/shared/rest' | 17 | import { RestExtractor } from '@app/shared/rest' |
17 | import { PluginType } from '@shared/models/plugins/plugin.type' | 18 | import { PluginType } from '@shared/models/plugins/plugin.type' |
18 | import { PublicServerSetting } from '@shared/models/plugins/public-server.setting' | 19 | import { PublicServerSetting } from '@shared/models/plugins/public-server.setting' |
diff --git a/client/src/app/shared/renderer/html-renderer.service.ts b/client/src/app/shared/renderer/html-renderer.service.ts index 94a8aa4c6..1ddd8fe2f 100644 --- a/client/src/app/shared/renderer/html-renderer.service.ts +++ b/client/src/app/shared/renderer/html-renderer.service.ts | |||
@@ -19,15 +19,18 @@ export class HtmlRendererService { | |||
19 | allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ], | 19 | allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ], |
20 | allowedSchemes: [ 'http', 'https' ], | 20 | allowedSchemes: [ 'http', 'https' ], |
21 | allowedAttributes: { | 21 | allowedAttributes: { |
22 | 'a': [ 'href', 'class', 'target' ] | 22 | 'a': [ 'href', 'class', 'target', 'rel' ] |
23 | }, | 23 | }, |
24 | transformTags: { | 24 | transformTags: { |
25 | a: (tagName, attribs) => { | 25 | a: (tagName, attribs) => { |
26 | let rel = 'noopener noreferrer' | ||
27 | if (attribs.rel === 'me') rel += ' me' | ||
28 | |||
26 | return { | 29 | return { |
27 | tagName, | 30 | tagName, |
28 | attribs: Object.assign(attribs, { | 31 | attribs: Object.assign(attribs, { |
29 | target: '_blank', | 32 | target: '_blank', |
30 | rel: 'noopener noreferrer' | 33 | rel |
31 | }) | 34 | }) |
32 | } | 35 | } |
33 | } | 36 | } |