aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/feeds.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-11 11:33:44 +0200
committerChocobozzz <me@florianbigard.com>2019-04-11 13:45:39 +0200
commit6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0 (patch)
treeb47de7efb8c6c611c63a15a971c6125a278f547a /server/controllers/feeds.ts
parent2c3abc4fa796555eb7d25f416c4f41ab3e3ad8ca (diff)
downloadPeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.gz
PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.zst
PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.zip
Move config in its own file
Diffstat (limited to 'server/controllers/feeds.ts')
-rw-r--r--server/controllers/feeds.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts
index cd46b6e0f..24c41d946 100644
--- a/server/controllers/feeds.ts
+++ b/server/controllers/feeds.ts
@@ -1,5 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import { CONFIG, FEEDS, ROUTE_CACHE_LIFETIME } from '../initializers/constants' 2import { FEEDS, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
3import { THUMBNAILS_SIZE } from '../initializers' 3import { THUMBNAILS_SIZE } from '../initializers'
4import { 4import {
5 asyncMiddleware, 5 asyncMiddleware,
@@ -14,6 +14,7 @@ import * as Feed from 'pfeed'
14import { cacheRoute } from '../middlewares/cache' 14import { cacheRoute } from '../middlewares/cache'
15import { VideoCommentModel } from '../models/video/video-comment' 15import { VideoCommentModel } from '../models/video/video-comment'
16import { buildNSFWFilter } from '../helpers/express-utils' 16import { buildNSFWFilter } from '../helpers/express-utils'
17import { CONFIG } from '../initializers/config'
17 18
18const feedsRouter = express.Router() 19const feedsRouter = express.Router()
19 20
@@ -54,7 +55,7 @@ async function generateVideoCommentsFeed (req: express.Request, res: express.Res
54 55
55 // Adding video items to the feed, one at a time 56 // Adding video items to the feed, one at a time
56 comments.forEach(comment => { 57 comments.forEach(comment => {
57 const link = CONFIG.WEBSERVER.URL + comment.getCommentStaticPath() 58 const link = WEBSERVER.URL + comment.getCommentStaticPath()
58 59
59 feed.addItem({ 60 feed.addItem({
60 title: `${comment.Video.name} - ${comment.Account.getDisplayName()}`, 61 title: `${comment.Video.name} - ${comment.Account.getDisplayName()}`,
@@ -122,7 +123,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
122 feed.addItem({ 123 feed.addItem({
123 title: video.name, 124 title: video.name,
124 id: video.url, 125 id: video.url,
125 link: CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid, 126 link: WEBSERVER.URL + '/videos/watch/' + video.uuid,
126 description: video.getTruncatedDescription(), 127 description: video.getTruncatedDescription(),
127 content: video.description, 128 content: video.description,
128 author: [ 129 author: [
@@ -137,7 +138,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
137 torrent: torrents, 138 torrent: torrents,
138 thumbnail: [ 139 thumbnail: [
139 { 140 {
140 url: CONFIG.WEBSERVER.URL + video.getThumbnailStaticPath(), 141 url: WEBSERVER.URL + video.getThumbnailStaticPath(),
141 height: THUMBNAILS_SIZE.height, 142 height: THUMBNAILS_SIZE.height,
142 width: THUMBNAILS_SIZE.width 143 width: THUMBNAILS_SIZE.width
143 } 144 }
@@ -150,7 +151,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
150} 151}
151 152
152function initFeed (name: string, description: string) { 153function initFeed (name: string, description: string) {
153 const webserverUrl = CONFIG.WEBSERVER.URL 154 const webserverUrl = WEBSERVER.URL
154 155
155 return new Feed({ 156 return new Feed({
156 title: name, 157 title: name,