ActivityPub-federated video streaming platform using P2P directly in your web browser
Remove max duration/filesize constraints
Chocobozzzc60774b05b12
diff --git a/server/initializers/constants.ts b/server/initializers/constants.tsindex f09422ffd9..82373ba843 100644--- a/server/initializers/constants.ts+++ b/server/initializers/constants.ts@@ -126,7 +126,7 @@ const CONSTRAINTS_FIELDS = {DESCRIPTION: { min: 3, max: 3000 }, // LengthEXTNAME: [ '.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 }, // NumberTAGS: { min: 0, max: 5 }, // Number of total tagsTAG: { min: 2, max: 30 }, // LengthTHUMBNAIL: { min: 2, max: 30 },@@ -134,7 +134,7 @@ const CONSTRAINTS_FIELDS = {VIEWS: { min: 0 },LIKES: { min: 0 },DISLIKES: { min: 0 },- FILE_SIZE: { min: 10, max: 1024 * 1024 * 1024 * 10 /* 10Go */ },+ FILE_SIZE: { min: 10 },URL: { min: 3, max: 2000 } // Length},ACCOUNTS: {@@ -216,12 +216,6 @@ 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 = {@@ -242,7 +236,9 @@ const ACTIVITY_PUB = {// Number of points we add/remove from a friend after a successful/bad requestconst SERVERS_SCORE = {PENALTY: -10,- BONUS: 10+ BONUS: 10,+ BASE: 100,+ MAX: 1000}const FOLLOW_STATES: { [ id: string ]: FollowState } = {@@ -323,8 +319,7 @@ const OPENGRAPH_AND_OEMBED_COMMENT = '<!-- open graph and oembed tags -->'// Special constants for a test instanceif (isTestInstance() === true) {- CONSTRAINTS_FIELDS.VIDEOS.DURATION.max = 14- FRIEND_SCORE.BASE = 20+ SERVERS_SCORE.BASE = 20JOBS_FETCHING_INTERVAL = 1000REMOTE_SCHEME.HTTP = 'http'REMOTE_SCHEME.WS = 'ws'@@ -341,7 +336,6 @@ export {CONFIG,CONSTRAINTS_FIELDS,EMBED_SIZE,- FRIEND_SCORE,JOB_STATES,JOBS_FETCH_LIMIT_PER_CYCLE,JOBS_FETCHING_INTERVAL,diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.tsindex 3cbf98312b..52b4475ce3 100644--- a/server/middlewares/validators/videos.ts+++ b/server/middlewares/validators/videos.ts@@ -6,7 +6,6 @@ import {isVideoAbuseReasonValid,isVideoCategoryValid,isVideoDescriptionValid,- isVideoDurationValid,isVideoExist,isVideoFile,isVideoLanguageValid,@@ -82,14 +81,6 @@ const videosAddValidator = [return}- if (!isVideoDurationValid('' + duration)) {- return res.status(400)- .json({- error: 'Duration of the video file is too big (max: ' + CONSTRAINTS_FIELDS.VIDEOS.DURATION.max + 's).'- })- .end()- }-videoFile['duration'] = durationreturn next()diff --git a/server/models/server/server.ts b/server/models/server/server.tsindex fcd7be090e..ebd216b082 100644--- a/server/models/server/server.ts+++ b/server/models/server/server.ts@@ -1,6 +1,6 @@import * as Sequelize from 'sequelize'import { isHostValid, logger } from '../../helpers'-import { FRIEND_SCORE, SERVERS_SCORE } from '../../initializers'+import { SERVERS_SCORE } from '../../initializers'import { addMethodsToModel } from '../utils'import { ServerAttributes, ServerInstance, ServerMethods } from './server-interface'@@ -22,11 +22,11 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da},score: {type: DataTypes.INTEGER,- defaultValue: FRIEND_SCORE.BASE,+ defaultValue: SERVERS_SCORE.BASE,allowNull: false,validate: {isInt: true,- max: FRIEND_SCORE.MAX+ max: SERVERS_SCORE.MAX}}},diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.tsindex 7f5609784c..2962f5640a 100644--- a/server/tests/api/check-params/videos.ts+++ b/server/tests/api/check-params/videos.ts@@ -333,14 +333,6 @@ describe('Test videos API validator', function () {await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})- it('Should fail with a too big duration', async function () {- const fields = getCompleteVideoUploadAttributes()- const attaches = {- 'videofile': join(__dirname, '..', 'fixtures', 'video_too_long.webm')- }- await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })- })-it('Should succeed with the correct parameters', async function () {this.timeout(10000)