fix: profile lookup error handling + overwrite in account statuses filter
This commit is contained in:
@@ -38,14 +38,12 @@ export function remoteProfileController(mountPath, plugin) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Look up the remote actor (signed request for Authorized Fetch)
|
// Look up the remote actor (signed request for Authorized Fetch)
|
||||||
const documentLoader = await ctx.getDocumentLoader({
|
|
||||||
identifier: handle,
|
|
||||||
});
|
|
||||||
let actor;
|
let actor;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const documentLoader = await ctx.getDocumentLoader({ identifier: handle });
|
||||||
actor = await lookupWithSecurity(ctx, new URL(actorUrl), { documentLoader });
|
actor = await lookupWithSecurity(ctx, new URL(actorUrl), { documentLoader });
|
||||||
} catch {
|
} catch (lookupError) {
|
||||||
|
console.warn(`[ActivityPub] Remote profile lookup failed for ${actorUrl}:`, lookupError?.message);
|
||||||
return response.status(404).render("error", {
|
return response.status(404).render("error", {
|
||||||
title: "Error",
|
title: "Error",
|
||||||
content: response.locals.__("activitypub.profile.remote.notFound"),
|
content: response.locals.__("activitypub.profile.remote.notFound"),
|
||||||
|
|||||||
@@ -430,16 +430,19 @@ router.get("/api/v1/accounts/:id/statuses", tokenRequired, scopeRequired("read",
|
|||||||
isContext: { $ne: true },
|
isContext: { $ne: true },
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mastodon filters
|
// Mastodon filters — use $and to avoid overwriting $or when both are set
|
||||||
if (req.query.only_media === "true") {
|
if (req.query.only_media === "true") {
|
||||||
baseFilter.$or = [
|
baseFilter.$and = (baseFilter.$and || []).concat([{ $or: [
|
||||||
{ "photo.0": { $exists: true } },
|
{ "photo.0": { $exists: true } },
|
||||||
{ "video.0": { $exists: true } },
|
{ "video.0": { $exists: true } },
|
||||||
{ "audio.0": { $exists: true } },
|
{ "audio.0": { $exists: true } },
|
||||||
];
|
]}]);
|
||||||
}
|
}
|
||||||
if (req.query.exclude_replies === "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") {
|
if (req.query.exclude_reblogs === "true") {
|
||||||
baseFilter.type = { $ne: "boost" };
|
baseFilter.type = { $ne: "boost" };
|
||||||
|
|||||||
Reference in New Issue
Block a user