aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+accounts/account-video-channels/account-video-channels.component.ts6
-rw-r--r--client/src/app/+accounts/accounts.component.ts6
-rw-r--r--client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts2
-rw-r--r--client/src/app/+admin/overview/comments/video-comment-list.component.ts2
-rw-r--r--client/src/app/+video-channels/video-channels.component.ts13
-rw-r--r--client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts2
-rw-r--r--client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts2
-rw-r--r--client/src/app/app.component.ts2
-rw-r--r--client/src/app/core/plugins/plugin.service.ts4
-rw-r--r--client/src/app/core/renderer/markdown.service.ts27
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts6
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup.service.ts2
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts6
-rw-r--r--client/src/app/shared/shared-forms/markdown-textarea.component.ts4
-rw-r--r--client/src/app/shared/shared-instance/instance.service.ts2
-rw-r--r--client/src/app/shared/shared-support-modal/support-modal.component.ts2
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts2
17 files changed, 64 insertions, 26 deletions
diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
index 457a432fe..59814a93d 100644
--- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
+++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
@@ -105,7 +105,11 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
105 }) 105 })
106 ) 106 )
107 .subscribe(async ({ videoChannel, videos, total }) => { 107 .subscribe(async ({ videoChannel, videos, total }) => {
108 this.channelsDescriptionHTML[videoChannel.id] = await this.markdown.textMarkdownToHTML(videoChannel.description) 108 this.channelsDescriptionHTML[videoChannel.id] = await this.markdown.textMarkdownToHTML({
109 markdown: videoChannel.description,
110 withEmoji: true,
111 withHtml: true
112 })
109 113
110 this.videoChannels.push(videoChannel) 114 this.videoChannels.push(videoChannel)
111 115
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts
index cf66b817a..0033fbf59 100644
--- a/client/src/app/+accounts/accounts.component.ts
+++ b/client/src/app/+accounts/accounts.component.ts
@@ -142,7 +142,11 @@ export class AccountsComponent implements OnInit, OnDestroy {
142 } 142 }
143 143
144 private async onAccount (account: Account) { 144 private async onAccount (account: Account) {
145 this.accountDescriptionHTML = await this.markdown.textMarkdownToHTML(account.description) 145 this.accountDescriptionHTML = await this.markdown.textMarkdownToHTML({
146 markdown: account.description,
147 withEmoji: true,
148 withHtml: true
149 })
146 150
147 // After the markdown renderer to avoid layout changes 151 // After the markdown renderer to avoid layout changes
148 this.account = account 152 this.account = account
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
index 911d2418e..efd99e52b 100644
--- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
+++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
@@ -127,7 +127,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
127 } 127 }
128 128
129 toHtml (text: string) { 129 toHtml (text: string) {
130 return this.markdownRenderer.textMarkdownToHTML(text) 130 return this.markdownRenderer.textMarkdownToHTML({ markdown: text })
131 } 131 }
132 132
133 async unblockVideo (entry: VideoBlacklist) { 133 async unblockVideo (entry: VideoBlacklist) {
diff --git a/client/src/app/+admin/overview/comments/video-comment-list.component.ts b/client/src/app/+admin/overview/comments/video-comment-list.component.ts
index cfe40b92a..c95d2ffeb 100644
--- a/client/src/app/+admin/overview/comments/video-comment-list.component.ts
+++ b/client/src/app/+admin/overview/comments/video-comment-list.component.ts
@@ -115,7 +115,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit {
115 } 115 }
116 116
117 toHtml (text: string) { 117 toHtml (text: string) {
118 return this.markdownRenderer.textMarkdownToHTML(text, true, true) 118 return this.markdownRenderer.textMarkdownToHTML({ markdown: text, withHtml: true, withEmoji: true })
119 } 119 }
120 120
121 isInSelectionMode () { 121 isInSelectionMode () {
diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts
index c5bcdffe2..afbf96032 100644
--- a/client/src/app/+video-channels/video-channels.component.ts
+++ b/client/src/app/+video-channels/video-channels.component.ts
@@ -56,8 +56,17 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
56 ])) 56 ]))
57 ) 57 )
58 .subscribe(async videoChannel => { 58 .subscribe(async videoChannel => {
59 this.channelDescriptionHTML = await this.markdown.textMarkdownToHTML(videoChannel.description) 59 this.channelDescriptionHTML = await this.markdown.textMarkdownToHTML({
60 this.ownerDescriptionHTML = await this.markdown.textMarkdownToHTML(videoChannel.ownerAccount.description) 60 markdown: videoChannel.description,
61 withEmoji: true,
62 withHtml: true
63 })
64
65 this.ownerDescriptionHTML = await this.markdown.textMarkdownToHTML({
66 markdown: videoChannel.ownerAccount.description,
67 withEmoji: true,
68 withHtml: true
69 })
61 70
62 // After the markdown renderer to avoid layout changes 71 // After the markdown renderer to avoid layout changes
63 this.videoChannel = videoChannel 72 this.videoChannel = videoChannel
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts
index cabea7551..191ec4a28 100644
--- a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts
+++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts
@@ -160,7 +160,7 @@ export class VideoCommentComponent implements OnInit, OnChanges {
160 private async init () { 160 private async init () {
161 // Before HTML rendering restore line feed for markdown list compatibility 161 // Before HTML rendering restore line feed for markdown list compatibility
162 const commentText = this.comment.text.replace(/<br.?\/?>/g, '\r\n') 162 const commentText = this.comment.text.replace(/<br.?\/?>/g, '\r\n')
163 const html = await this.markdownService.textMarkdownToHTML(commentText, true, true) 163 const html = await this.markdownService.textMarkdownToHTML({ markdown: commentText, withHtml: true, withEmoji: true })
164 this.sanitizedCommentHTML = this.markdownService.processVideoTimestamps(this.video.shortUUID, html) 164 this.sanitizedCommentHTML = this.markdownService.processVideoTimestamps(this.video.shortUUID, html)
165 this.newParentComments = this.parentComments.concat([ this.comment ]) 165 this.newParentComments = this.parentComments.concat([ this.comment ])
166 166
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts
index b5444facb..72b09a274 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts
@@ -80,7 +80,7 @@ export class VideoDescriptionComponent implements OnChanges {
80 } 80 }
81 81
82 private async setVideoDescriptionHTML () { 82 private async setVideoDescriptionHTML () {
83 const html = await this.markdownService.textMarkdownToHTML(this.video.description) 83 const html = await this.markdownService.textMarkdownToHTML({ markdown: this.video.description })
84 84
85 this.videoHTMLDescription = this.markdownService.processVideoTimestamps(this.video.shortUUID, html) 85 this.videoHTMLDescription = this.markdownService.processVideoTimestamps(this.video.shortUUID, html)
86 } 86 }
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index f2488aa59..e621ce432 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -206,7 +206,7 @@ export class AppComponent implements OnInit, AfterViewInit {
206 } 206 }
207 207
208 this.broadcastMessage = { 208 this.broadcastMessage = {
209 message: await this.markdownService.unsafeMarkdownToHTML(messageConfig.message, true), 209 message: await this.markdownService.markdownToUnsafeHTML({ markdown: messageConfig.message }),
210 dismissable: messageConfig.dismissable, 210 dismissable: messageConfig.dismissable,
211 class: classes[messageConfig.level] 211 class: classes[messageConfig.level]
212 } 212 }
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 1e79cbf79..bd8c61d9a 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -259,11 +259,11 @@ export class PluginService implements ClientHook {
259 259
260 markdownRenderer: { 260 markdownRenderer: {
261 textMarkdownToHTML: (textMarkdown: string) => { 261 textMarkdownToHTML: (textMarkdown: string) => {
262 return this.markdownRenderer.textMarkdownToHTML(textMarkdown) 262 return this.markdownRenderer.textMarkdownToHTML({ markdown: textMarkdown })
263 }, 263 },
264 264
265 enhancedMarkdownToHTML: (enhancedMarkdown: string) => { 265 enhancedMarkdownToHTML: (enhancedMarkdown: string) => {
266 return this.markdownRenderer.enhancedMarkdownToHTML(enhancedMarkdown) 266 return this.markdownRenderer.enhancedMarkdownToHTML({ markdown: enhancedMarkdown })
267 } 267 }
268 }, 268 },
269 269
diff --git a/client/src/app/core/renderer/markdown.service.ts b/client/src/app/core/renderer/markdown.service.ts
index 42e8c4a88..a5fd72862 100644
--- a/client/src/app/core/renderer/markdown.service.ts
+++ b/client/src/app/core/renderer/markdown.service.ts
@@ -62,23 +62,40 @@ export class MarkdownService {
62 62
63 constructor (private htmlRenderer: HtmlRendererService) {} 63 constructor (private htmlRenderer: HtmlRendererService) {}
64 64
65 textMarkdownToHTML (markdown: string, withHtml = false, withEmoji = false) { 65 textMarkdownToHTML (options: {
66 markdown: string
67 withHtml?: boolean
68 withEmoji?: boolean
69 }) {
70 const { markdown, withHtml = false, withEmoji = false } = options
71
66 if (withHtml) return this.render({ name: 'textWithHTMLMarkdownIt', markdown, withEmoji }) 72 if (withHtml) return this.render({ name: 'textWithHTMLMarkdownIt', markdown, withEmoji })
67 73
68 return this.render({ name: 'textMarkdownIt', markdown, withEmoji }) 74 return this.render({ name: 'textMarkdownIt', markdown, withEmoji })
69 } 75 }
70 76
71 enhancedMarkdownToHTML (markdown: string, withHtml = false, withEmoji = false) { 77 enhancedMarkdownToHTML (options: {
78 markdown: string
79 withHtml?: boolean
80 withEmoji?: boolean
81 }) {
82 const { markdown, withHtml = false, withEmoji = false } = options
83
72 if (withHtml) return this.render({ name: 'enhancedWithHTMLMarkdownIt', markdown, withEmoji }) 84 if (withHtml) return this.render({ name: 'enhancedWithHTMLMarkdownIt', markdown, withEmoji })
73 85
74 return this.render({ name: 'enhancedMarkdownIt', markdown, withEmoji }) 86 return this.render({ name: 'enhancedMarkdownIt', markdown, withEmoji })
75 } 87 }
76 88
77 unsafeMarkdownToHTML (markdown: string, _trustedInput: true) { 89 markdownToUnsafeHTML (options: { markdown: string }) {
78 return this.render({ name: 'unsafeMarkdownIt', markdown, withEmoji: true }) 90 return this.render({ name: 'unsafeMarkdownIt', markdown: options.markdown, withEmoji: true })
79 } 91 }
80 92
81 customPageMarkdownToHTML (markdown: string, additionalAllowedTags: string[]) { 93 customPageMarkdownToHTML (options: {
94 markdown: string
95 additionalAllowedTags: string[]
96 }) {
97 const { markdown, additionalAllowedTags } = options
98
82 return this.render({ name: 'customPageMarkdownIt', markdown, withEmoji: true, additionalAllowedTags }) 99 return this.render({ name: 'customPageMarkdownIt', markdown, withEmoji: true, additionalAllowedTags })
83 } 100 }
84 101
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
index a3a71ae20..569a37b17 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
+++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
@@ -214,8 +214,8 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
214 abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment` 214 abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment`
215 } else { 215 } else {
216 const truncated = truncate(abuse.comment.text, { length: 100 }) 216 const truncated = truncate(abuse.comment.text, { length: 100 })
217 abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true) 217 abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML({ markdown: truncated, withHtml: true })
218 abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML(abuse.comment.text, true) 218 abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML({ markdown: abuse.comment.text, withHtml: true })
219 } 219 }
220 } 220 }
221 221
@@ -451,6 +451,6 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
451 } 451 }
452 452
453 private toHtml (text: string) { 453 private toHtml (text: string) {
454 return this.markdownRenderer.textMarkdownToHTML(text) 454 return this.markdownRenderer.textMarkdownToHTML({ markdown: text })
455 } 455 }
456} 456}
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
index d738a644e..618c3dd4f 100644
--- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
+++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
@@ -58,7 +58,7 @@ export class CustomMarkupService {
58 } 58 }
59 59
60 async buildElement (text: string) { 60 async buildElement (text: string) {
61 const html = await this.markdown.customPageMarkdownToHTML(text, this.getSupportedTags()) 61 const html = await this.markdown.customPageMarkdownToHTML({ markdown: text, additionalAllowedTags: this.getSupportedTags() })
62 62
63 const rootElement = document.createElement('div') 63 const rootElement = document.createElement('div')
64 rootElement.innerHTML = html 64 rootElement.innerHTML = html
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
index e9c466a90..ba12b7139 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
@@ -42,7 +42,11 @@ export class ChannelMiniatureMarkupComponent implements CustomMarkupComponent, O
42 tap(channel => { 42 tap(channel => {
43 this.channel = channel 43 this.channel = channel
44 }), 44 }),
45 switchMap(() => from(this.markdown.textMarkdownToHTML(this.channel.description))), 45 switchMap(() => from(this.markdown.textMarkdownToHTML({
46 markdown: this.channel.description,
47 withEmoji: true,
48 withHtml: true
49 }))),
46 tap(html => { 50 tap(html => {
47 this.descriptionHTML = html 51 this.descriptionHTML = html
48 }), 52 }),
diff --git a/client/src/app/shared/shared-forms/markdown-textarea.component.ts b/client/src/app/shared/shared-forms/markdown-textarea.component.ts
index 089991884..e3371f22c 100644
--- a/client/src/app/shared/shared-forms/markdown-textarea.component.ts
+++ b/client/src/app/shared/shared-forms/markdown-textarea.component.ts
@@ -144,9 +144,9 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
144 144
145 html = result 145 html = result
146 } else if (this.markdownType === 'text') { 146 } else if (this.markdownType === 'text') {
147 html = await this.markdownService.textMarkdownToHTML(text) 147 html = await this.markdownService.textMarkdownToHTML({ markdown: text })
148 } else { 148 } else {
149 html = await this.markdownService.enhancedMarkdownToHTML(text) 149 html = await this.markdownService.enhancedMarkdownToHTML({ markdown: text })
150 } 150 }
151 151
152 if (this.markdownVideo) { 152 if (this.markdownVideo) {
diff --git a/client/src/app/shared/shared-instance/instance.service.ts b/client/src/app/shared/shared-instance/instance.service.ts
index 0241f56ef..89f47db24 100644
--- a/client/src/app/shared/shared-instance/instance.service.ts
+++ b/client/src/app/shared/shared-instance/instance.service.ts
@@ -51,7 +51,7 @@ export class InstanceService {
51 } 51 }
52 52
53 for (const key of Object.keys(html)) { 53 for (const key of Object.keys(html)) {
54 html[key] = await this.markdownService.textMarkdownToHTML(about.instance[key]) 54 html[key] = await this.markdownService.textMarkdownToHTML({ markdown: about.instance[key] })
55 } 55 }
56 56
57 return html 57 return html
diff --git a/client/src/app/shared/shared-support-modal/support-modal.component.ts b/client/src/app/shared/shared-support-modal/support-modal.component.ts
index 08e997f7b..f330228e1 100644
--- a/client/src/app/shared/shared-support-modal/support-modal.component.ts
+++ b/client/src/app/shared/shared-support-modal/support-modal.component.ts
@@ -27,7 +27,7 @@ export class SupportModalComponent {
27 27
28 const support = this.video?.support || this.videoChannel.support 28 const support = this.video?.support || this.videoChannel.support
29 29
30 this.markdownService.enhancedMarkdownToHTML(support) 30 this.markdownService.enhancedMarkdownToHTML({ markdown: support })
31 .then(r => { 31 .then(r => {
32 this.htmlSupport = r 32 this.htmlSupport = r
33 }) 33 })
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
index dd9fe0a5a..225c4eb64 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
@@ -32,7 +32,7 @@ export class VideoPlaylistMiniatureComponent implements OnInit {
32 async ngOnInit () { 32 async ngOnInit () {
33 this.buildPlaylistUrl() 33 this.buildPlaylistUrl()
34 if (this.displayDescription) { 34 if (this.displayDescription) {
35 this.playlistDescription = await this.markdownService.textMarkdownToHTML(this.playlist.description) 35 this.playlistDescription = await this.markdownService.textMarkdownToHTML({ markdown: this.playlist.description })
36 } 36 }
37 } 37 }
38 38