X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fchecker.ts;h=6048151a344085ec9f5fd451cbeff9ffea4f6941;hb=b36f41ca09e92ecb30d367d91d1089a23d10d585;hp=9dd104035f8f4991519793035dd5752692a80530;hpb=5447516b9a87725a6f8c55ec7e4ea1c1be839ee6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/checker.ts b/server/initializers/checker.ts index 9dd104035..6048151a3 100644 --- a/server/initializers/checker.ts +++ b/server/initializers/checker.ts @@ -7,6 +7,9 @@ import { parse } from 'url' import { CONFIG } from './constants' import { logger } from '../helpers/logger' import { getServerActor } from '../helpers/utils' +import { VideosRedundancy } from '../../shared/models/redundancy' +import { isArray } from '../helpers/custom-validators/misc' +import { uniq } from 'lodash' async function checkActivityPubUrls () { const actor = await getServerActor() @@ -35,6 +38,20 @@ function checkConfig () { return 'NSFW policy setting should be "do_not_list" or "blur" or "display" instead of ' + defaultNSFWPolicy } + const redundancyVideos = config.get('redundancy.videos') + if (isArray(redundancyVideos)) { + for (const r of redundancyVideos) { + if ([ 'most-views', 'trending' ].indexOf(r.strategy) === -1) { + return 'Redundancy video entries should have "most-views" strategy instead of ' + r.strategy + } + } + + const filtered = uniq(redundancyVideos.map(r => r.strategy)) + if (filtered.length !== redundancyVideos.length) { + return 'Redundancy video entries should have uniq strategies' + } + } + return null }