diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-23 09:32:53 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-05-04 16:21:39 +0200 |
commit | 8dc8a34ee8428e7657414115d1c137592efa174d (patch) | |
tree | e9b5ef0d7446d1b7766eac18da5a759edc7a9040 /server/helpers/utils.ts | |
parent | 7fed637506043e4432cbebe041ada0625171cceb (diff) | |
download | PeerTube-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.ts | 13 |
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 @@ | |||
1 | import { ResultList } from '../../shared' | 1 | import { ResultList } from '../../shared' |
2 | import { ApplicationModel } from '../models/application/application' | ||
3 | import { execPromise, execPromise2, randomBytesPromise, sha256 } from './core-utils' | 2 | import { execPromise, execPromise2, randomBytesPromise, sha256 } from './core-utils' |
4 | import { logger } from './logger' | 3 | import { logger } from './logger' |
5 | import { join } from 'path' | 4 | import { join } from 'path' |
6 | import { Instance as ParseTorrent } from 'parse-torrent' | 5 | import { Instance as ParseTorrent } from 'parse-torrent' |
7 | import { remove } from 'fs-extra' | 6 | import { remove } from 'fs-extra' |
8 | import * as memoizee from 'memoizee' | ||
9 | import { CONFIG } from '../initializers/config' | 7 | import { CONFIG } from '../initializers/config' |
10 | import { isVideoFileExtnameValid } from './custom-validators/videos' | 8 | import { 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 | ||
36 | const 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 | |||
46 | function generateVideoImportTmpPath (target: string | ParseTorrent, extensionArg?: string) { | 34 | function 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 |