server: accept HTTP signatures for fetches

Take into account any HTTP signatures on fetches as to allow to fetch notes
that are not public or unlisted.

Changelog: Added
This commit is contained in:
Johann150 2026-05-26 16:59:29 +02:00
commit f8b5d0204a
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -121,11 +121,13 @@ router.get('/notes/:note', async (ctx, next) => {
const note = await Notes.findOneBy({
id: ctx.params.note,
visibility: In(['public' as const, 'home' as const]),
localOnly: false,
});
if (note == null) {
if (
note == null
|| !(await Notes.isVisibleForMe(note, ctx.state.signingUserId))
) {
ctx.status = 404;
return;
}
@ -159,11 +161,13 @@ router.get('/notes/:note/activity', async ctx => {
const note = await Notes.findOneBy({
id: ctx.params.note,
userHost: IsNull(),
visibility: In(['public' as const, 'home' as const]),
localOnly: false,
});
if (note == null) {
if (
note == null
|| !(await Notes.isVisibleForMe(note, ctx.state.signingUserId))
) {
ctx.status = 404;
return;
}
@ -306,10 +310,12 @@ router.get('/likes/:like', async ctx => {
const note = await Notes.findOneBy({
id: reaction.noteId,
visibility: In(['public' as const, 'home' as const]),
});
if (note == null) {
if (
note == null
|| !(await Notes.isVisibleForMe(note, ctx.state.signingUserId))
) {
ctx.status = 404;
return;
}