diff --git a/index.js b/index.js index c8e34e2..6c60616 100644 --- a/index.js +++ b/index.js @@ -305,10 +305,15 @@ export default class ActivityPubEndpoint { if (!self._federationHandler) { return undefined; } - return self._federationHandler.deliverToFollowers( - properties, - publication, - ); + try { + return await self._federationHandler.deliverToFollowers( + properties, + publication, + ); + } catch (error) { + console.error("[ActivityPub] Syndication failed:", error.message); + return undefined; + } }, }; } diff --git a/lib/controllers/activities.js b/lib/controllers/activities.js index 2408b27..7423b36 100644 --- a/lib/controllers/activities.js +++ b/lib/controllers/activities.js @@ -10,7 +10,7 @@ export function activitiesController(mountPath) { const collection = application?.collections?.get("ap_activities"); if (!collection) { - return response.render("activities", { + return response.render("activitypub-activities", { title: response.locals.__("activitypub.activities"), activities: [], mountPath, @@ -30,7 +30,7 @@ export function activitiesController(mountPath) { const cursor = buildCursor(page, totalPages, mountPath + "/admin/activities"); - response.render("activities", { + response.render("activitypub-activities", { title: response.locals.__("activitypub.activities"), activities, mountPath, diff --git a/lib/controllers/dashboard.js b/lib/controllers/dashboard.js index defef97..65433b3 100644 --- a/lib/controllers/dashboard.js +++ b/lib/controllers/dashboard.js @@ -25,7 +25,7 @@ export function dashboardController(mountPath) { .toArray() : []; - response.render("dashboard", { + response.render("activitypub-dashboard", { title: response.locals.__("activitypub.title"), followerCount, followingCount, diff --git a/lib/controllers/followers.js b/lib/controllers/followers.js index bc262fd..acc05df 100644 --- a/lib/controllers/followers.js +++ b/lib/controllers/followers.js @@ -10,7 +10,7 @@ export function followersController(mountPath) { const collection = application?.collections?.get("ap_followers"); if (!collection) { - return response.render("followers", { + return response.render("activitypub-followers", { title: response.locals.__("activitypub.followers"), followers: [], followerCount: 0, @@ -31,7 +31,7 @@ export function followersController(mountPath) { const cursor = buildCursor(page, totalPages, mountPath + "/admin/followers"); - response.render("followers", { + response.render("activitypub-followers", { title: response.locals.__("activitypub.followers"), followers, followerCount: totalCount, diff --git a/lib/controllers/following.js b/lib/controllers/following.js index 911c6bf..9678776 100644 --- a/lib/controllers/following.js +++ b/lib/controllers/following.js @@ -10,7 +10,7 @@ export function followingController(mountPath) { const collection = application?.collections?.get("ap_following"); if (!collection) { - return response.render("following", { + return response.render("activitypub-following", { title: response.locals.__("activitypub.following"), following: [], followingCount: 0, @@ -31,7 +31,7 @@ export function followingController(mountPath) { const cursor = buildCursor(page, totalPages, mountPath + "/admin/following"); - response.render("following", { + response.render("activitypub-following", { title: response.locals.__("activitypub.following"), following, followingCount: totalCount, diff --git a/lib/controllers/migrate.js b/lib/controllers/migrate.js index a1aa866..efcc633 100644 --- a/lib/controllers/migrate.js +++ b/lib/controllers/migrate.js @@ -15,7 +15,7 @@ import { export function migrateGetController(mountPath) { return async (request, response, next) => { try { - response.render("migrate", { + response.render("activitypub-migrate", { title: response.locals.__("activitypub.migrate"), mountPath, result: null, @@ -91,7 +91,7 @@ export function migratePostController(mountPath, pluginOptions) { } } - response.render("migrate", { + response.render("activitypub-migrate", { title: response.locals.__("activitypub.migrate"), mountPath, result, diff --git a/lib/federation.js b/lib/federation.js index b196c06..308bbda 100644 --- a/lib/federation.js +++ b/lib/federation.js @@ -221,7 +221,7 @@ export function createFederationHandler(options) { actorUrl, objectUrl: activity.object?.id || activity.object, summary: `Delivered ${activity.type} to ${delivered}/${inboxes.size} inboxes`, - receivedAt: new Date(), + receivedAt: new Date().toISOString(), ...(storeRawActivities ? { raw: activity } : {}), }); diff --git a/lib/inbox.js b/lib/inbox.js index dbbaeb8..86935d4 100644 --- a/lib/inbox.js +++ b/lib/inbox.js @@ -63,7 +63,7 @@ async function handleFollow(activity, collections, context) { avatar: profile.icon?.url || "", inbox: profile.inbox || "", sharedInbox: profile.endpoints?.sharedInbox || "", - followedAt: new Date(), + followedAt: new Date().toISOString(), }, }, { upsert: true }, @@ -286,6 +286,6 @@ async function logActivity(collections, context, record) { await collections.ap_activities.insertOne({ ...rest, ...(context.storeRawActivities ? { raw } : {}), - receivedAt: new Date(), + receivedAt: new Date().toISOString(), }); } diff --git a/lib/keys.js b/lib/keys.js index c5c9f93..280fe45 100644 --- a/lib/keys.js +++ b/lib/keys.js @@ -32,7 +32,7 @@ export async function getOrCreateKeyPair(collection, actorUrl) { actorUrl, publicKeyPem: publicKey, privateKeyPem: privateKey, - createdAt: new Date(), + createdAt: new Date().toISOString(), }); return { publicKeyPem: publicKey, privateKeyPem: privateKey }; diff --git a/lib/migration.js b/lib/migration.js index fcd67fc..11ccdea 100644 --- a/lib/migration.js +++ b/lib/migration.js @@ -121,7 +121,7 @@ export async function bulkImportFollowing(handles, collection) { name: resolved.name, inbox: resolved.inbox, sharedInbox: resolved.sharedInbox, - followedAt: new Date(), + followedAt: new Date().toISOString(), source: "import", }, }, @@ -171,7 +171,7 @@ export async function bulkImportFollowers(entries, collection) { name: actorData.name, inbox: actorData.inbox, sharedInbox: actorData.sharedInbox, - followedAt: new Date(), + followedAt: new Date().toISOString(), pending: true, // Will be confirmed when they re-follow after Move }, }, diff --git a/package.json b/package.json index 8bc9e1e..8aa24e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rmdes/indiekit-endpoint-activitypub", - "version": "0.1.2", + "version": "0.1.3", "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.", "keywords": [ "indiekit", diff --git a/views/activities.njk b/views/activitypub-activities.njk similarity index 100% rename from views/activities.njk rename to views/activitypub-activities.njk diff --git a/views/dashboard.njk b/views/activitypub-dashboard.njk similarity index 100% rename from views/dashboard.njk rename to views/activitypub-dashboard.njk diff --git a/views/followers.njk b/views/activitypub-followers.njk similarity index 100% rename from views/followers.njk rename to views/activitypub-followers.njk diff --git a/views/following.njk b/views/activitypub-following.njk similarity index 100% rename from views/following.njk rename to views/activitypub-following.njk diff --git a/views/migrate.njk b/views/activitypub-migrate.njk similarity index 100% rename from views/migrate.njk rename to views/activitypub-migrate.njk