aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-01-19 14:27:51 +0100
committerChocobozzz <me@florianbigard.com>2023-01-19 14:27:59 +0100
commita4927884b224e3d4d78ff5db88cbb77bbdf8ee0b (patch)
treedbac6a21be5be4fd343f24884d8b911be902a18a
parent32fde390f465b9ceef9e49c4037acdacbe176d65 (diff)
downloadPeerTube-a4927884b224e3d4d78ff5db88cbb77bbdf8ee0b.tar.gz
PeerTube-a4927884b224e3d4d78ff5db88cbb77bbdf8ee0b.tar.zst
PeerTube-a4927884b224e3d4d78ff5db88cbb77bbdf8ee0b.zip
Support mailto for custom markup
-rw-r--r--client/src/app/core/renderer/markdown.service.ts10
-rw-r--r--shared/core-utils/renderer/html.ts6
2 files changed, 11 insertions, 5 deletions
diff --git a/client/src/app/core/renderer/markdown.service.ts b/client/src/app/core/renderer/markdown.service.ts
index a5fd72862..dd23a1b01 100644
--- a/client/src/app/core/renderer/markdown.service.ts
+++ b/client/src/app/core/renderer/markdown.service.ts
@@ -64,8 +64,8 @@ export class MarkdownService {
64 64
65 textMarkdownToHTML (options: { 65 textMarkdownToHTML (options: {
66 markdown: string 66 markdown: string
67 withHtml?: boolean 67 withHtml?: boolean // default false
68 withEmoji?: boolean 68 withEmoji?: boolean // default false
69 }) { 69 }) {
70 const { markdown, withHtml = false, withEmoji = false } = options 70 const { markdown, withHtml = false, withEmoji = false } = options
71 71
@@ -76,8 +76,8 @@ export class MarkdownService {
76 76
77 enhancedMarkdownToHTML (options: { 77 enhancedMarkdownToHTML (options: {
78 markdown: string 78 markdown: string
79 withHtml?: boolean 79 withHtml?: boolean // default false
80 withEmoji?: boolean 80 withEmoji?: boolean // default false
81 }) { 81 }) {
82 const { markdown, withHtml = false, withEmoji = false } = options 82 const { markdown, withHtml = false, withEmoji = false } = options
83 83
@@ -99,6 +99,8 @@ export class MarkdownService {
99 return this.render({ name: 'customPageMarkdownIt', markdown, withEmoji: true, additionalAllowedTags }) 99 return this.render({ name: 'customPageMarkdownIt', markdown, withEmoji: true, additionalAllowedTags })
100 } 100 }
101 101
102 // ---------------------------------------------------------------------------
103
102 processVideoTimestamps (videoShortUUID: string, html: string) { 104 processVideoTimestamps (videoShortUUID: string, html: string) {
103 return html.replace(/((\d{1,2}):)?(\d{1,2}):(\d{1,2})/g, function (str, _, h, m, s) { 105 return html.replace(/((\d{1,2}):)?(\d{1,2}):(\d{1,2})/g, function (str, _, h, m, s) {
104 const t = (3600 * +(h || 0)) + (60 * +(m || 0)) + (+(s || 0)) 106 const t = (3600 * +(h || 0)) + (60 * +(m || 0)) + (+(s || 0))
diff --git a/shared/core-utils/renderer/html.ts b/shared/core-utils/renderer/html.ts
index 502308979..877f2ec55 100644
--- a/shared/core-utils/renderer/html.ts
+++ b/shared/core-utils/renderer/html.ts
@@ -38,7 +38,11 @@ export function getCustomMarkupSanitizeOptions (additionalAllowedTags: string[]
38 ...additionalAllowedTags, 38 ...additionalAllowedTags,
39 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' 39 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img'
40 ], 40 ],
41 allowedSchemes: base.allowedSchemes, 41 allowedSchemes: [
42 ...base.allowedSchemes,
43
44 'mailto'
45 ],
42 allowedAttributes: { 46 allowedAttributes: {
43 ...base.allowedAttributes, 47 ...base.allowedAttributes,
44 48