X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Finstaller.ts;h=7e321fb76e8c9f30c3e34eed1db3ab10b5ba3009;hb=c3edc5b074aa4bb1861ed0a94d3713808e87170f;hp=33970f0fae9195b4cc46c2e4107e93eb8956db7e;hpb=53da06304957c7980c759c0db3e93010f4de7db3;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 33970f0fa..7e321fb76 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts @@ -1,15 +1,15 @@ -import * as passwordGenerator from 'password-generator' -import { UserRole } from '../../shared' +import { ensureDir, remove } from 'fs-extra' +import passwordGenerator from 'password-generator' +import { UserRole } from '@shared/models' 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.WEBAPP.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) }