1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Begin moving video channel to actor

This commit is contained in:
Chocobozzz 2017-12-14 17:38:41 +01:00
parent fadf619ad6
commit 50d6de9c28
No known key found for this signature in database
GPG key ID: 583A612D890159BE
100 changed files with 1761 additions and 2041 deletions

View file

@ -3,8 +3,9 @@ import { Model } from 'sequelize-typescript'
import { ResultList } from '../../shared'
import { VideoResolution } from '../../shared/models/videos'
import { CONFIG } from '../initializers'
import { AccountModel } from '../models/account/account'
import { UserModel } from '../models/account/user'
import { ActorModel } from '../models/activitypub/actor'
import { ApplicationModel } from '../models/application/application'
import { pseudoRandomBytesPromise } from './core-utils'
import { logger } from './logger'
@ -80,18 +81,19 @@ function resetSequelizeInstance (instance: Model<any>, savedFields: object) {
})
}
let serverAccount: AccountModel
async function getServerAccount () {
if (serverAccount === undefined) {
serverAccount = await AccountModel.loadApplication()
let serverActor: ActorModel
async function getServerActor () {
if (serverActor === undefined) {
const application = await ApplicationModel.load()
serverActor = application.Account.Actor
}
if (!serverAccount) {
logger.error('Cannot load server account.')
if (!serverActor) {
logger.error('Cannot load server actor.')
process.exit(0)
}
return Promise.resolve(serverAccount)
return Promise.resolve(serverActor)
}
type SortType = { sortModel: any, sortValue: string }
@ -105,6 +107,6 @@ export {
isSignupAllowed,
computeResolutionsToTranscode,
resetSequelizeInstance,
getServerAccount,
getServerActor,
SortType
}