import { randomBytes } from 'crypto'
import { invert } from 'lodash'
import { join } from 'path'
-import { randomInt } from '../../shared/core-utils/common/miscs'
+import { randomInt, root } from '@shared/core-utils'
import {
AbuseState,
JobType,
VideoTranscodingFPS
} from '../../shared/models'
import { ActivityPubActorType } from '../../shared/models/activitypub'
-import { FollowState } from '../../shared/models/actors'
+import { ActorImageType, FollowState } from '../../shared/models/actors'
import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'
import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'
-import { root } from '../../shared/core-utils'
// Do not use barrels, remain constants as independent as possible
-import { isTestInstance, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
+import { isTestInstance, parseDurationToMs, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
import { CONFIG, registerConfigChangedHandler } from './config'
// ---------------------------------------------------------------------------
-const LAST_MIGRATION_VERSION = 670
+const LAST_MIGRATION_VERSION = 685
// ---------------------------------------------------------------------------
}
const BROADCAST_CONCURRENCY = 30 // How many requests in parallel we do in activitypub-http-broadcast job
-const AP_CLEANER_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-cleaner job
const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch remote data (likes, shares...)
+
+const AP_CLEANER = {
+ CONCURRENCY: 10, // How many requests in parallel we do in activitypub-cleaner job
+ UNAVAILABLE_TRESHOLD: 3, // How many attemps we do before removing an unavailable remote resource
+ PERIOD: parseDurationToMs('1 week') // /!\ Has to be sync with REPEAT_JOBS
+}
+
const REQUEST_TIMEOUTS = {
DEFAULT: 7000, // 7 seconds
FILE: 30000, // 30 seconds
}
const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days
-const VIDEO_IMPORT_TIMEOUT = 1000 * 3600 // 1 hour
+const VIDEO_IMPORT_TIMEOUT = Math.floor(JOB_TTL['video-import'] * 0.9)
const SCHEDULER_INTERVALS_MS = {
ACTOR_FOLLOW_SCORES: 60000 * 60, // 1 hour
CAPTION_FILE: {
EXTNAME: [ '.vtt', '.srt' ],
FILE_SIZE: {
- max: 4 * 1024 * 1024 // 4MB
+ max: 20 * 1024 * 1024 // 20MB
}
}
},
[VideoState.WAITING_FOR_LIVE]: 'Waiting for livestream',
[VideoState.LIVE_ENDED]: 'Livestream ended',
[VideoState.TO_MOVE_TO_EXTERNAL_STORAGE]: 'To move to an external storage',
- [VideoState.TRANSCODING_FAILED]: 'Transcoding failed'
+ [VideoState.TRANSCODING_FAILED]: 'Transcoding failed',
+ [VideoState.TO_MOVE_TO_EXTERNAL_STORAGE_FAILED]: 'External storage move failed'
}
const VIDEO_IMPORT_STATES: { [ id in VideoImportState ]: string } = {
[VideoImportState.FAILED]: 'Failed',
[VideoImportState.PENDING]: 'Pending',
[VideoImportState.SUCCESS]: 'Success',
- [VideoImportState.REJECTED]: 'Rejected'
+ [VideoImportState.REJECTED]: 'Rejected',
+ [VideoImportState.CANCELLED]: 'Cancelled',
+ [VideoImportState.PROCESSING]: 'Processing'
}
const ABUSE_STATES: { [ id in AbuseState ]: string } = {
height: 480,
minWidth: 400
}
-const ACTOR_IMAGES_SIZE = {
- AVATARS: {
- width: 120,
- height: 120
- },
- BANNERS: {
- width: 1920,
- height: 317 // 6/1 ratio
- }
+const ACTOR_IMAGES_SIZE: { [key in ActorImageType]: { width: number, height: number }[]} = {
+ [ActorImageType.AVATAR]: [
+ {
+ width: 120,
+ height: 120
+ },
+ {
+ width: 48,
+ height: 48
+ }
+ ],
+ [ActorImageType.BANNER]: [
+ {
+ width: 1920,
+ height: 317 // 6/1 ratio
+ }
+ ]
}
const EMBED_SIZE = {
SCHEDULER_INTERVALS_MS.AUTO_FOLLOW_INDEX_INSTANCES = 5000
SCHEDULER_INTERVALS_MS.UPDATE_INBOX_STATS = 5000
SCHEDULER_INTERVALS_MS.CHECK_PEERTUBE_VERSION = 2000
+
REPEAT_JOBS['videos-views-stats'] = { every: 5000 }
+
REPEAT_JOBS['activitypub-cleaner'] = { every: 5000 }
+ AP_CLEANER.PERIOD = 5000
REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
REDUNDANCY,
JOB_CONCURRENCY,
JOB_ATTEMPTS,
- AP_CLEANER_CONCURRENCY,
+ AP_CLEANER,
LAST_MIGRATION_VERSION,
OAUTH_LIFETIME,
CUSTOM_HTML_TAG_COMMENTS,
languages['oc'] = 'Occitan'
languages['el'] = 'Greek'
+ // Chinese languages
+ languages['zh-Hans'] = 'Simplified Chinese'
+ languages['zh-Hant'] = 'Traditional Chinese'
+
return languages
}