diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/checker-before-init.ts | 5 | ||||
-rw-r--r-- | server/initializers/config.ts | 9 | ||||
-rw-r--r-- | server/initializers/constants.ts | 21 | ||||
-rw-r--r-- | server/initializers/database.ts | 2 | ||||
-rw-r--r-- | server/initializers/migrations/0715-video-source.ts | 34 |
5 files changed, 56 insertions, 15 deletions
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index 794303743..359f0c31d 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts | |||
@@ -31,8 +31,8 @@ function checkMissedConfig () { | |||
31 | 'transcoding.resolutions.0p', 'transcoding.resolutions.144p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p', | 31 | 'transcoding.resolutions.0p', 'transcoding.resolutions.144p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p', |
32 | 'transcoding.resolutions.480p', 'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', | 32 | 'transcoding.resolutions.480p', 'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', |
33 | 'transcoding.resolutions.2160p', 'video_studio.enabled', | 33 | 'transcoding.resolutions.2160p', 'video_studio.enabled', |
34 | 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'auto_blacklist.videos.of_users.enabled', | 34 | 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'import.videos.timeout', |
35 | 'trending.videos.interval_days', | 35 | 'auto_blacklist.videos.of_users.enabled', 'trending.videos.interval_days', |
36 | 'client.videos.miniature.display_author_avatar', | 36 | 'client.videos.miniature.display_author_avatar', |
37 | 'client.videos.miniature.prefer_author_display_name', 'client.menu.login.redirect_on_single_external_auth', | 37 | 'client.videos.miniature.prefer_author_display_name', 'client.menu.login.redirect_on_single_external_auth', |
38 | 'defaults.publish.download_enabled', 'defaults.publish.comments_enabled', 'defaults.publish.privacy', 'defaults.publish.licence', | 38 | 'defaults.publish.download_enabled', 'defaults.publish.comments_enabled', 'defaults.publish.privacy', 'defaults.publish.licence', |
@@ -44,6 +44,7 @@ function checkMissedConfig () { | |||
44 | 'history.videos.max_age', 'views.videos.remote.max_age', 'views.videos.local_buffer_update_interval', 'views.videos.ip_view_expiration', | 44 | 'history.videos.max_age', 'views.videos.remote.max_age', 'views.videos.local_buffer_update_interval', 'views.videos.ip_view_expiration', |
45 | 'rates_limit.login.window', 'rates_limit.login.max', 'rates_limit.ask_send_email.window', 'rates_limit.ask_send_email.max', | 45 | 'rates_limit.login.window', 'rates_limit.login.max', 'rates_limit.ask_send_email.window', 'rates_limit.ask_send_email.max', |
46 | 'theme.default', | 46 | 'theme.default', |
47 | 'feeds.videos.count', 'feeds.comments.count', | ||
47 | 'geo_ip.enabled', 'geo_ip.country.database_url', | 48 | 'geo_ip.enabled', 'geo_ip.country.database_url', |
48 | 'remote_redundancy.videos.accept_from', | 49 | 'remote_redundancy.videos.accept_from', |
49 | 'federation.videos.federate_unlisted', 'federation.videos.cleanup_remote_interactions', | 50 | 'federation.videos.federate_unlisted', 'federation.videos.cleanup_remote_interactions', |
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 59a65d6a5..c76a839bc 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -247,6 +247,14 @@ const CONFIG = { | |||
247 | } | 247 | } |
248 | } | 248 | } |
249 | }, | 249 | }, |
250 | FEEDS: { | ||
251 | VIDEOS: { | ||
252 | COUNT: config.get<number>('feeds.videos.count') | ||
253 | }, | ||
254 | COMMENTS: { | ||
255 | COUNT: config.get<number>('feeds.comments.count') | ||
256 | } | ||
257 | }, | ||
250 | ADMIN: { | 258 | ADMIN: { |
251 | get EMAIL () { return config.get<string>('admin.email') } | 259 | get EMAIL () { return config.get<string>('admin.email') } |
252 | }, | 260 | }, |
@@ -349,6 +357,7 @@ const CONFIG = { | |||
349 | IMPORT: { | 357 | IMPORT: { |
350 | VIDEOS: { | 358 | VIDEOS: { |
351 | get CONCURRENCY () { return config.get<number>('import.videos.concurrency') }, | 359 | get CONCURRENCY () { return config.get<number>('import.videos.concurrency') }, |
360 | get TIMEOUT () { return parseDurationToMs(config.get<string>('import.videos.timeout')) }, | ||
352 | 361 | ||
353 | HTTP: { | 362 | HTTP: { |
354 | get ENABLED () { return config.get<boolean>('import.videos.http.enabled') }, | 363 | get ENABLED () { return config.get<boolean>('import.videos.http.enabled') }, |
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 6c6628d28..5329d75f8 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -24,7 +24,7 @@ import { CONFIG, registerConfigChangedHandler } from './config' | |||
24 | 24 | ||
25 | // --------------------------------------------------------------------------- | 25 | // --------------------------------------------------------------------------- |
26 | 26 | ||
27 | const LAST_MIGRATION_VERSION = 710 | 27 | const LAST_MIGRATION_VERSION = 715 |
28 | 28 | ||
29 | // --------------------------------------------------------------------------- | 29 | // --------------------------------------------------------------------------- |
30 | 30 | ||
@@ -58,7 +58,7 @@ const WEBSERVER = { | |||
58 | 58 | ||
59 | // Sortable columns per schema | 59 | // Sortable columns per schema |
60 | const SORTABLE_COLUMNS = { | 60 | const SORTABLE_COLUMNS = { |
61 | USERS: [ 'id', 'username', 'videoQuotaUsed', 'createdAt', 'lastLoginDate', 'role' ], | 61 | ADMIN_USERS: [ 'id', 'username', 'videoQuotaUsed', 'createdAt', 'lastLoginDate', 'role' ], |
62 | USER_SUBSCRIPTIONS: [ 'id', 'createdAt' ], | 62 | USER_SUBSCRIPTIONS: [ 'id', 'createdAt' ], |
63 | ACCOUNTS: [ 'createdAt' ], | 63 | ACCOUNTS: [ 'createdAt' ], |
64 | JOBS: [ 'createdAt' ], | 64 | JOBS: [ 'createdAt' ], |
@@ -186,7 +186,7 @@ const JOB_TTL: { [id in JobType]: number } = { | |||
186 | 'video-file-import': 1000 * 3600, // 1 hour | 186 | 'video-file-import': 1000 * 3600, // 1 hour |
187 | 'video-transcoding': 1000 * 3600 * 48, // 2 days, transcoding could be long | 187 | 'video-transcoding': 1000 * 3600 * 48, // 2 days, transcoding could be long |
188 | 'video-studio-edition': 1000 * 3600 * 10, // 10 hours | 188 | 'video-studio-edition': 1000 * 3600 * 10, // 10 hours |
189 | 'video-import': 1000 * 3600 * 2, // 2 hours | 189 | 'video-import': CONFIG.IMPORT.VIDEOS.TIMEOUT, |
190 | 'email': 60000 * 10, // 10 minutes | 190 | 'email': 60000 * 10, // 10 minutes |
191 | 'actor-keys': 60000 * 20, // 20 minutes | 191 | 'actor-keys': 60000 * 20, // 20 minutes |
192 | 'videos-views-stats': undefined, // Unlimited | 192 | 'videos-views-stats': undefined, // Unlimited |
@@ -213,7 +213,7 @@ const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch re | |||
213 | 213 | ||
214 | const AP_CLEANER = { | 214 | const AP_CLEANER = { |
215 | CONCURRENCY: 10, // How many requests in parallel we do in activitypub-cleaner job | 215 | CONCURRENCY: 10, // How many requests in parallel we do in activitypub-cleaner job |
216 | UNAVAILABLE_TRESHOLD: 3, // How many attemps we do before removing an unavailable remote resource | 216 | UNAVAILABLE_TRESHOLD: 3, // How many attempts we do before removing an unavailable remote resource |
217 | PERIOD: parseDurationToMs('1 week') // /!\ Has to be sync with REPEAT_JOBS | 217 | PERIOD: parseDurationToMs('1 week') // /!\ Has to be sync with REPEAT_JOBS |
218 | } | 218 | } |
219 | 219 | ||
@@ -734,12 +734,14 @@ const VIDEO_LIVE = { | |||
734 | const MEMOIZE_TTL = { | 734 | const MEMOIZE_TTL = { |
735 | OVERVIEWS_SAMPLE: 1000 * 3600 * 4, // 4 hours | 735 | OVERVIEWS_SAMPLE: 1000 * 3600 * 4, // 4 hours |
736 | INFO_HASH_EXISTS: 1000 * 3600 * 12, // 12 hours | 736 | INFO_HASH_EXISTS: 1000 * 3600 * 12, // 12 hours |
737 | VIDEO_DURATION: 1000 * 10, // 10 seconds | ||
737 | LIVE_ABLE_TO_UPLOAD: 1000 * 60, // 1 minute | 738 | LIVE_ABLE_TO_UPLOAD: 1000 * 60, // 1 minute |
738 | LIVE_CHECK_SOCKET_HEALTH: 1000 * 60 // 1 minute | 739 | LIVE_CHECK_SOCKET_HEALTH: 1000 * 60 // 1 minute |
739 | } | 740 | } |
740 | 741 | ||
741 | const MEMOIZE_LENGTH = { | 742 | const MEMOIZE_LENGTH = { |
742 | INFO_HASH_EXISTS: 200 | 743 | INFO_HASH_EXISTS: 200, |
744 | VIDEO_DURATION: 200 | ||
743 | } | 745 | } |
744 | 746 | ||
745 | const QUEUE_CONCURRENCY = { | 747 | const QUEUE_CONCURRENCY = { |
@@ -769,12 +771,6 @@ const CUSTOM_HTML_TAG_COMMENTS = { | |||
769 | SERVER_CONFIG: '<!-- server config -->' | 771 | SERVER_CONFIG: '<!-- server config -->' |
770 | } | 772 | } |
771 | 773 | ||
772 | // --------------------------------------------------------------------------- | ||
773 | |||
774 | const FEEDS = { | ||
775 | COUNT: 20 | ||
776 | } | ||
777 | |||
778 | const MAX_LOGS_OUTPUT_CHARACTERS = 10 * 1000 * 1000 | 774 | const MAX_LOGS_OUTPUT_CHARACTERS = 10 * 1000 * 1000 |
779 | const LOG_FILENAME = 'peertube.log' | 775 | const LOG_FILENAME = 'peertube.log' |
780 | const AUDIT_LOG_FILENAME = 'peertube-audit.log' | 776 | const AUDIT_LOG_FILENAME = 'peertube-audit.log' |
@@ -818,7 +814,7 @@ const STATS_TIMESERIE = { | |||
818 | // --------------------------------------------------------------------------- | 814 | // --------------------------------------------------------------------------- |
819 | 815 | ||
820 | // Special constants for a test instance | 816 | // Special constants for a test instance |
821 | if (isTestInstance() === true) { | 817 | if (isTestInstance() === true && process.env.PRODUCTION_CONSTANTS !== 'true') { |
822 | PRIVATE_RSA_KEY_SIZE = 1024 | 818 | PRIVATE_RSA_KEY_SIZE = 1024 |
823 | 819 | ||
824 | ACTOR_FOLLOW_SCORE.BASE = 20 | 820 | ACTOR_FOLLOW_SCORE.BASE = 20 |
@@ -942,7 +938,6 @@ export { | |||
942 | ROUTE_CACHE_LIFETIME, | 938 | ROUTE_CACHE_LIFETIME, |
943 | SORTABLE_COLUMNS, | 939 | SORTABLE_COLUMNS, |
944 | HLS_STREAMING_PLAYLIST_DIRECTORY, | 940 | HLS_STREAMING_PLAYLIST_DIRECTORY, |
945 | FEEDS, | ||
946 | JOB_TTL, | 941 | JOB_TTL, |
947 | DEFAULT_THEME_NAME, | 942 | DEFAULT_THEME_NAME, |
948 | NSFW_POLICY_TYPES, | 943 | NSFW_POLICY_TYPES, |
diff --git a/server/initializers/database.ts b/server/initializers/database.ts index 3576f444c..09786a91f 100644 --- a/server/initializers/database.ts +++ b/server/initializers/database.ts | |||
@@ -49,6 +49,7 @@ import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-pla | |||
49 | import { VideoTagModel } from '../models/video/video-tag' | 49 | import { VideoTagModel } from '../models/video/video-tag' |
50 | import { VideoViewModel } from '../models/view/video-view' | 50 | import { VideoViewModel } from '../models/view/video-view' |
51 | import { CONFIG } from './config' | 51 | import { CONFIG } from './config' |
52 | import { VideoSourceModel } from '@server/models/video/video-source' | ||
52 | 53 | ||
53 | require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string | 54 | require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string |
54 | 55 | ||
@@ -126,6 +127,7 @@ async function initDatabaseModels (silent: boolean) { | |||
126 | VideoChannelModel, | 127 | VideoChannelModel, |
127 | VideoShareModel, | 128 | VideoShareModel, |
128 | VideoFileModel, | 129 | VideoFileModel, |
130 | VideoSourceModel, | ||
129 | VideoCaptionModel, | 131 | VideoCaptionModel, |
130 | VideoBlacklistModel, | 132 | VideoBlacklistModel, |
131 | VideoTagModel, | 133 | VideoTagModel, |
diff --git a/server/initializers/migrations/0715-video-source.ts b/server/initializers/migrations/0715-video-source.ts new file mode 100644 index 000000000..efcf77ebd --- /dev/null +++ b/server/initializers/migrations/0715-video-source.ts | |||
@@ -0,0 +1,34 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | async function up (utils: { | ||
4 | transaction: Sequelize.Transaction | ||
5 | queryInterface: Sequelize.QueryInterface | ||
6 | sequelize: Sequelize.Sequelize | ||
7 | db: any | ||
8 | }): Promise<void> { | ||
9 | { | ||
10 | const query = ` | ||
11 | CREATE TABLE IF NOT EXISTS "videoSource" ( | ||
12 | "id" SERIAL , | ||
13 | "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, | ||
14 | "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, | ||
15 | "filename" VARCHAR(255) DEFAULT NULL, | ||
16 | "videoId" INTEGER | ||
17 | REFERENCES "video" ("id") | ||
18 | ON DELETE CASCADE | ||
19 | ON UPDATE CASCADE, | ||
20 | PRIMARY KEY ("id") | ||
21 | ); | ||
22 | ` | ||
23 | await utils.sequelize.query(query) | ||
24 | } | ||
25 | } | ||
26 | |||
27 | function down (options) { | ||
28 | throw new Error('Not implemented.') | ||
29 | } | ||
30 | |||
31 | export { | ||
32 | up, | ||
33 | down | ||
34 | } | ||