1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Avoir some circular dependencies

This commit is contained in:
Chocobozzz 2020-04-23 09:32:53 +02:00 committed by Chocobozzz
parent 7fed637506
commit 8dc8a34ee8
69 changed files with 278 additions and 263 deletions

View file

@ -1,11 +1,9 @@
import { ResultList } from '../../shared'
import { ApplicationModel } from '../models/application/application'
import { execPromise, execPromise2, randomBytesPromise, sha256 } from './core-utils'
import { logger } from './logger'
import { join } from 'path'
import { Instance as ParseTorrent } from 'parse-torrent'
import { remove } from 'fs-extra'
import * as memoizee from 'memoizee'
import { CONFIG } from '../initializers/config'
import { isVideoFileExtnameValid } from './custom-validators/videos'
@ -33,16 +31,6 @@ function getFormattedObjects<U, V, T extends FormattableToJSON<U, V>> (objects:
} as ResultList<V>
}
const getServerActor = memoizee(async function () {
const application = await ApplicationModel.load()
if (!application) throw Error('Could not load Application from database.')
const actor = application.Account.Actor
actor.Account = application.Account
return actor
}, { promise: true })
function generateVideoImportTmpPath (target: string | ParseTorrent, extensionArg?: string) {
const id = typeof target === 'string'
? target
@ -105,7 +93,6 @@ export {
generateRandomString,
getFormattedObjects,
getSecureTorrentName,
getServerActor,
getServerCommit,
generateVideoImportTmpPath,
getUUIDFromFilename