diff options
Diffstat (limited to 'server/helpers/utils.ts')
-rw-r--r-- | server/helpers/utils.ts | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts index cb5e536b8..ef6a878cf 100644 --- a/server/helpers/utils.ts +++ b/server/helpers/utils.ts | |||
@@ -3,8 +3,9 @@ import { Model } from 'sequelize-typescript' | |||
3 | import { ResultList } from '../../shared' | 3 | import { ResultList } from '../../shared' |
4 | import { VideoResolution } from '../../shared/models/videos' | 4 | import { VideoResolution } from '../../shared/models/videos' |
5 | import { CONFIG } from '../initializers' | 5 | import { CONFIG } from '../initializers' |
6 | import { AccountModel } from '../models/account/account' | ||
7 | import { UserModel } from '../models/account/user' | 6 | import { UserModel } from '../models/account/user' |
7 | import { ActorModel } from '../models/activitypub/actor' | ||
8 | import { ApplicationModel } from '../models/application/application' | ||
8 | import { pseudoRandomBytesPromise } from './core-utils' | 9 | import { pseudoRandomBytesPromise } from './core-utils' |
9 | import { logger } from './logger' | 10 | import { logger } from './logger' |
10 | 11 | ||
@@ -80,18 +81,19 @@ function resetSequelizeInstance (instance: Model<any>, savedFields: object) { | |||
80 | }) | 81 | }) |
81 | } | 82 | } |
82 | 83 | ||
83 | let serverAccount: AccountModel | 84 | let serverActor: ActorModel |
84 | async function getServerAccount () { | 85 | async function getServerActor () { |
85 | if (serverAccount === undefined) { | 86 | if (serverActor === undefined) { |
86 | serverAccount = await AccountModel.loadApplication() | 87 | const application = await ApplicationModel.load() |
88 | serverActor = application.Account.Actor | ||
87 | } | 89 | } |
88 | 90 | ||
89 | if (!serverAccount) { | 91 | if (!serverActor) { |
90 | logger.error('Cannot load server account.') | 92 | logger.error('Cannot load server actor.') |
91 | process.exit(0) | 93 | process.exit(0) |
92 | } | 94 | } |
93 | 95 | ||
94 | return Promise.resolve(serverAccount) | 96 | return Promise.resolve(serverActor) |
95 | } | 97 | } |
96 | 98 | ||
97 | type SortType = { sortModel: any, sortValue: string } | 99 | type SortType = { sortModel: any, sortValue: string } |
@@ -105,6 +107,6 @@ export { | |||
105 | isSignupAllowed, | 107 | isSignupAllowed, |
106 | computeResolutionsToTranscode, | 108 | computeResolutionsToTranscode, |
107 | resetSequelizeInstance, | 109 | resetSequelizeInstance, |
108 | getServerAccount, | 110 | getServerActor, |
109 | SortType | 111 | SortType |
110 | } | 112 | } |