diff options
-rw-r--r-- | config/default.yaml | 10 | ||||
-rw-r--r-- | config/production.yaml.example | 16 | ||||
-rw-r--r-- | server/controllers/feeds.ts | 10 | ||||
-rw-r--r-- | server/initializers/config.ts | 8 | ||||
-rw-r--r-- | server/initializers/constants.ts | 7 |
5 files changed, 36 insertions, 15 deletions
diff --git a/config/default.yaml b/config/default.yaml index c3e42350b..c0d17decf 100644 --- a/config/default.yaml +++ b/config/default.yaml | |||
@@ -297,6 +297,16 @@ webadmin: | |||
297 | # Set this to false if you don't want to allow config edition in the web interface by instance admins | 297 | # Set this to false if you don't want to allow config edition in the web interface by instance admins |
298 | allowed: true | 298 | allowed: true |
299 | 299 | ||
300 | # XML, Atom or JSON feeds | ||
301 | feeds: | ||
302 | videos: | ||
303 | # Default number of videos displayed in feeds | ||
304 | count: 20 | ||
305 | |||
306 | comments: | ||
307 | # Default number of comments displayed in feeds | ||
308 | count: 20 | ||
309 | |||
300 | cache: | 310 | cache: |
301 | previews: | 311 | previews: |
302 | size: 500 # Max number of previews you want to cache | 312 | size: 500 # Max number of previews you want to cache |
diff --git a/config/production.yaml.example b/config/production.yaml.example index 4351a4b87..8fd8d805f 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example | |||
@@ -293,15 +293,25 @@ webadmin: | |||
293 | # Set this to false if you don't want to allow config edition in the web interface by instance admins | 293 | # Set this to false if you don't want to allow config edition in the web interface by instance admins |
294 | allowed: true | 294 | allowed: true |
295 | 295 | ||
296 | # XML, Atom or JSON feeds | ||
297 | feeds: | ||
298 | videos: | ||
299 | # Default number of videos displayed in feeds | ||
300 | count: 20 | ||
301 | |||
302 | comments: | ||
303 | # Default number of comments displayed in feeds | ||
304 | count: 20 | ||
305 | |||
296 | ############################################################################### | 306 | ############################################################################### |
297 | # | 307 | # |
298 | # From this point, all the following keys can be overridden by the web interface | 308 | # From this point, almost all following keys can be overridden by the web interface |
299 | # (local-production.json file). If you need to change some values, prefer to | 309 | # (local-production.json file). If you need to change some values, prefer to |
300 | # use the web interface because the configuration will be automatically | 310 | # use the web interface because the configuration will be automatically |
301 | # reloaded without any need to restart PeerTube | 311 | # reloaded without any need to restart PeerTube |
302 | # | 312 | # |
303 | # /!\ If you already have a local-production.json file, the modification of the | 313 | # /!\ If you already have a local-production.json file, modification of some of |
304 | # following keys will have no effect /!\ | 314 | # the following keys will have no effect /!\ |
305 | # | 315 | # |
306 | ############################################################################### | 316 | ############################################################################### |
307 | 317 | ||
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index c929a6726..9eb31ed93 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts | |||
@@ -1,13 +1,13 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { Feed } from '@peertube/feed' | ||
3 | import { extname } from 'path' | 2 | import { extname } from 'path' |
3 | import { Feed } from '@peertube/feed' | ||
4 | import { mdToOneLinePlainText, toSafeHtml } from '@server/helpers/markdown' | 4 | import { mdToOneLinePlainText, toSafeHtml } from '@server/helpers/markdown' |
5 | import { getServerActor } from '@server/models/application/application' | 5 | import { getServerActor } from '@server/models/application/application' |
6 | import { getCategoryLabel } from '@server/models/video/formatter/video-format-utils' | 6 | import { getCategoryLabel } from '@server/models/video/formatter/video-format-utils' |
7 | import { VideoInclude } from '@shared/models' | 7 | import { VideoInclude } from '@shared/models' |
8 | import { buildNSFWFilter } from '../helpers/express-utils' | 8 | import { buildNSFWFilter } from '../helpers/express-utils' |
9 | import { CONFIG } from '../initializers/config' | 9 | import { CONFIG } from '../initializers/config' |
10 | import { FEEDS, MIMETYPES, PREVIEWS_SIZE, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' | 10 | import { MIMETYPES, PREVIEWS_SIZE, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' |
11 | import { | 11 | import { |
12 | asyncMiddleware, | 12 | asyncMiddleware, |
13 | commonVideosFiltersValidator, | 13 | commonVideosFiltersValidator, |
@@ -76,7 +76,7 @@ async function generateVideoCommentsFeed (req: express.Request, res: express.Res | |||
76 | 76 | ||
77 | const comments = await VideoCommentModel.listForFeed({ | 77 | const comments = await VideoCommentModel.listForFeed({ |
78 | start, | 78 | start, |
79 | count: FEEDS.COUNT, | 79 | count: CONFIG.FEEDS.COMMENTS.COUNT, |
80 | videoId: video ? video.id : undefined, | 80 | videoId: video ? video.id : undefined, |
81 | accountId: account ? account.id : undefined, | 81 | accountId: account ? account.id : undefined, |
82 | videoChannelId: videoChannel ? videoChannel.id : undefined | 82 | videoChannelId: videoChannel ? videoChannel.id : undefined |
@@ -166,7 +166,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) { | |||
166 | const server = await getServerActor() | 166 | const server = await getServerActor() |
167 | const { data } = await VideoModel.listForApi({ | 167 | const { data } = await VideoModel.listForApi({ |
168 | start, | 168 | start, |
169 | count: FEEDS.COUNT, | 169 | count: CONFIG.FEEDS.VIDEOS.COUNT, |
170 | sort: req.query.sort, | 170 | sort: req.query.sort, |
171 | displayOnlyForFollower: { | 171 | displayOnlyForFollower: { |
172 | actorId: server.id, | 172 | actorId: server.id, |
@@ -202,7 +202,7 @@ async function generateVideoFeedForSubscriptions (req: express.Request, res: exp | |||
202 | 202 | ||
203 | const { data } = await VideoModel.listForApi({ | 203 | const { data } = await VideoModel.listForApi({ |
204 | start, | 204 | start, |
205 | count: FEEDS.COUNT, | 205 | count: CONFIG.FEEDS.VIDEOS.COUNT, |
206 | sort: req.query.sort, | 206 | sort: req.query.sort, |
207 | nsfw, | 207 | nsfw, |
208 | 208 | ||
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 2f59e3e3e..c76a839bc 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -247,6 +247,14 @@ const CONFIG = { | |||
247 | } | 247 | } |
248 | } | 248 | } |
249 | }, | 249 | }, |
250 | FEEDS: { | ||
251 | VIDEOS: { | ||
252 | COUNT: config.get<number>('feeds.videos.count') | ||
253 | }, | ||
254 | COMMENTS: { | ||
255 | COUNT: config.get<number>('feeds.comments.count') | ||
256 | } | ||
257 | }, | ||
250 | ADMIN: { | 258 | ADMIN: { |
251 | get EMAIL () { return config.get<string>('admin.email') } | 259 | get EMAIL () { return config.get<string>('admin.email') } |
252 | }, | 260 | }, |
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 231b86821..824a30bd2 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -766,12 +766,6 @@ const CUSTOM_HTML_TAG_COMMENTS = { | |||
766 | SERVER_CONFIG: '<!-- server config -->' | 766 | SERVER_CONFIG: '<!-- server config -->' |
767 | } | 767 | } |
768 | 768 | ||
769 | // --------------------------------------------------------------------------- | ||
770 | |||
771 | const FEEDS = { | ||
772 | COUNT: 20 | ||
773 | } | ||
774 | |||
775 | const MAX_LOGS_OUTPUT_CHARACTERS = 10 * 1000 * 1000 | 769 | const MAX_LOGS_OUTPUT_CHARACTERS = 10 * 1000 * 1000 |
776 | const LOG_FILENAME = 'peertube.log' | 770 | const LOG_FILENAME = 'peertube.log' |
777 | const AUDIT_LOG_FILENAME = 'peertube-audit.log' | 771 | const AUDIT_LOG_FILENAME = 'peertube-audit.log' |
@@ -939,7 +933,6 @@ export { | |||
939 | ROUTE_CACHE_LIFETIME, | 933 | ROUTE_CACHE_LIFETIME, |
940 | SORTABLE_COLUMNS, | 934 | SORTABLE_COLUMNS, |
941 | HLS_STREAMING_PLAYLIST_DIRECTORY, | 935 | HLS_STREAMING_PLAYLIST_DIRECTORY, |
942 | FEEDS, | ||
943 | JOB_TTL, | 936 | JOB_TTL, |
944 | DEFAULT_THEME_NAME, | 937 | DEFAULT_THEME_NAME, |
945 | NSFW_POLICY_TYPES, | 938 | NSFW_POLICY_TYPES, |