diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-14 17:38:41 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-19 10:53:16 +0100 |
commit | 50d6de9c286abcb34ff4234d56d9cbb803db7665 (patch) | |
tree | f1732b27edcd05c7877a8358b8312f1e38c287ed /server/helpers/utils.ts | |
parent | fadf619ad61a016c1c7fc53de5a8f398a4f77519 (diff) | |
download | PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.tar.gz PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.tar.zst PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.zip |
Begin moving video channel to actor
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 | } |