aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-10 17:27:49 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (patch)
treee57173bcd0590d939c28952a29258fd02a281e35 /server/initializers
parent38fa2065831b5f55be0d7f30f19a62c967397208 (diff)
downloadPeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.gz
PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.zst
PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.zip
Make it compile at least
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts6
-rw-r--r--server/initializers/database.ts5
-rw-r--r--server/initializers/installer.ts24
-rw-r--r--server/initializers/migrations/0075-video-resolutions.ts1
4 files changed, 15 insertions, 21 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index e6fda88c2..2d61094bd 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -361,12 +361,6 @@ export {
361 PODS_SCORE, 361 PODS_SCORE,
362 PREVIEWS_SIZE, 362 PREVIEWS_SIZE,
363 REMOTE_SCHEME, 363 REMOTE_SCHEME,
364 REQUEST_ENDPOINT_ACTIONS,
365 REQUEST_ENDPOINTS,
366 REQUEST_VIDEO_EVENT_ENDPOINT,
367 REQUEST_VIDEO_EVENT_TYPES,
368 REQUEST_VIDEO_QADU_ENDPOINT,
369 REQUEST_VIDEO_QADU_TYPES,
370 REQUESTS_IN_PARALLEL, 364 REQUESTS_IN_PARALLEL,
371 REQUESTS_INTERVAL, 365 REQUESTS_INTERVAL,
372 REQUESTS_LIMIT_PER_POD, 366 REQUESTS_LIMIT_PER_POD,
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index aefb6da3a..1383bb33b 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -2,7 +2,6 @@ import { join } from 'path'
2import { flattenDepth } from 'lodash' 2import { flattenDepth } from 'lodash'
3require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string 3require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string
4import * as Sequelize from 'sequelize' 4import * as Sequelize from 'sequelize'
5import * as Bluebird from 'bluebird'
6 5
7import { CONFIG } from './constants' 6import { CONFIG } from './constants'
8// Do not use barrel, we need to load database first 7// Do not use barrel, we need to load database first
@@ -19,10 +18,6 @@ import { UserModel } from '../models/account/user-interface'
19import { AccountVideoRateModel } from '../models/account/account-video-rate-interface' 18import { AccountVideoRateModel } from '../models/account/account-video-rate-interface'
20import { AccountFollowModel } from '../models/account/account-follow-interface' 19import { AccountFollowModel } from '../models/account/account-follow-interface'
21import { TagModel } from './../models/video/tag-interface' 20import { TagModel } from './../models/video/tag-interface'
22import { RequestModel } from './../models/request/request-interface'
23import { RequestVideoQaduModel } from './../models/request/request-video-qadu-interface'
24import { RequestVideoEventModel } from './../models/request/request-video-event-interface'
25import { RequestToPodModel } from './../models/request/request-to-pod-interface'
26import { PodModel } from './../models/pod/pod-interface' 21import { PodModel } from './../models/pod/pod-interface'
27import { OAuthTokenModel } from './../models/oauth/oauth-token-interface' 22import { OAuthTokenModel } from './../models/oauth/oauth-token-interface'
28import { OAuthClientModel } from './../models/oauth/oauth-client-interface' 23import { OAuthClientModel } from './../models/oauth/oauth-client-interface'
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts
index c8f6b3bc2..c617b16c9 100644
--- a/server/initializers/installer.ts
+++ b/server/initializers/installer.ts
@@ -1,20 +1,21 @@
1import * as passwordGenerator from 'password-generator' 1import * as passwordGenerator from 'password-generator'
2import * as Bluebird from 'bluebird' 2import { UserRole } from '../../shared'
3import { logger, mkdirpPromise, rimrafPromise } from '../helpers'
4import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto'
5import { createUserAccountAndChannel } from '../lib'
6import { clientsExist, usersExist } from './checker'
7import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants'
3 8
4import { database as db } from './database' 9import { database as db } from './database'
5import { CONFIG, LAST_MIGRATION_VERSION, CACHE } from './constants' 10import { createLocalAccount } from '../lib/user'
6import { clientsExist, usersExist } from './checker'
7import { logger, createCertsIfNotExist, mkdirpPromise, rimrafPromise } from '../helpers'
8import { createUserAccountAndChannel } from '../lib'
9import { UserRole } from '../../shared'
10 11
11async function installApplication () { 12async function installApplication () {
12 await db.sequelize.sync() 13 await db.sequelize.sync()
13 await removeCacheDirectories() 14 await removeCacheDirectories()
14 await createDirectoriesIfNotExist() 15 await createDirectoriesIfNotExist()
15 await createCertsIfNotExist()
16 await createOAuthClientIfNotExist() 16 await createOAuthClientIfNotExist()
17 await createOAuthAdminIfNotExist() 17 await createOAuthAdminIfNotExist()
18 await createApplicationIfNotExist()
18} 19}
19 20
20// --------------------------------------------------------------------------- 21// ---------------------------------------------------------------------------
@@ -28,7 +29,7 @@ export {
28function removeCacheDirectories () { 29function removeCacheDirectories () {
29 const cacheDirectories = CACHE.DIRECTORIES 30 const cacheDirectories = CACHE.DIRECTORIES
30 31
31 const tasks: Bluebird<any>[] = [] 32 const tasks: Promise<any>[] = []
32 33
33 // Cache directories 34 // Cache directories
34 for (const key of Object.keys(cacheDirectories)) { 35 for (const key of Object.keys(cacheDirectories)) {
@@ -120,7 +121,12 @@ async function createOAuthAdminIfNotExist () {
120 await createUserAccountAndChannel(user, validatePassword) 121 await createUserAccountAndChannel(user, validatePassword)
121 logger.info('Username: ' + username) 122 logger.info('Username: ' + username)
122 logger.info('User password: ' + password) 123 logger.info('User password: ' + password)
124}
123 125
126async function createApplicationIfNotExist () {
124 logger.info('Creating Application table.') 127 logger.info('Creating Application table.')
125 await db.Application.create({ migrationVersion: LAST_MIGRATION_VERSION }) 128 const applicationInstance = await db.Application.create({ migrationVersion: LAST_MIGRATION_VERSION })
129
130 logger.info('Creating application account.')
131 return createLocalAccount('peertube', null, applicationInstance.id, undefined)
126} 132}
diff --git a/server/initializers/migrations/0075-video-resolutions.ts b/server/initializers/migrations/0075-video-resolutions.ts
index e1d9fdacb..e7d8a2876 100644
--- a/server/initializers/migrations/0075-video-resolutions.ts
+++ b/server/initializers/migrations/0075-video-resolutions.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird'
3import { join } from 'path' 2import { join } from 'path'
4 3
5import { readdirPromise, renamePromise } from '../../helpers/core-utils' 4import { readdirPromise, renamePromise } from '../../helpers/core-utils'