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:
parent
bb8f7872f5
commit
744d0eca19
8 changed files with 99 additions and 62 deletions
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue