diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/checker-after-init.ts | 2 | ||||
-rw-r--r-- | server/initializers/checker-before-init.ts | 2 | ||||
-rw-r--r-- | server/initializers/config.ts | 1 | ||||
-rw-r--r-- | server/initializers/constants.ts | 19 | ||||
-rw-r--r-- | server/initializers/database.ts | 18 | ||||
-rw-r--r-- | server/initializers/installer.ts | 2 | ||||
-rw-r--r-- | server/initializers/migrations/0080-video-channels.ts | 4 | ||||
-rw-r--r-- | server/initializers/migrations/0345-video-playlists.ts | 4 | ||||
-rw-r--r-- | server/initializers/migrations/0560-user-feed-token.ts | 4 | ||||
-rw-r--r-- | server/initializers/migrations/0650-actor-custom-pages.ts | 33 |
10 files changed, 64 insertions, 25 deletions
diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts index a93c8b7fd..911734fa0 100644 --- a/server/initializers/checker-after-init.ts +++ b/server/initializers/checker-after-init.ts | |||
@@ -7,7 +7,7 @@ import { RecentlyAddedStrategy } from '../../shared/models/redundancy' | |||
7 | import { isProdInstance, isTestInstance, parseSemVersion } from '../helpers/core-utils' | 7 | import { isProdInstance, isTestInstance, parseSemVersion } from '../helpers/core-utils' |
8 | import { isArray } from '../helpers/custom-validators/misc' | 8 | import { isArray } from '../helpers/custom-validators/misc' |
9 | import { logger } from '../helpers/logger' | 9 | import { logger } from '../helpers/logger' |
10 | import { UserModel } from '../models/account/user' | 10 | import { UserModel } from '../models/user/user' |
11 | import { ApplicationModel, getServerActor } from '../models/application/application' | 11 | import { ApplicationModel, getServerActor } from '../models/application/application' |
12 | import { OAuthClientModel } from '../models/oauth/oauth-client' | 12 | import { OAuthClientModel } from '../models/oauth/oauth-client' |
13 | import { CONFIG, isEmailEnabled } from './config' | 13 | import { CONFIG, isEmailEnabled } from './config' |
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index 2864b0287..93c019121 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts | |||
@@ -19,7 +19,7 @@ function checkMissedConfig () { | |||
19 | 'csp.enabled', 'csp.report_only', 'csp.report_uri', | 19 | 'csp.enabled', 'csp.report_only', 'csp.report_uri', |
20 | 'security.frameguard.enabled', | 20 | 'security.frameguard.enabled', |
21 | 'cache.previews.size', 'cache.captions.size', 'cache.torrents.size', 'admin.email', 'contact_form.enabled', | 21 | 'cache.previews.size', 'cache.captions.size', 'cache.torrents.size', 'admin.email', 'contact_form.enabled', |
22 | 'signup.enabled', 'signup.limit', 'signup.requires_email_verification', | 22 | 'signup.enabled', 'signup.limit', 'signup.requires_email_verification', 'signup.minimum_age', |
23 | 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist', | 23 | 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist', |
24 | 'redundancy.videos.strategies', 'redundancy.videos.check_interval', | 24 | 'redundancy.videos.strategies', 'redundancy.videos.check_interval', |
25 | 'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions', 'transcoding.hls.enabled', | 25 | 'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions', 'transcoding.hls.enabled', |
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 5281d3a66..30a9823b9 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -185,6 +185,7 @@ const CONFIG = { | |||
185 | get ENABLED () { return config.get<boolean>('signup.enabled') }, | 185 | get ENABLED () { return config.get<boolean>('signup.enabled') }, |
186 | get LIMIT () { return config.get<number>('signup.limit') }, | 186 | get LIMIT () { return config.get<number>('signup.limit') }, |
187 | get REQUIRES_EMAIL_VERIFICATION () { return config.get<boolean>('signup.requires_email_verification') }, | 187 | get REQUIRES_EMAIL_VERIFICATION () { return config.get<boolean>('signup.requires_email_verification') }, |
188 | get MINIMUM_AGE () { return config.get<number>('signup.minimum_age') }, | ||
188 | FILTERS: { | 189 | FILTERS: { |
189 | CIDR: { | 190 | CIDR: { |
190 | get WHITELIST () { return config.get<string[]>('signup.filters.cidr.whitelist') }, | 191 | get WHITELIST () { return config.get<string[]>('signup.filters.cidr.whitelist') }, |
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 6f388420e..ab59320eb 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 = 645 | 27 | const LAST_MIGRATION_VERSION = 650 |
28 | 28 | ||
29 | // --------------------------------------------------------------------------- | 29 | // --------------------------------------------------------------------------- |
30 | 30 | ||
@@ -77,6 +77,7 @@ const SORTABLE_COLUMNS = { | |||
77 | // Don't forget to update peertube-search-index with the same values | 77 | // Don't forget to update peertube-search-index with the same values |
78 | VIDEOS_SEARCH: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'match' ], | 78 | VIDEOS_SEARCH: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'match' ], |
79 | VIDEO_CHANNELS_SEARCH: [ 'match', 'displayName', 'createdAt' ], | 79 | VIDEO_CHANNELS_SEARCH: [ 'match', 'displayName', 'createdAt' ], |
80 | VIDEO_PLAYLISTS_SEARCH: [ 'match', 'displayName', 'createdAt' ], | ||
80 | 81 | ||
81 | ABUSES: [ 'id', 'createdAt', 'state' ], | 82 | ABUSES: [ 'id', 'createdAt', 'state' ], |
82 | 83 | ||
@@ -152,7 +153,7 @@ const JOB_ATTEMPTS: { [id in JobType]: number } = { | |||
152 | const JOB_CONCURRENCY: { [id in Exclude<JobType, 'video-transcoding' | 'video-import'>]: number } = { | 153 | const JOB_CONCURRENCY: { [id in Exclude<JobType, 'video-transcoding' | 'video-import'>]: number } = { |
153 | 'activitypub-http-broadcast': 1, | 154 | 'activitypub-http-broadcast': 1, |
154 | 'activitypub-http-unicast': 5, | 155 | 'activitypub-http-unicast': 5, |
155 | 'activitypub-http-fetcher': 1, | 156 | 'activitypub-http-fetcher': 3, |
156 | 'activitypub-cleaner': 1, | 157 | 'activitypub-cleaner': 1, |
157 | 'activitypub-follow': 1, | 158 | 'activitypub-follow': 1, |
158 | 'video-file-import': 1, | 159 | 'video-file-import': 1, |
@@ -245,7 +246,7 @@ const CONSTRAINTS_FIELDS = { | |||
245 | CAPTION_FILE: { | 246 | CAPTION_FILE: { |
246 | EXTNAME: [ '.vtt', '.srt' ], | 247 | EXTNAME: [ '.vtt', '.srt' ], |
247 | FILE_SIZE: { | 248 | FILE_SIZE: { |
248 | max: 2 * 1024 * 1024 // 2MB | 249 | max: 4 * 1024 * 1024 // 4MB |
249 | } | 250 | } |
250 | } | 251 | } |
251 | }, | 252 | }, |
@@ -274,7 +275,7 @@ const CONSTRAINTS_FIELDS = { | |||
274 | IMAGE: { | 275 | IMAGE: { |
275 | EXTNAME: [ '.png', '.jpg', '.jpeg', '.webp' ], | 276 | EXTNAME: [ '.png', '.jpg', '.jpeg', '.webp' ], |
276 | FILE_SIZE: { | 277 | FILE_SIZE: { |
277 | max: 2 * 1024 * 1024 // 2MB | 278 | max: 4 * 1024 * 1024 // 4MB |
278 | } | 279 | } |
279 | }, | 280 | }, |
280 | EXTNAME: [] as string[], | 281 | EXTNAME: [] as string[], |
@@ -296,7 +297,7 @@ const CONSTRAINTS_FIELDS = { | |||
296 | IMAGE: { | 297 | IMAGE: { |
297 | EXTNAME: [ '.jpg', '.jpeg' ], | 298 | EXTNAME: [ '.jpg', '.jpeg' ], |
298 | FILE_SIZE: { | 299 | FILE_SIZE: { |
299 | max: 2 * 1024 * 1024 // 2MB | 300 | max: 4 * 1024 * 1024 // 4MB |
300 | } | 301 | } |
301 | } | 302 | } |
302 | }, | 303 | }, |
@@ -307,7 +308,7 @@ const CONSTRAINTS_FIELDS = { | |||
307 | IMAGE: { | 308 | IMAGE: { |
308 | EXTNAME: [ '.png', '.jpeg', '.jpg', '.gif', '.webp' ], | 309 | EXTNAME: [ '.png', '.jpeg', '.jpg', '.gif', '.webp' ], |
309 | FILE_SIZE: { | 310 | FILE_SIZE: { |
310 | max: 2 * 1024 * 1024 // 2MB | 311 | max: 4 * 1024 * 1024 // 4MB |
311 | } | 312 | } |
312 | } | 313 | } |
313 | }, | 314 | }, |
@@ -447,9 +448,10 @@ const MIMETYPES = { | |||
447 | 'audio/ogg': '.ogg', | 448 | 'audio/ogg': '.ogg', |
448 | 'audio/x-ms-wma': '.wma', | 449 | 'audio/x-ms-wma': '.wma', |
449 | 'audio/wav': '.wav', | 450 | 'audio/wav': '.wav', |
451 | 'audio/x-wav': '.wav', | ||
450 | 'audio/x-flac': '.flac', | 452 | 'audio/x-flac': '.flac', |
451 | 'audio/flac': '.flac', | 453 | 'audio/flac': '.flac', |
452 | 'audio/aac': '.aac', | 454 | 'audio/aac': '.aac', |
453 | 'audio/m4a': '.m4a', | 455 | 'audio/m4a': '.m4a', |
454 | 'audio/mp4': '.m4a', | 456 | 'audio/mp4': '.m4a', |
455 | 'audio/x-m4a': '.m4a', | 457 | 'audio/x-m4a': '.m4a', |
@@ -702,7 +704,8 @@ const CUSTOM_HTML_TAG_COMMENTS = { | |||
702 | TITLE: '<!-- title tag -->', | 704 | TITLE: '<!-- title tag -->', |
703 | DESCRIPTION: '<!-- description tag -->', | 705 | DESCRIPTION: '<!-- description tag -->', |
704 | CUSTOM_CSS: '<!-- custom css tag -->', | 706 | CUSTOM_CSS: '<!-- custom css tag -->', |
705 | META_TAGS: '<!-- meta tags -->' | 707 | META_TAGS: '<!-- meta tags -->', |
708 | SERVER_CONFIG: '<!-- server config -->' | ||
706 | } | 709 | } |
707 | 710 | ||
708 | // --------------------------------------------------------------------------- | 711 | // --------------------------------------------------------------------------- |
diff --git a/server/initializers/database.ts b/server/initializers/database.ts index edf12bc41..38e7a76d0 100644 --- a/server/initializers/database.ts +++ b/server/initializers/database.ts | |||
@@ -2,6 +2,9 @@ import { QueryTypes, Transaction } from 'sequelize' | |||
2 | import { Sequelize as SequelizeTypescript } from 'sequelize-typescript' | 2 | import { Sequelize as SequelizeTypescript } from 'sequelize-typescript' |
3 | import { TrackerModel } from '@server/models/server/tracker' | 3 | import { TrackerModel } from '@server/models/server/tracker' |
4 | import { VideoTrackerModel } from '@server/models/server/video-tracker' | 4 | import { VideoTrackerModel } from '@server/models/server/video-tracker' |
5 | import { UserModel } from '@server/models/user/user' | ||
6 | import { UserNotificationModel } from '@server/models/user/user-notification' | ||
7 | import { UserVideoHistoryModel } from '@server/models/user/user-video-history' | ||
5 | import { isTestInstance } from '../helpers/core-utils' | 8 | import { isTestInstance } from '../helpers/core-utils' |
6 | import { logger } from '../helpers/logger' | 9 | import { logger } from '../helpers/logger' |
7 | import { AbuseModel } from '../models/abuse/abuse' | 10 | import { AbuseModel } from '../models/abuse/abuse' |
@@ -11,13 +14,9 @@ import { VideoCommentAbuseModel } from '../models/abuse/video-comment-abuse' | |||
11 | import { AccountModel } from '../models/account/account' | 14 | import { AccountModel } from '../models/account/account' |
12 | import { AccountBlocklistModel } from '../models/account/account-blocklist' | 15 | import { AccountBlocklistModel } from '../models/account/account-blocklist' |
13 | import { AccountVideoRateModel } from '../models/account/account-video-rate' | 16 | import { AccountVideoRateModel } from '../models/account/account-video-rate' |
14 | import { ActorImageModel } from '../models/account/actor-image' | 17 | import { ActorModel } from '../models/actor/actor' |
15 | import { UserModel } from '../models/account/user' | 18 | import { ActorFollowModel } from '../models/actor/actor-follow' |
16 | import { UserNotificationModel } from '../models/account/user-notification' | 19 | import { ActorImageModel } from '../models/actor/actor-image' |
17 | import { UserNotificationSettingModel } from '../models/account/user-notification-setting' | ||
18 | import { UserVideoHistoryModel } from '../models/account/user-video-history' | ||
19 | import { ActorModel } from '../models/activitypub/actor' | ||
20 | import { ActorFollowModel } from '../models/activitypub/actor-follow' | ||
21 | import { ApplicationModel } from '../models/application/application' | 20 | import { ApplicationModel } from '../models/application/application' |
22 | import { OAuthClientModel } from '../models/oauth/oauth-client' | 21 | import { OAuthClientModel } from '../models/oauth/oauth-client' |
23 | import { OAuthTokenModel } from '../models/oauth/oauth-token' | 22 | import { OAuthTokenModel } from '../models/oauth/oauth-token' |
@@ -25,6 +24,7 @@ import { VideoRedundancyModel } from '../models/redundancy/video-redundancy' | |||
25 | import { PluginModel } from '../models/server/plugin' | 24 | import { PluginModel } from '../models/server/plugin' |
26 | import { ServerModel } from '../models/server/server' | 25 | import { ServerModel } from '../models/server/server' |
27 | import { ServerBlocklistModel } from '../models/server/server-blocklist' | 26 | import { ServerBlocklistModel } from '../models/server/server-blocklist' |
27 | import { UserNotificationSettingModel } from '../models/user/user-notification-setting' | ||
28 | import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update' | 28 | import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update' |
29 | import { TagModel } from '../models/video/tag' | 29 | import { TagModel } from '../models/video/tag' |
30 | import { ThumbnailModel } from '../models/video/thumbnail' | 30 | import { ThumbnailModel } from '../models/video/thumbnail' |
@@ -44,6 +44,7 @@ import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-pla | |||
44 | import { VideoTagModel } from '../models/video/video-tag' | 44 | import { VideoTagModel } from '../models/video/video-tag' |
45 | import { VideoViewModel } from '../models/video/video-view' | 45 | import { VideoViewModel } from '../models/video/video-view' |
46 | import { CONFIG } from './config' | 46 | import { CONFIG } from './config' |
47 | import { ActorCustomPageModel } from '@server/models/account/actor-custom-page' | ||
47 | 48 | ||
48 | require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string | 49 | require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string |
49 | 50 | ||
@@ -141,7 +142,8 @@ async function initDatabaseModels (silent: boolean) { | |||
141 | ThumbnailModel, | 142 | ThumbnailModel, |
142 | TrackerModel, | 143 | TrackerModel, |
143 | VideoTrackerModel, | 144 | VideoTrackerModel, |
144 | PluginModel | 145 | PluginModel, |
146 | ActorCustomPageModel | ||
145 | ]) | 147 | ]) |
146 | 148 | ||
147 | // Check extensions exist in the database | 149 | // Check extensions exist in the database |
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 8dcff64e2..676f88653 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts | |||
@@ -2,7 +2,7 @@ import * as passwordGenerator from 'password-generator' | |||
2 | import { UserRole } from '../../shared' | 2 | import { UserRole } from '../../shared' |
3 | import { logger } from '../helpers/logger' | 3 | import { logger } from '../helpers/logger' |
4 | import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user' | 4 | import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user' |
5 | import { UserModel } from '../models/account/user' | 5 | import { UserModel } from '../models/user/user' |
6 | import { ApplicationModel } from '../models/application/application' | 6 | import { ApplicationModel } from '../models/application/application' |
7 | import { OAuthClientModel } from '../models/oauth/oauth-client' | 7 | import { OAuthClientModel } from '../models/oauth/oauth-client' |
8 | import { applicationExist, clientsExist, usersExist } from './checker-after-init' | 8 | import { applicationExist, clientsExist, usersExist } from './checker-after-init' |
diff --git a/server/initializers/migrations/0080-video-channels.ts b/server/initializers/migrations/0080-video-channels.ts index 883224cb0..0e6952350 100644 --- a/server/initializers/migrations/0080-video-channels.ts +++ b/server/initializers/migrations/0080-video-channels.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { buildUUID } from '@server/helpers/uuid' | ||
1 | import * as Sequelize from 'sequelize' | 2 | import * as Sequelize from 'sequelize' |
2 | import { v4 as uuidv4 } from 'uuid' | ||
3 | 3 | ||
4 | async function up (utils: { | 4 | async function up (utils: { |
5 | transaction: Sequelize.Transaction | 5 | transaction: Sequelize.Transaction |
@@ -23,7 +23,7 @@ async function up (utils: { | |||
23 | { | 23 | { |
24 | const authors = await utils.db.Author.findAll() | 24 | const authors = await utils.db.Author.findAll() |
25 | for (const author of authors) { | 25 | for (const author of authors) { |
26 | author.uuid = uuidv4() | 26 | author.uuid = buildUUID() |
27 | await author.save() | 27 | await author.save() |
28 | } | 28 | } |
29 | } | 29 | } |
diff --git a/server/initializers/migrations/0345-video-playlists.ts b/server/initializers/migrations/0345-video-playlists.ts index 89a14a6ee..8dd631dff 100644 --- a/server/initializers/migrations/0345-video-playlists.ts +++ b/server/initializers/migrations/0345-video-playlists.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { buildUUID } from '@server/helpers/uuid' | ||
2 | import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos' | 3 | import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos' |
3 | import { v4 as uuidv4 } from 'uuid' | ||
4 | import { WEBSERVER } from '../constants' | 4 | import { WEBSERVER } from '../constants' |
5 | 5 | ||
6 | async function up (utils: { | 6 | async function up (utils: { |
@@ -57,7 +57,7 @@ CREATE TABLE IF NOT EXISTS "videoPlaylistElement" | |||
57 | const usernames = userResult.map(r => r.username) | 57 | const usernames = userResult.map(r => r.username) |
58 | 58 | ||
59 | for (const username of usernames) { | 59 | for (const username of usernames) { |
60 | const uuid = uuidv4() | 60 | const uuid = buildUUID() |
61 | 61 | ||
62 | const baseUrl = WEBSERVER.URL + '/video-playlists/' + uuid | 62 | const baseUrl = WEBSERVER.URL + '/video-playlists/' + uuid |
63 | const query = ` | 63 | const query = ` |
diff --git a/server/initializers/migrations/0560-user-feed-token.ts b/server/initializers/migrations/0560-user-feed-token.ts index 7c61def17..042301352 100644 --- a/server/initializers/migrations/0560-user-feed-token.ts +++ b/server/initializers/migrations/0560-user-feed-token.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { v4 as uuidv4 } from 'uuid' | 2 | import { buildUUID } from '@server/helpers/uuid' |
3 | 3 | ||
4 | async function up (utils: { | 4 | async function up (utils: { |
5 | transaction: Sequelize.Transaction | 5 | transaction: Sequelize.Transaction |
@@ -26,7 +26,7 @@ async function up (utils: { | |||
26 | const users = await utils.sequelize.query<any>(query, options) | 26 | const users = await utils.sequelize.query<any>(query, options) |
27 | 27 | ||
28 | for (const user of users) { | 28 | for (const user of users) { |
29 | const queryUpdate = `UPDATE "user" SET "feedToken" = '${uuidv4()}' WHERE id = ${user.id}` | 29 | const queryUpdate = `UPDATE "user" SET "feedToken" = '${buildUUID()}' WHERE id = ${user.id}` |
30 | await utils.sequelize.query(queryUpdate) | 30 | await utils.sequelize.query(queryUpdate) |
31 | } | 31 | } |
32 | } | 32 | } |
diff --git a/server/initializers/migrations/0650-actor-custom-pages.ts b/server/initializers/migrations/0650-actor-custom-pages.ts new file mode 100644 index 000000000..1338327e8 --- /dev/null +++ b/server/initializers/migrations/0650-actor-custom-pages.ts | |||
@@ -0,0 +1,33 @@ | |||
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 "actorCustomPage" ( | ||
12 | "id" serial, | ||
13 | "content" TEXT, | ||
14 | "type" varchar(255) NOT NULL, | ||
15 | "actorId" integer NOT NULL REFERENCES "actor" ("id") ON DELETE CASCADE ON UPDATE CASCADE, | ||
16 | "createdAt" timestamp WITH time zone NOT NULL, | ||
17 | "updatedAt" timestamp WITH time zone NOT NULL, | ||
18 | PRIMARY KEY ("id") | ||
19 | ); | ||
20 | ` | ||
21 | |||
22 | await utils.sequelize.query(query) | ||
23 | } | ||
24 | } | ||
25 | |||
26 | function down (options) { | ||
27 | throw new Error('Not implemented.') | ||
28 | } | ||
29 | |||
30 | export { | ||
31 | up, | ||
32 | down | ||
33 | } | ||