diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/installer.ts | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 7e321fb76..0517e0084 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts | |||
@@ -2,10 +2,9 @@ import { ensureDir, remove } from 'fs-extra' | |||
2 | import passwordGenerator from 'password-generator' | 2 | import passwordGenerator from 'password-generator' |
3 | import { UserRole } from '@shared/models' | 3 | import { UserRole } from '@shared/models' |
4 | import { logger } from '../helpers/logger' | 4 | import { logger } from '../helpers/logger' |
5 | import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user' | 5 | import { buildUser, createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user' |
6 | import { ApplicationModel } from '../models/application/application' | 6 | import { ApplicationModel } from '../models/application/application' |
7 | import { OAuthClientModel } from '../models/oauth/oauth-client' | 7 | import { OAuthClientModel } from '../models/oauth/oauth-client' |
8 | import { UserModel } from '../models/user/user' | ||
9 | import { applicationExist, clientsExist, usersExist } from './checker-after-init' | 8 | import { applicationExist, clientsExist, usersExist } from './checker-after-init' |
10 | import { CONFIG } from './config' | 9 | import { CONFIG } from './config' |
11 | import { FILES_CACHE, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION, RESUMABLE_UPLOAD_DIRECTORY } from './constants' | 10 | import { FILES_CACHE, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION, RESUMABLE_UPLOAD_DIRECTORY } from './constants' |
@@ -137,18 +136,15 @@ async function createOAuthAdminIfNotExist () { | |||
137 | password = passwordGenerator(16, true) | 136 | password = passwordGenerator(16, true) |
138 | } | 137 | } |
139 | 138 | ||
140 | const userData = { | 139 | const user = buildUser({ |
141 | username, | 140 | username, |
142 | email, | 141 | email, |
143 | password, | 142 | password, |
144 | role, | 143 | role, |
145 | verified: true, | 144 | emailVerified: true, |
146 | nsfwPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY, | ||
147 | p2pEnabled: CONFIG.DEFAULTS.P2P.WEBAPP.ENABLED, | ||
148 | videoQuota: -1, | 145 | videoQuota: -1, |
149 | videoQuotaDaily: -1 | 146 | videoQuotaDaily: -1 |
150 | } | 147 | }) |
151 | const user = new UserModel(userData) | ||
152 | 148 | ||
153 | await createUserAccountAndChannelAndPlaylist({ userToCreate: user, channelNames: undefined, validateUser: validatePassword }) | 149 | await createUserAccountAndChannelAndPlaylist({ userToCreate: user, channelNames: undefined, validateUser: validatePassword }) |
154 | logger.info('Username: ' + username) | 150 | logger.info('Username: ' + username) |