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

Send server announce when users upload a video

This commit is contained in:
Chocobozzz 2017-11-16 11:08:25 +01:00
parent d846501818
commit efc32059d9
No known key found for this signature in database
GPG key ID: 583A612D890159BE
22 changed files with 161 additions and 80 deletions

View file

@ -6,6 +6,7 @@ import { CONFIG, database as db } from '../initializers'
import { ResultList } from '../../shared'
import { VideoResolution } from '../../shared/models/videos/video-resolution.enum'
import { AccountInstance } from '../models/account/account-interface'
import { logger } from './logger'
function badRequest (req: express.Request, res: express.Response, next: express.NextFunction) {
return res.type('json').status(400).end()
@ -79,13 +80,18 @@ function resetSequelizeInstance (instance: Sequelize.Instance<any>, savedFields:
})
}
let applicationAccount: AccountInstance
async function getApplicationAccount () {
if (applicationAccount === undefined) {
applicationAccount = await db.Account.loadApplication()
let serverAccount: AccountInstance
async function getServerAccount () {
if (serverAccount === undefined) {
serverAccount = await db.Account.loadApplication()
}
return Promise.resolve(applicationAccount)
if (!serverAccount) {
logger.error('Cannot load server account.')
process.exit(0)
}
return Promise.resolve(serverAccount)
}
type SortType = { sortModel: any, sortValue: string }
@ -99,6 +105,6 @@ export {
isSignupAllowed,
computeResolutionsToTranscode,
resetSequelizeInstance,
getApplicationAccount,
getServerAccount,
SortType
}