X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fconstants.ts;h=573d86b607d8f55cfd2581711f379f578f43170b;hb=fccbbc1a77d6e215eb299b569e9a4e5c79c7b719;hp=e730e3c84080ddff3ef105e93892d2d773ae83dd;hpb=caf2aaf4f9d38ad441a5562c3b8720f8779d6f78;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index e730e3c84..573d86b60 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -1,9 +1,17 @@ import { join } from 'path' import { randomBytes } from 'crypto' -import { JobType, VideoRateType, VideoResolution, VideoState } from '../../shared/models' import { ActivityPubActorType } from '../../shared/models/activitypub' import { FollowState } from '../../shared/models/actors' -import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos' +import { + AbuseState, + VideoImportState, + VideoPrivacy, + VideoTranscodingFPS, + JobType, + VideoRateType, + VideoResolution, + VideoState +} from '../../shared/models' // Do not use barrels, remain constants as independent as possible import { isTestInstance, sanitizeHost, sanitizeUrl, root } from '../helpers/core-utils' import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' @@ -15,7 +23,7 @@ import { CONFIG, registerConfigChangedHandler } from './config' // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 515 +const LAST_MIGRATION_VERSION = 525 // --------------------------------------------------------------------------- @@ -47,11 +55,10 @@ const WEBSERVER = { // Sortable columns per schema const SORTABLE_COLUMNS = { - USERS: [ 'id', 'username', 'videoQuotaUsed', 'createdAt' ], + USERS: [ 'id', 'username', 'videoQuotaUsed', 'createdAt', 'lastLoginDate', 'role' ], USER_SUBSCRIPTIONS: [ 'id', 'createdAt' ], ACCOUNTS: [ 'createdAt' ], JOBS: [ 'createdAt' ], - VIDEO_ABUSES: [ 'id', 'createdAt', 'state' ], VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ], VIDEO_IMPORTS: [ 'createdAt' ], VIDEO_COMMENT_THREADS: [ 'createdAt', 'totalReplies' ], @@ -66,10 +73,12 @@ const SORTABLE_COLUMNS = { VIDEOS_SEARCH: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'match' ], VIDEO_CHANNELS_SEARCH: [ 'match', 'displayName', 'createdAt' ], + ABUSES: [ 'id', 'createdAt', 'state' ], + ACCOUNTS_BLOCKLIST: [ 'createdAt' ], SERVERS_BLOCKLIST: [ 'createdAt' ], - USER_NOTIFICATIONS: [ 'createdAt' ], + USER_NOTIFICATIONS: [ 'createdAt', 'read' ], VIDEO_PLAYLISTS: [ 'displayName', 'createdAt', 'updatedAt' ], @@ -193,10 +202,13 @@ const CONSTRAINTS_FIELDS = { VIDEO_LANGUAGES: { max: 500 }, // Array length BLOCKED_REASON: { min: 3, max: 250 } // Length }, - VIDEO_ABUSES: { + ABUSES: { REASON: { min: 2, max: 3000 }, // Length MODERATION_COMMENT: { min: 2, max: 3000 } // Length }, + ABUSE_MESSAGES: { + MESSAGE: { min: 2, max: 3000 } // Length + }, VIDEO_BLACKLIST: { REASON: { min: 2, max: 300 } // Length }, @@ -378,10 +390,10 @@ const VIDEO_IMPORT_STATES = { [VideoImportState.REJECTED]: 'Rejected' } -const VIDEO_ABUSE_STATES = { - [VideoAbuseState.PENDING]: 'Pending', - [VideoAbuseState.REJECTED]: 'Rejected', - [VideoAbuseState.ACCEPTED]: 'Accepted' +const ABUSE_STATES = { + [AbuseState.PENDING]: 'Pending', + [AbuseState.REJECTED]: 'Rejected', + [AbuseState.ACCEPTED]: 'Accepted' } const VIDEO_PLAYLIST_PRIVACIES = { @@ -778,7 +790,7 @@ export { VIDEO_RATE_TYPES, VIDEO_TRANSCODING_FPS, FFMPEG_NICE, - VIDEO_ABUSE_STATES, + ABUSE_STATES, VIDEO_CHANNELS, LRU_CACHE, JOB_REQUEST_TIMEOUT, @@ -811,6 +823,7 @@ export { function buildVideoMimetypeExt () { const data = { + // streamable formats that warrant cross-browser compatibility 'video/webm': '.webm', 'video/ogg': '.ogv', 'video/mp4': '.mp4' @@ -819,15 +832,44 @@ function buildVideoMimetypeExt () { if (CONFIG.TRANSCODING.ENABLED) { if (CONFIG.TRANSCODING.ALLOW_ADDITIONAL_EXTENSIONS) { Object.assign(data, { - 'video/quicktime': '.mov', - 'video/x-msvideo': '.avi', - 'video/x-flv': '.flv', 'video/x-matroska': '.mkv', - 'video/avi': '.avi', + 'video/ogg': '.ogg', + + // Developed by Apple + 'video/quicktime': '.mov', // often used as output format by editing software 'video/x-m4v': '.m4v', + 'video/m4v': '.m4v', + + // Developed by the Adobe Flash Platform + 'video/x-flv': '.flv', + 'video/x-f4v': '.f4v', // replacement for flv + + // Developed by Microsoft + 'video/x-ms-wmv': '.wmv', + 'video/x-msvideo': '.avi', + 'video/avi': '.avi', + + // Developed by 3GPP + // common video formats for cell phones + 'video/3gpp': '.3gp', + 'video/3gpp2': '.3g2', + + // Developed by FFmpeg/Mplayer + 'application/x-nut': '.nut', + + // The standard video format used by many Sony and Panasonic HD camcorders. + // It is also used for storing high definition video on Blu-ray discs. + 'video/mp2t': '.mts', + 'video/m2ts': '.m2ts', + + // Old formats reliant on MPEG-1/MPEG-2 + 'video/mpv': '.mpv', + 'video/mpeg2': '.m2v', + 'video/mpeg': '.mpeg', + // Could be anything 'application/octet-stream': null, - 'video/m4v': '.m4v' + 'application/mxf': '.mxf' // often used as exchange format by editing software }) } @@ -857,7 +899,7 @@ function updateWebserverConfig () { } function buildVideosExtname () { - return Object.keys(MIMETYPES.VIDEO.EXT_MIMETYPE) + return Object.keys(MIMETYPES.VIDEO.EXT_MIMETYPE).filter(e => e !== 'null') } function loadLanguages () {