import * as passwordGenerator from 'password-generator'
import { UserRole } from '../../shared'
import { logger } from '../helpers/logger'
-import { createApplicationActor, createUserAccountAndChannel } from '../lib/user'
+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 { applicationExist, clientsExist, usersExist } from './checker-after-init'
-import { CACHE, CONFIG, HLS_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION } from './constants'
+import { CACHE, CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION } from './constants'
import { sequelizeTypescript } from './database'
import { remove, ensureDir } from 'fs-extra'
}),
// Directories
- removeCacheDirectories()
+ removeCacheAndTmpDirectories()
.then(() => createDirectoriesIfNotExist())
])
} catch (err) {
// ---------------------------------------------------------------------------
-function removeCacheDirectories () {
+function removeCacheAndTmpDirectories () {
const cacheDirectories = Object.keys(CACHE)
.map(k => CACHE[k].DIRECTORY)
tasks.push(remove(dir))
}
+ tasks.push(remove(CONFIG.STORAGE.TMP_DIR))
+
return Promise.all(tasks)
}
}
// Playlist directories
- tasks.push(ensureDir(HLS_PLAYLIST_DIRECTORY))
+ tasks.push(ensureDir(HLS_STREAMING_PLAYLIST_DIRECTORY))
return Promise.all(tasks)
}
}
const user = new UserModel(userData)
- await createUserAccountAndChannel(user, validatePassword)
+ await createUserAccountAndChannelAndPlaylist(user, validatePassword)
logger.info('Username: ' + username)
logger.info('User password: ' + password)
}