diff options
author | Chocobozzz <me@florianbigard.com> | 2022-02-22 11:14:34 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-02-22 11:16:29 +0100 |
commit | bdb54e6f8c82b1dc95e41a43bf0a8d1082139309 (patch) | |
tree | f71251830ca63c0225125a76f5b5b66242b485ee /server | |
parent | ebee0c0427800e74800e21fd0e1d7550f7130270 (diff) | |
download | PeerTube-bdb54e6f8c82b1dc95e41a43bf0a8d1082139309.tar.gz PeerTube-bdb54e6f8c82b1dc95e41a43bf0a8d1082139309.tar.zst PeerTube-bdb54e6f8c82b1dc95e41a43bf0a8d1082139309.zip |
Use local URL for feed guid
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/feeds.ts | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index 90faaf024..c929a6726 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts | |||
@@ -104,7 +104,7 @@ async function generateVideoCommentsFeed (req: express.Request, res: express.Res | |||
104 | 104 | ||
105 | // Adding video items to the feed, one at a time | 105 | // Adding video items to the feed, one at a time |
106 | for (const comment of comments) { | 106 | for (const comment of comments) { |
107 | const link = WEBSERVER.URL + comment.getCommentStaticPath() | 107 | const localLink = WEBSERVER.URL + comment.getCommentStaticPath() |
108 | 108 | ||
109 | let title = comment.Video.name | 109 | let title = comment.Video.name |
110 | const author: { name: string, link: string }[] = [] | 110 | const author: { name: string, link: string }[] = [] |
@@ -119,8 +119,8 @@ async function generateVideoCommentsFeed (req: express.Request, res: express.Res | |||
119 | 119 | ||
120 | feed.addItem({ | 120 | feed.addItem({ |
121 | title, | 121 | title, |
122 | id: comment.url, | 122 | id: localLink, |
123 | link, | 123 | link: localLink, |
124 | content: toSafeHtml(comment.text), | 124 | content: toSafeHtml(comment.text), |
125 | author, | 125 | author, |
126 | date: comment.createdAt | 126 | date: comment.createdAt |
@@ -269,7 +269,7 @@ function addVideosToFeed (feed: Feed, videos: VideoModel[]) { | |||
269 | size_in_bytes: videoFile.size | 269 | size_in_bytes: videoFile.size |
270 | })) | 270 | })) |
271 | 271 | ||
272 | const videos = formattedVideoFiles.map(videoFile => { | 272 | const videoFiles = formattedVideoFiles.map(videoFile => { |
273 | const result = { | 273 | const result = { |
274 | type: MIMETYPES.VIDEO.EXT_MIMETYPE[extname(videoFile.fileUrl)], | 274 | type: MIMETYPES.VIDEO.EXT_MIMETYPE[extname(videoFile.fileUrl)], |
275 | medium: 'video', | 275 | medium: 'video', |
@@ -293,10 +293,12 @@ function addVideosToFeed (feed: Feed, videos: VideoModel[]) { | |||
293 | }) | 293 | }) |
294 | } | 294 | } |
295 | 295 | ||
296 | const localLink = WEBSERVER.URL + video.getWatchStaticPath() | ||
297 | |||
296 | feed.addItem({ | 298 | feed.addItem({ |
297 | title: video.name, | 299 | title: video.name, |
298 | id: video.url, | 300 | id: localLink, |
299 | link: WEBSERVER.URL + video.getWatchStaticPath(), | 301 | link: localLink, |
300 | description: mdToOneLinePlainText(video.getTruncatedDescription()), | 302 | description: mdToOneLinePlainText(video.getTruncatedDescription()), |
301 | content: toSafeHtml(video.description), | 303 | content: toSafeHtml(video.description), |
302 | author: [ | 304 | author: [ |
@@ -311,20 +313,20 @@ function addVideosToFeed (feed: Feed, videos: VideoModel[]) { | |||
311 | 313 | ||
312 | // Enclosure | 314 | // Enclosure |
313 | video: { | 315 | video: { |
314 | url: videos[0].url, | 316 | url: videoFiles[0].url, |
315 | length: videos[0].fileSize, | 317 | length: videoFiles[0].fileSize, |
316 | type: videos[0].type | 318 | type: videoFiles[0].type |
317 | }, | 319 | }, |
318 | 320 | ||
319 | // Media RSS | 321 | // Media RSS |
320 | videos, | 322 | videos: videoFiles, |
321 | 323 | ||
322 | embed: { | 324 | embed: { |
323 | url: video.getEmbedStaticPath(), | 325 | url: WEBSERVER.URL + video.getEmbedStaticPath(), |
324 | allowFullscreen: true | 326 | allowFullscreen: true |
325 | }, | 327 | }, |
326 | player: { | 328 | player: { |
327 | url: video.getWatchStaticPath() | 329 | url: WEBSERVER.URL + video.getWatchStaticPath() |
328 | }, | 330 | }, |
329 | categories, | 331 | categories, |
330 | community: { | 332 | community: { |