aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-23 09:32:53 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commit8dc8a34ee8428e7657414115d1c137592efa174d (patch)
treee9b5ef0d7446d1b7766eac18da5a759edc7a9040 /server/helpers/utils.ts
parent7fed637506043e4432cbebe041ada0625171cceb (diff)
downloadPeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.tar.gz
PeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.tar.zst
PeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.zip
Avoir some circular dependencies
Diffstat (limited to 'server/helpers/utils.ts')
-rw-r--r--server/helpers/utils.ts13
1 files changed, 0 insertions, 13 deletions
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts
index 11c118292..ad3b7949e 100644
--- a/server/helpers/utils.ts
+++ b/server/helpers/utils.ts
@@ -1,11 +1,9 @@
1import { ResultList } from '../../shared' 1import { ResultList } from '../../shared'
2import { ApplicationModel } from '../models/application/application'
3import { execPromise, execPromise2, randomBytesPromise, sha256 } from './core-utils' 2import { execPromise, execPromise2, randomBytesPromise, sha256 } from './core-utils'
4import { logger } from './logger' 3import { logger } from './logger'
5import { join } from 'path' 4import { join } from 'path'
6import { Instance as ParseTorrent } from 'parse-torrent' 5import { Instance as ParseTorrent } from 'parse-torrent'
7import { remove } from 'fs-extra' 6import { remove } from 'fs-extra'
8import * as memoizee from 'memoizee'
9import { CONFIG } from '../initializers/config' 7import { CONFIG } from '../initializers/config'
10import { isVideoFileExtnameValid } from './custom-validators/videos' 8import { isVideoFileExtnameValid } from './custom-validators/videos'
11 9
@@ -33,16 +31,6 @@ function getFormattedObjects<U, V, T extends FormattableToJSON<U, V>> (objects:
33 } as ResultList<V> 31 } as ResultList<V>
34} 32}
35 33
36const getServerActor = memoizee(async function () {
37 const application = await ApplicationModel.load()
38 if (!application) throw Error('Could not load Application from database.')
39
40 const actor = application.Account.Actor
41 actor.Account = application.Account
42
43 return actor
44}, { promise: true })
45
46function generateVideoImportTmpPath (target: string | ParseTorrent, extensionArg?: string) { 34function generateVideoImportTmpPath (target: string | ParseTorrent, extensionArg?: string) {
47 const id = typeof target === 'string' 35 const id = typeof target === 'string'
48 ? target 36 ? target
@@ -105,7 +93,6 @@ export {
105 generateRandomString, 93 generateRandomString,
106 getFormattedObjects, 94 getFormattedObjects,
107 getSecureTorrentName, 95 getSecureTorrentName,
108 getServerActor,
109 getServerCommit, 96 getServerCommit,
110 generateVideoImportTmpPath, 97 generateVideoImportTmpPath,
111 getUUIDFromFilename 98 getUUIDFromFilename