diff options
Diffstat (limited to 'server/initializers/checker.ts')
-rw-r--r-- | server/initializers/checker.ts | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/server/initializers/checker.ts b/server/initializers/checker.ts index 6a2badd35..a54f6155b 100644 --- a/server/initializers/checker.ts +++ b/server/initializers/checker.ts | |||
@@ -7,7 +7,7 @@ import { parse } from 'url' | |||
7 | import { CONFIG } from './constants' | 7 | import { CONFIG } from './constants' |
8 | import { logger } from '../helpers/logger' | 8 | import { logger } from '../helpers/logger' |
9 | import { getServerActor } from '../helpers/utils' | 9 | import { getServerActor } from '../helpers/utils' |
10 | import { VideosRedundancy } from '../../shared/models/redundancy' | 10 | import { RecentlyAddedStrategy, VideosRedundancy } from '../../shared/models/redundancy' |
11 | import { isArray } from '../helpers/custom-validators/misc' | 11 | import { isArray } from '../helpers/custom-validators/misc' |
12 | import { uniq } from 'lodash' | 12 | import { uniq } from 'lodash' |
13 | 13 | ||
@@ -34,21 +34,28 @@ async function checkActivityPubUrls () { | |||
34 | function checkConfig () { | 34 | function checkConfig () { |
35 | const defaultNSFWPolicy = config.get<string>('instance.default_nsfw_policy') | 35 | const defaultNSFWPolicy = config.get<string>('instance.default_nsfw_policy') |
36 | 36 | ||
37 | // NSFW policy | ||
37 | if ([ 'do_not_list', 'blur', 'display' ].indexOf(defaultNSFWPolicy) === -1) { | 38 | if ([ 'do_not_list', 'blur', 'display' ].indexOf(defaultNSFWPolicy) === -1) { |
38 | return 'NSFW policy setting should be "do_not_list" or "blur" or "display" instead of ' + defaultNSFWPolicy | 39 | return 'NSFW policy setting should be "do_not_list" or "blur" or "display" instead of ' + defaultNSFWPolicy |
39 | } | 40 | } |
40 | 41 | ||
41 | const redundancyVideos = config.get<VideosRedundancy[]>('redundancy.videos') | 42 | // Redundancies |
43 | const redundancyVideos = config.get<VideosRedundancy[]>('redundancy.videos.strategies') | ||
42 | if (isArray(redundancyVideos)) { | 44 | if (isArray(redundancyVideos)) { |
43 | for (const r of redundancyVideos) { | 45 | for (const r of redundancyVideos) { |
44 | if ([ 'most-views' ].indexOf(r.strategy) === -1) { | 46 | if ([ 'most-views', 'trending', 'recently-added' ].indexOf(r.strategy) === -1) { |
45 | return 'Redundancy video entries should have "most-views" strategy instead of ' + r.strategy | 47 | return 'Redundancy video entries should have "most-views" strategy instead of ' + r.strategy |
46 | } | 48 | } |
47 | } | 49 | } |
48 | 50 | ||
49 | const filtered = uniq(redundancyVideos.map(r => r.strategy)) | 51 | const filtered = uniq(redundancyVideos.map(r => r.strategy)) |
50 | if (filtered.length !== redundancyVideos.length) { | 52 | if (filtered.length !== redundancyVideos.length) { |
51 | return 'Redundancy video entries should have uniq strategies' | 53 | return 'Redundancy video entries should have unique strategies' |
54 | } | ||
55 | |||
56 | const recentlyAddedStrategy = redundancyVideos.find(r => r.strategy === 'recently-added') as RecentlyAddedStrategy | ||
57 | if (recentlyAddedStrategy && isNaN(recentlyAddedStrategy.minViews)) { | ||
58 | return 'Min views in recently added strategy is not a number' | ||
52 | } | 59 | } |
53 | } | 60 | } |
54 | 61 | ||
@@ -68,6 +75,7 @@ function checkMissedConfig () { | |||
68 | 'cache.previews.size', 'admin.email', | 75 | 'cache.previews.size', 'admin.email', |
69 | 'signup.enabled', 'signup.limit', 'signup.requires_email_verification', | 76 | 'signup.enabled', 'signup.limit', 'signup.requires_email_verification', |
70 | 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist', | 77 | 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist', |
78 | 'redundancy.videos.strategies', 'redundancy.videos.check_interval', | ||
71 | 'transcoding.enabled', 'transcoding.threads', | 79 | 'transcoding.enabled', 'transcoding.threads', |
72 | 'import.videos.http.enabled', 'import.videos.torrent.enabled', | 80 | 'import.videos.http.enabled', 'import.videos.torrent.enabled', |
73 | 'trending.videos.interval_days', | 81 | 'trending.videos.interval_days', |