X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Finstaller.ts;h=19adaf17764222d679dd7f3b5140a99f7b77e4ce;hb=9576506763c20c7efbdb229483440a1fc984cf4d;hp=33970f0fae9195b4cc46c2e4107e93eb8956db7e;hpb=432ebe8bddb407bfbe503b782d59b1ee4c0d6842;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 33970f0fa..19adaf177 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts @@ -1,15 +1,15 @@ -import * as passwordGenerator from 'password-generator' +import { ensureDir, remove } from 'fs-extra' +import passwordGenerator from 'password-generator' import { UserRole } from '../../shared' import { logger } from '../helpers/logger' import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user' -import { UserModel } from '../models/account/user' import { ApplicationModel } from '../models/application/application' import { OAuthClientModel } from '../models/oauth/oauth-client' +import { UserModel } from '../models/user/user' import { applicationExist, clientsExist, usersExist } from './checker-after-init' -import { FILES_CACHE, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION } from './constants' -import { sequelizeTypescript } from './database' -import { ensureDir, remove } from 'fs-extra' import { CONFIG } from './config' +import { FILES_CACHE, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION, RESUMABLE_UPLOAD_DIRECTORY } from './constants' +import { sequelizeTypescript } from './database' async function installApplication () { try { @@ -79,6 +79,9 @@ function createDirectoriesIfNotExist () { // Playlist directories tasks.push(ensureDir(HLS_STREAMING_PLAYLIST_DIRECTORY)) + // Resumable upload directory + tasks.push(ensureDir(RESUMABLE_UPLOAD_DIRECTORY)) + return Promise.all(tasks) } @@ -141,12 +144,13 @@ async function createOAuthAdminIfNotExist () { role, verified: true, nsfwPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY, + p2pEnabled: CONFIG.DEFAULTS.P2P.ENABLED, videoQuota: -1, videoQuotaDaily: -1 } const user = new UserModel(userData) - await createUserAccountAndChannelAndPlaylist(user, validatePassword) + await createUserAccountAndChannelAndPlaylist({ userToCreate: user, channelNames: undefined, validateUser: validatePassword }) logger.info('Username: ' + username) logger.info('User password: ' + password) }