aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-09 17:51:58 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commite4f97babf701481b55cc10fb3448feab5f97c867 (patch)
treeaf37402a594dc5ff09f71ecb0687e8cfe4cdb471 /server/initializers
parent343ad675f2a26c15b86150a9a3552e619d5d44f4 (diff)
downloadPeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.tar.gz
PeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.tar.zst
PeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.zip
Begin activitypub
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/checker.ts2
-rw-r--r--server/initializers/constants.ts31
-rw-r--r--server/initializers/database.ts14
3 files changed, 29 insertions, 18 deletions
diff --git a/server/initializers/checker.ts b/server/initializers/checker.ts
index 9eaef1695..b69188f7e 100644
--- a/server/initializers/checker.ts
+++ b/server/initializers/checker.ts
@@ -2,7 +2,7 @@ import * as config from 'config'
2 2
3import { promisify0 } from '../helpers/core-utils' 3import { promisify0 } from '../helpers/core-utils'
4import { OAuthClientModel } from '../models/oauth/oauth-client-interface' 4import { OAuthClientModel } from '../models/oauth/oauth-client-interface'
5import { UserModel } from '../models/user/user-interface' 5import { UserModel } from '../models/account/user-interface'
6 6
7// Some checks on configuration files 7// Some checks on configuration files
8function checkConfig () { 8function checkConfig () {
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index d349abaf0..cb838cf16 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -10,7 +10,8 @@ import {
10 RequestVideoEventType, 10 RequestVideoEventType,
11 RequestVideoQaduType, 11 RequestVideoQaduType,
12 RemoteVideoRequestType, 12 RemoteVideoRequestType,
13 JobState 13 JobState,
14 JobCategory
14} from '../../shared/models' 15} from '../../shared/models'
15import { VideoPrivacy } from '../../shared/models/videos/video-privacy.enum' 16import { VideoPrivacy } from '../../shared/models/videos/video-privacy.enum'
16 17
@@ -60,7 +61,6 @@ const CONFIG = {
60 PASSWORD: config.get<string>('database.password') 61 PASSWORD: config.get<string>('database.password')
61 }, 62 },
62 STORAGE: { 63 STORAGE: {
63 CERT_DIR: join(root(), config.get<string>('storage.certs')),
64 LOG_DIR: join(root(), config.get<string>('storage.logs')), 64 LOG_DIR: join(root(), config.get<string>('storage.logs')),
65 VIDEOS_DIR: join(root(), config.get<string>('storage.videos')), 65 VIDEOS_DIR: join(root(), config.get<string>('storage.videos')),
66 THUMBNAILS_DIR: join(root(), config.get<string>('storage.thumbnails')), 66 THUMBNAILS_DIR: join(root(), config.get<string>('storage.thumbnails')),
@@ -211,6 +211,10 @@ const FRIEND_SCORE = {
211 MAX: 1000 211 MAX: 1000
212} 212}
213 213
214const ACTIVITY_PUB = {
215 COLLECTION_ITEMS_PER_PAGE: 10
216}
217
214// --------------------------------------------------------------------------- 218// ---------------------------------------------------------------------------
215 219
216// Number of points we add/remove from a friend after a successful/bad request 220// Number of points we add/remove from a friend after a successful/bad request
@@ -288,17 +292,23 @@ const JOB_STATES: { [ id: string ]: JobState } = {
288 ERROR: 'error', 292 ERROR: 'error',
289 SUCCESS: 'success' 293 SUCCESS: 'success'
290} 294}
295const JOB_CATEGORIES: { [ id: string ]: JobCategory } = {
296 TRANSCODING: 'transcoding',
297 HTTP_REQUEST: 'http-request'
298}
291// How many maximum jobs we fetch from the database per cycle 299// How many maximum jobs we fetch from the database per cycle
292const JOBS_FETCH_LIMIT_PER_CYCLE = 10 300const JOBS_FETCH_LIMIT_PER_CYCLE = {
301 transcoding: 10,
302 httpRequest: 20
303}
293// 1 minutes 304// 1 minutes
294let JOBS_FETCHING_INTERVAL = 60000 305let JOBS_FETCHING_INTERVAL = 60000
295 306
296// --------------------------------------------------------------------------- 307// ---------------------------------------------------------------------------
297 308
298const PRIVATE_CERT_NAME = 'peertube.key.pem' 309// const SIGNATURE_ALGORITHM = 'RSA-SHA256'
299const PUBLIC_CERT_NAME = 'peertube.pub' 310// const SIGNATURE_ENCODING = 'hex'
300const SIGNATURE_ALGORITHM = 'RSA-SHA256' 311const PRIVATE_RSA_KEY_SIZE = 2048
301const SIGNATURE_ENCODING = 'hex'
302 312
303// Password encryption 313// Password encryption
304const BCRYPT_SALT_SIZE = 10 314const BCRYPT_SALT_SIZE = 10
@@ -368,14 +378,13 @@ export {
368 JOB_STATES, 378 JOB_STATES,
369 JOBS_FETCH_LIMIT_PER_CYCLE, 379 JOBS_FETCH_LIMIT_PER_CYCLE,
370 JOBS_FETCHING_INTERVAL, 380 JOBS_FETCHING_INTERVAL,
381 JOB_CATEGORIES,
371 LAST_MIGRATION_VERSION, 382 LAST_MIGRATION_VERSION,
372 OAUTH_LIFETIME, 383 OAUTH_LIFETIME,
373 OPENGRAPH_AND_OEMBED_COMMENT, 384 OPENGRAPH_AND_OEMBED_COMMENT,
374 PAGINATION_COUNT_DEFAULT, 385 PAGINATION_COUNT_DEFAULT,
375 PODS_SCORE, 386 PODS_SCORE,
376 PREVIEWS_SIZE, 387 PREVIEWS_SIZE,
377 PRIVATE_CERT_NAME,
378 PUBLIC_CERT_NAME,
379 REMOTE_SCHEME, 388 REMOTE_SCHEME,
380 REQUEST_ENDPOINT_ACTIONS, 389 REQUEST_ENDPOINT_ACTIONS,
381 REQUEST_ENDPOINTS, 390 REQUEST_ENDPOINTS,
@@ -393,11 +402,11 @@ export {
393 REQUESTS_VIDEO_QADU_LIMIT_PODS, 402 REQUESTS_VIDEO_QADU_LIMIT_PODS,
394 RETRY_REQUESTS, 403 RETRY_REQUESTS,
395 SEARCHABLE_COLUMNS, 404 SEARCHABLE_COLUMNS,
396 SIGNATURE_ALGORITHM, 405 PRIVATE_RSA_KEY_SIZE,
397 SIGNATURE_ENCODING,
398 SORTABLE_COLUMNS, 406 SORTABLE_COLUMNS,
399 STATIC_MAX_AGE, 407 STATIC_MAX_AGE,
400 STATIC_PATHS, 408 STATIC_PATHS,
409 ACTIVITY_PUB,
401 THUMBNAILS_SIZE, 410 THUMBNAILS_SIZE,
402 VIDEO_CATEGORIES, 411 VIDEO_CATEGORIES,
403 VIDEO_LANGUAGES, 412 VIDEO_LANGUAGES,
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index 141566c3a..52e766394 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -15,8 +15,9 @@ import { BlacklistedVideoModel } from './../models/video/video-blacklist-interfa
15import { VideoFileModel } from './../models/video/video-file-interface' 15import { VideoFileModel } from './../models/video/video-file-interface'
16import { VideoAbuseModel } from './../models/video/video-abuse-interface' 16import { VideoAbuseModel } from './../models/video/video-abuse-interface'
17import { VideoChannelModel } from './../models/video/video-channel-interface' 17import { VideoChannelModel } from './../models/video/video-channel-interface'
18import { UserModel } from './../models/user/user-interface' 18import { UserModel } from '../models/account/user-interface'
19import { UserVideoRateModel } from './../models/user/user-video-rate-interface' 19import { AccountVideoRateModel } from '../models/account/account-video-rate-interface'
20import { AccountFollowModel } from '../models/account/account-follow-interface'
20import { TagModel } from './../models/video/tag-interface' 21import { TagModel } from './../models/video/tag-interface'
21import { RequestModel } from './../models/request/request-interface' 22import { RequestModel } from './../models/request/request-interface'
22import { RequestVideoQaduModel } from './../models/request/request-video-qadu-interface' 23import { RequestVideoQaduModel } from './../models/request/request-video-qadu-interface'
@@ -26,7 +27,7 @@ import { PodModel } from './../models/pod/pod-interface'
26import { OAuthTokenModel } from './../models/oauth/oauth-token-interface' 27import { OAuthTokenModel } from './../models/oauth/oauth-token-interface'
27import { OAuthClientModel } from './../models/oauth/oauth-client-interface' 28import { OAuthClientModel } from './../models/oauth/oauth-client-interface'
28import { JobModel } from './../models/job/job-interface' 29import { JobModel } from './../models/job/job-interface'
29import { AuthorModel } from './../models/video/author-interface' 30import { AccountModel } from './../models/account/account-interface'
30import { ApplicationModel } from './../models/application/application-interface' 31import { ApplicationModel } from './../models/application/application-interface'
31 32
32const dbname = CONFIG.DATABASE.DBNAME 33const dbname = CONFIG.DATABASE.DBNAME
@@ -38,7 +39,7 @@ const database: {
38 init?: (silent: boolean) => Promise<void>, 39 init?: (silent: boolean) => Promise<void>,
39 40
40 Application?: ApplicationModel, 41 Application?: ApplicationModel,
41 Author?: AuthorModel, 42 Account?: AccountModel,
42 Job?: JobModel, 43 Job?: JobModel,
43 OAuthClient?: OAuthClientModel, 44 OAuthClient?: OAuthClientModel,
44 OAuthToken?: OAuthTokenModel, 45 OAuthToken?: OAuthTokenModel,
@@ -48,7 +49,8 @@ const database: {
48 RequestVideoQadu?: RequestVideoQaduModel, 49 RequestVideoQadu?: RequestVideoQaduModel,
49 Request?: RequestModel, 50 Request?: RequestModel,
50 Tag?: TagModel, 51 Tag?: TagModel,
51 UserVideoRate?: UserVideoRateModel, 52 AccountVideoRate?: AccountVideoRateModel,
53 AccountFollow?: AccountFollowModel,
52 User?: UserModel, 54 User?: UserModel,
53 VideoAbuse?: VideoAbuseModel, 55 VideoAbuse?: VideoAbuseModel,
54 VideoChannel?: VideoChannelModel, 56 VideoChannel?: VideoChannelModel,
@@ -126,7 +128,7 @@ async function getModelFiles (modelDirectory: string) {
126 return true 128 return true
127 }) 129 })
128 130
129 const tasks: Bluebird<any>[] = [] 131 const tasks: Promise<any>[] = []
130 132
131 // For each directory we read it and append model in the modelFilePaths array 133 // For each directory we read it and append model in the modelFilePaths array
132 for (const directory of directories) { 134 for (const directory of directories) {