diff --git a/lib/controllers/profile.remote.js b/lib/controllers/profile.remote.js index e2cbd91..9a99fb5 100644 --- a/lib/controllers/profile.remote.js +++ b/lib/controllers/profile.remote.js @@ -38,14 +38,12 @@ export function remoteProfileController(mountPath, plugin) { ); // Look up the remote actor (signed request for Authorized Fetch) - const documentLoader = await ctx.getDocumentLoader({ - identifier: handle, - }); let actor; - try { - actor = await lookupWithSecurity(ctx,new URL(actorUrl), { documentLoader }); - } catch { + const documentLoader = await ctx.getDocumentLoader({ identifier: handle }); + actor = await lookupWithSecurity(ctx, new URL(actorUrl), { documentLoader }); + } catch (lookupError) { + console.warn(`[ActivityPub] Remote profile lookup failed for ${actorUrl}:`, lookupError?.message); return response.status(404).render("error", { title: "Error", content: response.locals.__("activitypub.profile.remote.notFound"), diff --git a/lib/mastodon/routes/accounts.js b/lib/mastodon/routes/accounts.js index 444d8b9..ec5b089 100644 --- a/lib/mastodon/routes/accounts.js +++ b/lib/mastodon/routes/accounts.js @@ -430,16 +430,19 @@ router.get("/api/v1/accounts/:id/statuses", tokenRequired, scopeRequired("read", isContext: { $ne: true }, }; - // Mastodon filters + // Mastodon filters — use $and to avoid overwriting $or when both are set if (req.query.only_media === "true") { - baseFilter.$or = [ + baseFilter.$and = (baseFilter.$and || []).concat([{ $or: [ { "photo.0": { $exists: true } }, { "video.0": { $exists: true } }, { "audio.0": { $exists: true } }, - ]; + ]}]); } if (req.query.exclude_replies === "true") { - baseFilter.$or = [{ inReplyTo: { $exists: false } }, { inReplyTo: "" }]; + baseFilter.$and = (baseFilter.$and || []).concat([{ $or: [ + { inReplyTo: { $exists: false } }, + { inReplyTo: "" }, + ]}]); } if (req.query.exclude_reblogs === "true") { baseFilter.type = { $ne: "boost" };