X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fconstants.ts;h=8f278fb0bf6dd5be2cbada9bb503914129c1c4fd;hb=5cd80545422bba855cc9a730a2e13cc9d982c34b;hp=48d7b5b986ea5e8fbde774d67dad1e04cc8e3513;hpb=afffe98839db7ccbfa9fb8b7d1413b97900fdc73;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 48d7b5b98..8f278fb0b 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -14,7 +14,7 @@ import { FollowState } from '../../shared/models/accounts/follow.model' // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 95 +const LAST_MIGRATION_VERSION = 110 // --------------------------------------------------------------------------- @@ -32,6 +32,7 @@ const SEARCHABLE_COLUMNS = { // Sortable columns per schema const SORTABLE_COLUMNS = { USERS: [ 'id', 'username', 'createdAt' ], + JOBS: [ 'id', 'createdAt' ], VIDEO_ABUSES: [ 'id', 'createdAt' ], VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ], VIDEOS: [ 'name', 'duration', 'createdAt', 'views', 'likes' ], @@ -126,7 +127,7 @@ const CONSTRAINTS_FIELDS = { DESCRIPTION: { min: 3, max: 3000 }, // Length EXTNAME: [ '.mp4', '.ogv', '.webm' ], INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2 - DURATION: { min: 1, max: 7200 }, // Number + DURATION: { min: 1 }, // Number TAGS: { min: 0, max: 5 }, // Number of total tags TAG: { min: 2, max: 30 }, // Length THUMBNAIL: { min: 2, max: 30 }, @@ -134,7 +135,7 @@ const CONSTRAINTS_FIELDS = { VIEWS: { min: 0 }, LIKES: { min: 0 }, DISLIKES: { min: 0 }, - FILE_SIZE: { min: 10, max: 1024 * 1024 * 1024 * 3 /* 3Go */ }, + FILE_SIZE: { min: 10 }, URL: { min: 3, max: 2000 } // Length }, ACCOUNTS: { @@ -216,30 +217,34 @@ const VIDEO_MIMETYPE_EXT = { // --------------------------------------------------------------------------- -// Score a server has when we create it as a friend -const FRIEND_SCORE = { - BASE: 100, - MAX: 1000 -} - const SERVER_ACCOUNT_NAME = 'peertube' -const ACTIVITY_PUB_ACCEPT_HEADER = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' const ACTIVITY_PUB = { + ACCEPT_HEADERS: [ + 'application/activity+json, application/ld+json', + 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' + ], + ACCEPT_HEADER: '', + PUBLIC: 'https://www.w3.org/ns/activitystreams#Public', COLLECTION_ITEMS_PER_PAGE: 10, + FETCH_PAGE_LIMIT: 100, + MAX_HTTP_ATTEMPT: 5, URL_MIME_TYPES: { VIDEO: [ 'video/mp4', 'video/webm', 'video/ogg' ], // TODO: Merge with VIDEO_MIMETYPE_EXT TORRENT: [ 'application/x-bittorrent' ], MAGNET: [ 'application/x-bittorrent;x-scheme-handler/magnet' ] } } +ACTIVITY_PUB.ACCEPT_HEADER = ACTIVITY_PUB.ACCEPT_HEADERS[0] // --------------------------------------------------------------------------- // Number of points we add/remove from a friend after a successful/bad request const SERVERS_SCORE = { PENALTY: -10, - BONUS: 10 + BONUS: 10, + BASE: 100, + MAX: 1000 } const FOLLOW_STATES: { [ id: string ]: FollowState } = { @@ -320,12 +325,12 @@ const OPENGRAPH_AND_OEMBED_COMMENT = '' // Special constants for a test instance if (isTestInstance() === true) { - CONSTRAINTS_FIELDS.VIDEOS.DURATION.max = 14 - FRIEND_SCORE.BASE = 20 - JOBS_FETCHING_INTERVAL = 2000 + SERVERS_SCORE.BASE = 20 + JOBS_FETCHING_INTERVAL = 1000 REMOTE_SCHEME.HTTP = 'http' REMOTE_SCHEME.WS = 'ws' STATIC_MAX_AGE = '0' + ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2 } // --------------------------------------------------------------------------- @@ -337,7 +342,6 @@ export { CONFIG, CONSTRAINTS_FIELDS, EMBED_SIZE, - FRIEND_SCORE, JOB_STATES, JOBS_FETCH_LIMIT_PER_CYCLE, JOBS_FETCHING_INTERVAL, @@ -349,7 +353,6 @@ export { SERVERS_SCORE, PREVIEWS_SIZE, REMOTE_SCHEME, - ACTIVITY_PUB_ACCEPT_HEADER, FOLLOW_STATES, SEARCHABLE_COLUMNS, SERVER_ACCOUNT_NAME,