aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-31 10:07:38 +0100
committerChocobozzz <me@florianbigard.com>2022-01-31 10:07:38 +0100
commit228d8e8e47e913fc6487a917d43a59070aefa0ab (patch)
treed19b21565d4d60d57ffd06a3d5751d04f0263a33 /server/controllers
parentebe4b3df5c4e595f3fcf92b8ecf6c5174b13b3b0 (diff)
downloadPeerTube-228d8e8e47e913fc6487a917d43a59070aefa0ab.tar.gz
PeerTube-228d8e8e47e913fc6487a917d43a59070aefa0ab.tar.zst
PeerTube-228d8e8e47e913fc6487a917d43a59070aefa0ab.zip
Convert markdown to html/plain text for feeds
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/feeds.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts
index 29502a154..3c8680ca4 100644
--- a/server/controllers/feeds.ts
+++ b/server/controllers/feeds.ts
@@ -1,5 +1,6 @@
1import express from 'express' 1import express from 'express'
2import Feed from 'pfeed' 2import Feed from 'pfeed'
3import { mdToPlainText, toSafeHtml } from '@server/helpers/markdown'
3import { getServerActor } from '@server/models/application/application' 4import { getServerActor } from '@server/models/application/application'
4import { getCategoryLabel } from '@server/models/video/formatter/video-format-utils' 5import { getCategoryLabel } from '@server/models/video/formatter/video-format-utils'
5import { VideoInclude } from '@shared/models' 6import { VideoInclude } from '@shared/models'
@@ -119,7 +120,7 @@ async function generateVideoCommentsFeed (req: express.Request, res: express.Res
119 title, 120 title,
120 id: comment.url, 121 id: comment.url,
121 link, 122 link,
122 content: comment.text, 123 content: toSafeHtml(comment.text),
123 author, 124 author,
124 date: comment.createdAt 125 date: comment.createdAt
125 }) 126 })
@@ -235,7 +236,7 @@ function initFeed (parameters: {
235 236
236 return new Feed({ 237 return new Feed({
237 title: name, 238 title: name,
238 description, 239 description: mdToPlainText(description),
239 // updated: TODO: somehowGetLatestUpdate, // optional, default = today 240 // updated: TODO: somehowGetLatestUpdate, // optional, default = today
240 id: webserverUrl, 241 id: webserverUrl,
241 link: webserverUrl, 242 link: webserverUrl,
@@ -298,8 +299,8 @@ function addVideosToFeed (feed, videos: VideoModel[]) {
298 title: video.name, 299 title: video.name,
299 id: video.url, 300 id: video.url,
300 link: WEBSERVER.URL + video.getWatchStaticPath(), 301 link: WEBSERVER.URL + video.getWatchStaticPath(),
301 description: video.getTruncatedDescription(), 302 description: mdToPlainText(video.getTruncatedDescription()),
302 content: video.description, 303 content: toSafeHtml(video.description),
303 author: [ 304 author: [
304 { 305 {
305 name: video.VideoChannel.Account.getDisplayName(), 306 name: video.VideoChannel.Account.getDisplayName(),