diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-09 17:51:58 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | e4f97babf701481b55cc10fb3448feab5f97c867 (patch) | |
tree | af37402a594dc5ff09f71ecb0687e8cfe4cdb471 /server/initializers | |
parent | 343ad675f2a26c15b86150a9a3552e619d5d44f4 (diff) | |
download | PeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.tar.gz PeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.tar.zst PeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.zip |
Begin activitypub
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/checker.ts | 2 | ||||
-rw-r--r-- | server/initializers/constants.ts | 31 | ||||
-rw-r--r-- | server/initializers/database.ts | 14 |
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 | ||
3 | import { promisify0 } from '../helpers/core-utils' | 3 | import { promisify0 } from '../helpers/core-utils' |
4 | import { OAuthClientModel } from '../models/oauth/oauth-client-interface' | 4 | import { OAuthClientModel } from '../models/oauth/oauth-client-interface' |
5 | import { UserModel } from '../models/user/user-interface' | 5 | import { UserModel } from '../models/account/user-interface' |
6 | 6 | ||
7 | // Some checks on configuration files | 7 | // Some checks on configuration files |
8 | function checkConfig () { | 8 | function 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' |
15 | import { VideoPrivacy } from '../../shared/models/videos/video-privacy.enum' | 16 | import { 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 | ||
214 | const 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 | } |
295 | const 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 |
292 | const JOBS_FETCH_LIMIT_PER_CYCLE = 10 | 300 | const JOBS_FETCH_LIMIT_PER_CYCLE = { |
301 | transcoding: 10, | ||
302 | httpRequest: 20 | ||
303 | } | ||
293 | // 1 minutes | 304 | // 1 minutes |
294 | let JOBS_FETCHING_INTERVAL = 60000 | 305 | let JOBS_FETCHING_INTERVAL = 60000 |
295 | 306 | ||
296 | // --------------------------------------------------------------------------- | 307 | // --------------------------------------------------------------------------- |
297 | 308 | ||
298 | const PRIVATE_CERT_NAME = 'peertube.key.pem' | 309 | // const SIGNATURE_ALGORITHM = 'RSA-SHA256' |
299 | const PUBLIC_CERT_NAME = 'peertube.pub' | 310 | // const SIGNATURE_ENCODING = 'hex' |
300 | const SIGNATURE_ALGORITHM = 'RSA-SHA256' | 311 | const PRIVATE_RSA_KEY_SIZE = 2048 |
301 | const SIGNATURE_ENCODING = 'hex' | ||
302 | 312 | ||
303 | // Password encryption | 313 | // Password encryption |
304 | const BCRYPT_SALT_SIZE = 10 | 314 | const 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 | |||
15 | import { VideoFileModel } from './../models/video/video-file-interface' | 15 | import { VideoFileModel } from './../models/video/video-file-interface' |
16 | import { VideoAbuseModel } from './../models/video/video-abuse-interface' | 16 | import { VideoAbuseModel } from './../models/video/video-abuse-interface' |
17 | import { VideoChannelModel } from './../models/video/video-channel-interface' | 17 | import { VideoChannelModel } from './../models/video/video-channel-interface' |
18 | import { UserModel } from './../models/user/user-interface' | 18 | import { UserModel } from '../models/account/user-interface' |
19 | import { UserVideoRateModel } from './../models/user/user-video-rate-interface' | 19 | import { AccountVideoRateModel } from '../models/account/account-video-rate-interface' |
20 | import { AccountFollowModel } from '../models/account/account-follow-interface' | ||
20 | import { TagModel } from './../models/video/tag-interface' | 21 | import { TagModel } from './../models/video/tag-interface' |
21 | import { RequestModel } from './../models/request/request-interface' | 22 | import { RequestModel } from './../models/request/request-interface' |
22 | import { RequestVideoQaduModel } from './../models/request/request-video-qadu-interface' | 23 | import { RequestVideoQaduModel } from './../models/request/request-video-qadu-interface' |
@@ -26,7 +27,7 @@ import { PodModel } from './../models/pod/pod-interface' | |||
26 | import { OAuthTokenModel } from './../models/oauth/oauth-token-interface' | 27 | import { OAuthTokenModel } from './../models/oauth/oauth-token-interface' |
27 | import { OAuthClientModel } from './../models/oauth/oauth-client-interface' | 28 | import { OAuthClientModel } from './../models/oauth/oauth-client-interface' |
28 | import { JobModel } from './../models/job/job-interface' | 29 | import { JobModel } from './../models/job/job-interface' |
29 | import { AuthorModel } from './../models/video/author-interface' | 30 | import { AccountModel } from './../models/account/account-interface' |
30 | import { ApplicationModel } from './../models/application/application-interface' | 31 | import { ApplicationModel } from './../models/application/application-interface' |
31 | 32 | ||
32 | const dbname = CONFIG.DATABASE.DBNAME | 33 | const 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) { |