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:
parent
391b7f2128
commit
f8b5d0204a
1 changed files with 12 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue