summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarie <github@yuugi.dev>2025-02-17 19:46:11 +0000
committerMarie <github@yuugi.dev>2025-02-17 19:46:11 +0000
commit25da35eab246dc95fd4b688cbb1caf7b82ea936c (patch)
tree73edd18938a365535a8293b28de8e8a9212e3d26
parentmerge: Support Peertube preview thumbnails (resolves #513) (!906) (diff)
parentrelax validation of Announce(Note) timestamps (diff)
downloadsharkey-25da35eab246dc95fd4b688cbb1caf7b82ea936c.tar.gz
sharkey-25da35eab246dc95fd4b688cbb1caf7b82ea936c.tar.bz2
sharkey-25da35eab246dc95fd4b688cbb1caf7b82ea936c.zip
merge: relax validation of Announce / renote timestamps (resolves #799) (!905)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/905 Closes #799 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
-rw-r--r--packages/backend/src/core/activitypub/ApInboxService.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/backend/src/core/activitypub/ApInboxService.ts b/packages/backend/src/core/activitypub/ApInboxService.ts
index 278c97f907..1eef85aeef 100644
--- a/packages/backend/src/core/activitypub/ApInboxService.ts
+++ b/packages/backend/src/core/activitypub/ApInboxService.ts
@@ -363,10 +363,12 @@ export class ApInboxService {
this.logger.info(`Creating the (Re)Note: ${uri}`);
const activityAudience = await this.apAudienceService.parseAudience(actor, activity.to, activity.cc, resolver);
- const createdAt = activity.published ? new Date(activity.published) : null;
+ let createdAt = activity.published ? new Date(activity.published) : null;
- if (createdAt && createdAt < this.idService.parse(renote.id).date) {
- return 'skip: malformed createdAt';
+ const renoteDate = this.idService.parse(renote.id).date;
+ if (createdAt && createdAt < renoteDate) {
+ this.logger.warn(`Correcting invalid publish time for Announce "${uri}"`);
+ createdAt = renoteDate;
}
await this.noteCreateService.create(actor, {