diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/actor.ts | 26 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-delete.ts | 8 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-update.ts | 4 |
3 files changed, 18 insertions, 20 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 25cd40905..e0cb986bd 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts | |||
@@ -33,7 +33,7 @@ function setAsyncActorKeys (actor: ActorModel) { | |||
33 | return actor.save() | 33 | return actor.save() |
34 | }) | 34 | }) |
35 | .catch(err => { | 35 | .catch(err => { |
36 | logger.error('Cannot set public/private keys of actor %d.', actor.uuid, { err }) | 36 | logger.error('Cannot set public/private keys of actor %d.', actor.url, { err }) |
37 | return actor | 37 | return actor |
38 | }) | 38 | }) |
39 | } | 39 | } |
@@ -128,18 +128,17 @@ async function updateActorInstance (actorInstance: ActorModel, attributes: Activ | |||
128 | const followersCount = await fetchActorTotalItems(attributes.followers) | 128 | const followersCount = await fetchActorTotalItems(attributes.followers) |
129 | const followingCount = await fetchActorTotalItems(attributes.following) | 129 | const followingCount = await fetchActorTotalItems(attributes.following) |
130 | 130 | ||
131 | actorInstance.set('type', attributes.type) | 131 | actorInstance.type = attributes.type |
132 | actorInstance.set('uuid', attributes.uuid) | 132 | actorInstance.preferredUsername = attributes.preferredUsername |
133 | actorInstance.set('preferredUsername', attributes.preferredUsername) | 133 | actorInstance.url = attributes.id |
134 | actorInstance.set('url', attributes.id) | 134 | actorInstance.publicKey = attributes.publicKey.publicKeyPem |
135 | actorInstance.set('publicKey', attributes.publicKey.publicKeyPem) | 135 | actorInstance.followersCount = followersCount |
136 | actorInstance.set('followersCount', followersCount) | 136 | actorInstance.followingCount = followingCount |
137 | actorInstance.set('followingCount', followingCount) | 137 | actorInstance.inboxUrl = attributes.inbox |
138 | actorInstance.set('inboxUrl', attributes.inbox) | 138 | actorInstance.outboxUrl = attributes.outbox |
139 | actorInstance.set('outboxUrl', attributes.outbox) | 139 | actorInstance.sharedInboxUrl = attributes.endpoints.sharedInbox |
140 | actorInstance.set('sharedInboxUrl', attributes.endpoints.sharedInbox) | 140 | actorInstance.followersUrl = attributes.followers |
141 | actorInstance.set('followersUrl', attributes.followers) | 141 | actorInstance.followingUrl = attributes.following |
142 | actorInstance.set('followingUrl', attributes.following) | ||
143 | } | 142 | } |
144 | 143 | ||
145 | async function updateActorAvatarInstance (actorInstance: ActorModel, avatarName: string, t: Transaction) { | 144 | async function updateActorAvatarInstance (actorInstance: ActorModel, avatarName: string, t: Transaction) { |
@@ -388,7 +387,6 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode?: numbe | |||
388 | 387 | ||
389 | const actor = new ActorModel({ | 388 | const actor = new ActorModel({ |
390 | type: actorJSON.type, | 389 | type: actorJSON.type, |
391 | uuid: actorJSON.uuid, | ||
392 | preferredUsername: actorJSON.preferredUsername, | 390 | preferredUsername: actorJSON.preferredUsername, |
393 | url: actorJSON.id, | 391 | url: actorJSON.id, |
394 | publicKey: actorJSON.publicKey.publicKeyPem, | 392 | publicKey: actorJSON.publicKey.publicKeyPem, |
diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts index 76f07fd8a..6f10a50bd 100644 --- a/server/lib/activitypub/process/process-delete.ts +++ b/server/lib/activitypub/process/process-delete.ts | |||
@@ -95,23 +95,23 @@ async function processDeleteVideoPlaylist (actor: ActorModel, playlistToDelete: | |||
95 | } | 95 | } |
96 | 96 | ||
97 | async function processDeleteAccount (accountToRemove: AccountModel) { | 97 | async function processDeleteAccount (accountToRemove: AccountModel) { |
98 | logger.debug('Removing remote account "%s".', accountToRemove.Actor.uuid) | 98 | logger.debug('Removing remote account "%s".', accountToRemove.Actor.url) |
99 | 99 | ||
100 | await sequelizeTypescript.transaction(async t => { | 100 | await sequelizeTypescript.transaction(async t => { |
101 | await accountToRemove.destroy({ transaction: t }) | 101 | await accountToRemove.destroy({ transaction: t }) |
102 | }) | 102 | }) |
103 | 103 | ||
104 | logger.info('Remote account with uuid %s removed.', accountToRemove.Actor.uuid) | 104 | logger.info('Remote account %s removed.', accountToRemove.Actor.url) |
105 | } | 105 | } |
106 | 106 | ||
107 | async function processDeleteVideoChannel (videoChannelToRemove: VideoChannelModel) { | 107 | async function processDeleteVideoChannel (videoChannelToRemove: VideoChannelModel) { |
108 | logger.debug('Removing remote video channel "%s".', videoChannelToRemove.Actor.uuid) | 108 | logger.debug('Removing remote video channel "%s".', videoChannelToRemove.Actor.url) |
109 | 109 | ||
110 | await sequelizeTypescript.transaction(async t => { | 110 | await sequelizeTypescript.transaction(async t => { |
111 | await videoChannelToRemove.destroy({ transaction: t }) | 111 | await videoChannelToRemove.destroy({ transaction: t }) |
112 | }) | 112 | }) |
113 | 113 | ||
114 | logger.info('Remote video channel with uuid %s removed.', videoChannelToRemove.Actor.uuid) | 114 | logger.info('Remote video channel %s removed.', videoChannelToRemove.Actor.url) |
115 | } | 115 | } |
116 | 116 | ||
117 | function processDeleteVideoComment (byActor: ActorModel, videoComment: VideoCommentModel, activity: ActivityDelete) { | 117 | function processDeleteVideoComment (byActor: ActorModel, videoComment: VideoCommentModel, activity: ActivityDelete) { |
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index 54a9234bb..71a16dacc 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts | |||
@@ -95,7 +95,7 @@ async function processUpdateCacheFile (byActor: ActorModel, activity: ActivityUp | |||
95 | async function processUpdateActor (actor: ActorModel, activity: ActivityUpdate) { | 95 | async function processUpdateActor (actor: ActorModel, activity: ActivityUpdate) { |
96 | const actorAttributesToUpdate = activity.object as ActivityPubActor | 96 | const actorAttributesToUpdate = activity.object as ActivityPubActor |
97 | 97 | ||
98 | logger.debug('Updating remote account "%s".', actorAttributesToUpdate.uuid) | 98 | logger.debug('Updating remote account "%s".', actorAttributesToUpdate.url) |
99 | let accountOrChannelInstance: AccountModel | VideoChannelModel | 99 | let accountOrChannelInstance: AccountModel | VideoChannelModel |
100 | let actorFieldsSave: object | 100 | let actorFieldsSave: object |
101 | let accountOrChannelFieldsSave: object | 101 | let accountOrChannelFieldsSave: object |
@@ -128,7 +128,7 @@ async function processUpdateActor (actor: ActorModel, activity: ActivityUpdate) | |||
128 | await accountOrChannelInstance.save({ transaction: t }) | 128 | await accountOrChannelInstance.save({ transaction: t }) |
129 | }) | 129 | }) |
130 | 130 | ||
131 | logger.info('Remote account with uuid %s updated', actorAttributesToUpdate.uuid) | 131 | logger.info('Remote account %s updated', actorAttributesToUpdate.url) |
132 | } catch (err) { | 132 | } catch (err) { |
133 | if (actor !== undefined && actorFieldsSave !== undefined) { | 133 | if (actor !== undefined && actorFieldsSave !== undefined) { |
134 | resetSequelizeInstance(actor, actorFieldsSave) | 134 | resetSequelizeInstance(actor, actorFieldsSave) |