1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Refresh remote actors on GET enpoints

This commit is contained in:
Chocobozzz 2019-01-14 11:30:15 +01:00
parent bb8f7872f5
commit 744d0eca19
No known key found for this signature in database
GPG key ID: 583A612D890159BE
8 changed files with 99 additions and 62 deletions

View file

@ -14,6 +14,8 @@ import { AccountModel } from '../../models/account/account'
import { VideoModel } from '../../models/video/video'
import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
import { VideoChannelModel } from '../../models/video/video-channel'
import { JobQueue } from '../../lib/job-queue'
import { logger } from '../../helpers/logger'
const accountsRouter = express.Router()
@ -57,6 +59,11 @@ export {
function getAccount (req: express.Request, res: express.Response, next: express.NextFunction) {
const account: AccountModel = res.locals.account
if (account.isOutdated()) {
JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'actor', url: account.Actor.url } })
.catch(err => logger.error('Cannot create AP refresher job for actor %s.', account.Actor.url, { err }))
}
return res.json(account.toFormattedJSON())
}