aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/server/stats.ts2
-rw-r--r--server/initializers/checker.ts3
-rw-r--r--server/initializers/constants.ts4
-rw-r--r--server/lib/activitypub/actor.ts3
-rw-r--r--server/lib/schedulers/videos-redundancy-scheduler.ts6
-rw-r--r--server/models/video/tag.ts5
6 files changed, 13 insertions, 10 deletions
diff --git a/server/controllers/api/server/stats.ts b/server/controllers/api/server/stats.ts
index bb6311e81..85803f69e 100644
--- a/server/controllers/api/server/stats.ts
+++ b/server/controllers/api/server/stats.ts
@@ -23,7 +23,7 @@ async function getStats (req: express.Request, res: express.Response, next: expr
23 const { totalInstanceFollowers, totalInstanceFollowing } = await ActorFollowModel.getStats() 23 const { totalInstanceFollowers, totalInstanceFollowing } = await ActorFollowModel.getStats()
24 24
25 const videosRedundancyStats = await Promise.all( 25 const videosRedundancyStats = await Promise.all(
26 CONFIG.REDUNDANCY.VIDEOS.map(r => { 26 CONFIG.REDUNDANCY.VIDEOS.STRATEGIES.map(r => {
27 return VideoRedundancyModel.getStats(r.strategy) 27 return VideoRedundancyModel.getStats(r.strategy)
28 .then(stats => Object.assign(stats, { strategy: r.strategy, totalSize: r.size })) 28 .then(stats => Object.assign(stats, { strategy: r.strategy, totalSize: r.size }))
29 }) 29 })
diff --git a/server/initializers/checker.ts b/server/initializers/checker.ts
index b9dc1e725..8b5280848 100644
--- a/server/initializers/checker.ts
+++ b/server/initializers/checker.ts
@@ -40,7 +40,7 @@ function checkConfig () {
40 } 40 }
41 41
42 // Redundancies 42 // Redundancies
43 const redundancyVideos = config.get<VideosRedundancy[]>('redundancy.videos') 43 const redundancyVideos = config.get<VideosRedundancy[]>('redundancy.videos.strategies')
44 if (isArray(redundancyVideos)) { 44 if (isArray(redundancyVideos)) {
45 for (const r of redundancyVideos) { 45 for (const r of redundancyVideos) {
46 if ([ 'most-views', 'trending', 'recently-added' ].indexOf(r.strategy) === -1) { 46 if ([ 'most-views', 'trending', 'recently-added' ].indexOf(r.strategy) === -1) {
@@ -75,6 +75,7 @@ function checkMissedConfig () {
75 'cache.previews.size', 'admin.email', 75 'cache.previews.size', 'admin.email',
76 'signup.enabled', 'signup.limit', 'signup.requires_email_verification', 76 'signup.enabled', 'signup.limit', 'signup.requires_email_verification',
77 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist', 77 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist',
78 'redundancy.videos.strategies',
78 'transcoding.enabled', 'transcoding.threads', 79 'transcoding.enabled', 'transcoding.threads',
79 'import.videos.http.enabled', 'import.videos.torrent.enabled', 80 'import.videos.http.enabled', 'import.videos.torrent.enabled',
80 'trending.videos.interval_days', 81 'trending.videos.interval_days',
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index fa9093918..881978753 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -212,7 +212,9 @@ const CONFIG = {
212 } 212 }
213 }, 213 },
214 REDUNDANCY: { 214 REDUNDANCY: {
215 VIDEOS: buildVideosRedundancy(config.get<any[]>('redundancy.videos')) 215 VIDEOS: {
216 STRATEGIES: buildVideosRedundancy(config.get<any[]>('redundancy.videos.strategies'))
217 }
216 }, 218 },
217 ADMIN: { 219 ADMIN: {
218 get EMAIL () { return config.get<string>('admin.email') } 220 get EMAIL () { return config.get<string>('admin.email') }
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index 0bdb7d12e..d37a695a7 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -78,6 +78,9 @@ async function getOrCreateActorAndServerAndModel (
78 created = true 78 created = true
79 } 79 }
80 80
81 if (actor.Account) actor.Account.Actor = actor
82 if (actor.VideoChannel) actor.VideoChannel.Actor = actor
83
81 const { actor: actorRefreshed, refreshed } = await retryTransactionWrapper(refreshActorIfNeeded, actor, fetchType) 84 const { actor: actorRefreshed, refreshed } = await retryTransactionWrapper(refreshActorIfNeeded, actor, fetchType)
82 if (!actorRefreshed) throw new Error('Actor ' + actorRefreshed.url + ' does not exist anymore.') 85 if (!actorRefreshed) throw new Error('Actor ' + actorRefreshed.url + ' does not exist anymore.')
83 86
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts
index 7079600a9..5f9fd9911 100644
--- a/server/lib/schedulers/videos-redundancy-scheduler.ts
+++ b/server/lib/schedulers/videos-redundancy-scheduler.ts
@@ -1,10 +1,9 @@
1import { AbstractScheduler } from './abstract-scheduler' 1import { AbstractScheduler } from './abstract-scheduler'
2import { CONFIG, JOB_TTL, REDUNDANCY, SCHEDULER_INTERVALS_MS } from '../../initializers' 2import { CONFIG, JOB_TTL, REDUNDANCY, SCHEDULER_INTERVALS_MS } from '../../initializers'
3import { logger } from '../../helpers/logger' 3import { logger } from '../../helpers/logger'
4import { RecentlyAddedStrategy, VideoRedundancyStrategy, VideosRedundancy } from '../../../shared/models/redundancy' 4import { VideoRedundancyStrategy, VideosRedundancy } from '../../../shared/models/redundancy'
5import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' 5import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
6import { VideoFileModel } from '../../models/video/video-file' 6import { VideoFileModel } from '../../models/video/video-file'
7import { sortBy } from 'lodash'
8import { downloadWebTorrentVideo } from '../../helpers/webtorrent' 7import { downloadWebTorrentVideo } from '../../helpers/webtorrent'
9import { join } from 'path' 8import { join } from 'path'
10import { rename } from 'fs-extra' 9import { rename } from 'fs-extra'
@@ -12,7 +11,6 @@ import { getServerActor } from '../../helpers/utils'
12import { sendCreateCacheFile, sendUpdateCacheFile } from '../activitypub/send' 11import { sendCreateCacheFile, sendUpdateCacheFile } from '../activitypub/send'
13import { VideoModel } from '../../models/video/video' 12import { VideoModel } from '../../models/video/video'
14import { getVideoCacheFileActivityPubUrl } from '../activitypub/url' 13import { getVideoCacheFileActivityPubUrl } from '../activitypub/url'
15import { removeVideoRedundancy } from '../redundancy'
16import { isTestInstance } from '../../helpers/core-utils' 14import { isTestInstance } from '../../helpers/core-utils'
17 15
18export class VideosRedundancyScheduler extends AbstractScheduler { 16export class VideosRedundancyScheduler extends AbstractScheduler {
@@ -31,7 +29,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
31 29
32 this.executing = true 30 this.executing = true
33 31
34 for (const obj of CONFIG.REDUNDANCY.VIDEOS) { 32 for (const obj of CONFIG.REDUNDANCY.VIDEOS.STRATEGIES) {
35 try { 33 try {
36 const videoToDuplicate = await this.findVideoToDuplicate(obj) 34 const videoToDuplicate = await this.findVideoToDuplicate(obj)
37 if (!videoToDuplicate) continue 35 if (!videoToDuplicate) continue
diff --git a/server/models/video/tag.ts b/server/models/video/tag.ts
index e39a418cd..b39621eaf 100644
--- a/server/models/video/tag.ts
+++ b/server/models/video/tag.ts
@@ -48,11 +48,10 @@ export class TagModel extends Model<TagModel> {
48 }, 48 },
49 defaults: { 49 defaults: {
50 name: tag 50 name: tag
51 } 51 },
52 transaction
52 } 53 }
53 54
54 if (transaction) query['transaction'] = transaction
55
56 const promise = TagModel.findOrCreate(query) 55 const promise = TagModel.findOrCreate(query)
57 .then(([ tagInstance ]) => tagInstance) 56 .then(([ tagInstance ]) => tagInstance)
58 tasks.push(promise) 57 tasks.push(promise)