aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-14 17:38:41 +0100
committerChocobozzz <me@florianbigard.com>2017-12-19 10:53:16 +0100
commit50d6de9c286abcb34ff4234d56d9cbb803db7665 (patch)
treef1732b27edcd05c7877a8358b8312f1e38c287ed /server/helpers/utils.ts
parentfadf619ad61a016c1c7fc53de5a8f398a4f77519 (diff)
downloadPeerTube-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.ts20
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'
3import { ResultList } from '../../shared' 3import { ResultList } from '../../shared'
4import { VideoResolution } from '../../shared/models/videos' 4import { VideoResolution } from '../../shared/models/videos'
5import { CONFIG } from '../initializers' 5import { CONFIG } from '../initializers'
6import { AccountModel } from '../models/account/account'
7import { UserModel } from '../models/account/user' 6import { UserModel } from '../models/account/user'
7import { ActorModel } from '../models/activitypub/actor'
8import { ApplicationModel } from '../models/application/application'
8import { pseudoRandomBytesPromise } from './core-utils' 9import { pseudoRandomBytesPromise } from './core-utils'
9import { logger } from './logger' 10import { logger } from './logger'
10 11
@@ -80,18 +81,19 @@ function resetSequelizeInstance (instance: Model<any>, savedFields: object) {
80 }) 81 })
81} 82}
82 83
83let serverAccount: AccountModel 84let serverActor: ActorModel
84async function getServerAccount () { 85async 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
97type SortType = { sortModel: any, sortValue: string } 99type 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}