fix: profile lookup error handling + overwrite in account statuses filter

This commit is contained in:
svemagie
2026-05-17 09:43:58 +02:00
parent bd26b25961
commit b86b88619e
2 changed files with 11 additions and 10 deletions
+4 -6
View File
@@ -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"),
+7 -4
View File
@@ -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" };