Support rel="me" links in markdown
authorChocobozzz <me@florianbigard.com>
Thu, 16 Apr 2020 14:12:10 +0000 (16:12 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 16 Apr 2020 14:13:28 +0000 (16:13 +0200)
client/src/app/+admin/config/shared/batch-domains-validators.service.ts
client/src/app/core/plugins/plugin.service.ts
client/src/app/shared/renderer/html-renderer.service.ts

index 154ef3a23ae3cd31170a5d9769cf3a79251a4b6a..46fa6514d71f91ed1ea8b43c312df13ba01daaf8 100644 (file)
@@ -1,7 +1,7 @@
 import { I18n } from '@ngx-translate/i18n-polyfill'
 import { Validators, ValidatorFn } from '@angular/forms'
 import { Injectable } from '@angular/core'
-import { BuildFormValidator, validateHost } from '@app/shared'
+import { BuildFormValidator, validateHost } from '@app/shared/forms/form-validators'
 
 @Injectable()
 export class BatchDomainsValidatorsService {
index b4ed56cbe4723b4dbbdfdf97ff3bbc6aa73000fb..039fd6ff1ee8108f6a955a223afad790b7b0c8c6 100644 (file)
@@ -12,7 +12,8 @@ import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plu
 import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type'
 import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model'
 import { HttpClient } from '@angular/common/http'
-import { AuthService, Notifier } from '@app/core'
+import { AuthService } from '@app/core/auth'
+import { Notifier } from '@app/core/notification'
 import { RestExtractor } from '@app/shared/rest'
 import { PluginType } from '@shared/models/plugins/plugin.type'
 import { PublicServerSetting } from '@shared/models/plugins/public-server.setting'
index 94a8aa4c655742aa929350f4647e75189cfab6ce..1ddd8fe2f9e185fa664ac1c808905ffe0804fb47 100644 (file)
@@ -19,15 +19,18 @@ export class HtmlRendererService {
       allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ],
       allowedSchemes: [ 'http', 'https' ],
       allowedAttributes: {
-        'a': [ 'href', 'class', 'target' ]
+        '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: 'noopener noreferrer'
+              rel
             })
           }
         }