diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-04 14:04:02 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-04 14:04:02 +0100 |
commit | a5625b416797fa20f7cccead6201f3faf9427080 (patch) | |
tree | 089ad8155f924385d5f528c96cbcec1b52f56c72 /server/models/activitypub | |
parent | 4cb6d4578893db310297d7e118ce2fb7ecb952a3 (diff) | |
download | PeerTube-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.ts | 13 |
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' |
15 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' | 15 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' |
16 | import { ACTIVITY_PUB_ACTOR_TYPES, CONFIG, CONSTRAINTS_FIELDS } from '../../initializers' | 16 | import { ACTIVITY_PUB, ACTIVITY_PUB_ACTOR_TYPES, CONFIG, CONSTRAINTS_FIELDS } from '../../initializers' |
17 | import { AccountModel } from '../account/account' | 17 | import { AccountModel } from '../account/account' |
18 | import { AvatarModel } from '../avatar/avatar' | 18 | import { AvatarModel } from '../avatar/avatar' |
19 | import { ServerModel } from '../server/server' | 19 | import { 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 | } |