aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-04 14:04:02 +0100
committerChocobozzz <me@florianbigard.com>2018-01-04 14:04:02 +0100
commita5625b416797fa20f7cccead6201f3faf9427080 (patch)
tree089ad8155f924385d5f528c96cbcec1b52f56c72 /server/models/activitypub
parent4cb6d4578893db310297d7e118ce2fb7ecb952a3 (diff)
downloadPeerTube-a5625b416797fa20f7cccead6201f3faf9427080.tar.gz
PeerTube-a5625b416797fa20f7cccead6201f3faf9427080.tar.zst
PeerTube-a5625b416797fa20f7cccead6201f3faf9427080.zip
Refresh remote accounts
Diffstat (limited to 'server/models/activitypub')
-rw-r--r--server/models/activitypub/actor.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index ed7fcfe27..707f140af 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -13,7 +13,7 @@ import {
13 isActorPublicKeyValid 13 isActorPublicKeyValid
14} from '../../helpers/custom-validators/activitypub/actor' 14} from '../../helpers/custom-validators/activitypub/actor'
15import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 15import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
16import { ACTIVITY_PUB_ACTOR_TYPES, CONFIG, CONSTRAINTS_FIELDS } from '../../initializers' 16import { ACTIVITY_PUB, ACTIVITY_PUB_ACTOR_TYPES, CONFIG, CONSTRAINTS_FIELDS } from '../../initializers'
17import { AccountModel } from '../account/account' 17import { AccountModel } from '../account/account'
18import { AvatarModel } from '../avatar/avatar' 18import { AvatarModel } from '../avatar/avatar'
19import { ServerModel } from '../server/server' 19import { ServerModel } from '../server/server'
@@ -375,4 +375,15 @@ export class ActorModel extends Model<ActorModel> {
375 375
376 return CONFIG.WEBSERVER.URL + this.Avatar.getWebserverPath() 376 return CONFIG.WEBSERVER.URL + this.Avatar.getWebserverPath()
377 } 377 }
378
379 isOutdated () {
380 if (this.isOwned()) return false
381
382 const now = Date.now()
383 const createdAtTime = this.createdAt.getTime()
384 const updatedAtTime = this.updatedAt.getTime()
385
386 return (now - createdAtTime) > ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL &&
387 (now - updatedAtTime) > ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL
388 }
378} 389}